/* =====================================================================
   ELRU PPMS — stylesheet recreated FAITHFULLY from the ELRU Design System v2
   ("The operations console", ui-design/project/v2/PPMS v2 Design System.dc.html).
   Tokens and component rules are lifted from that source — the single source of
   truth for every visual. Do not invent or deviate; extend only with v2 values.
   v2 foundations (2026-08-15): neutrals cooled one step; IBM Plex Sans for UI &
   data (tabular numerals), Poppins kept for headings & brand; radii flattened to
   4/6/8/999; 32px controls; 36px table rows (32px dense); cards sit on borders,
   shadows only on popovers; content fluid to 1600px.
   ===================================================================== */

/* ------------------------------ Tokens ------------------------------ */
:root {
    --color-primary-50:#EEF2FF;  --color-primary-100:#E0E7FF; --color-primary-200:#C7D2FE;
    --color-primary-300:#A5B4FC; --color-primary-400:#818CF8; --color-primary-500:#6366F1;
    --color-primary-600:#4F46E5; --color-primary-700:#4338CA; --color-primary-800:#3730A3;
    --color-primary-900:#312E81;

    --color-navy-50:#F4F3FB;  --color-navy-100:#E4E2F4; --color-navy-200:#C9C5E9;
    --color-navy-300:#A29BD6; --color-navy-400:#7A6FC0; --color-navy-500:#5A4FA8;
    --color-navy-600:#453B8B; --color-navy-700:#34306B; --color-navy-800:#282456;
    --color-navy-900:#1E1B4B;

    --color-gray-50:#F9FAFB;  --color-gray-100:#F2F4F7; --color-gray-200:#E5E8EF;
    --color-gray-300:#D0D5DD; --color-gray-400:#98A2B3; --color-gray-500:#667085;
    --color-gray-600:#475467; --color-gray-700:#344054; --color-gray-800:#1D2939;
    --color-gray-900:#101828;

    --color-success-50:#F0FDF4;  --color-success-100:#DCFCE7; --color-success-200:#BBF7D0;
    --color-success-500:#22C55E; --color-success-600:#16A34A; --color-success-700:#15803D;
    --color-warning-50:#FFF7ED;  --color-warning-100:#FFEDD5; --color-warning-200:#FED7AA;
    --color-warning-500:#F97316; --color-warning-600:#EA580C; --color-warning-700:#C2410C;
    --color-error-50:#FEF2F2;    --color-error-100:#FEE2E2;   --color-error-200:#FECACA;
    --color-error-300:#FCA5A5;   --color-error-400:#F87171;
    --color-error-500:#EF4444;   --color-error-600:#DC2626;   --color-error-700:#B91C1C;
    --color-info-50:#EFF6FF;     --color-info-100:#DBEAFE;    --color-info-200:#BFDBFE;
    --color-info-500:#3B82F6;    --color-info-600:#2563EB;    --color-info-700:#1D4ED8;

    /* MRD pathway metals — real bronze / silver / gold */
    --color-bronze-100:#F5E6D3; --color-bronze-400:#C68A4E; --color-bronze-500:#B87333;
    --color-bronze-600:#9C5F27; --color-bronze-700:#7F4C1E;
    --color-silver-100:#EEF1F5; --color-silver-400:#A8B1BD; --color-silver-500:#8E98A6;
    --color-silver-600:#717D8D; --color-silver-700:#5B6675;
    --color-gold-100:#FAF0CF;   --color-gold-400:#E2BB45;   --color-gold-500:#D4A72C;
    --color-gold-600:#B3891A;   --color-gold-700:#8F6C12;

    --color-bg-page:#F6F7F9;
    --color-bg-surface:#FFFFFF;
    --color-bg-sidebar:var(--color-navy-900);
    --color-text-primary:var(--color-gray-900);
    --color-text-secondary:var(--color-gray-500);
    --color-text-inverse:#FFFFFF;

    --font-body:'IBM Plex Sans',sans-serif;   /* UI & data — tabular numerals */
    --font-heading:'Poppins',sans-serif;      /* headings & brand only */
    --font-mono:'IBM Plex Mono',monospace;    /* refs, codes */

    --space-xs:4px; --space-sm:8px; --space-md:12px; --space-lg:16px;
    --space-xl:24px; --space-2xl:32px; --space-3xl:32px; /* 48 retired (v2) */

    --radius-xs:4px; --radius-sm:6px; --radius-md:8px; --radius-lg:8px;   /* 12 retired (v2) */
    --radius-xl:10px; --radius-full:999px;                                /* 16 retired (v2) */

    --shadow-xs:0 1px 2px rgba(16,24,40,.05);
    --shadow-sm:0 1px 3px rgba(16,24,40,.08),0 1px 2px rgba(16,24,40,.04);
    --shadow-md:0 4px 12px rgba(16,24,40,.08);
    --shadow-lg:0 12px 32px rgba(16,24,40,.16);

    --border-w-1:1px; --border-w-2:2px;
    --border-color:var(--color-gray-200);
    --border-color-strong:var(--color-gray-300);
    --border-1:1px solid var(--color-gray-200);
    --focus-ring:0 0 0 3px var(--color-primary-100);
}

/* ------------------------------ Base -------------------------------- */
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;padding:0;background:var(--color-bg-page);font-family:var(--font-body);
    color:var(--color-gray-800);-webkit-font-smoothing:antialiased}
a{color:var(--color-primary-600);text-decoration:none}
a:hover{color:var(--color-primary-700)}
input,select,textarea,button{font-family:inherit}
h1,h2,h3,h4,p{margin:0}
/* Poppins carries headings and brand; everything else is Plex (v2 type split). */
h1,h2,h3,.page-title,.section-title,.login-title{font-family:var(--font-heading)}

/* ------------------------------ Shell -------------------------------
   v2 concept 01 — RAIL + PANEL. A 56px navy icon rail carries one icon per
   module; a 216px panel lists every section of the active module, always.
   Nothing is buried two clicks deep: what the old tab strip and its Manage
   dropdown hid is a flat, permanent list here. Concept 02 — the context bar
   (top) carries period · scope · programme on every page that has them. */
.app{display:flex;min-height:100vh}
.sidebar{display:flex;flex-shrink:0;position:sticky;top:0;height:100vh;z-index:20}

/* Rail */
.rail{width:56px;background:var(--color-navy-900);display:flex;flex-direction:column;
    align-items:center;padding:12px 0;gap:4px;flex-shrink:0}
/* The ELRU "e" mark on a white tile — the multicolour glyph needs a light
   ground to read against the navy rail. Same footprint as the old letter tile. */
.rail__brand{width:30px;height:30px;border-radius:7px;background:#fff;
    display:flex;align-items:center;justify-content:center;margin-bottom:12px;text-decoration:none}
.rail__brand img{width:20px;height:20px;display:block}
.rail__item{width:38px;height:38px;border-radius:var(--radius-md);border:none;cursor:pointer;
    display:flex;align-items:center;justify-content:center;background:transparent;
    color:var(--color-navy-300);text-decoration:none}
