/* MagicLoop application stylesheet.
   Extracted from templates/base.html + templates/_ml_design_system.html
   so the ~35KB of shared CSS is downloaded ONCE and cached (hashed
   filename, 1y immutable) instead of re-shipped inline in every HTML
   response. Order matters: base styles first, design system layers on
   top, matching the old in-head order. Page-specific CSS still lives
   in each template and layers on top of this; it must never redefine
   these tokens (docs/STYLE_GUIDE.md). */

        :root {
            /* Primary brand */
            --oxford-blue: #09294E;
            --sky-blue: #09C6EF;
            --pumpkin: #FF8030;

            /* Secondary */
            --denim-blue: #304E70;
            --light-orange: #FFEBDD;
            --ash-blue: #577AA3;
            --dim-gray: #636363;
            --dark-gray: #252525;
            --white: #FFFFFF;

            /* Functional */
            --bg: #FFFFFF;
            --surface: #FFFFFF;
            --surface-muted: #F7F8FA;
            --border: #E6EAF0;
            --text: var(--dark-gray);
            --text-muted: var(--dim-gray);

            /* Status (kept semantic, brand-tinted) */
            --status-ok-bg: #E6F7EE;
            --status-ok-fg: #1F7A4A;
            --status-warn-bg: var(--light-orange);
            --status-warn-fg: #B7460E;
            --status-info-bg: #DFF6FC;
            --status-info-fg: #066A82;
            --status-err-bg: #FCE5E0;
            --status-err-fg: #A12B17;
        }

        * { box-sizing: border-box; }

        html, body {
            margin: 0;
            padding: 0;
            background: var(--bg);
            color: var(--text);
            font-family: "Inter", -apple-system, system-ui, sans-serif;
            font-weight: 400;
            font-size: 16px;
            line-height: 1.5;
            -webkit-font-smoothing: antialiased;
            overflow-x: hidden;
        }

        nav {
            background: linear-gradient(180deg, #061B36 0%, var(--oxford-blue) 100%);
            color: var(--white);
            padding: 14px 32px;
            display: flex;
            gap: 22px;
            align-items: center;
            font-weight: 500;
            position: relative;
            border-bottom: 1px solid rgba(9,198,239,0.18);
            box-shadow: 0 1px 0 rgba(9,198,239,0.10),
                        0 8px 24px rgba(6,27,54,0.18);
        }
        /* Thin animated accent line at the bottom -- "alive system" cue */
        nav::after {
            content: "";
            position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
            background: linear-gradient(90deg,
                transparent 0%,
                rgba(9,198,239,0.30) 20%,
                rgba(9,198,239,0.60) 50%,
                rgba(9,198,239,0.30) 80%,
                transparent 100%);
            background-size: 200% 100%;
            animation: nav-shimmer 8s linear infinite;
        }
        @keyframes nav-shimmer {
            0%   { background-position: 100% 0; }
            100% { background-position: -100% 0; }
        }
        nav .brand {
            font-family: "Space Grotesk", "Inter", sans-serif;
            font-weight: 700;
            font-size: 17px;
            letter-spacing: -0.2px;
            display: inline-flex;
            align-items: center;
            gap: 9px;
        }
        nav .brand .brand-pulse {
            width: 7px; height: 7px; border-radius: 50%;
            background: var(--sky-blue);
            box-shadow: 0 0 8px rgba(9,198,239,0.7);
            animation: brand-pulse 2.2s ease-in-out infinite;
        }
        @keyframes brand-pulse {
            0%, 100% { opacity: 1; transform: scale(1); }
            50%      { opacity: 0.65; transform: scale(0.85); }
        }
        nav a, nav .menu > .label {
            color: rgba(255, 255, 255, 0.72);
            text-decoration: none;
            font-size: 14px;
            font-weight: 500;
            padding: 5px 0;
            border-bottom: 1.5px solid transparent;
            transition: color 0.15s, border-color 0.15s;
            line-height: 1.4;
            display: inline-flex;
            align-items: center;
        }
        nav a:hover, nav a.active {
            color: var(--white);
            border-bottom-color: var(--sky-blue);
        }
        /* Mega-dropdown. Pure CSS :hover -- no JS.
           Two wide sectioned panels (Tools, Company) replace the old
           per-department dropdowns and their nested flyouts, so no
           destination is ever more than one hover deep. Sections whose
           links a user can't access simply don't render (Django gates),
           so the panel narrows itself per role. */
        nav .menu {
            position: relative;
            display: inline-flex;
            align-items: center;
        }
        nav .menu > .label {
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s;
        }
        /* Caret on every dropdown label. Inline-block so the glyph
           sits on the same baseline regardless of font rendering. */
        nav .menu > .label .caret {
            display: inline-block;
            margin-left: 5px;
            font-size: 9px;
            line-height: 1;
            opacity: 0.55;
            transform: translateY(-1px);
            transition: opacity 0.15s, transform 0.15s;
        }
        nav .menu.active > .label .caret {
            opacity: 1;
            transform: translateY(0);
        }
        /* Caret flips while the panel is open -- a small "alive" cue. */
        nav .menu:hover > .label .caret,
        nav .menu:focus-within > .label .caret {
            opacity: 1;
            transform: rotate(180deg);
        }
        /* Primary destinations sit centered between the brand and the
           right cluster, with generous air between them. */
        nav .nav-primary {
            display: flex;
            align-items: center;
            gap: 36px;
            margin: 0 auto;
        }
        nav .menu:hover > .label,
        nav .menu.active > .label {
            color: var(--white);
            border-bottom-color: var(--sky-blue);
        }
        nav .menu > .mega-panel {
            position: absolute;
            top: 100%;
            left: 50%;
            margin-top: 8px;
            display: flex;
            align-items: flex-start;
            gap: 4px;
            padding: 20px 14px;
            background: rgba(6,27,54,0.96);
            backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
            border: 1px solid rgba(9,198,239,0.20);
            border-radius: 14px;
            box-shadow: 0 24px 56px rgba(0,0,0,0.40),
                        inset 0 1px 0 rgba(9,198,239,0.10);
            max-width: min(960px, calc(100vw - 48px));
            opacity: 0;
            visibility: hidden;
            transform: translate(-50%, -6px);
            transition: opacity 0.14s ease, transform 0.14s ease, visibility 0s linear 0.18s;
            z-index: 100;
        }
        /* Invisible bridge across the visual gap so the cursor can
           travel from the label into the panel without breaking hover. */
        nav .menu > .mega-panel::before {
            content: "";
            position: absolute;
            left: 0; right: 0;
            top: -14px;
            height: 14px;
        }
        nav .menu:hover > .mega-panel,
        nav .menu:focus-within > .mega-panel {
            opacity: 1;
            visibility: visible;
            transform: translate(-50%, 0);
            transition: opacity 0.14s ease, transform 0.14s ease, visibility 0s;
        }
        nav .mega-col {
            display: flex;
            flex-direction: column;
            gap: 22px;
            min-width: 188px;
            padding: 0 10px;
        }
        nav .mega-col + .mega-col {
            border-left: 1px solid rgba(9,198,239,0.10);
        }
        nav .mega-section {
            display: flex;
            flex-direction: column;
        }
        nav .mega-section .mega-title {
            font-family: "JetBrains Mono", ui-monospace, monospace;
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: rgba(9,198,239,0.80);
            padding: 0 12px 7px;
        }
        /* Sub-group heading inside a section (e.g. CAD under Metrics). */
        nav .mega-section .mega-sub {
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.10em;
            text-transform: uppercase;
            color: rgba(255,255,255,0.35);
            padding: 10px 12px 3px;
        }
        nav .mega-section > a {
            display: flex;
            align-items: center;
            padding: 6px 12px;
            font-size: 13px;
            line-height: 1.45;
            color: rgba(255,255,255,0.78);
            border-bottom: none;
            border-radius: 7px;
            white-space: nowrap;
        }
        nav .mega-section > a:hover,
        nav .mega-section > a.active {
            background: rgba(9,198,239,0.10);
            color: var(--white);
        }
        nav .mega-section > a .ext {
            opacity: 0.45;
            font-size: 11px;
            margin-left: 5px;
        }

        /* Due-now pill on nav dropdown items. Two variants:
           .nav-pill (sky-blue) -- neutral info count (e.g. items to
                                   look at, no time pressure)
           .nav-pill.due (pumpkin) -- AR needs to act on this now
                                      (overdue invoices, commissions
                                      past due, etc.) */
        nav .nav-pill {
            display: inline-block;
            background: rgba(9,198,239,0.18);
            color: var(--sky-blue);
            font-size: 11.5px;
            font-weight: 700;
            padding: 2px 7px;
            border-radius: 9px;
            margin-left: 6px;
            vertical-align: middle;
            line-height: 1.3;
            letter-spacing: 0.1px;
        }
        nav .nav-pill.due {
            background: rgba(255,128,48,0.18);
            color: var(--pumpkin);
        }

        nav .spacer { flex: 1; }
        /* Cmd-K hint pill -- makes the (previously invisible) command
           palette discoverable from the header. */
        nav .cmdk-hint {
            display: inline-flex;
            align-items: center;
            gap: 1px;
            font-family: "JetBrains Mono", ui-monospace, monospace;
            font-size: 12px;
            letter-spacing: 0.5px;
            color: rgba(255,255,255,0.60);
            background: rgba(255,255,255,0.06);
            border: 1px solid rgba(255,255,255,0.16);
            border-radius: 7px;
            padding: 5px 9px;
            cursor: pointer;
            transition: color 0.15s, border-color 0.15s, background 0.15s;
        }
        nav .cmdk-hint:hover {
            color: var(--white);
            border-color: rgba(9,198,239,0.55);
            background: rgba(9,198,239,0.10);
        }
        /* Right-side cluster -- jobs runtime indicator + user */
        nav .nav-right {
            display: inline-flex; align-items: center; gap: 18px;
        }
        nav .runtime-link {
            display: inline-flex; align-items: center; gap: 6px;
            font-family: "JetBrains Mono", ui-monospace, monospace;
            font-size: 12px;
            letter-spacing: 0.5px;
            color: rgba(255,255,255,0.75);
            padding: 6px 12px;
            border-radius: 999px;
            background: rgba(9,198,239,0.08);
            border: 1px solid rgba(9,198,239,0.25);
        }
        nav .runtime-link:hover {
            color: var(--white);
            background: rgba(9,198,239,0.16);
            border-color: rgba(9,198,239,0.55);
            border-bottom-color: rgba(9,198,239,0.55);
        }
        nav .runtime-link .dot {
            width: 6px; height: 6px; border-radius: 50%;
            background: #22D38A;
            box-shadow: 0 0 6px rgba(34,211,138,0.6);
            animation: brand-pulse 2.4s ease-in-out infinite;
        }
        nav .user-menu { position: relative; display: inline-block; }
        nav .user-menu .user-trigger {
            display: inline-flex; align-items: center; gap: 8px;
            font-size: 13px;
            color: rgba(255, 255, 255, 0.70);
            font-weight: 500;
            cursor: pointer;
            padding: 5px 0;
            border-bottom: 1.5px solid transparent;
            transition: color 0.15s, border-color 0.15s;
        }
        nav .user-menu:hover .user-trigger {
            color: var(--white);
            border-bottom-color: var(--sky-blue);
        }
        nav .user-menu .user-trigger .avatar {
            width: 24px; height: 24px; border-radius: 50%;
            background: rgba(9, 198, 239, 0.18);
            color: var(--sky-blue);
            font-family: "JetBrains Mono", ui-monospace, monospace;
            font-size: 11px; font-weight: 700;
            display: inline-flex; align-items: center; justify-content: center;
            text-transform: uppercase;
        }
        nav .user-menu > .items {
            position: absolute;
            top: 100%;
            right: 0;
            margin-top: 6px;
            background: rgba(6,27,54,0.95);
            backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
            min-width: 180px;
            padding: 6px 0;
            border-radius: 8px;
            border: 1px solid rgba(9,198,239,0.20);
            box-shadow: 0 12px 32px rgba(0,0,0,0.32);
            display: flex;
            flex-direction: column;
            opacity: 0;
            visibility: hidden;
            transform: translateY(-4px);
            transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.18s;
            z-index: 100;
        }
        /* Invisible bridge across the 6px visual gap so the cursor can
           cross from the trigger into the menu without breaking hover. */
        nav .user-menu > .items::before {
            content: "";
            position: absolute;
            left: 0; right: 0;
            top: -10px;
            height: 10px;
        }
        nav .user-menu:hover > .items,
        nav .user-menu:focus-within > .items {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
            transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s;
        }
        nav .user-menu > .items > a,
        nav .user-menu > .items > .item-email {
            padding: 8px 16px;
            font-size: 13px;
            color: rgba(255,255,255,0.72);
            border-bottom: none;
            border-left: 2px solid transparent;
            text-decoration: none;
        }
        nav .user-menu > .items > a:hover {
            background: rgba(9,198,239,0.10);
            color: var(--white);
            border-left-color: var(--sky-blue);
        }
        nav .user-menu > .items > .item-email {
            font-family: "JetBrains Mono", ui-monospace, monospace;
            font-size: 11px;
            color: rgba(255,255,255,0.45);
            border-bottom: 1px solid rgba(9,198,239,0.12);
            margin-bottom: 4px;
            cursor: default;
        }
        nav .user-menu > .items > .signout {
            color: var(--sky-blue);
            font-weight: 500;
            border-top: 1px solid rgba(9,198,239,0.12);
            margin-top: 4px;
            padding-top: 10px;
        }

        main {
            padding: 40px 32px;
            max-width: 1200px;
            margin: 0 auto;
        }

        h1 {
            font-size: 26px;
            font-weight: 600;
            color: var(--oxford-blue);
            margin: 0 0 24px;
            letter-spacing: -0.2px;
        }
        h2 {
            font-size: 16px;
            font-weight: 600;
            color: var(--oxford-blue);
            margin: 32px 0 12px;
        }

        a { color: var(--sky-blue); text-decoration: none; }
        a:hover { text-decoration: underline; }

        /* Card-ish wrapper for tables */
        table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            overflow: hidden;
            font-size: 13px;
        }
        th, td {
            text-align: left;
            padding: 14px 16px;
            border-bottom: 1px solid var(--border);
            vertical-align: middle;
        }
        thead th {
            background: var(--surface-muted);
            font-weight: 600;
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            color: var(--dim-gray);
        }
        tbody tr:last-child td { border-bottom: 0; }
        tbody tr:hover { background: var(--surface-muted); }

        /* Status pills */
        .pill {
            display: inline-block;
            padding: 3px 10px;
            border-radius: 999px;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.2px;
            text-transform: lowercase;
        }
        .pill.alive, .pill.succeeded { background: var(--status-ok-bg); color: var(--status-ok-fg); }
        .pill.stale { background: var(--status-warn-bg); color: var(--status-warn-fg); }
        .pill.failed { background: var(--status-err-bg); color: var(--status-err-fg); }
        .pill.running, .pill.queued, .pill.working, .pill.idle { background: var(--status-info-bg); color: var(--status-info-fg); }

        /* Primary CTA: Pumpkin */
        button, .btn {
            background: var(--pumpkin);
            color: var(--white);
            border: 0;
            border-radius: 8px;
            padding: 8px 14px;
            font-family: inherit;
            font-size: 12px;
            font-weight: 600;
            letter-spacing: 0.2px;
            cursor: pointer;
            transition: background 0.15s, transform 0.05s;
        }
        button:hover, .btn:hover {
            background: #E66E22;
        }
        button:active, .btn:active { transform: translateY(1px); }
        button.secondary, .btn.secondary {
            background: var(--surface);
            color: var(--oxford-blue);
            border: 1px solid var(--border);
        }
        button.secondary:hover {
            border-color: var(--ash-blue);
            background: var(--surface-muted);
        }

        code {
            background: var(--surface-muted);
            padding: 2px 6px;
            border-radius: 4px;
            font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
            font-size: 12px;
            color: var(--denim-blue);
        }

        .muted { color: var(--text-muted); font-size: 12px; }
        .stack { display: flex; flex-direction: column; gap: 4px; }

        /* Empty-state cell */
        .empty {
            text-align: center;
            color: var(--text-muted);
            padding: 28px;
        }

        /* Top progress bar -- shown immediately on every navigation,
           removed once the new page finishes loading. Solves the
           "blank stare while server responds" problem on slow pages
           like /sync/ar/?view=aging and /sync/invoices/. */
        #page-loading {
            position: fixed; top: 0; left: 0; height: 3px;
            width: 0%; z-index: 9999;
            background: linear-gradient(90deg, var(--sky-blue) 0%,
                            var(--pumpkin) 50%, var(--sky-blue) 100%);
            background-size: 200% 100%;
            box-shadow: 0 0 8px rgba(9,198,239,0.55);
            transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            pointer-events: none;
        }
        #page-loading.visible {
            animation: page-loading-shimmer 1.4s linear infinite;
        }
        @keyframes page-loading-shimmer {
            0%   { background-position:   0% 0; }
            100% { background-position: 200% 0; }
        }
        /* Fixed bottom-right dock: the access-review trigger pinned to
           the left of the Loading pill. One flex row so the two
           controls never overlap and stay aligned as the pill toggles. */
        #bottom-right-dock {
            position: fixed; bottom: 18px; right: 18px; z-index: 9999;
            display: flex; align-items: center; gap: 10px;
        }
        #page-loading-label {
            background: rgba(9,41,78,0.92); color: #fff;
            font-family: "JetBrains Mono", ui-monospace, monospace;
            font-size: 11px; letter-spacing: 0.3px;
            padding: 6px 12px; border-radius: 999px;
            box-shadow: 0 6px 18px rgba(9,41,78,0.35);
            display: none;
            backdrop-filter: blur(8px);
        }
        #page-loading-label .dot {
            display: inline-block; width: 6px; height: 6px; border-radius: 50%;
            background: var(--sky-blue); margin-right: 6px; vertical-align: middle;
            animation: page-loading-pulse 1s ease-in-out infinite;
        }
        @keyframes page-loading-pulse {
            0%, 100% { opacity: 1;   transform: scale(1);   }
            50%      { opacity: 0.4; transform: scale(0.7); }
        }
        .hp-flash {
            max-width: min(1080px, calc(100vw - 48px));
            margin: 14px auto 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .hp-flash-card {
            display: flex;
            align-items: center;
            gap: 10px;
            width: fit-content;
            max-width: 100%;
            padding: 8px 12px;
            border: 1px solid #D8E1EA;
            border-radius: 10px;
            background: #F8FAFC;
            color: #31485C;
            box-shadow: 0 8px 24px rgba(9, 41, 78, 0.08);
            font-size: 13px;
            line-height: 1.35;
        }
        .hp-flash-card.success {
            border-color: #BFE8D1;
            background: #F4FBF7;
            color: #236A47;
        }
        .hp-flash-card.warning {
            border-color: #F0D4A8;
            background: #FFF9EF;
            color: #81511B;
        }
        .hp-flash-card.error {
            border-color: #F2BEB8;
            background: #FFF5F3;
            color: #8B1F1F;
        }
        .hp-flash-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 18px;
            height: 18px;
            border-radius: 999px;
            background: rgba(9, 41, 78, 0.08);
            font-size: 11px;
            font-weight: 700;
            flex: 0 0 auto;
        }
        .hp-flash-card.success .hp-flash-icon { background: rgba(31, 122, 74, 0.12); }
        .hp-flash-card.warning .hp-flash-icon { background: rgba(199, 131, 30, 0.16); }
        .hp-flash-card.error .hp-flash-icon { background: rgba(139, 31, 31, 0.12); }
        .hp-flash-text {
            min-width: 0;
            overflow-wrap: anywhere;
        }
        .access-hover {
            position: relative;
            display: inline-flex;
        }
        /* Docked pill: floats over page content next to the Loading
           pill, so it needs its own surface to stay legible. */
        .access-trigger {
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--dim-gray);
            font-size: 11px;
            font-weight: 600;
            text-decoration: none;
            padding: 6px 12px;
            border-radius: 999px;
            box-shadow: 0 6px 18px rgba(9,41,78,0.12);
            cursor: help;
        }
        .access-trigger:hover,
        .access-trigger:focus {
            color: var(--oxford-blue);
            border-color: var(--oxford-blue);
            outline: none;
            background: var(--surface);
        }
        .access-popover {
            position: absolute;
            right: 0;
            bottom: calc(100% + 8px);
            z-index: 90;
            width: min(430px, 86vw);
            max-height: 460px;
            overflow: auto;
            padding: 10px 12px;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--surface);
            box-shadow: 0 16px 36px rgba(16,32,51,.16);
            opacity: 0;
            visibility: hidden;
            transform: translateY(3px);
            transition: opacity .12s ease, transform .12s ease, visibility 0s linear .12s;
            pointer-events: none;
            text-align: left;
        }
        .access-hover:hover .access-popover,
        .access-hover:focus-within .access-popover {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
            transition: opacity .12s ease, transform .12s ease, visibility 0s;
            pointer-events: auto;
        }
        .access-popover strong {
            display: block;
            margin-bottom: 2px;
            color: var(--oxford-blue);
            font-size: 12px;
        }
        .access-popover .basis {
            display: block;
            margin-bottom: 7px;
            color: var(--dim-gray);
            font-size: 11px;
        }
        .access-popover .person {
            display: block;
            padding: 4px 0;
            color: var(--text);
            font-size: 12px;
            line-height: 1.35;
            overflow-wrap: anywhere;
        }
        .access-editor {
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid var(--border);
        }
        .access-editor label {
            display: block;
            margin-bottom: 6px;
            color: var(--dim-gray);
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
        }
        .access-editor select {
            width: 100%;
            min-height: 128px;
            box-sizing: border-box;
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 5px 7px;
            color: var(--text);
            background: var(--surface);
            font-size: 12px;
            outline: none;
        }
        .access-editor select:focus {
            border-color: var(--oxford-blue);
            box-shadow: 0 0 0 3px rgba(9,41,78,.10);
        }
        .access-actions {
            display: flex;
            justify-content: flex-end;
            margin-top: 8px;
        }
        .access-save {
            min-height: 28px;
            padding: 0 10px;
            border: 1px solid var(--oxford-blue);
            border-radius: 6px;
            background: var(--oxford-blue);
            color: #fff;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
        }

