/* Вынесено из base.php (ревью 18.11, A1-21, волна 5): было встроено в каждую страницу админки, теперь файл кэшируется браузером. Правка — здесь. */
        /* =========================================================
           iOS semantic color system (Apple HIG)
           ---------------------------------------------------------
           Single source of truth for every action color used across
           the admin. Prefer CSS variables over hard-coded hex values
           so the palette stays consistent and themeable.

           Semantic meaning (Apple HIG):
             --ios-blue    primary / info / default action (View, Edit, Submit, Refresh)
             --ios-green   success / positive commit (Save, Enable, Approve)
             --ios-red     destructive (Delete, Remove)
             --ios-orange  warning / caution (Clear data, reversible destructive)
             --ios-yellow  caution / pending
             --ios-purple  creative / duplicate / copy-as-new / magic
             --ios-indigo  brand / premium / data transfer (Export, Import)
             --ios-pink    attention / hot
             --ios-mint    fresh / new
             --ios-teal    info (secondary)
             --ios-cyan    info highlight
             --ios-brown   archive / log
             --ios-gray    neutral / dismiss / passive (Cancel, Edit-default)
           ========================================================= */
        :root {
            --ios-blue:         #007aff;
            --ios-blue-dark:    #0060df;
            --ios-blue-darker:  #0051c7;
            --ios-blue-tint:    rgba(0, 122, 255, 0.12);

            --ios-green:        #34c759;
            --ios-green-dark:   #28a745;
            --ios-green-darker: #1e8a39;
            --ios-green-tint:   rgba(52, 199, 89, 0.12);

            --ios-red:          #ff3b30;
            --ios-red-dark:     #d70015;
            --ios-red-darker:   #b30011;
            --ios-red-tint:     rgba(255, 59, 48, 0.12);

            --ios-orange:       #ff9500;
            --ios-orange-dark:  #e08600;
            --ios-orange-darker:#cc7700;
            --ios-orange-tint:  rgba(255, 149, 0, 0.12);

            --ios-yellow:       #ffcc00;
            --ios-yellow-dark:  #e0b000;
            --ios-yellow-tint:  rgba(255, 204, 0, 0.14);

            --ios-purple:       #af52de;
            --ios-purple-dark:  #9c3bd0;
            --ios-purple-darker:#812db0;
            --ios-purple-tint:  rgba(175, 82, 222, 0.12);

            --ios-indigo:       #5856d6;
            --ios-indigo-dark:  #4845b8;
            --ios-indigo-darker:#3a3899;
            --ios-indigo-tint:  rgba(88, 86, 214, 0.12);

            --ios-pink:         #ff2d55;
            --ios-pink-dark:    #d70042;
            --ios-pink-tint:    rgba(255, 45, 85, 0.12);

            --ios-mint:         #00c7be;
            --ios-mint-dark:    #00a69e;
            --ios-mint-tint:    rgba(0, 199, 190, 0.12);

            --ios-teal:         #30b0c7;
            --ios-teal-dark:    #2499ad;
            --ios-teal-tint:    rgba(48, 176, 199, 0.12);

            --ios-cyan:         #32ade6;
            --ios-cyan-dark:    #2499d0;
            --ios-cyan-tint:    rgba(50, 173, 230, 0.12);

            --ios-brown:        #a2845e;
            --ios-brown-dark:   #8a6e4c;
            --ios-brown-tint:   rgba(162, 132, 94, 0.12);

            --ios-gray:         #8e8e93;
            --ios-gray-2:       #aeaeb2;
            --ios-gray-3:       #c7c7cc;
            --ios-gray-4:       #d1d1d6;
            --ios-gray-5:       #e5e5ea;
            --ios-gray-6:       #f2f2f7;

            --ios-ink:          #1d1d1f;
            --ios-ink-2:        #3a3a3c;
            --ios-bg:           #f5f5f7;

            /* Semantic aliases — use these in new components */
            --c-primary:     var(--ios-blue);
            --c-success:     var(--ios-green);
            --c-danger:      var(--ios-red);
            --c-warning:     var(--ios-orange);
            --c-caution:     var(--ios-yellow);
            --c-duplicate:   var(--ios-purple);
            --c-export:      var(--ios-indigo);
            --c-import:      var(--ios-indigo);
            --c-attention:   var(--ios-pink);
            --c-new:         var(--ios-mint);
            --c-info:        var(--ios-teal);
            --c-archive:     var(--ios-brown);
            --c-neutral:     var(--ios-gray);
        }

        .copyTooltip {
            position: absolute;
            background-color: black;
            color: white;
            padding: 5px 10px;
            border-radius: 5px;
            font-size: 14px;
            opacity: 0;
            transition: opacity 0.3s ease-in-out;
            pointer-events: none;
            white-space: nowrap;
        }

        /* =========================================================
           Global mobile overflow protection (admin-wide safety net)
           Prevents the page itself from horizontally scrolling when
           wide tables / cards / pre blocks / navbars appear. Wide
           content is kept scrollable inside its own responsive
           container.

           Implementation note: `overflow-x: hidden` on <html> can
           break `position: sticky` on descendants. We therefore
           apply clip/hidden only to AdminLTE's internal wrappers
           (.wrapper, .content-wrapper, .main-footer, .main-header)
           while leaving <html>/<body> with `overflow-x: clip`
           (modern browsers) which preserves sticky behaviour.
           ========================================================= */
        html, body {
            max-width: 100vw;
            overflow-x: clip;            /* Safer than hidden: keeps sticky working */
        }
        /* Fallback for browsers that don't support overflow-x: clip (<=2022).
           overflow-x: hidden creates a new scroll container and may
           subtly interfere with sticky elements; clip is the preferred
           behaviour on modern browsers. */
        @supports not (overflow-x: clip) {
            html, body { overflow-x: hidden; }
        }
        .wrapper {
            max-width: 100vw;
            overflow-x: clip;
        }
        @supports not (overflow-x: clip) {
            .wrapper { overflow-x: hidden; }
        }
        .content-wrapper,
        .main-footer {
            max-width: 100vw;
            overflow-x: hidden;
        }
        .content,
        .content > .container,
        .content > .container-fluid {
            max-width: 100%;
        }
        /* Navbar: cap width; do NOT set overflow here (would clip dropdowns).
           Horizontal clipping is handled by .wrapper above. */
        .main-header {
            max-width: 100vw;
        }

        /* Make every .table living outside .table-responsive behave
           like a responsive table on narrow viewports — no surgery
           required on individual legacy views. */
        @media (max-width: 991.98px) {
            .content .table-responsive {
                -webkit-overflow-scrolling: touch;
                border-radius: 6px;
                max-width: 100%;
            }
            /* Tables outside .table-responsive: auto-scroll at viewport edge.
               The page won't scroll horizontally; the table gets its own
               horizontal scroll instead. Tables already wrapped in
               .table-responsive keep their default display:table thanks
               to the specificity rule below. */
            .content table.table {
                display: block;
                width: 100%;
                max-width: 100%;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
            }
            .content .table-responsive > table.table,
            .content .table-responsive table.table {
                display: table;           /* restore default inside wrapper */
                overflow-x: visible;
                width: 100%;
            }
            /* Long strings / code / pre blocks wrap instead of pushing layout */
            .content pre,
            .content code,
            .content .break-anywhere {
                white-space: pre-wrap;
                word-break: break-word;
                overflow-wrap: anywhere;
            }
            .content img,
            .content video,
            .content iframe {
                max-width: 100%;
                height: auto;
            }
            /* Keep cards / containers from sticking past the viewport */
            .content .card,
            .content .container,
            .content .container-fluid,
            .content .row {
                max-width: 100%;
            }
            /* Row + cols should shrink, never overflow */
            .content .row {
                margin-left: -8px;
                margin-right: -8px;
            }
            .content .row > [class*="col-"] {
                padding-left: 8px;
                padding-right: 8px;
                min-width: 0;   /* allow flex children to shrink */
            }
            /* Dataform row safety: form-row columns stack instead of overflowing */
            .content .form-row > [class*="col-"] {
                min-width: 0;
            }
            /* Inline forms squashed on narrow viewports */
            .content .form-inline {
                flex-wrap: wrap;
                max-width: 100%;
            }
            .content .form-inline .form-control,
            .content .form-inline input,
            .content .form-inline select {
                min-width: 0;
                max-width: 100%;
            }
            /* Any nested .content-wrapper inside renderSection('content')
               (legacy pattern) shouldn't establish its own block width.
               tgnotify/index.php is an offender — this neutralises it. */
            .content-wrapper .content-wrapper {
                padding: 0 !important;
                background: transparent;
                min-height: 0;
                overflow-x: visible;
            }
        }

        /* Extra tight layout below 480px — reduce padding so tables
           breathe and the whole page uses the full viewport width. */
        @media (max-width: 479.98px) {
            .content > .container,
            .content > .container-fluid {
                padding-left: 10px;
                padding-right: 10px;
            }
            .content .table td,
            .content .table th {
                padding: 0.45rem 0.5rem;
                font-size: 12.5px;
            }
            .content .card-body {
                padding: 0.75rem;
            }
        }

        /* =========================================================
           .table-ios — global iOS-minimalistic table style
           ---------------------------------------------------------
           Additive on top of Bootstrap .table. Use together with
           .responsive-table so rows collapse into cards on mobile:
           <div class="table-ios responsive-table"><table>...</table></div>
           Patterned after gal2/admin/list.php (the "reference" table).
           ========================================================= */
        .table-ios {
            background: #ffffff;
            border-radius: 14px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04),
                        0 0 0 1px rgba(0, 0, 0, 0.06);
            overflow: hidden;
            font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
                         "Segoe UI", Inter, system-ui, sans-serif;
            margin-bottom: 16px;
        }
        /* When combined with .table-responsive on desktop, allow horizontal
           scroll inside the card (for wide tables like ailog's 20 cols). */
        .table-ios.table-responsive {
            overflow-x: auto;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
        }
        /* Wrapping an existing .card-body > .responsive-table:
           don't double-up the shadow/border when the parent card already
           provides one. */
        .card .table-ios {
            box-shadow: none;
            border-radius: 0;
        }
        .table-ios > table,
        .table-ios table.table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
            margin: 0;
            background: transparent;
        }
        /* Neutralise Bootstrap .table-bordered / .table-striped inside .table-ios
           so we own the visual rhythm (hairline dividers + subtle hover). */
        .table-ios table.table-bordered,
        .table-ios table.table-bordered th,
        .table-ios table.table-bordered td {
            border: none;
        }
        .table-ios table.table-striped tbody tr:nth-of-type(odd) {
            background: transparent;
        }
        /* Header */
        .table-ios thead th,
        .table-ios thead.thead-dark th {
            background: #fafafa;
            text-transform: uppercase;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.06em;
            color: #8e8e93;
            padding: 12px 16px;
            border: none;
            border-bottom: 1px solid rgba(0, 0, 0, 0.06);
            text-align: left;
            white-space: nowrap;
            vertical-align: middle;
        }
        .table-ios thead th.text-center { text-align: center; }
        .table-ios thead th.text-right  { text-align: right;  }
        /* Body cells */
        .table-ios tbody td {
            padding: 14px 16px;
            font-size: 14px;
            color: #1d1d1f;
            vertical-align: middle;
            border: none;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
            background: transparent;
        }
        .table-ios tbody tr:last-child td {
            border-bottom: none;
        }
        .table-ios tbody tr {
            transition: background 150ms ease;
        }
        .table-ios tbody tr:hover {
            background: rgba(0, 0, 0, 0.015);
        }
        /* Links inside cells — iOS blue */
        .table-ios tbody a:not(.btn):not(.nav-link):not(.pill):not([class*="-action"]):not([class*="-link"]):not([class*="-chip"]):not([class*="-badge"]) {
            color: #0069d9;
            text-decoration: none;
            transition: color 0.15s ease;
        }
        .table-ios tbody a:not(.btn):not(.nav-link):not(.pill):not([class*="-action"]):not([class*="-link"]):not([class*="-chip"]):not([class*="-badge"]):hover {
            color: #0051d5;
        }

        /* Actions column — right-aligned, tight button group */
        .table-ios td.actions {
            text-align: right;
            white-space: nowrap;
            width: 1%;
        }
        .table-ios td.actions > form {
            display: inline-block;
            margin: 0;
            padding: 0;
            vertical-align: middle;
        }
        .table-ios td.actions > a,
        .table-ios td.actions > button,
        .table-ios td.actions > form > button,
        .table-ios td.actions > form > a {
            vertical-align: middle;
        }
        /* 4px gap between adjacent action controls */
        .table-ios td.actions > a + a,
        .table-ios td.actions > a + form,
        .table-ios td.actions > a + button,
        .table-ios td.actions > form + a,
        .table-ios td.actions > form + form,
        .table-ios td.actions > form + button,
        .table-ios td.actions > button + a,
        .table-ios td.actions > button + form,
        .table-ios td.actions > button + button {
            margin-left: 4px;
        }

        /* .btn-icon — square icon-only action button (iOS ghost)
           Sized for 32px action cells (tables) with an alternate 36px
           rule applied when the button lives outside .table-ios (forms,
           toolbars). Hover lifts subtly + adds a soft shadow. */
        .table-ios .btn-icon,
        .btn-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            padding: 0;
            border-radius: 9px;
            border: none;
            background: transparent;
            color: #8e8e93;
            will-change: transform;
            -webkit-tap-highlight-color: transparent;
            transition: background 180ms cubic-bezier(0.4, 0, 0.2, 1),
                        color 150ms ease,
                        box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1),
                        transform 120ms cubic-bezier(0.4, 0, 0.2, 1);
        }
        .table-ios .btn-icon:hover,
        .btn-icon:hover {
            background: rgba(0, 0, 0, 0.05);
            color: #1d1d1f;
            text-decoration: none;
            transform: translateY(-1px);
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
        }
        .table-ios .btn-icon:active,
        .btn-icon:active {
            transform: scale(0.95);
            background: rgba(0, 0, 0, 0.08);
            box-shadow: none;
            transition-duration: 80ms;
        }
        .table-ios .btn-icon:focus-visible,
        .btn-icon:focus-visible {
            outline: none;
            box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
        }
        /* =========================================================
           .btn-icon semantic color modifiers
           ---------------------------------------------------------
           Hover-only tints driven by the iOS palette. Resting state
           stays neutral gray, which is the Apple HIG pattern for
           non-destructive actions: color only appears on interaction.

           Intent aliases (both shape-class AND intent-class work):
              .btn-icon--view        primary  (blue)     — open detail
              .btn-icon--edit        neutral+ (blue hover) — safe edit
              .btn-icon--duplicate   purple            — copy-as-new
              .btn-icon--delete      red               — destructive
              .btn-icon--danger      red               — destructive (alias)
              .btn-icon--clear       orange            — warning (clears data)
              .btn-icon--warning     orange            — warning (alias)
              .btn-icon--save        green             — commit
              .btn-icon--success     green             — positive
              .btn-icon--primary     blue              — generic primary
              .btn-icon--info        teal              — informational
              .btn-icon--export/import indigo          — data transfer
              .btn-icon--new         mint              — fresh/new
              .btn-icon--attention   pink              — hot/flagged
              .btn-icon--archive     brown             — archive/log
           Legacy `.btn-icon.danger` kept for backward compatibility.
           ========================================================= */
        .table-ios .btn-icon.danger:hover,
        .btn-icon.danger:hover,
        .table-ios .btn-icon--delete:hover,
        .btn-icon--delete:hover,
        .table-ios .btn-icon--danger:hover,
        .btn-icon--danger:hover {
            background: var(--ios-red-tint);
            color: var(--ios-red);
            box-shadow: 0 2px 6px rgba(255, 59, 48, 0.12);
        }
        .table-ios .btn-icon--view:hover,
        .btn-icon--view:hover,
        .table-ios .btn-icon--primary:hover,
        .btn-icon--primary:hover,
        .table-ios .btn-icon--edit:hover,
        .btn-icon--edit:hover,
        .table-ios .btn-icon--refresh:hover,
        .btn-icon--refresh:hover {
            background: var(--ios-blue-tint);
            color: var(--ios-blue);
            box-shadow: 0 2px 6px rgba(0, 122, 255, 0.12);
        }
        .table-ios .btn-icon--duplicate:hover,
        .btn-icon--duplicate:hover,
        .table-ios .btn-icon--purple:hover,
        .btn-icon--purple:hover {
            background: var(--ios-purple-tint);
            color: var(--ios-purple);
            box-shadow: 0 2px 6px rgba(175, 82, 222, 0.14);
        }
        .table-ios .btn-icon--clear:hover,
        .btn-icon--clear:hover,
        .table-ios .btn-icon--warning:hover,
        .btn-icon--warning:hover {
            background: var(--ios-orange-tint);
            color: var(--ios-orange);
            box-shadow: 0 2px 6px rgba(255, 149, 0, 0.14);
        }
        .table-ios .btn-icon--save:hover,
        .btn-icon--save:hover,
        .table-ios .btn-icon--success:hover,
        .btn-icon--success:hover,
        .table-ios .btn-icon--enable:hover,
        .btn-icon--enable:hover {
            background: var(--ios-green-tint);
            color: var(--ios-green-dark);
            box-shadow: 0 2px 6px rgba(52, 199, 89, 0.14);
        }
        .table-ios .btn-icon--info:hover,
        .btn-icon--info:hover,
        .table-ios .btn-icon--teal:hover,
        .btn-icon--teal:hover {
            background: var(--ios-teal-tint);
            color: var(--ios-teal-dark);
            box-shadow: 0 2px 6px rgba(48, 176, 199, 0.14);
        }
        .table-ios .btn-icon--export:hover,
        .btn-icon--export:hover,
        .table-ios .btn-icon--import:hover,
        .btn-icon--import:hover,
        .table-ios .btn-icon--indigo:hover,
        .btn-icon--indigo:hover {
            background: var(--ios-indigo-tint);
            color: var(--ios-indigo);
            box-shadow: 0 2px 6px rgba(88, 86, 214, 0.14);
        }
        .table-ios .btn-icon--new:hover,
        .btn-icon--new:hover,
        .table-ios .btn-icon--mint:hover,
        .btn-icon--mint:hover {
            background: var(--ios-mint-tint);
            color: var(--ios-mint-dark);
            box-shadow: 0 2px 6px rgba(0, 199, 190, 0.14);
        }
        .table-ios .btn-icon--attention:hover,
        .btn-icon--attention:hover,
        .table-ios .btn-icon--pink:hover,
        .btn-icon--pink:hover {
            background: var(--ios-pink-tint);
            color: var(--ios-pink);
            box-shadow: 0 2px 6px rgba(255, 45, 85, 0.14);
        }
        .table-ios .btn-icon--archive:hover,
        .btn-icon--archive:hover,
        .table-ios .btn-icon--brown:hover,
        .btn-icon--brown:hover {
            background: var(--ios-brown-tint);
            color: var(--ios-brown-dark);
            box-shadow: 0 2px 6px rgba(162, 132, 94, 0.14);
        }
        /* Standalone icon buttons (outside tables) sit at 36px to match
           the 38px .btn height grid. Opt in explicitly via .btn-icon--md. */
        .btn-icon--md {
            width: 36px;
            height: 36px;
            border-radius: 10px;
        }

        /* Legacy .nav-link icon buttons inside .table-ios action cells:
           tone them down to match the iOS ghost look. */
        .table-ios td.actions .nav-link,
        .table-ios tbody td .nav-link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            padding: 0;
            border-radius: 8px;
            background: transparent;
            color: #8e8e93;
            transition: background 150ms ease, color 150ms ease, transform 100ms ease;
        }
        .table-ios td.actions .nav-link:hover,
        .table-ios tbody td .nav-link:hover {
            background: rgba(0, 0, 0, 0.05);
            color: #1d1d1f;
            text-decoration: none;
        }
        .table-ios td.actions .nav-link:active,
        .table-ios tbody td .nav-link:active {
            transform: scale(0.95);
            opacity: 0.85;
        }
        .table-ios td.actions .nav-link i,
        .table-ios tbody td .nav-link i {
            margin: 0;
            font-size: 14px;
        }
        /* Trash nav-link → red on hover (destructive) */
        .table-ios td.actions .nav-link[onclick*="Delete"]:hover,
        .table-ios tbody td .nav-link[onclick*="Delete"]:hover,
        .table-ios td.actions .nav-link[href*="delete"]:hover,
        .table-ios tbody td .nav-link[href*="delete"]:hover {
            background: var(--ios-red-tint);
            color: var(--ios-red);
        }
        /* Edit / open nav-link → blue on hover (primary, NOT warning) */
        .table-ios td.actions .nav-link[href*="edit"]:hover,
        .table-ios tbody td .nav-link[href*="edit"]:hover,
        .table-ios td.actions .nav-link[href*="gallery"]:hover,
        .table-ios tbody td .nav-link[href*="gallery"]:hover,
        .table-ios td.actions .nav-link[onclick*="Edit"]:hover,
        .table-ios tbody td .nav-link[onclick*="Edit"]:hover {
            background: var(--ios-blue-tint);
            color: var(--ios-blue);
        }
        /* Duplicate / copy nav-link → purple on hover (creative) */
        .table-ios td.actions .nav-link[href*="duplicate"]:hover,
        .table-ios tbody td .nav-link[href*="duplicate"]:hover,
        .table-ios td.actions .nav-link[onclick*="uplicate"]:hover,
        .table-ios tbody td .nav-link[onclick*="uplicate"]:hover {
            background: var(--ios-purple-tint);
            color: var(--ios-purple);
        }
        /* Clear nav-link → orange on hover (warning: reversible destructive) */
        .table-ios td.actions .nav-link[onclick*="Clear"]:hover,
        .table-ios tbody td .nav-link[onclick*="Clear"]:hover,
        .table-ios td.actions .nav-link[href*="clear"]:hover,
        .table-ios tbody td .nav-link[href*="clear"]:hover {
            background: var(--ios-orange-tint);
            color: var(--ios-orange);
        }

        /* Pills / badges — unified look reusable across tables */
        .table-ios .pill,
        .pill {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 3px 10px;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 600;
            line-height: 1;
            white-space: nowrap;
        }
        .pill .pill-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: currentColor;
        }
        .pill--green { background: rgba(52, 199, 89, 0.15);  color: #248a3d; }
        .pill--red   { background: rgba(255, 59, 48, 0.15);  color: #c0271d; }
        .pill--amber { background: rgba(255, 149, 0, 0.15);  color: #9a5a00; }
        .pill--blue  { background: rgba(0, 122, 255, 0.15);  color: #0051d5; }
        .pill--gray  { background: rgba(142, 142, 147, 0.15); color: #6d6d72; }

        /* =========================================================
           iOS premium button — base
           ---------------------------------------------------------
           Gradient + inner highlight + colored drop shadow give the
           button dimensional depth. Hover translates up -1px while
           intensifying the shadow. Active presses down with scale.
           ========================================================= */
        .btn-ios {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 9px 18px;
            min-height: 38px;
            border-radius: 11px;
            background: linear-gradient(180deg, #0a84ff 0%, #0060df 100%);
            color: #fff !important;
            font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
                         "Helvetica Neue", system-ui, sans-serif;
            font-size: 14px;
            font-weight: 590;
            letter-spacing: -0.015em;
            line-height: 1.3;
            -webkit-font-smoothing: antialiased;
            border: none;
            cursor: pointer;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
            will-change: transform;
            position: relative;
            text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.08);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 1px 2px rgba(0, 122, 255, 0.35),
                0 0 0 0.5px rgba(0, 95, 223, 0.5);
            transition: transform 120ms cubic-bezier(0.4, 0, 0.2, 1),
                        box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1),
                        background 180ms cubic-bezier(0.4, 0, 0.2, 1),
                        opacity 150ms ease;
        }
        .btn-ios:hover {
            background: linear-gradient(180deg, #0073e6 0%, #0051c7 100%);
            text-decoration: none;
            transform: translateY(-1px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 4px 12px rgba(0, 122, 255, 0.35),
                0 0 0 0.5px rgba(0, 95, 223, 0.6);
        }
        .btn-ios:active {
            transform: scale(0.97);
            background: linear-gradient(180deg, #005bbf 0%, #0046a8 100%);
            box-shadow:
                inset 0 1px 2px rgba(0, 0, 0, 0.15),
                0 0 0 0.5px rgba(0, 60, 150, 0.5);
            transition-duration: 80ms;
        }
        .btn-ios:focus-visible {
            outline: none;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 1px 2px rgba(0, 122, 255, 0.35),
                0 0 0 0.5px rgba(0, 95, 223, 0.5),
                0 0 0 4px rgba(0, 122, 255, 0.25);
        }

        /* iOS outline button — subtle bordered variant */
        .btn-ios-outline {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 9px 18px;
            min-height: 38px;
            border-radius: 11px;
            background: transparent;
            color: #007aff;
            font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
                         "Helvetica Neue", system-ui, sans-serif;
            font-size: 14px;
            font-weight: 590;
            letter-spacing: -0.015em;
            line-height: 1.3;
            -webkit-font-smoothing: antialiased;
            border: 1.5px solid rgba(0, 122, 255, 0.3);
            cursor: pointer;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
            will-change: transform;
            transition: transform 120ms cubic-bezier(0.4, 0, 0.2, 1),
                        box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1),
                        background 180ms cubic-bezier(0.4, 0, 0.2, 1),
                        border-color 180ms ease,
                        color 150ms ease;
        }
        .btn-ios-outline:hover {
            background: rgba(0, 122, 255, 0.08);
            border-color: rgba(0, 122, 255, 0.5);
            color: #0060df;
            text-decoration: none;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(0, 122, 255, 0.12);
        }
        .btn-ios-outline:active {
            transform: scale(0.97);
            background: rgba(0, 122, 255, 0.14);
            transition-duration: 80ms;
        }
        .btn-ios-outline:focus-visible {
            outline: none;
            box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.25);
        }

        /* Empty-state card (dashed iOS look) */
        .empty-card-ios {
            border: 1px dashed rgba(0, 0, 0, 0.12);
            border-radius: 14px;
            padding: 40px 20px;
            text-align: center;
            color: #8e8e93;
            background: #fafafa;
        }

        /* DataTables polish — rounded search & pagination to match .table-ios */
        .table-ios + .dataTables_wrapper,
        .dataTables_wrapper {
            font-size: 13.5px;
        }
        .dataTables_wrapper .dataTables_filter input {
            border: 1px solid rgba(0, 0, 0, 0.12);
            border-radius: 8px;
            background: #fafafa;
            padding: 6px 10px;
            margin-left: 6px;
            transition: border-color 0.15s ease,
                        box-shadow 0.15s ease,
                        background 0.15s ease;
        }
        .dataTables_wrapper .dataTables_filter input:focus {
            outline: none;
            border-color: #0069d9;
            background: #fff;
            box-shadow: 0 0 0 3px rgba(0, 105, 217, 0.15);
        }
        .dataTables_wrapper .dataTables_length select {
            border: 1px solid rgba(0, 0, 0, 0.12);
            border-radius: 8px;
            background: #fafafa;
            padding: 4px 8px;
        }
        .dataTables_wrapper .pagination .page-link {
            border: 1px solid rgba(0, 0, 0, 0.08);
            border-radius: 8px;
            margin: 0 2px;
            color: #1d1d1f;
            transition: background 0.15s ease, color 0.15s ease;
        }
        .dataTables_wrapper .pagination .page-link:hover {
            background: rgba(0, 0, 0, 0.04);
            color: #0069d9;
        }
        .dataTables_wrapper .pagination .page-item.active .page-link {
            background: #0069d9;
            border-color: #0069d9;
            color: #fff;
        }
        .dataTables_wrapper .pagination .page-item.disabled .page-link {
            color: #c7c7cc;
            background: transparent;
        }

        /* Mobile tweaks: softer corner radius + single-shadow card look */
        @media (max-width: 767.98px) {
            .table-ios {
                border-radius: 12px;
                box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
            }
        }

        /* =========================================================
           Responsive tables — "table → cards" pattern
           ---------------------------------------------------------
           On desktop  : normal <table> layout.
           On mobile   : each <tr> becomes a card with per-cell
                         labels (via data-label="Column name").
           Mark the wrapping <div> with class="responsive-table".
           Cells holding action buttons: <td class="actions">.
           ========================================================= */
        .responsive-table { width: 100%; }
        .responsive-table table { width: 100%; margin-bottom: 0; }

        /* Desktop action-cell polish: tighter gaps between button icons */
        .responsive-table td.actions .btn + .btn,
        .responsive-table td.actions .btn + form,
        .responsive-table td.actions form + .btn,
        .responsive-table td.actions form + form { margin-left: 4px; }

        @media (max-width: 767.98px) {
            /* When .table-ios is also .responsive-table: each row becomes
               its own card, so the outer wrapper should be transparent
               (no double card). */
            .table-ios.responsive-table {
                background: transparent;
                border-radius: 0;
                box-shadow: none;
                overflow: visible;
            }
            /* Nuke desktop table geometry; rebuild as a card stack.
               !important overrides the generic admin-wide fallback
               (which sets `.content table.table { display:block; overflow-x:auto; }`)
               so our cards render natively without a nested scroller. */
            .responsive-table,
            .responsive-table > .table-responsive {
                overflow: visible !important;
            }
            .content .responsive-table table.table,
            .responsive-table table,
            .responsive-table thead,
            .responsive-table tbody,
            .responsive-table th,
            .responsive-table td {
                display: block !important;
                width: 100% !important;
                max-width: 100% !important;
                overflow: visible !important;
                box-sizing: border-box;
            }
            /* Rows: use block but without !important so DataTables can still
               hide filtered rows via inline style="display:none". */
            .responsive-table tr {
                display: block;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
            }
            /* Hide header row visually but keep it in the DOM for a11y */
            .responsive-table thead tr {
                position: absolute;
                top: -9999px;
                left: -9999px;
                width: 1px;
                height: 1px;
                overflow: hidden;
            }
            /* Each row = a card */
            .responsive-table tbody tr {
                background: #fff;
                border: 1px solid rgba(0, 0, 0, 0.08);
                border-radius: 12px;
                margin: 0 0 12px 0;
                padding: 6px 16px;
                box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
                transition: box-shadow 0.15s ease, transform 0.15s ease;
            }
            .responsive-table tbody tr:hover {
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
            }
            /* Each cell = a label:value row inside the card */
            .responsive-table tbody td {
                position: relative;
                display: flex !important;
                align-items: center;
                justify-content: space-between;
                gap: 12px;
                padding: 10px 0 !important;
                min-height: 40px;
                border: none !important;
                border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
                text-align: right;
                font-size: 14px;
                line-height: 1.35;
                white-space: normal;
                word-break: break-word;
            }
            .responsive-table tbody td:last-child {
                border-bottom: none !important;
            }
            .responsive-table tbody td::before {
                content: attr(data-label);
                flex-shrink: 0;
                font-weight: 600;
                font-size: 12px;
                text-transform: uppercase;
                letter-spacing: 0.5px;
                color: #8e8e93;
                text-align: left;
            }
            /* Action cells — icons stay right-aligned, wrap to new line if needed */
            .responsive-table tbody td.actions {
                justify-content: flex-end;
                flex-wrap: wrap;
                gap: 8px;
                padding-top: 12px !important;
                margin-top: 4px;
                border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
            }
            .responsive-table tbody td.actions::before {
                display: none;
            }
            /* Compact buttons inside cards */
            .responsive-table tbody td .btn {
                font-size: 13px;
                padding: 6px 10px;
            }
            .responsive-table tbody td.actions .btn {
                min-width: 40px;
                min-height: 36px;
                padding: 0 12px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
            }
            .responsive-table tbody td.actions .btn i { font-size: 14px; }
            /* nav-link icon buttons (legacy pattern used in many admin pages) */
            .responsive-table tbody td.actions .nav-link {
                padding: 6px 10px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                border-radius: 8px;
                background: rgba(0, 0, 0, 0.04);
                min-height: 36px;
                min-width: 40px;
                transition: background 0.15s ease;
            }
            .responsive-table tbody td.actions .nav-link:hover {
                background: rgba(0, 0, 0, 0.08);
            }
            .responsive-table tbody td.actions .nav-link i {
                margin: 0;
                font-size: 15px;
            }
            /* Forms inside action cells render inline */
            .responsive-table tbody td.actions form { display: inline-flex; }
            /* Optional "icon only on mobile" toggle for content cells */
            .responsive-table .btn-text-mobile-hide { display: none; }
            /* Empty-state rows (e.g. "No data") span full card with centered text */
            .responsive-table tbody tr.empty-row td {
                justify-content: center;
                border: none !important;
                color: #8e8e93;
                text-align: center;
            }
            .responsive-table tbody tr.empty-row td::before { display: none; }
        }

        /* =========================================================
           iOS button palette — premium extended variants
           ---------------------------------------------------------
           Each filled variant pairs a vertical gradient with an
           inner highlight and a tinted drop shadow matching the
           swatch. Hover raises and intensifies; active presses in.
           ========================================================= */
        .btn-ios--primary {
            background: linear-gradient(180deg, #0a84ff 0%, #0060df 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 1px 2px rgba(0, 122, 255, 0.35),
                0 0 0 0.5px rgba(0, 95, 223, 0.5);
        }
        .btn-ios--primary:hover {
            background: linear-gradient(180deg, #0073e6 0%, #0051c7 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 4px 12px rgba(0, 122, 255, 0.35),
                0 0 0 0.5px rgba(0, 95, 223, 0.6);
        }

        .btn-ios--success {
            background: linear-gradient(180deg, #30d158 0%, #28a745 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 1px 2px rgba(48, 209, 88, 0.35),
                0 0 0 0.5px rgba(40, 167, 69, 0.5);
        }
        .btn-ios--success:hover {
            background: linear-gradient(180deg, #28a745 0%, #1e8a39 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 4px 12px rgba(48, 209, 88, 0.35),
                0 0 0 0.5px rgba(40, 167, 69, 0.6);
        }

        .btn-ios--danger {
            background: linear-gradient(180deg, #ff453a 0%, #d70015 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 1px 2px rgba(255, 59, 48, 0.35),
                0 0 0 0.5px rgba(215, 0, 21, 0.5);
        }
        .btn-ios--danger:hover {
            background: linear-gradient(180deg, #ee3024 0%, #b30011 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 4px 12px rgba(255, 59, 48, 0.35),
                0 0 0 0.5px rgba(215, 0, 21, 0.6);
        }

        .btn-ios--warning {
            background: linear-gradient(180deg, #ffb340 0%, #ff9500 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 1px 2px rgba(255, 149, 0, 0.35),
                0 0 0 0.5px rgba(224, 134, 0, 0.5);
        }
        .btn-ios--warning:hover {
            background: linear-gradient(180deg, #ff9500 0%, #e08600 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 4px 12px rgba(255, 149, 0, 0.35),
                0 0 0 0.5px rgba(224, 134, 0, 0.6);
        }

        .btn-ios--info {
            background: linear-gradient(180deg, #64d2ff 0%, #32ade6 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.35),
                0 1px 2px rgba(90, 200, 250, 0.35),
                0 0 0 0.5px rgba(50, 173, 230, 0.5);
        }
        .btn-ios--info:hover {
            background: linear-gradient(180deg, #4cc3f4 0%, #2499d0 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.35),
                0 4px 12px rgba(90, 200, 250, 0.35),
                0 0 0 0.5px rgba(50, 173, 230, 0.6);
        }

        /* Purple — for Duplicate / copy-as-new / creative */
        .btn-ios--purple {
            background: linear-gradient(180deg, #bf5af2 0%, #af52de 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 1px 2px rgba(175, 82, 222, 0.35),
                0 0 0 0.5px rgba(156, 59, 208, 0.5);
        }
        .btn-ios--purple:hover {
            background: linear-gradient(180deg, #af52de 0%, #9c3bd0 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 4px 12px rgba(175, 82, 222, 0.38),
                0 0 0 0.5px rgba(156, 59, 208, 0.6);
        }

        /* Indigo — for Export / Import / brand */
        .btn-ios--indigo {
            background: linear-gradient(180deg, #6e6de0 0%, #5856d6 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 1px 2px rgba(88, 86, 214, 0.35),
                0 0 0 0.5px rgba(72, 69, 184, 0.5);
        }
        .btn-ios--indigo:hover {
            background: linear-gradient(180deg, #5856d6 0%, #4845b8 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 4px 12px rgba(88, 86, 214, 0.38),
                0 0 0 0.5px rgba(72, 69, 184, 0.6);
        }

        /* Pink — for Attention / hot flag */
        .btn-ios--pink {
            background: linear-gradient(180deg, #ff4e6a 0%, #ff2d55 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 1px 2px rgba(255, 45, 85, 0.35),
                0 0 0 0.5px rgba(215, 0, 66, 0.5);
        }
        .btn-ios--pink:hover {
            background: linear-gradient(180deg, #ff2d55 0%, #d70042 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 4px 12px rgba(255, 45, 85, 0.38),
                0 0 0 0.5px rgba(215, 0, 66, 0.6);
        }

        /* Mint — for Fresh / new items */
        .btn-ios--mint {
            background: linear-gradient(180deg, #63e6e2 0%, #00c7be 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.35),
                0 1px 2px rgba(0, 199, 190, 0.35),
                0 0 0 0.5px rgba(0, 166, 158, 0.5);
        }
        .btn-ios--mint:hover {
            background: linear-gradient(180deg, #00c7be 0%, #00a69e 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.35),
                0 4px 12px rgba(0, 199, 190, 0.38),
                0 0 0 0.5px rgba(0, 166, 158, 0.6);
        }

        /* Teal — for secondary info */
        .btn-ios--teal {
            background: linear-gradient(180deg, #40c8e0 0%, #30b0c7 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.35),
                0 1px 2px rgba(48, 176, 199, 0.35),
                0 0 0 0.5px rgba(36, 153, 173, 0.5);
        }
        .btn-ios--teal:hover {
            background: linear-gradient(180deg, #30b0c7 0%, #2499ad 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.35),
                0 4px 12px rgba(48, 176, 199, 0.38),
                0 0 0 0.5px rgba(36, 153, 173, 0.6);
        }

        /* Brown — for Archive / logs */
        .btn-ios--brown {
            background: linear-gradient(180deg, #ac8e68 0%, #a2845e 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 1px 2px rgba(162, 132, 94, 0.35),
                0 0 0 0.5px rgba(138, 110, 76, 0.5);
        }
        .btn-ios--brown:hover {
            background: linear-gradient(180deg, #a2845e 0%, #8a6e4c 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 4px 12px rgba(162, 132, 94, 0.38),
                0 0 0 0.5px rgba(138, 110, 76, 0.6);
        }

        .btn-ios--dark {
            background: linear-gradient(180deg, #3a3a3c 0%, #1d1d1f 100%);
            color: #fff !important;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.15),
                0 1px 2px rgba(0, 0, 0, 0.3),
                0 0 0 0.5px rgba(0, 0, 0, 0.5);
        }
        .btn-ios--dark:hover {
            background: linear-gradient(180deg, #2c2c2e 0%, #000 100%);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.15),
                0 4px 12px rgba(0, 0, 0, 0.3),
                0 0 0 0.5px rgba(0, 0, 0, 0.6);
        }

        /* Secondary (glass / gray) — frosted iOS style */
        .btn-ios--secondary {
            background: rgba(120, 120, 128, 0.12);
            color: #1d1d1f !important;
            text-shadow: none;
            -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.5),
                0 0 0 0.5px rgba(0, 0, 0, 0.04);
        }
        .btn-ios--secondary:hover {
            background: rgba(120, 120, 128, 0.18);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.5),
                0 2px 8px rgba(0, 0, 0, 0.06),
                0 0 0 0.5px rgba(0, 0, 0, 0.06);
        }

        /* Tinted (iOS 15+ colored fill, low opacity) */
        .btn-ios--tinted {
            background: rgba(0, 122, 255, 0.15);
            color: #007aff !important;
            text-shadow: none;
            box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.3);
        }
        .btn-ios--tinted:hover {
            background: rgba(0, 122, 255, 0.22);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 2px 6px rgba(0, 122, 255, 0.15);
        }

        /* Plain (link-style button, no backdrop) */
        .btn-ios--plain {
            background: transparent;
            color: #007aff !important;
            text-shadow: none;
            padding: 6px 10px;
            box-shadow: none;
        }
        .btn-ios--plain:hover {
            background: rgba(0, 122, 255, 0.08);
            box-shadow: none;
            transform: none;
        }

        /* Sizes */
        .btn-ios--sm {
            padding: 6px 12px;
            font-size: 13px;
            min-height: 30px;
            border-radius: 9px;
        }
        .btn-ios--lg {
            padding: 12px 24px;
            font-size: 16px;
            min-height: 48px;
            border-radius: 13px;
            font-weight: 600;
        }

        /* Outline tint variants — colored hairline + transparent fill */
        .btn-ios-outline--success { border-color: rgba(48, 209, 88, 0.4); color: #28a745; }
        .btn-ios-outline--success:hover {
            background: rgba(48, 209, 88, 0.08);
            border-color: rgba(48, 209, 88, 0.55);
            color: #1e8a39;
            box-shadow: 0 2px 8px rgba(48, 209, 88, 0.12);
        }
        .btn-ios-outline--danger  { border-color: rgba(255, 69, 58, 0.4); color: #ff3b30; }
        .btn-ios-outline--danger:hover {
            background: rgba(255, 69, 58, 0.08);
            border-color: rgba(255, 69, 58, 0.55);
            color: #d70015;
            box-shadow: 0 2px 8px rgba(255, 69, 58, 0.12);
        }
        .btn-ios-outline--warning { border-color: rgba(255, 149, 0, 0.4); color: #ff9500; }
        .btn-ios-outline--warning:hover {
            background: rgba(255, 149, 0, 0.08);
            border-color: rgba(255, 149, 0, 0.55);
            color: #e08600;
            box-shadow: 0 2px 8px rgba(255, 149, 0, 0.12);
        }
        .btn-ios-outline--info    { border-color: rgba(100, 210, 255, 0.5); color: #32ade6; }
        .btn-ios-outline--info:hover {
            background: rgba(100, 210, 255, 0.1);
            border-color: rgba(100, 210, 255, 0.65);
            color: #2499d0;
            box-shadow: 0 2px 8px rgba(100, 210, 255, 0.15);
        }
        .btn-ios-outline--dark    { border-color: rgba(0, 0, 0, 0.3); color: #1d1d1f; }
        .btn-ios-outline--dark:hover {
            background: rgba(0, 0, 0, 0.05);
            border-color: rgba(0, 0, 0, 0.45);
            color: #000;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        }

        .btn-ios-outline--purple  { border-color: rgba(175, 82, 222, 0.4); color: var(--ios-purple); }
        .btn-ios-outline--purple:hover {
            background: var(--ios-purple-tint);
            border-color: rgba(175, 82, 222, 0.55);
            color: var(--ios-purple-dark);
            box-shadow: 0 2px 8px rgba(175, 82, 222, 0.14);
        }
        .btn-ios-outline--indigo  { border-color: rgba(88, 86, 214, 0.4); color: var(--ios-indigo); }
        .btn-ios-outline--indigo:hover {
            background: var(--ios-indigo-tint);
            border-color: rgba(88, 86, 214, 0.55);
            color: var(--ios-indigo-dark);
            box-shadow: 0 2px 8px rgba(88, 86, 214, 0.14);
        }
        .btn-ios-outline--pink    { border-color: rgba(255, 45, 85, 0.4); color: var(--ios-pink); }
        .btn-ios-outline--pink:hover {
            background: var(--ios-pink-tint);
            border-color: rgba(255, 45, 85, 0.55);
            color: var(--ios-pink-dark);
            box-shadow: 0 2px 8px rgba(255, 45, 85, 0.14);
        }
        .btn-ios-outline--mint    { border-color: rgba(0, 199, 190, 0.4); color: var(--ios-mint); }
        .btn-ios-outline--mint:hover {
            background: var(--ios-mint-tint);
            border-color: rgba(0, 199, 190, 0.55);
            color: var(--ios-mint-dark);
            box-shadow: 0 2px 8px rgba(0, 199, 190, 0.14);
        }
        .btn-ios-outline--teal    { border-color: rgba(48, 176, 199, 0.4); color: var(--ios-teal); }
        .btn-ios-outline--teal:hover {
            background: var(--ios-teal-tint);
            border-color: rgba(48, 176, 199, 0.55);
            color: var(--ios-teal-dark);
            box-shadow: 0 2px 8px rgba(48, 176, 199, 0.14);
        }
        .btn-ios-outline--brown   { border-color: rgba(162, 132, 94, 0.4); color: var(--ios-brown); }
        .btn-ios-outline--brown:hover {
            background: var(--ios-brown-tint);
            border-color: rgba(162, 132, 94, 0.55);
            color: var(--ios-brown-dark);
            box-shadow: 0 2px 8px rgba(162, 132, 94, 0.14);
        }

        /* =========================================================
           Global Bootstrap -> iOS premium button override
           ---------------------------------------------------------
           Any existing .btn.btn-primary / .btn-success / ... picks
           up the iOS premium look automatically. Add .btn-ios-keep
           to opt out on a specific button (rare). DataTables buttons,
           AdminLTE cards, modal actions all inherit this.

           Design system:
             - SF Pro Text, weight 590, letter-spacing -0.015em
             - 11px radius (38px tall) / 9px (sm) / 13px (lg)
             - Vertical gradient + inner highlight + tinted shadow
             - Hover: translateY(-1px) + intensified shadow
             - Active: scale(0.97) + pressed-in inset shadow
             - Standard easing: cubic-bezier(0.4, 0, 0.2, 1)
           ========================================================= */
        .btn:not(.btn-ios-keep) {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
                         "Helvetica Neue", "Segoe UI", Inter, system-ui, sans-serif;
            font-size: 14px;
            font-weight: 590;
            letter-spacing: -0.015em;
            line-height: 1.3;
            -webkit-font-smoothing: antialiased;
            padding: 9px 18px;
            min-height: 38px;
            border-radius: 11px;
            border: none;
            cursor: pointer;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
            will-change: transform;
            position: relative;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
            transition: transform 120ms cubic-bezier(0.4, 0, 0.2, 1),
                        box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1),
                        background 180ms cubic-bezier(0.4, 0, 0.2, 1),
                        border-color 180ms ease,
                        color 150ms ease,
                        opacity 150ms ease;
        }
        .btn:not(.btn-ios-keep):active {
            transform: scale(0.97);
            transition-duration: 80ms;
        }
        .btn:not(.btn-ios-keep):focus {
            outline: none;
        }
        .btn:not(.btn-ios-keep):focus-visible {
            outline: none;
            box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.25);
        }
        .btn.disabled:not(.btn-ios-keep),
        .btn:disabled:not(.btn-ios-keep) {
            opacity: 0.4;
            cursor: not-allowed;
            transform: none !important;
            pointer-events: none;
        }

        /* Size modifiers (preserve Bootstrap semantics) */
        .btn.btn-sm:not(.btn-ios-keep) {
            padding: 6px 12px;
            font-size: 13px;
            min-height: 30px;
            border-radius: 9px;
            gap: 5px;
        }
        .btn.btn-lg:not(.btn-ios-keep) {
            padding: 12px 24px;
            font-size: 16px;
            min-height: 48px;
            border-radius: 13px;
            font-weight: 600;
            gap: 8px;
        }

        /* === Filled variants — vertical gradient + tinted shadow === */
        .btn.btn-primary:not(.btn-ios-keep) {
            background: linear-gradient(180deg, #0a84ff 0%, #0060df 100%);
            color: #fff;
            text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.08);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 1px 2px rgba(0, 122, 255, 0.35),
                0 0 0 0.5px rgba(0, 95, 223, 0.5);
        }
        .btn.btn-primary:not(.btn-ios-keep):hover {
            background: linear-gradient(180deg, #0073e6 0%, #0051c7 100%);
            color: #fff;
            transform: translateY(-1px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 4px 12px rgba(0, 122, 255, 0.35),
                0 0 0 0.5px rgba(0, 95, 223, 0.6);
        }
        .btn.btn-primary:not(.btn-ios-keep):active {
            background: linear-gradient(180deg, #005bbf 0%, #0046a8 100%);
            box-shadow:
                inset 0 1px 2px rgba(0, 0, 0, 0.15),
                0 0 0 0.5px rgba(0, 60, 150, 0.5);
        }

        .btn.btn-success:not(.btn-ios-keep) {
            background: linear-gradient(180deg, #30d158 0%, #28a745 100%);
            color: #fff;
            text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.08);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 1px 2px rgba(48, 209, 88, 0.35),
                0 0 0 0.5px rgba(40, 167, 69, 0.5);
        }
        .btn.btn-success:not(.btn-ios-keep):hover {
            background: linear-gradient(180deg, #28a745 0%, #1e8a39 100%);
            color: #fff;
            transform: translateY(-1px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 4px 12px rgba(48, 209, 88, 0.35),
                0 0 0 0.5px rgba(40, 167, 69, 0.6);
        }
        .btn.btn-success:not(.btn-ios-keep):active {
            background: linear-gradient(180deg, #1e8a39 0%, #176f2c 100%);
            box-shadow:
                inset 0 1px 2px rgba(0, 0, 0, 0.15),
                0 0 0 0.5px rgba(23, 111, 44, 0.5);
        }

        .btn.btn-danger:not(.btn-ios-keep) {
            background: linear-gradient(180deg, #ff453a 0%, #d70015 100%);
            color: #fff;
            text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.08);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 1px 2px rgba(255, 59, 48, 0.35),
                0 0 0 0.5px rgba(215, 0, 21, 0.5);
        }
        .btn.btn-danger:not(.btn-ios-keep):hover {
            background: linear-gradient(180deg, #ee3024 0%, #b30011 100%);
            color: #fff;
            transform: translateY(-1px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.25),
                0 4px 12px rgba(255, 59, 48, 0.35),
                0 0 0 0.5px rgba(215, 0, 21, 0.6);
        }
        .btn.btn-danger:not(.btn-ios-keep):active {
            background: linear-gradient(180deg, #a8000f 0%, #80000b 100%);
            box-shadow:
                inset 0 1px 2px rgba(0, 0, 0, 0.2),
                0 0 0 0.5px rgba(128, 0, 11, 0.5);
        }

        .btn.btn-warning:not(.btn-ios-keep) {
            background: linear-gradient(180deg, #ffb340 0%, #ff9500 100%);
            color: #fff;
            text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.08);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 1px 2px rgba(255, 149, 0, 0.35),
                0 0 0 0.5px rgba(224, 134, 0, 0.5);
        }
        .btn.btn-warning:not(.btn-ios-keep):hover {
            background: linear-gradient(180deg, #ff9500 0%, #e08600 100%);
            color: #fff;
            transform: translateY(-1px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.3),
                0 4px 12px rgba(255, 149, 0, 0.35),
                0 0 0 0.5px rgba(224, 134, 0, 0.6);
        }
        .btn.btn-warning:not(.btn-ios-keep):active {
            background: linear-gradient(180deg, #cc7700 0%, #a35f00 100%);
            box-shadow:
                inset 0 1px 2px rgba(0, 0, 0, 0.15),
                0 0 0 0.5px rgba(163, 95, 0, 0.5);
        }

        .btn.btn-info:not(.btn-ios-keep) {
            background: linear-gradient(180deg, #64d2ff 0%, #32ade6 100%);
            color: #fff;
            text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.08);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.35),
                0 1px 2px rgba(90, 200, 250, 0.35),
                0 0 0 0.5px rgba(50, 173, 230, 0.5);
        }
        .btn.btn-info:not(.btn-ios-keep):hover {
            background: linear-gradient(180deg, #4cc3f4 0%, #2499d0 100%);
            color: #fff;
            transform: translateY(-1px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.35),
                0 4px 12px rgba(90, 200, 250, 0.35),
                0 0 0 0.5px rgba(50, 173, 230, 0.6);
        }
        .btn.btn-info:not(.btn-ios-keep):active {
            background: linear-gradient(180deg, #1f85b8 0%, #176a94 100%);
            box-shadow:
                inset 0 1px 2px rgba(0, 0, 0, 0.15),
                0 0 0 0.5px rgba(23, 106, 148, 0.5);
        }

        .btn.btn-dark:not(.btn-ios-keep) {
            background: linear-gradient(180deg, #3a3a3c 0%, #1d1d1f 100%);
            color: #fff;
            text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.15);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.15),
                0 1px 2px rgba(0, 0, 0, 0.3),
                0 0 0 0.5px rgba(0, 0, 0, 0.5);
        }
        .btn.btn-dark:not(.btn-ios-keep):hover {
            background: linear-gradient(180deg, #2c2c2e 0%, #000 100%);
            color: #fff;
            transform: translateY(-1px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.15),
                0 4px 12px rgba(0, 0, 0, 0.3),
                0 0 0 0.5px rgba(0, 0, 0, 0.6);
        }
        .btn.btn-dark:not(.btn-ios-keep):active {
            background: linear-gradient(180deg, #000 0%, #000 100%);
            box-shadow:
                inset 0 1px 2px rgba(0, 0, 0, 0.35),
                0 0 0 0.5px rgba(0, 0, 0, 0.6);
        }

        /* Secondary — frosted glass iOS gray */
        .btn.btn-secondary:not(.btn-ios-keep) {
            background: rgba(120, 120, 128, 0.12);
            color: #1d1d1f;
            -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.5),
                0 0 0 0.5px rgba(0, 0, 0, 0.04);
        }
        .btn.btn-secondary:not(.btn-ios-keep):hover {
            background: rgba(120, 120, 128, 0.18);
            color: #1d1d1f;
            transform: translateY(-1px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.5),
                0 2px 8px rgba(0, 0, 0, 0.06),
                0 0 0 0.5px rgba(0, 0, 0, 0.06);
        }
        .btn.btn-secondary:not(.btn-ios-keep):active {
            background: rgba(120, 120, 128, 0.26);
            box-shadow:
                inset 0 1px 2px rgba(0, 0, 0, 0.08),
                0 0 0 0.5px rgba(0, 0, 0, 0.08);
        }

        /* Light / default — whiteish with hairline + subtle gradient */
        .btn.btn-light:not(.btn-ios-keep),
        .btn.btn-default:not(.btn-ios-keep) {
            background: linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
            color: #1d1d1f;
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.8),
                0 1px 2px rgba(0, 0, 0, 0.04),
                0 0 0 0.5px rgba(0, 0, 0, 0.1);
        }
        .btn.btn-light:not(.btn-ios-keep):hover,
        .btn.btn-default:not(.btn-ios-keep):hover {
            background: linear-gradient(180deg, #f9f9fb 0%, #ebebef 100%);
            color: #1d1d1f;
            transform: translateY(-1px);
            box-shadow:
                inset 0 0.5px 0 rgba(255, 255, 255, 0.8),
                0 3px 8px rgba(0, 0, 0, 0.06),
                0 0 0 0.5px rgba(0, 0, 0, 0.12);
        }
        .btn.btn-light:not(.btn-ios-keep):active,
        .btn.btn-default:not(.btn-ios-keep):active {
            background: linear-gradient(180deg, #ebebef 0%, #dcdce1 100%);
            box-shadow:
                inset 0 1px 2px rgba(0, 0, 0, 0.06),
                0 0 0 0.5px rgba(0, 0, 0, 0.12);
        }

        /* === Outline variants — hairline border + tint on hover === */
        .btn.btn-outline-primary:not(.btn-ios-keep) {
            background: transparent;
            border: 1.5px solid rgba(0, 122, 255, 0.3);
            color: #007aff;
            box-shadow: none;
        }
        .btn.btn-outline-primary:not(.btn-ios-keep):hover {
            background: rgba(0, 122, 255, 0.08);
            border-color: rgba(0, 122, 255, 0.5);
            color: #0060df;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(0, 122, 255, 0.12);
        }
        .btn.btn-outline-primary:not(.btn-ios-keep):active {
            background: rgba(0, 122, 255, 0.14);
            box-shadow: inset 0 1px 2px rgba(0, 122, 255, 0.1);
        }

        .btn.btn-outline-success:not(.btn-ios-keep) {
            background: transparent;
            border: 1.5px solid rgba(48, 209, 88, 0.4);
            color: #28a745;
            box-shadow: none;
        }
        .btn.btn-outline-success:not(.btn-ios-keep):hover {
            background: rgba(48, 209, 88, 0.08);
            border-color: rgba(48, 209, 88, 0.55);
            color: #1e8a39;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(48, 209, 88, 0.12);
        }

        .btn.btn-outline-danger:not(.btn-ios-keep) {
            background: transparent;
            border: 1.5px solid rgba(255, 69, 58, 0.4);
            color: #ff3b30;
            box-shadow: none;
        }
        .btn.btn-outline-danger:not(.btn-ios-keep):hover {
            background: rgba(255, 69, 58, 0.08);
            border-color: rgba(255, 69, 58, 0.55);
            color: #d70015;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(255, 69, 58, 0.12);
        }

        .btn.btn-outline-warning:not(.btn-ios-keep) {
            background: transparent;
            border: 1.5px solid rgba(255, 149, 0, 0.4);
            color: #ff9500;
            box-shadow: none;
        }
        .btn.btn-outline-warning:not(.btn-ios-keep):hover {
            background: rgba(255, 149, 0, 0.08);
            border-color: rgba(255, 149, 0, 0.55);
            color: #e08600;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(255, 149, 0, 0.12);
        }

        .btn.btn-outline-info:not(.btn-ios-keep) {
            background: transparent;
            border: 1.5px solid rgba(100, 210, 255, 0.5);
            color: #32ade6;
            box-shadow: none;
        }
        .btn.btn-outline-info:not(.btn-ios-keep):hover {
            background: rgba(100, 210, 255, 0.1);
            border-color: rgba(100, 210, 255, 0.65);
            color: #2499d0;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(100, 210, 255, 0.15);
        }

        .btn.btn-outline-secondary:not(.btn-ios-keep) {
            background: transparent;
            border: 1.5px solid rgba(0, 0, 0, 0.15);
            color: #3a3a3c;
            box-shadow: none;
        }
        .btn.btn-outline-secondary:not(.btn-ios-keep):hover {
            background: rgba(0, 0, 0, 0.04);
            border-color: rgba(0, 0, 0, 0.25);
            color: #1d1d1f;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        }

        .btn.btn-outline-dark:not(.btn-ios-keep) {
            background: transparent;
            border: 1.5px solid rgba(0, 0, 0, 0.3);
            color: #1d1d1f;
            box-shadow: none;
        }
        .btn.btn-outline-dark:not(.btn-ios-keep):hover {
            background: rgba(0, 0, 0, 0.05);
            border-color: rgba(0, 0, 0, 0.45);
            color: #000;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        }

        /* === Loading state — spinner replaces label === */
        .btn.is-loading:not(.btn-ios-keep) {
            pointer-events: none;
            color: transparent !important;
            position: relative;
        }
        .btn.is-loading:not(.btn-ios-keep)::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 14px;
            height: 14px;
            margin: -7px 0 0 -7px;
            border: 2px solid rgba(255, 255, 255, 0.35);
            border-top-color: #fff;
            border-radius: 50%;
            animation: btn-spin 600ms linear infinite;
        }
        .btn.is-loading.btn-secondary:not(.btn-ios-keep)::after,
        .btn.is-loading.btn-light:not(.btn-ios-keep)::after,
        .btn.is-loading.btn-default:not(.btn-ios-keep)::after,
        .btn.is-loading[class*="btn-outline-"]:not(.btn-ios-keep)::after {
            border: 2px solid rgba(0, 0, 0, 0.15);
            border-top-color: #1d1d1f;
        }
        @keyframes btn-spin {
            to { transform: rotate(360deg); }
        }

        /* Don't touch markers that aren't real .btn actions:
           .close (Bootstrap close X), .page-link (pagination),
           .navbar-toggler, DataTables paginator links. These either
           don't carry .btn or are already polished upstream. */
        .close { transform: none !important; box-shadow: none !important; }

        /* btn-group — inner radii flatten so buttons visually touch */
        .btn-group > .btn:not(.btn-ios-keep) {
            will-change: transform;
        }
        .btn-group > .btn:not(.btn-ios-keep):not(:first-child):not(:last-child) { border-radius: 0; }
        .btn-group > .btn:not(.btn-ios-keep):first-child:not(:last-child) {
            border-top-right-radius: 0;
            border-bottom-right-radius: 0;
        }
        .btn-group > .btn:not(.btn-ios-keep):last-child:not(:first-child) {
            border-top-left-radius: 0;
            border-bottom-left-radius: 0;
        }
        /* Grouped buttons shouldn't lift on hover (breaks the joined look) */
        .btn-group > .btn:not(.btn-ios-keep):hover { transform: none; }
        .btn-group > .btn:not(.btn-ios-keep):active { transform: scale(0.97); }

        /* =========================================================
           Form controls — iOS-matched inputs to pair with buttons
           ---------------------------------------------------------
           Slightly rounded, hairline border, blue focus ring.
           Matches .btn radius/typography rhythm.
           ========================================================= */
        .form-control {
            font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
                         "Helvetica Neue", system-ui, sans-serif;
            font-size: 14px;
            line-height: 1.4;
            color: #1d1d1f;
            background: #fff;
            border: 1px solid rgba(0, 0, 0, 0.12);
            border-radius: 10px;
            padding: 9px 14px;
            min-height: 38px;
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.02);
            transition: border-color 180ms ease,
                        box-shadow 180ms ease,
                        background 150ms ease;
            -webkit-font-smoothing: antialiased;
        }
        .form-control:hover:not(:focus):not(:disabled) {
            border-color: rgba(0, 0, 0, 0.22);
        }
        .form-control:focus {
            outline: none;
            border-color: #007aff;
            background: #fff;
            box-shadow:
                inset 0 1px 1px rgba(0, 0, 0, 0.02),
                0 0 0 4px rgba(0, 122, 255, 0.15);
        }
        .form-control:disabled,
        .form-control[readonly] {
            background: rgba(0, 0, 0, 0.04);
            color: #8e8e93;
            cursor: not-allowed;
        }
        .form-control.is-invalid {
            border-color: #ff3b30;
        }
        .form-control.is-invalid:focus {
            box-shadow:
                inset 0 1px 1px rgba(0, 0, 0, 0.02),
                0 0 0 4px rgba(255, 59, 48, 0.18);
        }
        .form-control.is-valid {
            border-color: #34c759;
        }
        .form-control.is-valid:focus {
            box-shadow:
                inset 0 1px 1px rgba(0, 0, 0, 0.02),
                0 0 0 4px rgba(52, 199, 89, 0.18);
        }
        /* Size modifiers */
        .form-control-sm {
            padding: 6px 10px;
            font-size: 13px;
            min-height: 30px;
            border-radius: 8px;
        }
        .form-control-lg {
            padding: 12px 16px;
            font-size: 16px;
            min-height: 48px;
            border-radius: 12px;
        }
        /* Select elements inherit input polish */
        select.form-control {
            cursor: pointer;
            padding-right: 32px;
        }

        /* =========================================================
           Contextual help badges — helpTip() in app/Common.php
           ---------------------------------------------------------
           The badge carries no data-toggle="tooltip" on purpose: several
           pages run their own $('[data-toggle="tooltip"]').tooltip() and
           would double-initialise these, showing two stacked popups.
           Initialisation is delegated once, at the bottom of this file.
           ========================================================= */
        .help-tip {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 15px;
            height: 15px;
            border-radius: 50%;
            background: rgba(0, 122, 255, .12);
            color: #007aff;
            border: 1px solid rgba(0, 122, 255, .32);
            font-size: 10px;
            font-weight: 700;
            line-height: 1;
            cursor: help;
            margin-left: 5px;
            vertical-align: middle;
            flex-shrink: 0;
            user-select: none;
            transition: background .15s ease, color .15s ease, border-color .15s ease;
        }
        .help-tip:hover,
        .help-tip:focus {
            background: #007aff;
            border-color: #007aff;
            color: #fff;
            outline: none;
        }
        .help-tip:focus-visible {
            box-shadow: 0 0 0 3px rgba(0, 122, 255, .25);
        }
        /* Keep the badge legible on dark headers, buttons and coloured cards. */
        .bg-dark .help-tip,
        .bg-primary .help-tip,
        .bg-success .help-tip,
        .bg-danger .help-tip,
        .bg-warning .help-tip,
        .bg-info .help-tip,
        .thead-dark .help-tip,
        .table-dark .help-tip,
        .navbar-dark .help-tip,
        .main-sidebar .help-tip,
        .btn .help-tip,
        .card-header .help-tip.on-dark {
            background: rgba(255, 255, 255, .22);
            border-color: rgba(255, 255, 255, .45);
            color: #fff;
        }
        /* A badge that follows a full-width button has nowhere to sit on the
           same line, so it wraps — centre it instead of leaving it hanging
           under the left edge. */
        .btn-block + .help-tip {
            display: flex;
            margin: 6px auto 0;
        }
        /* A badge left as a direct child of a flex row IS a flex item. With a
           fixed 15px box it never stretches, so the default `align-items:
           stretch` parks it against the TOP edge of a 38px button row instead
           of on the control's baseline. Centring it costs nothing where the
           row is already centred and rescues every row that is not. */
        .input-group > .help-tip,
        .input-group-append + .help-tip,
        .d-flex > .help-tip,
        .form-inline > .help-tip,
        .card-tools > .help-tip,
        .btn-group > .help-tip,
        .btn-toolbar > .help-tip {
            align-self: center;
        }

        /* ---------------------------------------------------------
           Corner-anchored badge for controls inside a flex/grid row
           ---------------------------------------------------------
           An icon button has no text label for the badge to trail, so a
           row of icon buttons with trailing badges reads as
           "icon ? icon ? icon ?" — the badge visually sticks to the icon
           on its RIGHT while describing the one on its LEFT, and the row
           grows by ~20px per control.

           The same breakage hits TEXT buttons the moment their row is a
           flex/grid container: a trailing badge becomes a layout item of
           its own, so a `gap` opens on BOTH of its sides and it floats
           between two buttons, closer to the one it does NOT describe.
           Under `justify-content: space-between` it is worse still — the
           badge counts as a third item, so the button it belongs to gets
           shoved into the middle of the row.

           Wrapping the control in .help-anchor pins its badge to the
           control's own top-right corner: the badge overlaps the control
           it belongs to, so the pair reads as a single object, occupies a
           single flex slot and the row keeps its original rhythm.

           The badge must stay a SIBLING of the control, never a child:
           disabled controls carry pointer-events:none, which a nested
           badge would inherit — the tooltip would then never open on a
           disabled button (exactly where the explanation is needed most).
           Sitting outside the control also guarantees a click on the
           badge can never activate it.

           Placed after the base rules on purpose: same specificity,
           later wins.
           --------------------------------------------------------- */
        .help-anchor {
            position: relative;
            /* inline-flex, not inline-block: as a flex item the wrapper is
               sized by the control and the control still stretches to the
               row height exactly as it did before it was wrapped. */
            display: inline-flex;
            vertical-align: middle;
            max-width: 100%;
        }
        /* The wrapper stands in for the control it holds, so a control that
           filled its row must keep filling it: opt in with --block. */
        .help-anchor--block {
            display: flex;
            width: 100%;
        }
        .help-anchor--block > * {
            flex: 1 1 auto;
            min-width: 0;
        }
        .help-anchor > .help-tip {
            position: absolute;
            top: -4px;
            right: -4px;
            z-index: 3;
            width: 14px;
            height: 14px;
            margin: 0;
            font-size: 9px;
            background: #fff;
            color: #007aff;
            border-color: rgba(0, 122, 255, .45);
            box-shadow: 0 1px 3px rgba(15, 23, 42, .18);
            transition: transform .18s cubic-bezier(.4, 0, .2, 1),
                        background .15s ease,
                        color .15s ease,
                        border-color .15s ease,
                        box-shadow .15s ease;
        }
        /* Hovering the control lifts its own badge — the pairing cue that
           makes a row of icon buttons unambiguous. */
        .help-anchor:hover > .help-tip {
            transform: scale(1.12);
            box-shadow: 0 2px 5px rgba(15, 23, 42, .22);
        }
        .help-anchor > .help-tip:hover,
        .help-anchor > .help-tip:focus {
            background: #007aff;
            border-color: #007aff;
            color: #fff;
            transform: scale(1.2);
        }
        .help-anchor > .help-tip:focus-visible {
            box-shadow: 0 0 0 3px rgba(0, 122, 255, .3),
                        0 1px 3px rgba(15, 23, 42, .18);
        }
        @media (prefers-reduced-motion: reduce) {
            .help-anchor > .help-tip { transition-duration: .001ms; }
            .help-anchor:hover > .help-tip,
            .help-anchor > .help-tip:hover,
            .help-anchor > .help-tip:focus { transform: none; }
        }

        /* =========================================================
           Global loading indicator
           ---------------------------------------------------------
           Long filter queries used to give no feedback at all, so a
           slow page was indistinguishable from a frozen one. Driven
           by KSLoading at the bottom of this file, which counts
           in-flight jQuery, fetch and XHR requests.

           Both parts are pointer-events:none — this reports progress,
           it never blocks the page.
           ========================================================= */
        #ks-loading-bar {
            position: fixed;
            top: 0;
            left: 0;
            height: 3px;
            width: 0;
            z-index: 30000;
            background: linear-gradient(90deg, #007aff, #34c1ff);
            box-shadow: 0 0 8px rgba(0, 122, 255, .6);
            opacity: 0;
            pointer-events: none;
            transition: width .25s cubic-bezier(.4, 0, .2, 1), opacity .2s ease;
        }
        #ks-loading-bar.is-active { opacity: 1; }

        #ks-loading-chip {
            position: fixed;
            top: 14px;
            left: 50%;
            transform: translate(-50%, -12px);
            z-index: 30001;
            display: inline-flex;
            align-items: center;
            gap: 9px;
            padding: 8px 15px;
            border-radius: 999px;
            background: rgba(28, 28, 30, .92);
            color: #fff;
            font-size: 13px;
            font-weight: 500;
            line-height: 1;
            box-shadow: 0 6px 20px rgba(15, 23, 42, .28);
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity .2s ease, transform .2s cubic-bezier(.4, 0, .2, 1), visibility .2s;
        }
        #ks-loading-chip.is-active {
            opacity: 1;
            visibility: visible;
            transform: translate(-50%, 0);
        }
        #ks-loading-chip .ks-spin {
            width: 14px;
            height: 14px;
            border: 2px solid rgba(255, 255, 255, .3);
            border-top-color: #fff;
            border-radius: 50%;
            animation: ks-spin .7s linear infinite;
            flex-shrink: 0;
        }
        @keyframes ks-spin { to { transform: rotate(360deg); } }

        /* The chip still appears, it just stops spinning. */
        @media (prefers-reduced-motion: reduce) {
            #ks-loading-chip .ks-spin { animation-duration: 2.4s; }
            #ks-loading-bar { transition: opacity .2s ease; }
        }

        .tooltip-inner {
            max-width: 320px;
            text-align: left;
            white-space: pre-line;
            font-size: 12px;
            line-height: 1.45;
            padding: 7px 10px;
        }
        .tooltip {
            z-index: 20000 !important;
            /* A tooltip that can take the cursor causes an endless loop: it
               opens under the pointer, the trigger gets mouseleave, the tooltip
               hides, the pointer is back on the trigger, and it opens again.
               Bootstrap 5 sets this for the same reason; 4 does not. Nothing
               inside a tooltip is interactive, so nothing is lost. */
            pointer-events: none;
        }
    