.rail__item:hover{background:rgba(255,255,255,.12);color:#fff}
.rail__item.is-active{background:rgba(255,255,255,.14);color:#fff}
/* Concept 06: a module the account cannot open stays visible, greyed — it
   never silently vanishes. */
.rail__item.is-locked{color:var(--color-navy-600);cursor:default}
.rail__item.is-locked:hover{background:transparent;color:var(--color-navy-600)}
.rail__spacer{flex:1}
.rail__avatar{width:30px;height:30px;border-radius:50%;background:var(--color-navy-600);
    border:1px solid var(--color-navy-500);color:#fff;font-size:10px;font-weight:600;
    display:flex;align-items:center;justify-content:center;text-decoration:none;margin-top:2px}
.rail__avatar:hover{color:#fff;border-color:var(--color-navy-300)}

/* Panel */
.panel{width:216px;background:#FBFBFD;border-right:var(--border-1);padding:14px 10px;
    flex-shrink:0;overflow-y:auto;display:flex;flex-direction:column}
.panel__title{font-family:var(--font-heading);font-weight:600;font-size:12.5px;
    color:var(--color-gray-900);padding:0 8px 2px}
.panel__sub{font-size:10.5px;color:var(--color-gray-400);padding:0 8px 12px}
.panel__group{font-size:10px;font-weight:600;letter-spacing:.07em;text-transform:uppercase;
    color:var(--color-gray-400);padding:14px 8px 4px}
.panel__item{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:var(--radius-sm);
    font-size:12.5px;color:var(--color-gray-600);text-decoration:none}
.panel__item:hover{background:var(--color-primary-50);color:var(--color-primary-700)}
.panel__item.is-active{background:var(--color-primary-50);color:var(--color-primary-700);font-weight:600}
.panel__item .dot{display:inline-block;width:7px;height:7px;border-radius:50%;flex-shrink:0}
.panel__count{margin-left:auto;font-size:10.5px;font-variant-numeric:tabular-nums;
    color:var(--color-gray-400)}
.panel__spacer{flex:1}

/* Desktop: the toggle hides the panel, the rail persists. */
.app.sidebar-collapsed .panel{display:none}
.sidebar-backdrop{display:none}
@media (max-width:1024px){
    .sidebar{position:fixed;left:0;top:0;transform:translateX(-100%);transition:transform .25s ease}
    .app.sidebar-open .sidebar{transform:translateX(0)}
    .app.sidebar-collapsed .panel{display:flex}
    .sidebar-backdrop{display:block;position:fixed;inset:0;background:rgba(11,18,32,.5);z-index:15;
        opacity:0;pointer-events:none;transition:opacity .25s ease}
    .app.sidebar-open .sidebar-backdrop{opacity:1;pointer-events:auto}
}
.app-main{flex:1;min-width:0;display:flex;flex-direction:column}
.content{padding:20px var(--space-xl) var(--space-2xl);max-width:1600px;width:100%;margin:0 auto}

/* Context bar (v2 concept 02): 48px, breadcrumb-side left, workspace context
   pinned right. Scope chips are <select>s dressed as chips — no JS needed. */
.topbar{display:flex;align-items:center;gap:10px;height:48px;
    padding:0 var(--space-xl);background:var(--color-bg-surface);border-bottom:var(--border-1);
    position:sticky;top:0;z-index:5}
.menu-toggle{display:flex;align-items:center;justify-content:center;background:none;border:none;
    padding:6px;margin-left:-6px;cursor:pointer;color:var(--color-gray-600);border-radius:var(--radius-md)}
.menu-toggle:hover{background:var(--color-gray-100);color:var(--color-gray-800)}
.topbar__crumb{font-size:12px;color:var(--color-gray-500);white-space:nowrap;overflow:hidden;
    text-overflow:ellipsis}
.topbar__crumb b{color:var(--color-gray-900);font-weight:600}
.topbar__spacer{flex:1}
.ctx-chip{display:inline-flex;align-items:center;gap:6px;padding:0 8px;height:30px;
    border:var(--border-1);border-radius:var(--radius-sm);background:#FBFBFD}
.ctx-chip:hover{border-color:var(--color-primary-200)}
.ctx-chip__label{font-size:10.5px;font-weight:600;letter-spacing:.05em;color:var(--color-gray-400)}
.ctx-chip select{border:none;outline:none;background:transparent;font-family:inherit;
    font-size:12px;font-weight:600;color:var(--color-gray-900);cursor:pointer;max-width:170px}
.icon-btn{position:relative;cursor:pointer;color:var(--color-gray-500);display:flex;align-items:center;
    justify-content:center;width:28px;height:28px;border:var(--border-1);border-radius:var(--radius-sm)}
.icon-btn:hover{color:var(--color-gray-700);background:var(--color-gray-50)}
.icon-btn__badge{position:absolute;top:-5px;right:-5px;background:var(--color-error-500);color:#fff;
    font-size:9px;font-weight:600;border-radius:var(--radius-full);padding:1px 4px}

/* ------------------------- Page-level chrome ------------------------ */
.breadcrumbs{display:flex;align-items:center;gap:6px;font-size:12px;margin-bottom:var(--space-lg)}
.breadcrumbs a{color:var(--color-gray-500)}
.breadcrumbs a:hover{color:var(--color-primary-600)}
.breadcrumbs .sep{color:var(--color-gray-400)}
.breadcrumbs .is-current{color:var(--color-primary-700);font-weight:600}

.page-header{display:flex;align-items:center;gap:var(--space-md);margin-bottom:var(--space-xl)}
.page-header__avatar{width:44px;height:44px;border-radius:50%;background:var(--color-navy-900);
    display:flex;align-items:center;justify-content:center;gap:4px;flex-shrink:0}
.page-header__avatar span{width:8px;height:8px;border-radius:50%;background:#fff;display:block}
.page-title{font-size:19px;font-weight:600;color:var(--color-gray-900);letter-spacing:-.01em}
.page-subtitle{font-size:12px;color:var(--color-gray-500);margin-top:2px}
.page-subtitle .prog{color:var(--color-primary-600);font-weight:600}

/* Underline tabs */
.tabs{display:flex;gap:var(--space-xl);border-bottom:var(--border-1);margin-bottom:var(--space-xl)}
.tab{padding:12px 2px;font-size:13px;font-weight:500;color:var(--color-gray-500);
    border-bottom:2px solid transparent;margin-bottom:-1px;cursor:pointer;text-decoration:none}
.tab:hover{color:var(--color-gray-700)}
.tab.is-active{font-weight:600;color:var(--color-primary-600);border-bottom-color:var(--color-primary-600)}

/* Tab strip is now the navigation row only; filters live in .filterbar below it. */
.tabs{margin-bottom:0}

/* Dropdown tabs (Tiers, Manage) — <details>/<summary>, no JS required to open. */
.tabmenu{position:relative}
.tabmenu--right{margin-left:auto}
.tabmenu > summary{display:inline-flex;align-items:center;gap:5px;list-style:none;user-select:none}
.tabmenu > summary::-webkit-details-marker{display:none}
.tabmenu > summary:focus-visible{outline:2px solid var(--color-primary-500);outline-offset:2px}
.tabmenu__caret{font-size:9px;line-height:1;transition:transform .15s ease}
.tabmenu[open] .tabmenu__caret{transform:rotate(180deg)}
.tabmenu__panel{position:absolute;top:100%;left:0;z-index:40;min-width:190px;
    background:var(--color-bg-surface);border:var(--border-1);border-radius:var(--radius-md);
    box-shadow:var(--shadow-md);padding:6px;margin-top:4px}
.tabmenu--right .tabmenu__panel{left:auto;right:0}
.tabmenu__panel--wide{min-width:265px}
.tabmenu__item{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:var(--radius-sm);
    font-size:12.5px;color:var(--color-gray-700);text-decoration:none;white-space:nowrap}
.tabmenu__item:hover{background:var(--color-gray-50);color:var(--color-gray-900)}
.tabmenu__item.is-active{background:var(--color-primary-50);color:var(--color-primary-700);font-weight:600}
.tabmenu__sep{height:1px;background:var(--color-gray-200);margin:6px 4px}
.tabmenu__form{padding:6px 10px 10px;display:flex;flex-direction:column;gap:6px}
.tabmenu__label{font-size:11px;color:var(--color-gray-500);font-weight:500}
@media (prefers-reduced-motion:reduce){.tabmenu__caret{transition:none}}

/* Filter row: period + ELP scope, visually distinct from navigation. */
.filterbar{display:flex;align-items:center;gap:var(--space-md);flex-wrap:wrap;
    padding:10px 0 0;margin-bottom:var(--space-xl)}
.filterbar__group{margin:0;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.filterbar__label{font-size:11px;text-transform:uppercase;letter-spacing:.03em;
    color:var(--color-gray-500);font-weight:600}

/* Section heading */
.section-title{font-size:19px;font-weight:600;color:var(--color-gray-900)}
.section-sub{font-size:13px;color:var(--color-gray-500);margin-top:2px}

/* ------------------------------ Grids ------------------------------- */
.grid-4{display:grid;grid-template-columns:repeat(4,1fr);gap:var(--space-lg)}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--space-xl)}
.grid-2{display:grid;grid-template-columns:repeat(2,1fr);gap:var(--space-xl)}
.stack-xl > * + *{margin-top:var(--space-xl)}

/* ------------------------------ Cards ------------------------------- */
.card{background:var(--color-bg-surface);border:var(--border-1);border-radius:var(--radius-xl);
    padding:var(--space-xl)}
.card h3{font-size:14px;font-weight:600;color:var(--color-gray-900);margin:0 0 var(--space-lg)}
.card--split{background:var(--color-bg-surface);border:var(--border-1);border-radius:var(--radius-xl);
    overflow:hidden}
.card__header{padding:14px var(--space-lg);border-bottom:var(--border-1);display:flex;
    justify-content:space-between;align-items:center}
.card__header h3{margin:0;font-size:13.5px;font-weight:600;color:var(--color-gray-900)}
.card__body{padding:var(--space-lg);font-size:13px;color:var(--color-gray-600);line-height:1.6}
.card__footer{padding:12px var(--space-lg);border-top:var(--border-1);background:var(--color-gray-50);
    font-size:12px;color:var(--color-gray-500)}

/* KPI / metric tile */
.kpi-tile{border:var(--border-1);border-radius:var(--radius-md);padding:var(--space-lg);
    background:var(--color-bg-surface)}
.kpi-tile__label{font-size:11.5px;color:var(--color-gray-500)}
.kpi-tile__value{font-size:22px;font-weight:600;color:var(--color-gray-900);margin:2px 0;font-variant-numeric:tabular-nums}
.kpi-tile__delta{font-size:11.5px;font-weight:600}
.kpi-tile__delta.up{color:var(--color-success-600)}
.kpi-tile__delta.down{color:var(--color-error-600)}
.kpi-tile__delta.muted{color:var(--color-gray-400);font-weight:500}

/* Icon stat card */
.stat-card{border:var(--border-1);border-radius:var(--radius-md);padding:var(--space-lg);
    background:var(--color-bg-surface);display:flex;gap:var(--space-md);align-items:center}
.stat-card:hover{border-color:var(--color-primary-300)}
.stat-card__well{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.stat-card__label{font-size:11.5px;color:var(--color-gray-500)}
.stat-card__num{font-size:21px;font-weight:600;color:var(--color-gray-900);line-height:1.1;font-variant-numeric:tabular-nums}

/* ------------------------------ Badges ------------------------------ */
.badge{display:inline-block;font-size:10.5px;font-weight:600;padding:3px 10px;border-radius:var(--radius-full)}
.badge--success{background:var(--color-success-100);color:var(--color-success-700)}
.badge--info{background:var(--color-info-100);color:var(--color-info-700)}
.badge--primary{background:var(--color-primary-100);color:var(--color-primary-700)}
.badge--gray{background:var(--color-gray-100);color:var(--color-gray-600)}
.badge--warning{background:var(--color-warning-100);color:var(--color-warning-700)}
.badge--error{background:var(--color-error-100);color:var(--color-error-700)}
.badge--bronze{background:var(--color-bronze-100);color:var(--color-bronze-700)}
.badge--silver{background:var(--color-silver-100);color:var(--color-silver-700)}
.badge--gold{background:var(--color-gold-100);color:var(--color-gold-700)}

/* ---------------------------- Progress ------------------------------ */
.progress{height:6px;border-radius:var(--radius-full);background:var(--color-gray-200);overflow:hidden}
.progress__fill{height:100%;border-radius:var(--radius-full);background:var(--color-primary-600)}
.progress__fill.success{background:var(--color-success-500)}
.progress__fill.info{background:var(--color-info-600)}

/* ------------------------------ Tables ------------------------------ */
/* v2 density system: 36px rows default, 32px dense; caps headers in gray-400;
   tabular numerals so figures align in columns (the reason Plex carries data). */
/* Fixed layout everywhere: column widths come from the header row, never from
   whichever cell happens to hold the longest value — so tables stay stable
   across pages and data, and long values ellipsis instead of blowing out. */
.table{width:100%;border-collapse:collapse;font-size:12px;font-variant-numeric:tabular-nums;
    table-layout:fixed}
.table td{overflow:hidden;text-overflow:ellipsis}
.table th{text-align:left;padding:8px 10px;color:var(--color-gray-400);font-weight:600;
    font-size:10.5px;letter-spacing:.05em;text-transform:uppercase;
    border-bottom:var(--border-1);white-space:nowrap}
.table td{padding:9px 10px;border-bottom:1px solid var(--color-gray-100);color:var(--color-gray-700)}
.table tbody tr:hover td{background:var(--color-gray-50)}
.table .num{text-align:right}

/* Wide tables live inside cards that clip (`overflow:hidden`), which used to cut
   columns off with no way to reach them. Wrap any table wider than its card in
   .table-scroll: the card keeps its rounded clip, the table scrolls sideways,
   and the header stays put vertically on long pages. */
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:thin;
    scrollbar-color:var(--color-gray-300) var(--color-gray-100)}
/* macOS hides overlay scrollbars until mid-scroll, so an overflowing table looks
   simply cut off. A styled WebKit scrollbar is ALWAYS painted — the cue that
   there is more to the right. */
.table-scroll::-webkit-scrollbar{height:8px}
.table-scroll::-webkit-scrollbar-track{background:var(--color-gray-100)}
.table-scroll::-webkit-scrollbar-thumb{background:var(--color-gray-300);border-radius:var(--radius-full)}
.table-scroll::-webkit-scrollbar-thumb:hover{background:var(--color-gray-400)}
/* Under fixed layout max-content is meaningless; wide tables declare their own
   min-width (inline) and scroll inside this wrapper. */
.table-scroll .table th{position:sticky;top:0;background:var(--color-bg-surface);z-index:1}
/* Dense variant for very wide tables (the 13-column registry): tighter cells so
   every column fits on a laptop before scrolling is even needed. */
.table--dense th{padding:6px 10px}
.table--dense td{padding:5px 10px}

/* ---------------- Table tools (columns menu · density · frozen cols) --------
   Interaction patterns per the wide-table convention in data products (Mobbin:
   Neon/Clay/Vanta) — visuals strictly Design System tokens. */
.table-tools{display:flex;justify-content:flex-end;align-items:center;gap:10px;
    padding:8px var(--space-lg);border-bottom:var(--border-1);position:relative}
.table-tools .tt-chip{font-size:10.5px;padding:3px 10px}
/* Column paging: square icon buttons sized to sit level with the Columns button.
   Disabled at an edge rather than hidden, so the pair never shifts position. */
.tt-nav{display:flex;gap:4px}
.tt-nav .btn{height:28px;width:30px;padding:0;line-height:0}
.tt-nav .btn:disabled{opacity:.35;cursor:default}
.tt-nav .btn:disabled:hover{background:var(--color-bg-surface)}
.tt-pop{position:absolute;top:calc(100% - 4px);right:var(--space-lg);z-index:30;min-width:210px;
    background:var(--color-bg-surface);border:var(--border-1);border-radius:var(--radius-md);
    box-shadow:var(--shadow-lg, 0 8px 24px rgba(17,24,39,.12));padding:10px 0;display:none}
.tt-pop.is-open{display:block}
.tt-pop__head{font-size:10.5px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;
    color:var(--color-gray-400);padding:6px 14px 4px}
.tt-pop label{display:flex;align-items:center;gap:8px;padding:5px 14px;font-size:12.5px;
    color:var(--color-gray-700);cursor:pointer}
.tt-pop label:hover{background:var(--color-gray-50)}
.tt-pop hr{border:none;border-top:var(--border-1);margin:8px 0}
.tt-pop .tt-reset{display:block;width:calc(100% - 28px);margin:6px 14px 0;font-size:11.5px;padding:5px 0}
/* Frozen identity columns: stay put while the rest scrolls horizontally, so a
   row never detaches from WHO it belongs to. Opaque backgrounds are required —
   sticky cells are painted over the columns sliding beneath them. */
.table td.is-sticky,.table th.is-sticky{position:sticky;background:var(--color-bg-surface);z-index:2}
.table th.is-sticky{z-index:3}
.table tbody tr:hover td.is-sticky{background:var(--color-gray-50)}
.table-scroll.is-scrolled .is-sticky-last{box-shadow:8px 0 8px -8px rgba(17,24,39,.18);
    clip-path:inset(0 -16px 0 0)}
/* Long free-text cells (names, centres, addresses): clip with an ellipsis and
   carry the full value in title="" — never silently truncate without it. */
.table .cell-clip{max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.table .nowrap{white-space:nowrap}

/* ---------------- Reconcile Import review (2026-08-16) ---------------------
   One uploaded row per block: who it matched, why, and the old→new diffs. */
.recon-row{padding:10px var(--space-lg);border-bottom:1px solid var(--color-gray-100)}
.recon-row:last-child{border-bottom:none}
.recon-row__head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:12.5px}
.recon-row__diffs{margin:8px 0 2px 26px;display:flex;flex-direction:column;gap:4px}
.recon-diff{display:flex;align-items:center;gap:8px;font-size:12px;flex-wrap:wrap}
.recon-diff__field{min-width:120px;font-weight:600;color:var(--color-gray-500);font-size:11px;
    letter-spacing:.03em;text-transform:uppercase}
.recon-diff__old{color:var(--color-gray-500);text-decoration:line-through;
    text-decoration-color:var(--color-error-300)}
.recon-diff__arrow{color:var(--color-gray-400)}
.recon-diff__new{color:var(--color-success-700);font-weight:600}

/* ---------------- Geographical Reach map filters (2026-08-16) --------------
   Selects populated from the pin payload; applied client-side. */
.map-filters{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;margin-bottom:10px}
.map-filters label{display:flex;flex-direction:column;gap:3px;font-size:10.5px;font-weight:600;
    letter-spacing:.05em;text-transform:uppercase;color:var(--color-gray-400)}
.map-filters select{width:auto;min-width:150px;font-size:12px}
.map-filters__count{font-size:11.5px;margin-left:auto;align-self:center}

/* ---------------- Oversight view-only (2026-08-16) -------------------------
   The Managing Director reads every MRD page without the pen: form controls
   fade and stop responding. Cosmetic only — MdReadOnlyFilter refuses every
   non-GET from the role centrally, whatever a page shows. GET forms (the
   period/scope selectors in the context bar) live outside <main>. */
.view-only main form button,.view-only main form input,.view-only main form select,
.view-only main form textarea,.view-only main form label{
    pointer-events:none;opacity:.45}

/* ---------------- Children Reached timeline (2026-08-16) -------------------
   Distinct children per month, oldest→newest. Plain flex columns on DS
   tokens — no chart library. Each column is a real link to that month. */
.att-timeline{display:flex;align-items:flex-end;gap:14px;padding:16px var(--space-lg) 12px;
    border-bottom:var(--border-1);overflow-x:auto}
.att-timeline__col{display:flex;flex-direction:column;align-items:center;gap:4px;
    text-decoration:none;min-width:52px;flex:1}
.att-timeline__value{font-size:11px;font-variant-numeric:tabular-nums;color:var(--color-gray-600)}
.att-timeline__bar{display:block;width:100%;max-width:64px;border-radius:3px 3px 0 0;
    background:var(--color-primary-200)}
.att-timeline__col:hover .att-timeline__bar{background:var(--color-primary-400)}
.att-timeline__col.is-selected .att-timeline__bar{background:var(--color-primary-600)}
.att-timeline__col.is-selected .att-timeline__value{color:var(--color-primary-700);font-weight:600}
.att-timeline__label{font-size:10.5px;color:var(--color-gray-400);white-space:nowrap}

/* -------------------- Identity-first tables (v2 concept 03) ---------------
   Six identity + status columns; every measure lives in an expandable detail
   row that pages, filters and column-toggles WITH its master row. */
/* Tone aliases so template-computed tones (success/warning/…) drive the dot. */
.status--success .status__dot,.status--ok .status__dot{background:var(--color-success-500)}
.status--warning .status__dot,.status--warn .status__dot{background:var(--color-warning-500)}
.status--error .status__dot{background:var(--color-error-500)}
.status--info .status__dot{background:var(--color-info-500)}
.status--gray,.status--muted{color:var(--color-gray-400)}
.row-main{cursor:pointer}
.row-main.is-open td{background:#F5F7FF}
.row-chev{display:inline-block;font-size:10px;color:var(--color-gray-400);
    transition:transform .15s ease}
.row-main.is-open .row-chev{transform:rotate(180deg)}
@media (prefers-reduced-motion:reduce){.row-chev{transition:none}}
.row-detail>td{padding:0;background:#FBFBFD;border-bottom:var(--border-1)}
.row-detail__grid{display:flex;gap:26px;flex-wrap:wrap;align-items:center;
    padding:13px 16px 13px 48px}
.row-detail__sep{width:1px;height:26px;background:var(--color-gray-200)}
/* Detail rows that hold FORMS (Settings → Users): sections side by side,
   wrapping on narrow screens, each led by a detail__k caption. */
.row-detail__forms{display:flex;gap:26px;flex-wrap:wrap;align-items:flex-start;
    padding:14px var(--space-lg) 16px}
.row-detail__forms .detail__k{margin-bottom:6px}
.detail__k{font-size:10px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;
    color:var(--color-gray-400);margin-bottom:2px}
.detail__v{font-size:13px;font-weight:600;color:var(--color-gray-900);font-variant-numeric:tabular-nums}
.detail__v.is-quiet{font-size:12px;font-weight:500;color:var(--color-gray-700)}

/* Floating bulk bar (v2): appears only when rows are checked — never a
   permanent grey strip. Without JavaScript it stays a plain block above the
   table, so bulk actions survive; the script upgrades it to the floating bar. */
.bulkbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:var(--space-md);
    padding:10px 14px;border-radius:var(--radius-md);background:var(--color-gray-50);
    border:var(--border-1)}
.bulkbar--float{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);z-index:40;
    margin:0;background:var(--color-navy-900);border:none;border-radius:var(--radius-xl);
    box-shadow:0 12px 32px rgba(16,24,40,.28);color:#fff}
.bulkbar--float .muted{color:var(--color-navy-300)}
.bulkbar--float .bulkbar__count{color:#fff;font-weight:600;font-variant-numeric:tabular-nums}
.bulkbar--float.is-empty{display:none}

/* --------------------------- Feed / lists --------------------------- */
.feed{display:flex;flex-direction:column;gap:var(--space-md)}
.feed-item{border-left:3px solid var(--color-primary-500);padding:2px 0 2px var(--space-md);
    display:flex;justify-content:space-between;gap:var(--space-md)}
.feed-item__text{font-size:12.5px;color:var(--color-gray-700)}
.feed-item__time{font-size:11px;color:var(--color-gray-400);white-space:nowrap}
.list-row{display:flex;justify-content:space-between;align-items:center;padding:10px 0;
    border-bottom:1px solid var(--color-gray-100)}
.list-row:last-child{border-bottom:none}
.list-row__label{font-size:12.5px;color:var(--color-gray-700)}
.view-all{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;font-weight:500;color:var(--color-primary-600)}

/* Description list */
.desc-list{display:grid;grid-template-columns:140px 1fr;gap:8px var(--space-lg);font-size:13px}
.desc-list dt{color:var(--color-gray-500)}
.desc-list dd{margin:0;font-weight:600;color:var(--color-gray-900)}

/* --------------------------- Form inputs ---------------------------- */
.input,.select,.textarea{width:100%;box-sizing:border-box;
    border:var(--border-w-1) solid var(--border-color-strong);border-radius:var(--radius-sm);
    padding:7px 10px;font-size:12.5px;color:var(--color-gray-800);outline:none;background:var(--color-bg-surface)}
/* Single-line controls share the buttons' 32px box so mixed rows line up;
   textareas keep their padding-driven height. */
.input:not(textarea),.select{height:32px;padding-top:0;padding-bottom:0}
.input:focus,.select:focus,.textarea:focus{border-color:var(--color-primary-500);box-shadow:var(--focus-ring)}

/* ---------------------------- Buttons ------------------------------- */
/* 32px control height (v2), border-box so primary (borderless) and secondary
   (1px border) land on the SAME box. nowrap: a squeezed flex row must shrink
   the button's neighbours, never wrap its label to two lines. */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;
    border-radius:var(--radius-sm);height:32px;padding:0 14px;box-sizing:border-box;
    font-size:12.5px;white-space:nowrap;cursor:pointer;border:none;text-decoration:none}
/* In-table/row actions: 28px, per the v2 applied screens. */
.btn--sm{height:28px;padding:0 10px;font-size:11.5px;gap:6px}
.btn-primary{background:var(--color-primary-600);color:var(--color-text-inverse);font-weight:600}
.btn-primary:hover{background:var(--color-primary-700);color:#fff}
.btn-secondary{background:var(--color-bg-surface);color:var(--color-gray-700);
    border:var(--border-w-1) solid var(--border-color-strong);font-weight:500}
.btn-secondary:hover{background:var(--color-gray-50)}
/* Native file inputs: the "Choose file" button matches .btn-secondary */
.file-input{font-size:13px;color:var(--color-gray-500)}
.file-input::file-selector-button{display:inline-flex;align-items:center;border-radius:var(--radius-md);
    padding:9px 18px;font-size:13px;font-weight:500;cursor:pointer;text-decoration:none;
    background:var(--color-bg-surface);color:var(--color-gray-700);
    border:var(--border-w-1) solid var(--border-color-strong);margin-right:var(--space-sm)}
.file-input::file-selector-button:hover{background:var(--color-gray-50)}

/* ------------------------ File picker ------------------------------ */
/* The native control puts "No file chosen" after its button, and in a table
   cell there is no room for it — clipped to "N.", it told the uploader
   nothing. The input is visually hidden, a label carries the button, and the
   filename is rendered where it can actually be read. */
.file-pick{display:inline-flex;align-items:center;gap:8px;min-width:0}
.file-pick input[type=file]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;
    overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
/* Keyboard users must still see where focus is, since the input itself cannot show it. */
.file-pick input[type=file]:focus-visible + .file-pick__btn{outline:2px solid var(--color-primary-500);outline-offset:2px}
.file-pick__btn{cursor:pointer;white-space:nowrap}
.file-pick__name{font-size:11.5px;color:var(--color-gray-500);min-width:0;max-width:170px;
    overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.file-pick__name.is-set{color:var(--color-success-700);font-weight:500}

/* ---------------------- Quiet status (v2 concept 05) ----------------
   Operational status = dot + text. The coloured pill is reserved for the
   Bronze/Silver/Gold pathway, where colour IS the meaning. */
.status{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;font-weight:500;
    color:var(--color-gray-700);white-space:nowrap}
.status__dot{width:7px;height:7px;border-radius:50%;background:var(--color-gray-300);flex-shrink:0}
.status--ok .status__dot{background:var(--color-success-500)}
.status--warn .status__dot{background:var(--color-warning-500)}
.status--error .status__dot{background:var(--color-error-500)}
.status--info .status__dot{background:var(--color-info-500)}
.status--muted{color:var(--color-gray-400)}
/* Monospace identity refs (ELP-0114) — v2 sets these in Plex Mono, quiet. */
.ref-mono{font-family:var(--font-mono);font-size:11px;color:var(--color-gray-400)}

/* ------------------------- Flash alerts ------------------------------
   The message a page shows after it did something — "3 FCMs imported",
   "That number already belongs to someone". Thirty templates have asked for
   .alert since long before this rule existed; until now none of them got
   anything, so every flash rendered as unstyled body text.

   Built on the same formula as .login-alert, which is the one alert this
   application already had: the 50 tint as ground, the 200 step as border,
   the 700 step as text. That triplet is what makes a semantic colour legible
   at small sizes, and reusing it means the message after sign-in and the
   message after an import are recognisably the same object.

   Quiet by intent, in keeping with the states doctrine: a tinted strip that
   reads as information, not a saturated banner competing with the page. */
.alert{border-radius:var(--radius-md);border:1px solid transparent;
    padding:10px 14px;font-size:12.5px;line-height:1.55;
    margin-bottom:var(--space-lg)}
/* Anything the alert wraps — a count, a name — stays in the alert's own colour. */
.alert b,.alert strong{font-weight:600}
.alert a{color:inherit;text-decoration:underline}

.alert--success,.alert--ok{background:var(--color-success-50);
    border-color:var(--color-success-200);color:var(--color-success-700)}
.alert--error{background:var(--color-error-50);
    border-color:var(--color-error-200);color:var(--color-error-700)}
.alert--warning,.alert--warn{background:var(--color-warning-50);
    border-color:var(--color-warning-200);color:var(--color-warning-700)}
.alert--info{background:var(--color-info-50);
    border-color:var(--color-info-200);color:var(--color-info-700)}

/* ---------------------- FCM portal: household cards ------------------
   An FCM reads this one-handed, outdoors, on a phone. Cards rather than a
   table because a row of seven columns is not readable at that width, and
   a whole card is a bigger tap target than a link inside a cell. */
.hh-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
    gap:var(--space-md)}
.hh-card{display:block;background:#fff;border:1px solid var(--color-gray-200);
    border-radius:var(--radius-lg);padding:var(--space-lg);text-decoration:none;
    color:inherit;min-height:112px}
.hh-card:hover{border-color:var(--color-primary-300);background:var(--color-primary-50)}
.hh-card__top{display:flex;align-items:center;justify-content:space-between;gap:8px;
    margin-bottom:6px}
.hh-card__ref{font-family:var(--font-mono);font-size:11.5px;color:var(--color-gray-500)}
.hh-card__name{font-size:15px;font-weight:600;color:var(--color-gray-900);line-height:1.3}
.hh-card__addr{font-size:12.5px;color:var(--color-gray-600);margin-top:2px}
.hh-card__meta{display:flex;gap:14px;flex-wrap:wrap;margin-top:10px;
    font-size:11.5px;color:var(--color-gray-500)}
@media (max-width:720px){
    /* One per row, and a taller target: this is used with a thumb. */
    .hh-cards{grid-template-columns:minmax(0,1fr)}
    .fcm-portal .btn{min-height:46px}
    .fcm-portal .input{min-height:44px}
}

/* ------------------ Photographing a birth certificate ----------------
   The input is hidden behind its label so the control looks like every
   other button here. It is hidden with clip rather than display:none —
   a display:none file input cannot be opened from its label on some
   mobile browsers, which is the whole interaction. */
.cert-capture{display:flex;flex-wrap:wrap;gap:10px 12px;align-items:center}
.cert-form{display:inline-flex;align-items:center;gap:8px;margin:0}
.cert-form input[type=file]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;
    overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cert-form label{cursor:pointer;white-space:nowrap}
/* Keyboard users must still see where focus is, since the input cannot show it. */
.cert-form input[type=file]:focus-visible + label{outline:2px solid var(--color-primary-500);
    outline-offset:2px}
/* The submit is a no-JS fallback: with the script running, choosing a photo
   submits on its own and this never needs pressing. */
.cert-form .cert-go[disabled]{display:none}
.cert-chosen{flex-basis:100%}
@media (max-width:720px){
    /* A thumb, outdoors. Full width and a real target height. */
    .cert-capture{flex-direction:column;align-items:stretch}
    .cert-form{width:100%}
    .cert-form label{width:100%;justify-content:center;min-height:48px;font-size:15px}
}

/* ------------------------- Age band and funding ----------------------
   The band is a fact about the child, so it reads as text with its meaning
   underneath — not as a coloured pill, which this design system reserves
   for the Bronze/Silver/Gold pathway where colour carries the meaning. */
.age-band{display:block;font-size:13px;font-weight:600;color:var(--color-gray-900);
    font-variant-numeric:tabular-nums}
.age-band__note{display:block;font-size:11px;color:var(--color-gray-500);margin-top:1px}

/* Funding is a decision somebody makes, so it looks pressable rather than
   like a value being reported back. */
.funded-toggle{display:inline-flex;align-items:center;gap:7px;cursor:pointer;
    background:none;border:1px solid var(--color-gray-300);border-radius:var(--radius-md);
    padding:5px 10px;font:inherit;font-size:12px;color:var(--color-gray-600)}
.funded-toggle:hover{border-color:var(--color-gray-400);background:var(--color-gray-50)}
.funded-toggle__box{width:15px;height:15px;border-radius:4px;flex-shrink:0;
    border:1px solid var(--color-gray-400);background:#fff;
    display:inline-flex;align-items:center;justify-content:center;
    font-size:11px;line-height:1;color:#fff}
.funded-toggle.is-on{color:var(--color-success-700);border-color:var(--color-success-200);
    background:var(--color-success-50)}
.funded-toggle.is-on .funded-toggle__box{background:var(--color-success-600);
    border-color:var(--color-success-600)}
@media (max-width:720px){
    .funded-toggle{min-height:40px;width:100%;justify-content:flex-start}
}

/* ------------------- Managing one FCM (expanded row) -----------------
   Fields and actions are separated deliberately. In one flex line the
   bare-button forms stretch to the height of the labelled fields and their
   buttons ride at the top of that box — which is what left "Send a reset
   PIN" hanging above everything beside it. */
.fcm-manage{display:flex;flex-direction:column;gap:var(--space-lg);padding:var(--space-lg) 0}
.fcm-manage__fields{display:flex;flex-wrap:wrap;gap:var(--space-lg)}
.fcm-manage__fields>form{margin:0;min-width:240px}
/* Input and its button share a baseline because they share a row. */
.fcm-manage__control{display:flex;gap:8px;align-items:center}
.fcm-manage__control .input{flex:1;min-width:0}
.fcm-manage__control .btn{flex-shrink:0}
/* The actions sit on their own line, centred on each other, above a hairline
   so it reads as "and here is what you can do". */
.fcm-manage__actions{display:flex;flex-wrap:wrap;gap:10px 12px;align-items:center;
    padding-top:var(--space-md);border-top:1px solid var(--color-gray-200)}
.fcm-manage__actions>form{margin:0}
.fcm-manage__note{font-size:12px;flex:1;min-width:180px}
@media (max-width:720px){
    /* On a phone every control is full width and stacks; a half-width button
       beside a half-width input is unusable at that size. */
    .fcm-manage__fields>form{width:100%;min-width:0}
    .fcm-manage__control{flex-direction:column;align-items:stretch}
    .fcm-manage__control .btn{width:100%;justify-content:center;min-height:44px}
    .fcm-manage__actions{flex-direction:column;align-items:stretch}
    .fcm-manage__actions .btn{width:100%;justify-content:center;min-height:44px}
}

/* --------------------------- Empty state ---------------------------- */
.empty-state{border:1px dashed var(--color-gray-300);border-radius:var(--radius-lg);
    padding:var(--space-2xl);text-align:center}
.empty-state__well{width:44px;height:44px;border-radius:50%;background:var(--color-primary-50);
    color:var(--color-primary-500);display:inline-flex;align-items:center;justify-content:center;margin-bottom:var(--space-md)}
.empty-state__title{font-size:14px;font-weight:600;color:var(--color-gray-800)}
.empty-state__sub{font-size:12px;color:var(--color-gray-500);margin-top:4px}

/* Module card (executive dashboard) */
.module-card{display:block;border:var(--border-1);border-radius:var(--radius-xl);
    background:var(--color-bg-surface);padding:var(--space-lg);text-decoration:none}
.module-card:hover{border-color:var(--color-primary-300)}
.module-card__top{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-md);margin-bottom:var(--space-md)}
.module-card__name{font-size:15px;font-weight:600;color:var(--color-gray-900)}
.module-card__type{font-size:11.5px;color:var(--color-gray-500);margin-top:2px}
.module-card__meta{display:flex;gap:var(--space-lg);font-size:11.5px;color:var(--color-gray-500);margin-top:var(--space-md)}
.module-card__meta b{color:var(--color-gray-800)}

.muted{color:var(--color-gray-400)}

/* ----------------------- Executive dashboard ------------------------ */
.exec-header{display:flex;justify-content:space-between;align-items:flex-start;gap:var(--space-lg);
    margin-bottom:var(--space-xl)}
.toolbar{display:flex;gap:var(--space-sm);align-items:center;flex-wrap:wrap}
.pill-select{display:inline-flex;align-items:center;gap:8px;border:var(--border-1);border-radius:var(--radius-md);
    padding:8px 14px;font-size:12.5px;background:var(--color-bg-surface);color:var(--color-gray-700)}

.grid-6{display:grid;grid-template-columns:repeat(6,1fr);gap:var(--space-md)}
.kpi6{border:var(--border-1);border-radius:var(--radius-md);background:var(--color-bg-surface);
    padding:var(--space-md);display:flex;gap:10px;align-items:flex-start}
/* Tiles are anchors; only the ones carrying an href read as clickable. */
.kpi6{color:inherit;text-decoration:none}
.kpi6--link{cursor:pointer;transition:box-shadow .15s ease,border-color .15s ease,transform .15s ease}
.kpi6--link:hover{border-color:var(--color-primary-300);transform:translateY(-1px)}
.kpi6--link:focus-visible{outline:2px solid var(--color-primary-500);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.kpi6--link{transition:none}.kpi6--link:hover{transform:none}}
.kpi6__well{width:38px;height:38px;border-radius:var(--radius-md);flex-shrink:0;
    display:flex;align-items:center;justify-content:center}
.kpi6__well.tone-primary{background:var(--color-primary-100);color:var(--color-primary-600)}
.kpi6__well.tone-success{background:var(--color-success-100);color:var(--color-success-600)}
.kpi6__well.tone-info{background:var(--color-info-100);color:var(--color-info-600)}
.kpi6__well.tone-warning{background:var(--color-warning-100);color:var(--color-warning-600)}
.kpi6__well.tone-gray{background:var(--color-gray-100);color:var(--color-gray-500)}
.kpi6__label{font-size:11px;color:var(--color-gray-500);line-height:1.3}
.kpi6__value{font-size:21px;font-weight:600;color:var(--color-gray-900);margin:1px 0;font-variant-numeric:tabular-nums}
.kpi6__sub{font-size:10px;color:var(--color-gray-400);line-height:1.3}

/* v2 flat KPI tile: 3px tone accent replaces the icon well. */
.kpi6--flat{position:relative;padding:11px 13px 11px 16px;display:block}
.kpi6__accent{position:absolute;left:0;top:9px;bottom:9px;width:3px;border-radius:0 3px 3px 0;
    background:var(--color-gray-300)}
.kpi6__accent.tone-primary{background:var(--color-primary-500)}
.kpi6__accent.tone-success{background:var(--color-success-500)}
.kpi6__accent.tone-info{background:var(--color-info-500)}
.kpi6__accent.tone-warning{background:var(--color-warning-500)}
.kpi6__accent.tone-gray{background:var(--color-gray-400)}
.kpi6__accent.tone-bronze{background:var(--color-bronze-500)}
.kpi6__accent.tone-silver{background:var(--color-silver-500)}
.kpi6__accent.tone-gold{background:var(--color-gold-500)}
@media (max-width:1024px){.dash-split{grid-template-columns:1fr !important}}

/* Donut */
.donut-wrap{position:relative;width:150px;height:150px;margin:0 auto var(--space-md)}
.donut{width:150px;height:150px;transform:rotate(-90deg)}
.donut-center{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center}
.donut-center__big{font-size:19px;font-weight:600;color:var(--color-gray-900);font-variant-numeric:tabular-nums}
.donut-center__sub{font-size:10px;color:var(--color-gray-500)}
.legend{display:flex;flex-direction:column;gap:6px}
.legend-row{display:flex;justify-content:space-between;align-items:center;font-size:12px;color:var(--color-gray-600)}
.legend-row .dot,.gantt-legend .dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:6px}

/* Programme cards with ring */
.prog-card{display:block;border:var(--border-1);border-radius:var(--radius-xl);background:var(--color-bg-surface);
    overflow:hidden;text-decoration:none}
.prog-card:hover{border-color:var(--color-primary-300)}
.prog-card__head{display:flex;align-items:center;gap:10px;padding:12px var(--space-lg);
    background:linear-gradient(135deg,var(--color-primary-600),var(--color-primary-800))}
.prog-card__icon{width:30px;height:30px;border-radius:var(--radius-sm);background:rgba(255,255,255,.18);
    display:flex;align-items:center;justify-content:center}
.prog-card__name{color:#fff;font-weight:600;font-size:13.5px}
.prog-card__body{display:flex;justify-content:space-between;align-items:center;padding:var(--space-lg)}
.prog-card__stat{font-size:12.5px;color:var(--color-gray-600);margin-bottom:6px}
.prog-card__stat b{color:var(--color-gray-900);font-size:15px;font-weight:700;margin-right:4px}
.prog-ring{position:relative;width:60px;height:60px}
.prog-ring svg{width:60px;height:60px}
.prog-ring__label{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
    font-size:9px;font-weight:600;text-align:center;line-height:1.1}

/* --------------------- Implementation timeline ----------------------
   Horizontal stepper recreated from the Design System stepper spec:
   28px numbered nodes joined by a connector line, name + metric beneath. */
.impl-timeline{display:flex;align-items:flex-start;gap:0;margin-top:var(--space-md);overflow-x:auto}
.impl-step{flex:1;min-width:120px;text-align:center;position:relative;padding:0 6px}
.impl-step:not(:last-child)::after{content:"";position:absolute;top:14px;left:50%;width:100%;
    height:2px;background:var(--color-gray-200);z-index:0}
.impl-step__node{position:relative;z-index:1;width:28px;height:28px;border-radius:50%;margin:0 auto 8px;
    display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;
    background:var(--color-primary-100);color:var(--color-primary-700);border:2px solid var(--color-primary-200)}
.impl-step__name{font-size:11.5px;font-weight:500;color:var(--color-gray-700);line-height:1.3;min-height:30px}
.impl-step__pct{font-size:15px;font-weight:700;color:var(--color-gray-900);margin-top:4px}
.impl-step__weight{font-size:10.5px;margin-top:2px}

/* ------------------------------ Gantt -------------------------------
   Recreated from the Design System Gantt spec: bordered container, quarter
   grid overlay (gray-100 column rules), state-coloured bars
   (success-500 completed / info-500 in-progress / primary-400 upcoming). */
.gantt-head{display:grid;margin-left:220px;font-size:10.5px;color:var(--color-gray-500);
    padding:0 0 6px;text-align:left}
.gantt{position:relative;border:var(--border-1);border-radius:var(--radius-md);overflow:hidden;
    padding:var(--space-md) 0;background:var(--color-bg-surface)}
.gantt-grid{position:absolute;top:0;bottom:0;left:220px;right:0;display:grid;pointer-events:none}
.gantt-grid > div{border-right:1px solid var(--color-gray-100)}
.gantt-grid > div:last-child{border-right:none}
.gantt-row{display:flex;align-items:center;height:26px;position:relative}
.gantt-row__label{width:220px;flex-shrink:0;font-size:11px;color:var(--color-gray-600);
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:right;padding:0 12px;box-sizing:border-box}
.gantt-row__track{position:relative;flex:1;height:22px}
.gantt-bar{position:absolute;top:0;height:22px;border-radius:var(--radius-xs);
    display:flex;align-items:center;justify-content:center;color:#fff;font-size:10.5px;font-weight:500}
.gantt-bar.gantt--done{background:var(--color-success-500)}
.gantt-bar.gantt--active{background:var(--color-info-500)}
.gantt-bar.gantt--upcoming{background:var(--color-primary-400)}
.gantt-legend{display:flex;gap:var(--space-xl);font-size:11.5px;color:var(--color-gray-600);
    margin-top:var(--space-md)}
.gantt-legend .dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:6px}

/* ------------------------- Login page ------------------------------- */
.login-page{min-height:100vh;display:flex;align-items:center;justify-content:center;position:relative;
    background:linear-gradient(160deg,var(--color-navy-900),var(--color-primary-800));padding:var(--space-lg)}
.login-card{width:100%;max-width:380px;background:var(--color-bg-surface);border-radius:var(--radius-xl);
    box-shadow:var(--shadow-lg);padding:var(--space-2xl)}
.login-brand{display:flex;flex-direction:column;align-items:center;gap:8px;margin-bottom:var(--space-xl);text-align:center}
.login-brand__logo{width:190px;height:auto;display:block}
.login-brand__name{font-weight:700;font-size:16px;letter-spacing:.04em;color:var(--color-gray-900)}
.login-brand__sub{font-size:10px;color:var(--color-gray-500)}
.login-title{font-size:20px;font-weight:600;color:var(--color-gray-900);margin-bottom:var(--space-lg)}
.login-label{display:block;font-size:12px;font-weight:600;color:var(--color-gray-700);margin-bottom:6px}
.login-alert{border-radius:var(--radius-md);padding:10px 14px;font-size:12.5px;margin-bottom:var(--space-lg)}
.login-alert--error{background:var(--color-error-50);border:1px solid var(--color-error-200);color:var(--color-error-700)}
.login-alert--ok{background:var(--color-success-50);border:1px solid var(--color-success-200);color:var(--color-success-700)}
.login-footer{position:absolute;left:0;right:0;bottom:0;padding:var(--space-lg);text-align:center;
    color:var(--color-navy-300);font-size:11px;line-height:1.6}
.login-footer div:first-child{color:var(--color-navy-100)}

/* App footer (authenticated shell) */
.app-footer{margin-top:auto;padding:var(--space-lg) var(--space-xl);text-align:center;
    color:var(--color-gray-400);font-size:11px;line-height:1.6;border-top:var(--border-1)}
.app-footer div:first-child{color:var(--color-gray-500)}

/* Sidebar logout button */
.logout-btn{background:transparent;border:none;color:var(--color-navy-300);cursor:pointer;
    padding:6px;border-radius:var(--radius-sm);display:flex;align-items:center}
.logout-btn:hover{background:rgba(255,255,255,.08);color:#fff}

/* Period selector on the Programme Overview header (V12). */
.period-select {
  font-family: inherit;
  font-size: 13px;
  color: var(--color-gray-700);
  background: var(--color-white, #fff);
  border: var(--border-1);
  border-radius: var(--radius-md);
  padding: 8px 30px 8px 12px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.period-select:hover { border-color: var(--color-primary-400); }

/* Data-entry form controls (V12 data-management page). */
.cell-input {
  font-family: inherit;
  font-size: 13px;
  color: var(--color-gray-800);
  background: var(--color-white, #fff);
  border: var(--border-1);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  width: 120px;
}
.cell-input:focus { outline: none; border-color: var(--color-primary-400); box-shadow: 0 0 0 3px var(--color-primary-100); }
.form-label { display:block; font-size:11.5px; font-weight:600; color:var(--color-gray-600); margin-bottom:4px; text-transform:uppercase; letter-spacing:.03em; }

/* ----------------------- MRD Compliance module -----------------------
   Recreates the client-mockup visuals within DS tokens: circular pastel
   icon wells with medal tones for Bronze/Silver/Gold, and tier cards with
   the coloured banner + progress-ring pattern of the programme cards. */
.kpi6__well.is-round{border-radius:50%}
.kpi6__well.tone-bronze{background:var(--color-bronze-100);color:var(--color-bronze-600)}
.kpi6__well.tone-silver{background:var(--color-silver-100);color:var(--color-silver-600)}
.kpi6__well.tone-gold{background:var(--color-gold-100);color:var(--color-gold-600)}
.prog-card__head--bronze{background:linear-gradient(135deg,var(--color-bronze-500),var(--color-bronze-700))}
.prog-card__head--silver{background:linear-gradient(135deg,var(--color-silver-400),var(--color-silver-600))}
.prog-card__head--gold{background:linear-gradient(135deg,var(--color-gold-400),var(--color-gold-600))}
/* Tier tabs + inline tier words carry their metal colour */
.tab--bronze{color:var(--color-bronze-600)}
.tab--bronze:hover{color:var(--color-bronze-700)}
.tab--bronze.is-active{color:var(--color-bronze-600);border-bottom-color:var(--color-bronze-500)}
.tab--silver{color:var(--color-silver-600)}
.tab--silver:hover{color:var(--color-silver-700)}
.tab--silver.is-active{color:var(--color-silver-600);border-bottom-color:var(--color-silver-500)}
.tab--gold{color:var(--color-gold-600)}
.tab--gold:hover{color:var(--color-gold-700)}
.tab--gold.is-active{color:var(--color-gold-600);border-bottom-color:var(--color-gold-500)}
.tier-word--bronze{color:var(--color-bronze-600)}
.tier-word--silver{color:var(--color-silver-600)}
.tier-word--gold{color:var(--color-gold-600)}
/* ELP portal — Requirements cards colour-coded by pathway tier */
.req-tier{border-top:3px solid var(--color-gray-300)}
.req-tier--bronze{border-top-color:var(--color-bronze-500)}
.req-tier--silver{border-top-color:var(--color-silver-500)}
.req-tier--gold{border-top-color:var(--color-gold-500)}
.req-tier--bronze>.card__header{background:var(--color-bronze-100)}
.req-tier--silver>.card__header{background:var(--color-silver-100)}
.req-tier--gold>.card__header{background:var(--color-gold-100)}

/* Small-screen refinements on top of the sidebar drawer (Shell section):
   tighter content padding, and the Certificate Designer stacks to one column. */
@media (max-width: 1024px){
    .content{padding:var(--space-lg)}
    .settings-grid{grid-template-columns:1fr !important}
}
.mrd-req-list{max-height:250px;overflow-y:auto;padding:var(--space-md) var(--space-lg);
    border-top:var(--border-1)}

/* Steps that are not open yet. Muted rather than hidden: a practitioner should
   still see the path ahead and what opens the next rung, just not have it
   competing with the step they can actually act on today. */
.prog-card--locked{opacity:.55;filter:saturate(.6)}
.prog-card__lock{margin-left:auto;font-size:12px;line-height:1;opacity:.85}
.req-tier--locked{border-top-color:var(--color-gray-300)!important;background:var(--color-gray-50)}
.req-tier--locked>.card__header{background:var(--color-gray-100)!important}
.req-tier--locked>.card__header h3{color:var(--color-gray-500)!important}
.req-tier__lock{margin-right:6px;font-size:12px;line-height:1}

/* ---------------------- ELP portal (mobile-first) ------------------- */
.elp-body-grid{display:grid;grid-template-columns:2fr 1fr;gap:var(--space-xl);align-items:start}
/* Requirement guidance. The 420px was an inline style on each of these divs,
   which no stylesheet could override without !important; as a class the mobile
   query can free it. Desktop is unchanged. */
.req-guidance{max-width:420px}
/* The page stacks at the same width the sidebar becomes a drawer (1024px), so
   the two breakpoints agree. 721–1024px is landscape phone and small tablet: it
   used to keep the 2fr/1fr split, squeezing a five-column table into ~55% of an
   already narrow screen — the worst width on the page, and previously the only
   one with no rules at all. */
@media (max-width:1024px){
    html,body{overflow-x:hidden}
    /* Single column: tier cards and the requirements/contact split both stack.
       minmax(0,1fr) (not a bare 1fr) lets the track shrink below content width
       so nothing pushes past the viewport. */
    .elp-portal .grid-3{grid-template-columns:minmax(0,1fr);gap:var(--space-md)}
    .elp-body-grid{grid-template-columns:minmax(0,1fr);gap:var(--space-lg)}
    /* Every grid/flex child must be allowed to shrink below its content, or a
       wide table forces the whole column past the viewport. */
    .elp-portal .grid-3>*,.elp-body-grid>*,.elp-body-grid>*>*,
    .elp-portal .card--split,.elp-portal .card,.elp-portal .prog-card{min-width:0;max-width:100%}

    /* Mobile Safari zooms the viewport whenever a field under 16px takes focus,
       and never zooms back — on a page of 14 inputs that is every single tap.
       The Design System pins 13px but specifies no mobile behaviour anywhere,
       so 13px still stands on desktop and this fills a gap rather than
       overriding a rule. Padding is trimmed so the taller text does not push
       the control past the 46px tap target. */
    .input,.select,.textarea{font-size:16px;padding:11px 12px}

    /* File pickers were left out of the tap-target pass the buttons got. */
    .elp-portal .btn{min-height:46px}
    .elp-portal input[type=file]{min-height:46px}
}

@media (max-width:720px){
    .elp-portal{padding:var(--space-md)}
    .elp-portal .page-title{font-size:20px;line-height:1.2}
    .elp-portal .page-subtitle{font-size:12px}
    .elp-portal .table{width:100%;table-layout:fixed}
    /* Comfortable tap targets + roomier requirement rows. */
    .elp-portal .table td{word-break:break-word;padding-top:12px;padding-bottom:12px}
    /* Give long requirement names more room; the status badge needs little.
       Scoped to the two-column site-check tables — as a bare td:last-child this
       also hit the Documents and Good Practice tables, crushing their Upload
       cell (file input + button) into 96px. Uploading is the whole point of
       those rows. :nth-child(2) matches only where the last cell is the second,
       which is true of the site-check tables and of nothing else. */
    .elp-portal .table td:last-child:nth-child(2){width:96px!important}

    /* --- Documents & Good Practice: stop being tables ------------------
       Five columns of declared widths total ~555px before the name column
       gets anything, so on a 360px screen these can only ever overflow. The
       previous answer was to scroll them better, which was the wrong goal:
       nobody should drag a table sideways to reach the Upload button, and
       table-layout:fixed rations the description column into a thin ribbon
       that breaks mid-word. So below 720px each row becomes a stacked card,
       the header row is dropped, and each cell captions itself from its
       data-label. Nothing scrolls sideways, and the guidance gets the full
       width of the card. */
    .elp-portal .table--docs,
    .elp-portal .table--docs tbody,
    .elp-portal .table--docs tr,
    .elp-portal .table--docs td{display:block;width:auto!important}
    .elp-portal .table--docs{min-width:0!important;table-layout:auto}
    .elp-portal .table--docs thead{display:none}
    .elp-portal .table--docs tr{border:var(--border-1);border-radius:var(--radius-md);
        padding:var(--space-md);margin-bottom:var(--space-md);background:var(--color-bg-surface)}
    .elp-portal .table--docs tr:last-child{margin-bottom:0}
    .elp-portal .table--docs td{border:none;padding:0;margin-top:12px;word-break:normal;overflow-wrap:anywhere}
    .elp-portal .table--docs td:first-child{margin-top:0}
    .elp-portal .table--docs td[data-label]::before{content:attr(data-label);display:block;
        font-size:10px;text-transform:uppercase;letter-spacing:.04em;
        color:var(--color-gray-500);margin-bottom:5px}
    .elp-portal .table--docs .req-name{font-size:13.5px;font-weight:600;color:var(--color-gray-900)}
    /* The whole point: the description gets the card, not a column. */
    .elp-portal .table--docs .req-guidance{max-width:none;font-size:12px;line-height:1.5;margin-top:4px}
    /* Actions become full-width, legible and thumb-sized — the inline styles
       on these controls are 11px, which is a desktop density. */
    .elp-portal .table--docs .btn{min-height:46px;font-size:13px!important;padding:9px 16px!important}
    .elp-portal .table--docs .upload-form{flex-wrap:wrap;gap:8px}
    .elp-portal .table--docs .upload-form .file-input{max-width:none!important;width:100%;
        font-size:13px!important;min-height:46px}
    .elp-portal .table--docs .upload-form .btn{width:100%;justify-content:center}

    /* Header: identity on top, full-width actions stacked below. */
    .elp-header{flex-wrap:wrap;gap:var(--space-md)}
    .elp-actions{width:100%;flex-wrap:wrap;gap:var(--space-sm)}
    .elp-actions>*{width:100%;margin:0}
    .elp-actions .btn{width:100%;justify-content:center;min-height:46px}
    .elp-actions form{display:flex;align-items:center;gap:8px}
    .elp-actions .period-select{flex:1;width:100%}
    /* The topbar search overflows and isn't useful on a phone. */
    .topbar .search{display:none}
    /* The scroll-edge fade that used to live here is gone: the document tables
       now stack instead of scrolling, and the site-check tables are two columns
       and fit. A fade with nothing behind it just reads as a smudge. */
}

/* ---------------------- FCM household module (mobile-friendly) -------
   FCMs work in the field on phones: Households -> profile -> Record a
   visit must all be one-thumb usable. The shell (drawer sidebar, 16px
   inputs) is already responsive; these rules make the module's grids
   and forms stack instead of squeezing. */
.fgrid{display:grid;gap:12px}
.fgrid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.fgrid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.fgrid-6{grid-template-columns:repeat(6,minmax(0,1fr))}
.fform{display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap}
@media (max-width:1024px){
    .fgrid-3{grid-template-columns:repeat(2,minmax(0,1fr))}
    .fgrid-6{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (max-width:720px){
    .fcm-page,.elp-profile{padding:var(--space-md)}
    .fcm-page .page-title,.elp-profile .page-title{font-size:20px;line-height:1.2}
    .fcm-page .page-subtitle,.elp-profile .page-subtitle{font-size:12px}
    /* Every question gets the full width of the screen. */
    .fgrid-3,.fgrid-2{grid-template-columns:minmax(0,1fr)}
    .fgrid-6{grid-template-columns:repeat(2,minmax(0,1fr))}
    /* Add-forms stack: label above field, field edge to edge, thumb-sized
       submit. The !important frees fields from their inline desktop widths. */
    .fform{flex-direction:column;align-items:stretch}
    .fform>div{width:100%}
    .fform input,.fform select{width:100%!important;min-width:0!important;max-width:none!important}
    .fform .btn{width:100%;justify-content:center;min-height:46px}
    .fform>label{padding-bottom:0!important}
    /* Buttons and table rows sized for touch. */
    .fcm-page .btn,.elp-profile .btn{min-height:44px}
    .fcm-page .btn--sm,.elp-profile .btn--sm{min-height:38px}
    .fcm-page .table td,.fcm-page .table th{padding-top:11px;padding-bottom:11px}
    .elp-profile .table td,.elp-profile .table th{padding-top:11px;padding-bottom:11px}
    /* Wide tables scroll inside table-scroll; the selects inside the visit
       form's participation table stay usable rather than crushed. */
    .fcm-page .table select.input{min-width:150px}
    .fcm-page .page-header,.elp-profile .page-header{flex-wrap:wrap;gap:var(--space-md)}
    .fcm-page .card__header{flex-wrap:wrap;gap:8px}
}

/* ---------------------- Programme pages on mobile --------------------
   The programme overview had no mobile rules at all: six KPI cards
   abreast, three-column sections and a non-wrapping header row. These
   step down by width; desktop is untouched. Global on purpose — every
   page built from grid-6/grid-3/grid-2 benefits identically. */
@media (max-width:1024px){
    .grid-6{grid-template-columns:repeat(3,minmax(0,1fr))}
    .grid-3{grid-template-columns:minmax(0,1fr)}
    .grid-2{grid-template-columns:minmax(0,1fr)}
    .grid-6>*,.grid-3>*,.grid-2>*{min-width:0;max-width:100%}
}
@media (max-width:720px){
    .grid-6{grid-template-columns:repeat(2,minmax(0,1fr))}
    /* Header stacks: identity first, then period selector + actions, each
       allowed to wrap instead of pushing off-screen. */
    .page-header{flex-wrap:wrap;gap:var(--space-md)}
    .page-header>div{flex-wrap:wrap;min-width:0;max-width:100%}
    .page-header .btn{min-height:44px}
    .breadcrumbs{white-space:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;
        scrollbar-width:none}
    .breadcrumbs::-webkit-scrollbar{display:none}

    /* table--stack: each row becomes a card, cells caption themselves from
       data-label (same doctrine as the ELP portal's table--docs). */
    .table--stack,.table--stack tbody,.table--stack tr,.table--stack td{display:block;width:auto!important}
    .table--stack{min-width:0!important;table-layout:auto}
    .table--stack thead{display:none}
    .table--stack tr{border:var(--border-1);border-radius:var(--radius-md);
        padding:var(--space-md);margin-bottom:var(--space-md);background:var(--color-bg-surface)}
    .table--stack tr:last-child{margin-bottom:0}
    .table--stack td{border:none;padding:4px 0;text-align:left!important;word-break:break-word}
    .table--stack td[data-label]::before{content:attr(data-label);display:block;
        font-size:10px;text-transform:uppercase;letter-spacing:.04em;
        color:var(--color-gray-500);margin-bottom:2px}
    .table--stack td:first-child[data-label]::before{display:none}
    .table--stack td:first-child{font-size:15px;padding-bottom:2px}
    .table--stack .stack-title{font-weight:600;color:var(--color-gray-900)}
}

/* Programme page below 720px, continued: card headers wrap (the
   Registrations roll-up pins a link right of its title), the tab strip
   scrolls instead of wrapping into three ragged lines, and a stacked
   row's Open button becomes a proper touch target. */
@media (max-width:720px){
    .card__header{flex-wrap:wrap;gap:8px}
    .tabs{overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch;scrollbar-width:none}
    .tabs::-webkit-scrollbar{display:none}
    .tabs .tab{white-space:nowrap}
    .table--stack .btn{min-height:44px;width:100%;justify-content:center;margin-top:6px}
}

/* ELP profile below 720px, continued: the certificate / back / deactivate
   action row wraps into full-width thumb targets instead of pushing past
   the screen edge; upload forms and file pickers get the full card width;
   status selects inside tables stay usable. */
@media (max-width:720px){
    .elp-profile .page-header>div{flex-wrap:wrap;min-width:0;max-width:100%}
    .elp-profile .page-header>div:last-child{width:100%}
    .elp-profile .page-header>div:last-child .btn{width:100%;justify-content:center}
    .elp-profile .page-header>div:last-child form{width:100%;margin:0}
    .elp-profile .card__header{flex-wrap:wrap;gap:8px}
    /* flex-wrap is additive: none of these forms set it inline. */
    .elp-profile form{flex-wrap:wrap}
    .elp-profile input[type=file],.elp-profile .file-pick{max-width:100%}
    .elp-profile .file-pick__btn{min-height:44px}
    .elp-profile .table select.input{min-width:150px}
    .elp-profile .table--stack .file-pick{width:100%}
    .elp-profile .table--stack .file-pick__btn{width:100%;justify-content:center}
}

/* A cell spanning columns must never CREATE columns: on a phone the grid
   is one column, and an inline `span 2` would force an implicit second
   column that crushes the real one to a sliver (the overlapping-labels
   bug). Full-width is what such a cell means; make that literal. */
@media (max-width:720px){
    .fgrid>[style*="grid-column"]{grid-column:1/-1!important}
}

/* ==========================================================================
   Continuous Monitoring (V75)

   A 53-question inspection filled in standing up, on a phone, inside
   someone's centre. Two things follow from that and drive everything here:
   answers are TAPPED, never selected from a dropdown, and only one section
   is open at a time so the thumb never travels past the question it is on.
   ========================================================================== */
.mon-section{margin-bottom:var(--space-lg)}
.mon-section__head{display:flex;align-items:center;justify-content:space-between;gap:var(--space-md);
    width:100%;background:var(--color-bg-surface);border:1px solid var(--color-gray-200);
    border-radius:var(--radius-md);padding:var(--space-md) var(--space-lg);cursor:pointer;
    font-family:var(--font-heading);font-size:14px;font-weight:600;text-align:left;
    color:var(--color-text-primary)}
.mon-section__head:hover{border-color:var(--color-primary-300)}
.mon-section__count{font-family:var(--font-body);font-size:11.5px;font-weight:500;
    color:var(--color-text-secondary);white-space:nowrap}
.mon-section__count[data-done="1"]{color:var(--color-success-600)}
.mon-section__body{border:1px solid var(--color-gray-200);border-top:0;
    border-radius:0 0 var(--radius-md) var(--radius-md);background:var(--color-bg-surface);
    padding:var(--space-md) var(--space-lg)}
.mon-section[data-open="0"] .mon-section__body{display:none}
.mon-section[data-open="1"] .mon-section__head{border-radius:var(--radius-md) var(--radius-md) 0 0}

.mon-q{padding:var(--space-md) 0;border-bottom:1px solid var(--color-gray-100)}
.mon-q:last-child{border-bottom:0}
.mon-q__label{font-size:13px;line-height:1.45;color:var(--color-text-primary);margin-bottom:6px}
.mon-q__detail{margin:0 0 8px 18px;padding:0;font-size:12px;line-height:1.5;
    color:var(--color-text-secondary)}

/* The tri-state. Radios rather than a select: three visible targets beat a
   dropdown that hides two of them behind a tap. */
.mon-choice{display:flex;gap:6px;flex-wrap:wrap}
.mon-choice input{position:absolute;opacity:0;pointer-events:none}
.mon-choice label{flex:1 1 0;min-width:76px;min-height:44px;display:flex;align-items:center;
    justify-content:center;border:1px solid var(--color-gray-300);border-radius:var(--radius-sm);
    font-size:13px;font-weight:600;color:var(--color-text-secondary);cursor:pointer;
    background:var(--color-bg-surface);user-select:none}
.mon-choice input:checked+label[data-a="YES"]{background:var(--color-success-50);
    border-color:var(--color-success-500);color:var(--color-success-700)}
.mon-choice input:checked+label[data-a="NO"]{background:var(--color-error-50);
    border-color:var(--color-error-500);color:var(--color-error-700)}
.mon-choice input:checked+label[data-a="NA"]{background:var(--color-gray-100);
    border-color:var(--color-gray-400);color:var(--color-gray-700)}
.mon-choice input:focus-visible+label{outline:2px solid var(--color-primary-500);outline-offset:2px}

/* ELRU's own instruction: comment wherever you answer No or N/A — so those
   open the box themselves. Any answer may still carry one on request, which
   is what data-comment-open holds. */
.mon-q__comment{margin-top:8px;display:none}
.mon-q[data-needs-comment="1"] .mon-q__comment,
.mon-q[data-comment-open="1"] .mon-q__comment{display:block}

/* The offer to comment, and nothing more: a full button here would compete
   with Yes/No/N/A, which are the answer. Hidden once the box is open on the
   answer's account — there is then nothing left to offer. */
.mon-q__add{margin-top:8px;background:none;border:0;padding:0;cursor:pointer;
    font-size:12px;font-weight:500;color:var(--color-primary-600)}
.mon-q__add:hover{text-decoration:underline}
.mon-q[data-needs-comment="1"] .mon-q__add,
.mon-q[data-comment-open="1"] .mon-q__add{display:none}

/* The signature pad. Fixed drawing surface, scaled for the device's pixel
   ratio in JS — a canvas sized by CSS alone draws a blurred line. */
.mon-sign{border:1px dashed var(--color-gray-300);border-radius:var(--radius-md);
    background:var(--color-bg-surface);touch-action:none;width:100%;height:180px;display:block}
.mon-sign--signed{border-style:solid;border-color:var(--color-success-500)}
.mon-signature-img{max-width:320px;width:100%;border:1px solid var(--color-gray-200);
    border-radius:var(--radius-sm);background:#fff}

.mon-answer{display:inline-flex;align-items:center;justify-content:center;min-width:44px;
    padding:2px 8px;border-radius:var(--radius-full);font-size:11.5px;font-weight:600}
.mon-answer--YES{background:var(--color-success-100);color:var(--color-success-700)}
.mon-answer--NO{background:var(--color-error-100);color:var(--color-error-700)}
.mon-answer--NA{background:var(--color-gray-100);color:var(--color-gray-700)}

@media (max-width:720px){
    .mon-section__head{padding:var(--space-md)}
    .mon-section__body{padding:var(--space-sm) var(--space-md)}
    .mon-choice label{min-width:0}
}

/* The idle-session warning. A native <dialog> rather than a new component:
   the browser gives the modal behaviour, the focus trap and Escape for
   nothing, and the design system has no dialog of its own to follow. */
.session-dialog{border:0;padding:var(--space-xl);max-width:420px;width:calc(100% - 32px);
    border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);
    background:var(--color-bg-surface);color:var(--color-gray-800)}
.session-dialog::backdrop{background:rgba(16,24,40,.45)}
.session-dialog h2{font-size:17px;font-weight:600;margin:0 0 var(--space-sm);
    color:var(--color-gray-900)}
.session-dialog p{font-size:13.5px;line-height:1.5;margin:0 0 var(--space-sm)}
.session-dialog p.muted{font-size:12.5px}
.session-dialog__actions{display:flex;gap:var(--space-sm);margin-top:var(--space-lg)}


/* ---------------------------------------------------------------
   A row arrived at from a link — the rejection notice mails one per
   document. Landing on the right page is not the same as finding the
   right row, so the target says which one it is for a few seconds.
   --------------------------------------------------------------- */
tr:target > td,
tr.is-landed > td {
    background: var(--color-warning-50, #fffbeb);
    box-shadow: inset 0 0 0 9999px rgba(245, 158, 11, 0.07);
    animation: row-landed 2.4s ease-out 1;
}

@keyframes row-landed {
    0%   { background: var(--color-warning-100, #fef3c7); }
    100% { background: var(--color-warning-50, #fffbeb); }
}

@media (prefers-reduced-motion: reduce) {
    tr:target > td, tr.is-landed > td { animation: none; }
}