/* ---- shared design system (was _ml_design_system.html) ---- */

/* =========================================================
   PAGE SHELL
   Centered container with consistent max-width + side padding.
   Use .ml-page-wide for data-heavy table pages (1200px), default
   .ml-page for scannable lists / forms (880px).
   ========================================================= */
.ml-page,
.ml-page-wide {
    margin: 0 auto;
    padding: 24px 28px 64px;
}
.ml-page       { max-width: 880px; }
.ml-page-wide  { max-width: 1200px; }
.ml-page *,
.ml-page-wide * { box-sizing: border-box; }

/* =========================================================
   TYPOGRAPHY
   One title style, one lede style, one section-header style.
   ========================================================= */
.ml-title {
    font-family: "Space Grotesk", "Inter", sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--oxford-blue);
    letter-spacing: -0.5px;
    margin: 0;
}
.ml-lede {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 60ch;
    margin: 8px 0 0;
}
.ml-section-h {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0 4px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.ml-section-h .name {
    font-size: 18px;
    font-weight: 600;
    color: var(--oxford-blue);
}
.ml-section-h .meta {
    font-size: 14px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* =========================================================
   QUIET STATS
   Numbers without boxes -- AR's eye reads the number, then the
   label. Use this for summary rows at the top of a page.
   ========================================================= */
.ml-stats {
    display: flex;
    gap: 56px;
    margin: 28px 0 8px;
    flex-wrap: wrap;
}
.ml-stat .n {
    font-size: 26px;
    font-weight: 600;
    color: var(--oxford-blue);
    letter-spacing: -0.4px;
    font-variant-numeric: tabular-nums;
}
.ml-stat .l {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =========================================================
   TOOLBAR
   Left-justified action area + right-justified utility links.
   Sits between the page header and the data.
   ========================================================= */
.ml-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0 8px;
    flex-wrap: wrap;
    gap: 12px;
}
.ml-toolbar .tb-left   { display: flex; align-items: center; gap: 12px; }
.ml-toolbar .tb-status { font-size: 13.5px; color: var(--text-muted); }
.ml-toolbar a {
    font-size: 13.5px;
    color: var(--ash-blue);
    text-decoration: none;
}
.ml-toolbar a:hover { text-decoration: underline; }

/* =========================================================
   BUTTONS
   .ml-btn        -- primary, Oxford-Blue solid
   .ml-btn-ghost  -- secondary, transparent
   .ml-btn-link   -- text-like, no border / background
   Always disable :hover transform if [disabled] is set.
   ========================================================= */
.ml-btn {
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--oxford-blue);
    background: var(--oxford-blue);
    color: #fff;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.ml-btn:hover:not([disabled]) { opacity: 0.9; transform: translateY(-1px); }
.ml-btn[disabled] { opacity: 0.55; cursor: default; }
.ml-btn-ghost {
    background: transparent;
    color: var(--ash-blue);
    border-color: var(--border);
}
.ml-btn-ghost:hover:not([disabled]) {
    background: var(--surface-muted);
    transform: translateY(-1px);
}
.ml-btn-link {
    font: inherit;
    font-size: 13.5px;
    color: var(--text-muted);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}
.ml-btn-link:hover { color: var(--text); }

/* =========================================================
   BANNER
   Single banner pattern for EXCEPTION states only -- overdue
   (red), blocked (amber). Do NOT use for "informational"
   states like "Ready for review" or "All caught up" -- those
   are noise on a page AR opens daily.
   ========================================================= */
.ml-banner {
    margin: 0 0 18px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid;
    border-left-width: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    line-height: 1.45;
}
.ml-banner.alarm   { background: #FDECEA; border-color: #E5A39C; border-left-color: #C53030; color: #7A1F12; }
.ml-banner.warn    { background: #FFF4E5; border-color: #F0D2A8; border-left-color: #C77700; color: #7A4A00; }

/* =========================================================
   INPUTS + NOTES
   Shared form-field look. Always reuse before writing local
   styling for textareas / selects / text inputs.
   ========================================================= */
.ml-input,
.ml-select,
.ml-textarea {
    font: inherit;
    font-size: 14px;
    color: var(--text);
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
.ml-input:focus,
.ml-select:focus,
.ml-textarea:focus {
    outline: none;
    border-color: var(--ash-blue);
}
.ml-textarea {
    width: 100%;
    line-height: 1.5;
    resize: vertical;
    min-height: 64px;
}

/* =========================================================
   EMPTY STATE
   A single muted box with playful copy. Use whenever a list
   or section has no rows -- never a bare "No data".
   ========================================================= */
.ml-empty {
    margin-top: 36px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14.5px;
    line-height: 1.55;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}
