:root {
    /* Force light rendering of native controls (select popups, date pickers, scrollbars)
       so they stay readable even when the OS/browser is in dark mode. */
    color-scheme: light;
    --color-brand: #1a7b93;
    --color-brand-light: #e9f6fb;
    --color-brand-dark: #023047;
    /* Brand tone for *text* sitting on --color-overlay. The plain brand is tuned
       for white: on the tinted table header it falls to 4.04:1, under the 4.5
       minimum for 12px text. This darkened step measures 5.65:1 there and stays
       recognisably brand rather than collapsing into body ink. */
    --color-brand-on-overlay: #156376;
    --color-brand-hover: #12657b;
    --color-sidebar: #ffffff;
    --color-sidebar-hover: #bed8e4;
    --color-sidebar-active: #e9f6fb;
    --color-sidebar-text: #2f576a;
    --color-sidebar-text-active: #023047;
    --color-sidebar-accent: #1a7b93;
    --color-sidebar-border: #cbe1ec;
    /* The page is white, the same as the card and the sidebar's content area.
       It used to be a 97% tint, which separated page from card by lightness at
       1.07:1 - fainter than the 1.11:1 another system in this codebase family
       rejected as "a fill nobody can see". Separation is now carried by
       --color-border and the shadow, which is why both were strengthened. */
    --color-canvas: #ffffff;
    --color-surface: #ffffff;
    /* RECESSED tint: table headers, row hovers, inset panels. On a white card
       this is the only banding available, so it is deepened from 1.09:1
       (invisible) to 1.20:1. */
    --color-overlay: #deecf2;
    /* --color-success / --color-warning stay at their vivid values because they
       are fills (bars, dots, accent strips) where nothing sits on top. As TEXT
       on white they measure 2.94:1 and 2.13:1, so text uses the -text variants. */
    --color-success: #12784a;
    --color-success-text: #0e5f3a;
    --color-success-light: #e6f5ed;
    --color-success-border: hsl(142,40%,72%);
    --color-danger: #b02a21;
    --color-danger-light: #fdecea;
    --color-warning: #8a6300;
    /* 32% clears 4.5:1 on white but only 4.41:1 on --color-warning-light, which
       is exactly where warning text is usually placed. 30% clears both:
       5.41:1 on white, 4.93:1 on the tint. */
    --color-warning-text: #6d4e00;
    --color-warning-light: #fdf4e0;
    --color-text-primary: #023047;
    /* 44% cleared 4.5:1 on white but only 4.31:1 once --color-overlay was
       deepened for banding, and this colour labels table headers that sit ON
       that band. 42% clears both: 5.57:1 on white, 4.64:1 on the band. */
    --color-text-secondary: #2f576a;
    /* Was hsl(215,8%,62%) = 2.74:1 on white - under the 4.5:1 body-text minimum,
       and it carries real content in 154 .text-muted usages. Now 4.79:1. */
    --color-text-muted: #4a6978;
    /* Card and table boundaries. With the page white this is the only thing
       saying where a card ends, so it is no longer decoration: 1.40 -> 1.56:1. */
    --color-border: #cbe1ec;
    /* FORM CONTROL boundaries. WCAG 1.4.11 wants 3:1 for the edge of an input;
       the old value managed 2.05:1 and a tinted page merely hid the problem.
       On a white page an input with an invisible border is simply not there. */
    --color-border-strong: #7299ac;
    --shadow-xs: 0 1px 2px rgba(2,32,48,.04);
    --shadow-sm: 0 1px 2px rgba(2,32,48,.05),0 1px 3px rgba(2,32,48,.04);
    --shadow: 0 1px 2px rgba(2,32,48,.05),0 6px 18px rgba(2,32,48,.06);
    --shadow-md: 0 2px 4px rgba(2,32,48,.05),0 12px 30px rgba(2,32,48,.09);
    --shadow-lg: 0 4px 8px rgba(2,32,48,.06),0 24px 52px rgba(2,32,48,.12);
    --radius-xs: 6px; --radius-sm: 9px; --radius-md: 13px;
    --radius-lg: 18px; --radius-xl: 18px; --radius-full: 9999px;
    --transition-fast: 100ms ease;
    --transition-base: 180ms ease;
    --transition-slow: 320ms ease;
    --text-xs: 11px; --text-sm: 13px; --text-base: 15px; --text-md: 17px;
    --text-lg: 20px; --text-xl: 24px; --text-2xl: 30px; --text-3xl: 40px;
    --sidebar-width: 244px; --navbar-height: 56px;

    /* ===== CARD SURFACE =====
       One contract for every card in the system. Before this, a card's
       appearance depended on which page it was on: four radii (8, 10, 13 and
       18px), three border colours, shadows ranging from none to a 24px blur,
       and on the dashboard a tinted surface per metric. The result read as
       several products stacked on top of each other.

       The rules: a card is a white surface, a one-pixel neutral border, one
       radius and the lightest shadow that still separates it from the page.
       Colour belongs to content inside the card -- an icon, a status dot, a
       delta -- never to the card itself, so that when something IS coloured it
       means something. */
    --card-bg: var(--color-surface);
    --card-border: var(--color-border);
    --card-radius: 13px;
    --card-shadow: var(--shadow-xs);
    /* Hover is a slightly deeper version of the same shadow, not a jump to a
       different elevation, and nothing moves: cards that lifted on hover made
       a grid of them twitch as the pointer crossed it. */
    --card-shadow-hover: 0 1px 2px rgba(2,32,48,.05), 0 6px 16px rgba(2,32,48,.07);
    --card-pad: 18px 20px;
    --card-pad-tight: 14px 16px;
}
*,*::before,*::after{box-sizing:border-box}
body{font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;font-size:var(--text-base);color:var(--color-text-primary);background:var(--color-canvas);margin:0;padding:0;line-height:1.55;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
button,a,[role="button"],.btn,.form-control,.form-select{transition:color var(--transition-base),background-color var(--transition-base),border-color var(--transition-base),box-shadow var(--transition-base),transform var(--transition-base),opacity var(--transition-base)}

/* LAYOUT */
.app-layout{display:flex;min-height:100vh}
/* min-width:0 is required, not cosmetic: the sidebar is position:fixed and therefore
   leaves the flex flow, so .main-wrapper is the only flex item. Without this it keeps
   its automatic minimum size (min-width:auto = intrinsic content width) and refuses to
   shrink to the 260px-narrower track, pushing every page ~279px past the right edge. */
.main-wrapper{flex:1;min-width:0;margin-left:var(--sidebar-width);display:flex;flex-direction:column;min-height:100vh}
/* Top padding trimmed from 24px: with the navbar above it and the page's own
   heading below, the old value put roughly 50px of nothing between the two. */
.main-content{flex:1;padding:16px 24px 24px}
.messages-container{margin-bottom:16px}

/* SIDEBAR */
.sidebar{position:fixed;top:0;left:0;bottom:0;width:var(--sidebar-width);background:var(--color-sidebar);border-right:1px solid var(--color-border);display:flex;flex-direction:column;z-index:1040;overflow-y:auto;overflow-x:hidden;transition:width var(--transition-slow)}

/* Header */
.sidebar-header{display:flex;align-items:center;justify-content:space-between;padding:18px 16px 14px;gap:8px}
.sidebar-logo{display:flex;align-items:center;gap:12px;color:var(--color-text-primary);white-space:nowrap;overflow:hidden;text-decoration:none;transition:opacity var(--transition-base)}
.sidebar-logo:hover{color:var(--color-text-primary);opacity:.92}
.sidebar-logo-icon{width:38px;height:38px;min-width:38px;border-radius:var(--radius-md);background:var(--color-brand-light);border:1px solid var(--color-border);display:flex;align-items:center;justify-content:center;font-size:18px;color:var(--color-brand);transition:all var(--transition-base)}
.sidebar-logo-icon-svg{background:transparent;border:0;padding:0;overflow:hidden}
.sidebar-logo-icon-svg img{width:38px;height:38px;display:block;object-fit:contain}
.sidebar-logo-text{display:flex;flex-direction:column;overflow:hidden;transition:opacity var(--transition-base)}
.sidebar-logo-title{font-size:var(--text-md);font-weight:700;letter-spacing:-.3px;line-height:1.2}
.sidebar-logo-sub{font-size:var(--text-xs);color:var(--color-sidebar-text);opacity:.6;letter-spacing:0;line-height:1.2;white-space:normal}/* wraps rather than being cut ("Quality Assurance Offi") where the sidebar is narrow */
.sidebar-collapse-btn{background:none;border:1px solid var(--color-sidebar-border);color:var(--color-sidebar-text);font-size:16px;cursor:pointer;padding:4px 6px;border-radius:var(--radius-sm);transition:all var(--transition-base);flex-shrink:0;display:none}
.sidebar-collapse-btn:hover{background:var(--color-sidebar-hover);color:var(--color-text-primary);border-color:var(--color-border)}
@media(min-width:992px){.sidebar-collapse-btn{display:flex;align-items:center;justify-content:center}}
.sidebar-close{background:none;border:none;color:var(--color-sidebar-text);font-size:20px;cursor:pointer;padding:4px}



/* Navigation */
.sidebar-nav{flex:1;padding:0 8px}
.sidebar-menu{list-style:none;padding:0;margin:0}
.sidebar-menu-item{margin-bottom:1px;position:relative}
/* Rail metrics taken from the reference system rather than guessed: the entries
   here were set a size larger and a weight heavier than the rail they were
   modelled on (13px/600 in 10x14 padding against 14px/500 in 9x11), which is why
   the list read as loose and shouty next to it. Larger type, less padding and a
   lighter weight fit more entries on screen and read calmer. */
.sidebar-link{display:flex;align-items:center;gap:11px;padding:9px 11px;color:var(--color-sidebar-text);text-decoration:none;font-size:14px;font-weight:500;border-radius:var(--radius-sm);position:relative;white-space:nowrap;overflow:hidden}
.sidebar-link:hover{background:var(--color-sidebar-hover);color:var(--color-text-primary)}
.sidebar-link:hover i{color:var(--color-text-primary)}
.sidebar-link-text{transition:opacity var(--transition-base);overflow:hidden}
.sidebar-link i{font-size:17px;width:20px;text-align:center;flex-shrink:0;opacity:.72}
.sidebar-menu-item.active .sidebar-link i{opacity:1}

/* Active item: tinted background, bold label, brand icon. The 3px accent bar
   that used to sit on its left edge was removed on request. */
.sidebar-menu-item.active .sidebar-link{background:var(--color-sidebar-active);color:var(--color-sidebar-text-active);font-weight:600}
.sidebar-menu-item.active .sidebar-link i{color:var(--color-sidebar-accent)}

/* Notification Badges */
.sidebar-badge{font-size:10px;font-weight:700;background:var(--color-brand);color:#fff;padding:2px 7px;border-radius:var(--radius-full);line-height:1.3;margin-left:auto;flex-shrink:0;min-width:20px;text-align:center}
.sidebar-badge.danger{background:var(--color-danger)}

/* Section Labels & Dividers */
.sidebar-divider{height:1px;background:var(--color-sidebar-border);margin:12px 14px;list-style:none}
.sidebar-menu-label{margin:14px 0 5px;padding:0 10px;font-size:10.5px;text-transform:uppercase;letter-spacing:.7px;font-weight:700;opacity:1;color:var(--color-text-muted);list-style:none;white-space:nowrap;overflow:hidden;transition:opacity var(--transition-base)}
.sidebar-menu-label:first-child{margin-top:2px}
.sidebar-footer{padding:12px 8px 16px;border-top:1px solid var(--color-sidebar-border)}
/* hsl(0,70%,70%) was a light red for the dark rail; on white it measures 2.74:1.
   The danger token reads correctly on a light ground at 6.56:1. */
.sidebar-logout{color:var(--color-danger)!important}
.sidebar-logout:hover{background:var(--color-danger-light)!important;color:var(--color-danger)!important}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:1035;backdrop-filter:blur(2px)}
.sidebar-overlay.active{display:block}

/* ===== Collapsed Mini Mode ===== */
.sidebar.collapsed{width:68px}
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-link-text,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-badge{opacity:0;width:0;overflow:hidden;padding:0;margin:0;display:none}
.sidebar.collapsed .sidebar-menu-label{opacity:0;height:0;padding:0;margin:0;overflow:hidden;font-size:0;line-height:0}
.sidebar.collapsed .sidebar-divider{margin:4px 16px}
.sidebar.collapsed .sidebar-header{padding:16px 0 10px;justify-content:center;flex-direction:column;align-items:center;gap:6px}
.sidebar.collapsed .sidebar-logo{justify-content:center;gap:0}
.sidebar.collapsed .sidebar-logo-icon{border:none;background:transparent}
.sidebar.collapsed .sidebar-collapse-btn{border:none;padding:4px;margin:0}
.sidebar.collapsed .sidebar-collapse-btn i{transform:rotate(180deg)}
.sidebar.collapsed .sidebar-nav{padding:0 6px}
.sidebar.collapsed .sidebar-link{justify-content:center;padding:10px 0;border-radius:var(--radius-sm);width:52px;height:42px;margin:2px auto}
.sidebar.collapsed .sidebar-link i{margin:0;width:auto}
.sidebar.collapsed .sidebar-footer{padding:10px 6px 16px}
.sidebar.collapsed .sidebar-footer .sidebar-link{width:52px;height:42px;margin:0 auto}

/* Tooltip on hover when collapsed */
.sidebar.collapsed .sidebar-link[data-tooltip]{position:relative}
.sidebar.collapsed .sidebar-link[data-tooltip]:hover::after{content:attr(data-tooltip);position:absolute;left:calc(100% + 8px);top:50%;transform:translateY(-50%);background:var(--color-text-primary);color:#fff;font-size:var(--text-xs);font-weight:600;padding:5px 10px;border-radius:var(--radius-sm);white-space:nowrap;z-index:9999;box-shadow:var(--shadow-md);pointer-events:none;animation:tooltipFadeIn .15s ease}
@keyframes tooltipFadeIn{from{opacity:0;transform:translateY(-50%) translateX(-4px)}to{opacity:1;transform:translateY(-50%) translateX(0)}}

/* Adjust main wrapper when sidebar is collapsed */
.sidebar.collapsed ~ .main-wrapper{margin-left:68px}

/* NAVBAR */
.top-navbar{height:var(--navbar-height);display:flex;align-items:center;justify-content:space-between;padding:0 24px;background:var(--color-surface);border-bottom:1px solid var(--color-border);position:sticky;top:0;z-index:1020}
.navbar-left{display:flex;align-items:center;gap:16px}
.sidebar-toggle{background:none;border:none;font-size:24px;color:var(--color-text-secondary);cursor:pointer;padding:4px}
.navbar-title{font-size:var(--text-md);font-weight:700;color:var(--color-text-primary);margin:0;letter-spacing:-.3px}
.navbar-subtitle{font-size:var(--text-xs);color:var(--color-text-muted);margin:0;line-height:1.2}
.navbar-right{display:flex;align-items:center;gap:12px}
.navbar-user-btn{display:flex;align-items:center;gap:8px;background:none;border:1px solid var(--color-border);padding:6px 14px;border-radius:var(--radius-full);color:var(--color-text-primary);font-size:var(--text-sm);font-weight:500;cursor:pointer}
.navbar-user-btn:hover{background:var(--color-overlay);border-color:var(--color-border-strong)}
.navbar-user-btn i{font-size:20px;color:var(--color-brand)}
.navbar-user-btn .navbar-user-avatar{width:28px;height:28px;border-radius:50%;object-fit:cover;flex-shrink:0;display:block}
/* Toasts. The stack sat at bottom:0 right:0 and rose directly over the QA
   Assistant button (fixed, bottom:28px right:28px, 56x56), so every message
   covered the control. It now starts above it and shares its right edge. */
/* Top centre, under the navbar. Bottom-right put every confirmation in the one
   corner the floating Messages button occupies, and at the far edge of where
   anyone is looking after clicking something at the top of a page. Centred
   under the bar it is seen without covering the table, the toolbar or the
   button that opened it. Position lives here, not in Bootstrap's utilities,
   which are !important and cannot be overridden from the stylesheet. */
.qa-toast-container{position:fixed;top:calc(var(--navbar-height) + 14px);left:50%;transform:translateX(-50%);
    display:flex;flex-direction:column;align-items:center;gap:8px;
    z-index:10800;max-width:min(420px,calc(100vw - 32px));pointer-events:none}
.qa-toast-container .qa-toast-item{
    pointer-events:auto;max-width:420px;font-size:13px;margin-bottom:0!important;
    animation:qa-toast-drop .22s cubic-bezier(.4,0,.2,1);
    background:var(--color-surface);color:var(--color-text-primary);
    border:1px solid var(--color-border)!important;
    border-left:3px solid var(--qa-toast-accent,var(--color-brand))!important;
    box-shadow:0 6px 18px rgba(2,48,71,.14);border-radius:var(--radius-sm)!important}
.qa-toast-container .qa-toast-row{display:flex;align-items:flex-start;gap:8px;padding:9px 8px 9px 11px}
.qa-toast-container .qa-toast-icon{color:var(--qa-toast-accent,var(--color-brand));font-size:15px;line-height:1.4;flex-shrink:0}
.qa-toast-container .toast-body{padding:0;line-height:1.4;flex:1;min-width:0}
/* 23px failed the 24px minimum a pointer target needs. */
.qa-toast-container .btn-close{width:24px;height:24px;padding:0;margin:0;flex-shrink:0;background-size:10px;opacity:.55;transform:none}
.qa-toast-container .btn-close:hover{opacity:1}
/* Meaning is carried by the icon and the words; the colour only agrees. */
.qa-toast--success{--qa-toast-accent:var(--color-success)}
.qa-toast--warning{--qa-toast-accent:var(--color-warning)}
.qa-toast--danger{--qa-toast-accent:var(--color-danger)}
.qa-toast--info{--qa-toast-accent:var(--color-brand)}
/* It arrives from the edge it sits against. */
@keyframes qa-toast-drop{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}
@media (prefers-reduced-motion:reduce){.qa-toast-container .qa-toast-item{animation:none}}
@media (max-width:575px){.qa-toast-container{left:12px;right:12px;transform:none;max-width:none}
    .qa-toast-container .qa-toast-item{max-width:none;width:100%}}
.qa-doc-detail-modal .modal-body{max-height:calc(100vh - 140px)}
.qa-doc-detail-panel .min-w-0{min-width:0}
.qa-job-status-pill{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:var(--radius-full);background:hsl(215,80%,96%);color:hsl(215,70%,42%);font-size:var(--text-xs);font-weight:600;text-decoration:none;border:1px solid hsl(215,60%,88%);cursor:pointer;white-space:nowrap;max-width:280px;overflow:hidden;text-overflow:ellipsis}
.qa-job-status-pill:hover{background:hsl(215,80%,92%);color:hsl(215,70%,35%)}
.qa-job-status-pill::before{content:'';width:8px;height:8px;border-radius:50%;background:hsl(215,70%,50%);animation:qa-job-pulse 1.2s ease-in-out infinite;flex-shrink:0}
@keyframes qa-job-pulse{0%,100%{opacity:.4;transform:scale(.85)}50%{opacity:1;transform:scale(1)}}

/* CARDS
   Every card here takes the shared surface tokens. The old values -- a two-layer
   6px/18px shadow on a resting card, a 2px lift on hover -- were doing the
   work the border now does, and doing it loudly. */
.card{background:var(--card-bg);border:1px solid var(--card-border);border-radius:var(--card-radius);box-shadow:var(--card-shadow);transition:box-shadow var(--transition-base),border-color var(--transition-base)}
.card:hover{box-shadow:var(--card-shadow-hover)}
.card-header{background:transparent;border-bottom:1px solid var(--card-border);padding:16px 20px;font-weight:600;font-size:var(--text-base);color:var(--color-text-primary)}
.card-body{padding:20px 22px}
.stat-card{background:var(--card-bg);border:1px solid var(--card-border);border-radius:var(--card-radius);padding:var(--card-pad);box-shadow:var(--card-shadow);transition:box-shadow var(--transition-base),border-color var(--transition-base);display:flex;align-items:flex-start;gap:14px}
.stat-card:hover{box-shadow:var(--card-shadow-hover)}
/* 40px, not 48: the icon is a label for the number beside it, and at 48 it was
   the largest object on the card. */
.stat-icon{width:40px;height:40px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:19px;flex-shrink:0}
.stat-icon.blue{background:var(--color-brand-light);color:var(--color-brand)}
.stat-icon.green{background:var(--color-success-light);color:var(--color-success)}
.stat-icon.orange{background:var(--color-warning-light);color:var(--color-warning)}
.stat-icon.red{background:var(--color-danger-light);color:var(--color-danger)}
.stat-info{flex:1}
.stat-value{font-size:var(--text-2xl);font-weight:700;color:var(--color-text-primary);line-height:1.1;letter-spacing:-.5px}
.stat-label{font-size:var(--text-sm);color:var(--color-text-secondary);margin-top:2px}

/* FILE-TYPE ICON TAG (shared across repository, reports, AI processing) */
.ft-tag{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:600;letter-spacing:.4px}
.ft-ico{font-size:16px;line-height:1;flex-shrink:0}
.ft-ico--pdf{color:hsl(4,75%,55%)}
.ft-ico--doc{color:hsl(212,75%,52%)}
.ft-ico--xls{color:hsl(150,60%,40%)}
.ft-ico--img{color:hsl(265,60%,58%)}
.ft-ico--other{color:hsl(220,10%,55%)}
.ft-tag-label{color:var(--color-text-secondary)}

/* TABLES */
.table-container{background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-sm);overflow:hidden}
.table-container .table{margin-bottom:0}
.table{font-size:var(--text-sm);color:var(--color-text-primary)}
.table thead th{background:var(--color-overlay);border-bottom:2px solid var(--color-border);font-weight:600;font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.5px;color:var(--color-text-secondary);padding:12px 16px;white-space:nowrap}
.table tbody td{padding:12px 16px;vertical-align:middle;border-bottom:1px solid var(--color-border)}
/* Row hover, one rule for every data table.
   Bootstrap 5.3 paints each cell with its own background and draws hover and
   striping as an inset shadow from --bs-table-bg-state, so a background on the
   <tr> -- what this rule used to set -- sits underneath white cells and never
   showed. Setting the state variable on the cells is what Bootstrap itself
   does for .table-hover. A tint of the brand colour, not a different blue,
   and nothing moves: checkboxes, menus and links in the row stay exactly
   where the pointer expects them. */
:root{--row-hover:hsla(193,70%,34%,.055);--row-selected:hsla(193,70%,34%,.11);--row-selected-hover:hsla(193,70%,34%,.15)}
.table tbody tr > *{transition:box-shadow var(--transition-fast)}
.table tbody tr:hover > *{--bs-table-bg-state:var(--row-hover)}
.table tbody tr.is-selected > *{--bs-table-bg-state:var(--row-selected)}
.table tbody tr.is-selected:hover > *{--bs-table-bg-state:var(--row-selected-hover)}
.table tbody tr.repo-skeleton-row:hover > *,
.table tbody tr:only-child > td[colspan]{--bs-table-bg-state:transparent}
/* A row on its way out: dimmed and inert while its delete is in flight. */
.table tbody tr.repo-row-busy{opacity:.45;pointer-events:none;transition:opacity var(--transition-base)}
.table tbody tr:last-child td{border-bottom:none}

/* Scrollable list/table panel (repository pattern — use site-wide for long lists) */
.repo-scroll-panel{
    max-height:min(65vh,calc(100vh - 280px));
    overflow:auto;
    background:var(--color-surface);
    border:1px solid var(--color-border);
    /* 18px on a full-width data panel read as a soft card wrapped around a
       dense grid; the reference uses a much tighter corner and the table sits
       better inside it. */
    border-radius:10px;
    box-shadow:var(--shadow-sm);
    -webkit-overflow-scrolling:touch;
}
@supports (height:100dvh){
    .repo-scroll-panel{max-height:min(65dvh,calc(100dvh - 280px))}
}
@media (min-width:992px){
    .repo-scroll-panel{max-height:min(72vh,calc(100vh - 260px))}
}
@media (min-width:1200px){
    .repo-scroll-panel{max-height:min(78vh,calc(100vh - 240px))}
}
.repo-scroll-panel .table{margin-bottom:0}
/* ---- panels sized to fill the window (see sizeScrollPanels in main.js) ---- */
/* The container's foot padding is what kept the floating assistant button clear
   of content. A filled panel reaches the window edge, so the clearance moves
   inside its scroll area: the last row can still be scrolled out from under the
   button, and the space is no longer wasted when the table is scrolled to the top. */
.main-content.has-filled-panel,
body:has(#qaDockFab) .main-content.has-filled-panel{padding-bottom:24px}
/* A panel that is the page's main scroll region gets a taller ceiling than one
   embedded in a card: it is what the page is for, and the old cap left the
   repository table showing about five rows on a laptop. main.js grows this
   further when the window has more room than the rule asks for; it never
   shrinks it. */
.repo-scroll-panel[data-fill-viewport]{max-height:min(75vh,calc(100vh - 190px))}
@supports (height:100dvh){
    .repo-scroll-panel[data-fill-viewport]{max-height:min(75dvh,calc(100dvh - 190px))}
}
@media (min-width:992px){
    .repo-scroll-panel[data-fill-viewport]{max-height:min(82vh,calc(100vh - 170px))}
}
@media (min-width:1200px){
    .repo-scroll-panel[data-fill-viewport]{max-height:min(88vh,calc(100vh - 150px))}
}
.repo-scroll-panel.is-filled .table{margin-bottom:56px}
/* Bootstrap's .table-responsive sets overflow-x:auto, and per spec that makes the
   used value of overflow-y 'auto' too - which turns the wrapper into a scroll
   container and steals the sticky containing block from .repo-scroll-panel. The
   wrapper never scrolls vertically itself, so the header had nothing to stick to
   and scrolled away with the rows. The panel already scrolls both axes, so the
   nested scroll context is redundant: neutralise it and sticky resolves against
   the panel again. */
.repo-scroll-panel > .table-responsive{overflow:visible}
.repo-scroll-panel thead th,
.repo-scroll-panel .mapping-table thead th,
.repo-scroll-panel .user-table thead th,
.repo-scroll-panel .nx-table thead th{
    position:sticky;
    top:0;
    z-index:2;
    box-shadow:0 1px 0 var(--color-border);
}
/* --color-overlay (#deecf2) is a tinted brand wash. Behind a header row that
   spans the full width of a dense table it was the loudest thing on the page --
   heavier than the data it labels. A near-white grey separates the header
   without competing; the border underneath does the actual dividing. */
.repo-scroll-panel .table thead th{background:hsl(205,30%,98%)}
.repo-scroll-panel .mapping-table thead th{background:hsl(220,20%,98%)}
.repo-scroll-panel .user-table thead th{background:hsl(220,20%,98%)}
.repo-scroll-panel .nx-table thead th{background:hsl(220,20%,99%)}
.repo-scroll-panel--embedded{
    border:none;
    border-radius:0;
    box-shadow:none;
}

/* BADGES */
.badge{font-size:var(--text-xs);font-weight:600;padding:4px 10px;border-radius:var(--radius-full);letter-spacing:.3px}
.badge-complete{background:var(--color-success-light);color:hsl(142,52%,30%);border:1px solid var(--color-success-border)}
.badge-missing{background:var(--color-danger-light);color:hsl(0,60%,40%);border:1px solid hsl(0,50%,78%)}
.badge-review{background:var(--color-warning-light);color:hsl(38,60%,30%);border:1px solid hsl(38,50%,72%)}
.badge-suggested{background:var(--color-brand-light);color:hsl(210,60%,32%);border:1px solid hsl(210,50%,76%)}
.badge-unmapped{background:var(--color-overlay);color:var(--color-text-secondary);border:1px solid var(--color-border)}

/* BUTTONS */
.btn{font-size:var(--text-sm);font-weight:600;padding:8px 18px;border-radius:var(--radius-sm);display:inline-flex;align-items:center;gap:6px;letter-spacing:.2px}
.btn:hover{transform:scale(1.01)}
.btn-primary{background:var(--color-brand);border-color:var(--color-brand);color:#fff}
/* Bootstrap's `.btn.disabled, .btn:disabled` sets background-color from
   --bs-btn-disabled-bg at specificity (0,2,0), which outranks the (0,1,0)
   rule above. A disabled primary button therefore reverted to Bootstrap
   blue #0d6efd -- measured on the upload button, which is disabled for the
   whole of an upload, exactly when the user is watching it. The brand
   colour holds through the disabled state; the 0.65 opacity Bootstrap
   applies still marks it as unavailable. */
.btn.btn-primary.disabled,.btn.btn-primary:disabled{background-color:var(--color-brand);border-color:var(--color-brand);color:#fff}
.btn-primary:hover{background:var(--color-brand-hover);border-color:var(--color-brand-hover);color:#fff;box-shadow:var(--shadow-xs)}
.btn-success{background:var(--color-success);border-color:var(--color-success);color:#fff}
.btn-outline-primary{color:var(--color-brand);border-color:var(--color-brand);background:#fff}
.btn-outline-primary:hover{background:var(--color-brand);color:#fff}
.btn-sm{padding:5px 12px;font-size:var(--text-xs)}
/* Filter bars: the Filter and Reset buttons stand exactly as tall as the
   fields beside them (--filter-control-h), in the body text size, with the
   same width as each other. They were small buttons beside full-size fields. */
:root{--filter-control-h:40px}
.filter-actions{display:flex;align-items:flex-end;gap:8px}
.filter-actions .btn{height:var(--filter-control-h);min-width:96px;padding:0 18px;font-size:var(--text-sm);justify-content:center;white-space:nowrap}
@media (max-width:575px){.filter-actions .btn{flex:1 1 0;min-width:0}}
.btn-icon{width:32px;height:32px;padding:0;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-sm)}

/* FORMS */
.form-control,.form-select{font-size:var(--text-sm);border:1px solid var(--color-border);border-radius:var(--radius-sm);padding:10px 14px;color:var(--color-text-primary);background:var(--color-surface)}
.form-control:focus,.form-select:focus{border-color:var(--color-brand);box-shadow:0 0 0 3px hsla(210,78%,46%,.12)}
/* An input group (search icon + field + button) is one box. The icon's border
   was Bootstrap's grey while the field's is ours, and on focus only the field
   turned teal with its own glow, so the bar looked cut at the icon. Now the
   icon matches the field, and focus outlines the whole box. */
.input-group>.input-group-text{border-color:var(--color-border);border-radius:var(--radius-sm)}
.input-group:focus-within>.input-group-text,.input-group:focus-within>.form-control,.input-group:focus-within>.form-select{border-color:var(--color-brand)}
.input-group>.form-control:focus,.input-group>.form-select:focus{box-shadow:none}
.input-group:focus-within{border-radius:var(--radius-sm);box-shadow:0 0 0 3px hsla(210,78%,46%,.12)}
/* Keep native <option> popups readable (fixes black-on-black dropdowns on dark-mode OSes) */
.form-select,.form-control,select,input,textarea{color-scheme:light}
.form-select option,.form-control option,select option{background-color:#fff;color:var(--color-text-primary)}
.form-label{font-size:var(--text-sm);font-weight:600;color:var(--color-text-primary);margin-bottom:6px}

/* ALERTS */
.alert{border-radius:var(--radius-md);font-size:var(--text-sm);font-weight:500;padding:12px 18px;border:1px solid}
.alert-success{background:var(--color-success-light);color:hsl(142,40%,28%);border-color:var(--color-success-border)}
.alert-error,.alert-danger{background:var(--color-danger-light);color:hsl(0,50%,35%);border-color:hsl(0,50%,78%)}
.alert-warning{background:var(--color-warning-light);color:hsl(38,50%,28%);border-color:hsl(38,50%,72%)}
.alert-info{background:var(--color-brand-light);color:hsl(210,50%,30%);border-color:hsl(210,50%,78%)}

/* PAGE HEADERS */
.page-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px;flex-wrap:wrap;gap:12px}
.page-header h2{font-size:25px;font-weight:700;color:var(--color-text-primary);margin:0;letter-spacing:-.35px}
.page-header p{font-size:var(--text-sm);color:var(--color-text-secondary);margin:2px 0 0}
.page-header-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}

/* BREADCRUMBS (shared, see includes/breadcrumb usage) */
.filter-bar{background:var(--color-surface);border:1px solid var(--color-border);border-radius:10px;padding:16px 20px;margin-bottom:14px;box-shadow:var(--shadow-xs)}

/* CHATBOT */
.chat-container{height:calc(100vh - var(--navbar-height) - 140px);min-height:400px;display:flex;flex-direction:column;background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-sm);overflow:hidden}
.chat-messages{flex:1;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:12px}
.chat-message{max-width:75%;padding:12px 16px;border-radius:var(--radius-md);font-size:var(--text-sm);line-height:1.5;animation:chatFadeIn .3s ease}
@keyframes chatFadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
.chat-message.user{align-self:flex-end;background:var(--color-brand);color:#fff;border-bottom-right-radius:var(--radius-xs)}
.chat-message.bot{align-self:flex-start;background:var(--color-overlay);color:var(--color-text-primary);border-bottom-left-radius:var(--radius-xs);border:1px solid var(--color-border)}
.chat-input-bar{display:flex;gap:10px;padding:16px 20px;border-top:1px solid var(--color-border);background:var(--color-overlay)}
.chat-input-bar input{flex:1}

/* LOGIN */
.login-page{min-height:100vh;display:flex;align-items:center;justify-content:center;background:#1E3A8A;padding:20px}
/* The sign-in card is the one deliberate exception to the flat card shadow: it
   floats on its own over the page rather than sitting in a grid with others. */
.login-card{background:var(--card-bg);border:1px solid var(--card-border);border-radius:var(--radius-xl);box-shadow:var(--shadow-lg);padding:40px;width:100%;max-width:420px}
.login-logo{text-align:center;margin-bottom:28px}
.login-logo i{font-size:42px;color:var(--color-brand)}
.login-logo h2{font-size:var(--text-xl);font-weight:700;color:var(--color-text-primary);margin:10px 0 4px;letter-spacing:-.3px}
.login-logo p{font-size:var(--text-sm);color:hsl(215,12%,38%)}

/* DROPDOWN & MODAL */
.dropdown-menu{border:1px solid var(--color-border);border-radius:var(--radius-md);box-shadow:var(--shadow-md);padding:6px}
.dropdown-item{border-radius:var(--radius-sm);font-size:var(--text-sm);padding:8px 12px}
.dropdown-item:hover{background:var(--color-overlay)}
.modal-content{border:1px solid var(--color-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg)}
.modal-header{border-bottom:1px solid var(--color-border);padding:16px 20px}
.modal-body{padding:20px}
.modal-footer{border-top:1px solid var(--color-border);padding:12px 20px}

/* MISC */
.chart-wrapper{position:relative;padding:12px}
.empty-state{text-align:center;padding:48px 24px;color:var(--color-text-muted);display:flex;flex-direction:column;align-items:center;justify-content:center}
.empty-state i{font-size:48px;margin-bottom:16px;opacity:.4}
.empty-state p{font-size:var(--text-sm)}
.empty-state .empty-title{font-size:var(--text-md);font-weight:600;color:var(--color-text-secondary);margin:0 0 4px}
.empty-state .empty-text{font-size:var(--text-sm);color:var(--color-text-muted);margin:0 0 16px;max-width:340px}
.empty-state .empty-action{display:inline-flex;align-items:center;gap:6px;background:var(--color-brand);color:#fff;text-decoration:none;font-size:var(--text-sm);font-weight:600;padding:8px 16px;border-radius:var(--radius-md);transition:filter .15s,transform .1s}
.empty-state .empty-action:hover{filter:brightness(1.07);transform:translateY(-1px);color:#fff}

/* GLOBAL ACCESSIBILITY POLISH */
a:focus-visible,button:focus-visible,.btn:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible,.act:focus-visible,.sidebar-link:focus-visible{outline:2px solid var(--color-brand);outline-offset:2px;border-radius:var(--radius-sm)}
@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.001ms !important;animation-iteration-count:1 !important;transition-duration:.001ms !important;scroll-behavior:auto !important}}
.mapping-panel{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.skeleton{background:var(--color-overlay);animation:qa-skeleton-pulse 1.4s ease-in-out infinite;border-radius:var(--radius-sm)}
@keyframes qa-skeleton-pulse{0%,100%{opacity:1}50%{opacity:.55}}
.repo-skeleton-row td{padding:12px;vertical-align:middle;border-color:var(--color-border)}
.repo-skel-line{display:block;height:11px;border-radius:6px;width:100%;min-width:40px}
.repo-skeleton-row:nth-child(3n) .repo-skel-line:nth-child(1){max-width:72%}
.repo-skeleton-row:nth-child(3n+1) .repo-skel-line:nth-child(1){max-width:58%}
.repo-skeleton-row:nth-child(3n+2) .repo-skel-line:nth-child(1){max-width:65%}
#tableBody.repo-loading{pointer-events:none;min-height:120px}
.smart-search-tbody.repo-loading{pointer-events:none;min-height:80px}
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
/* The sidebar used to draw a 4px thumb. Class selectors outrank the global
   *::-webkit-scrollbar rule below, so it has to be hidden explicitly here. */
.sidebar::-webkit-scrollbar{width:0;height:0;display:none}

/* Bootstrap ships .btn-outline-secondary in its own grey, which measured 3.88:1
   on white and is the one place its default palette showed through the system's.
   Mapped onto the token ramp so it matches every other control. */
.btn-outline-secondary{color:var(--color-text-secondary);border-color:var(--color-border-strong)}
.btn-outline-secondary:hover{background:var(--color-overlay);color:var(--color-text-primary);border-color:var(--color-border-strong)}

/* ===== ROW ACTIONS (shared) =====
   One icon-action pattern for every table whose rows carry three or more actions.
   It used to exist twice: inline in repository.html as .act, and again in
   user_list.html as .action-btn with different sizes, colours and hover states -
   two systems doing the same job on two pages.

   Tables with one or two row actions keep the labelled .btn-outline-* button,
   which is clearer and is already what thirteen other templates use. Icons are
   for the crowded case: labelling the repository's five actions measured 410px
   against 176px for the icon row, which would push that table 234px wider than
   its panel and undo the overflow fix. */
.action-group {
    display: flex;
    gap: 4px;
}
.act {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

/* Row actions carry a colour per action type, and each colour means something:
   blue = read, slate = information, green = take a copy away, amber = modifies
   stored data, red = destroys it. The glyph is coloured while the chip stays
   transparent at rest, so 22 rows read as five legible icon columns rather than
   110 filled pills; the matching tint appears only on hover and focus. */
.act {
    color: var(--color-text-secondary);
    background: transparent;
}
.act.view      { color: var(--color-brand); }
/* Deliberately the ink token, not --color-sidebar. This borrowed the sidebar
   colour as a 'slate'; when the rail turned white in the design migration the
   glyph turned white too and vanished on a white card. A text colour must come
   from a text token. */
.act.info      { color: var(--color-text-primary); }
/* The success and warning tokens are tuned for fills and badges, where they sit on a
   tinted ground. As a 14px glyph on white they measure 2.94:1 and 2.13:1, under the
   3:1 WCAG minimum for non-text UI, so these two use darkened variants of the same
   hues - 4.14:1 and 3.91:1. The tokens themselves are untouched. */
.act.download  { color: hsl(142, 55%, 36%); }
.act.edit      { color: hsl(38, 95%, 36%); }
.act.delete    { color: var(--color-danger); }

.act:hover,
.act:focus-visible          { background: var(--color-overlay); }
.act.view:hover,
.act.view:focus-visible     { background: var(--color-brand-light); color: var(--color-brand-dark); }
.act.info:hover,
.act.info:focus-visible     { background: var(--color-overlay); color: var(--color-text-primary); }
.act.download:hover,
.act.download:focus-visible { background: var(--color-success-light); color: hsl(142, 60%, 28%); }
.act.edit:hover,
.act.edit:focus-visible     { background: var(--color-warning-light); color: hsl(38, 95%, 30%); }
.act.delete:hover,
.act.delete:focus-visible   { background: var(--color-danger-light); color: var(--color-danger); }

.act:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 1px;
}

/* The label opens below the icon, where it does not cover the row above or
   the table's header. */
.act::after {
    content: attr(title);
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 5;
    transform: translateX(-50%) translateY(-4px);
    background: hsl(220, 20%, 18%);
    color: white;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
}
.act:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(4px);
}
/* Room under the last row of a scrolling table, so that row's label is not
   cut off by the panel's edge. */
.repo-scroll-panel:has(.act:not(.qa-row-menu-toggle)) { padding-bottom: 14px; }

/* ===== ROW ACTION MENU =====
   The document tables used to end in five 32px chips: ~176px of every row spent
   on controls, on tables already wide enough to scroll sideways, with each
   action's meaning carried by a glyph and a hover tooltip. One kebab is 32px
   and names every action in words when it is opened. The chips above are kept
   for tables with one or two actions, where a menu would be a click for
   nothing.

   The toggle reuses .act for size, radius and hover tint -- but not for the
   tooltip. `.act::after` draws its own pill from `content: attr(title)`, and
   that pill carries a background, padding and a radius of its own, so with the
   title removed it still painted an empty dark chip above the button on every
   hover. The column header says "Actions" in the open now; the toggle draws
   nothing. `.act` keeps the tooltip for User Management, which still uses the
   labelled-by-hover chips. */
.qa-row-menu-toggle::after { content: none; }
.qa-row-menu { display: inline-block; }
.qa-row-menu-toggle {
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}
/* Bootstrap's caret would sit beside the kebab saying the same thing twice. */
.qa-row-menu-toggle::before { display: none; }
.dropdown-toggle.qa-row-menu-toggle::after { display: none; }
.qa-row-menu-toggle.show {
    background: var(--color-overlay);
    color: var(--color-text-primary);
}

.qa-row-menu-list {
    --bs-dropdown-min-width: 11.5rem;
    --bs-dropdown-padding-y: 6px;
    --bs-dropdown-padding-x: 6px;
    --bs-dropdown-border-color: var(--color-border);
    --bs-dropdown-border-radius: var(--radius-md);
    --bs-dropdown-link-hover-bg: var(--color-overlay);
    --bs-dropdown-link-active-bg: var(--color-overlay);
    --bs-dropdown-link-active-color: var(--color-text-primary);
    --bs-dropdown-font-size: var(--text-sm);
    box-shadow: 0 10px 28px rgba(16, 42, 56, 0.14);
}
.qa-row-menu-list .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-xs);
    font-weight: 500;
}
.qa-row-menu-list .dropdown-divider { margin: 5px 4px; border-top-color: var(--color-border); }

/* The same five colours the icon row used, and for the same reason: blue =
   read, slate = information, green = take a copy away, amber = modifies stored
   data, red = destroys it. */
.qa-mi { font-size: 14px; width: 16px; text-align: center; flex: none; }
.qa-mi-view     { color: var(--color-brand); }
.qa-mi-info     { color: var(--color-text-primary); }
.qa-mi-download { color: hsl(142, 55%, 36%); }
.qa-mi-edit     { color: hsl(38, 95%, 36%); }
.qa-mi-delete   { color: var(--color-danger); }

/* Destroying a file is the one item that should not look like the others. */
.qa-row-menu-list .qa-mi-danger { color: var(--color-danger); }
.qa-row-menu-list .qa-mi-danger:hover,
.qa-row-menu-list .qa-mi-danger:focus {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

/* The column is now one button wide, so it stops competing with the title. */
.repo-col-actions { width: 1%; white-space: nowrap; }

/* ===== HIDDEN SCROLLBARS =====
   Every scrollable region still scrolls by wheel, trackpad, touch, keyboard
   (arrows / PgUp / PgDn / Home / End) and programmatic scrollTo - only the bar
   itself is not painted. Three declarations are needed because no single one is
   supported everywhere: ::-webkit-scrollbar for Chrome / Edge / Safari,
   scrollbar-width for Firefox, -ms-overflow-style for legacy Edge and IE.

   Trade-off worth knowing: the scrollbar is also the cue that tells a user more
   content exists below or to the right. Hiding it removes that affordance, so
   long panels rely on the content itself to imply there is more. */
/* 2026-11-12: scrollbars are shown again -- thin, flat and in the theme's
   colours -- so a page or panel that scrolls says so. The sidebar alone keeps
   its bar hidden. */
:root{--scroll-thumb:hsl(215,14%,74%);--scroll-thumb-hover:hsl(215,14%,58%)}
html[data-theme="dark"]{--scroll-thumb:hsl(215,12%,36%);--scroll-thumb-hover:hsl(215,12%,50%)}
*{scrollbar-width:thin;scrollbar-color:var(--scroll-thumb) transparent}
*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-track{background:transparent}
*::-webkit-scrollbar-thumb{background:var(--scroll-thumb);border-radius:999px;border:2px solid transparent;background-clip:padding-box}
*::-webkit-scrollbar-thumb:hover{background:var(--scroll-thumb-hover);background-clip:padding-box}
*::-webkit-scrollbar-corner{background:transparent}
.sidebar,.sidebar *{scrollbar-width:none;-ms-overflow-style:none}
.sidebar::-webkit-scrollbar,.sidebar *::-webkit-scrollbar{width:0;height:0;display:none}

/* RESPONSIVE */
@media(max-width:991.98px){
    .sidebar{transform:translateX(-100%);transition:transform var(--transition-slow)}
    .sidebar.open{transform:translateX(0)}
    .main-wrapper{margin-left:0}
    .main-content{padding:16px}
    .mapping-panel{grid-template-columns:1fr}
}
@media(max-width:575.98px){
    .stat-card{padding:14px}
    .stat-value{font-size:var(--text-xl)}
    .page-header{flex-direction:column;align-items:flex-start}
}

/* PRINT */
@media print{
    .sidebar,.top-navbar,.sidebar-overlay,.btn,.filter-bar{display:none!important}
    .main-wrapper{margin-left:0!important}
    .main-content{padding:0!important}
    .card{box-shadow:none!important;border:1px solid #ddd!important}
}

/* ============================================================
   PROFILE PHOTOS
   ------------------------------------------------------------
   Every avatar in the system is a fixed-size, round element that
   shows initials on a coloured ground. A photo is laid inside
   that same element rather than replacing it, so a surface built
   around initials keeps its exact size, shape and alignment once
   a picture exists. `.has-photo` drops the coloured ground so it
   cannot show through a transparent image.
   ============================================================ */
/* A compact avatar for list rows that previously showed a name alone --
   same family as the Messages and dashboard avatars, one size down. */
.qa-row-avatar {
    width: 22px; height: 22px; border-radius: var(--radius-full); flex-shrink: 0;
    display: grid; place-items: center;
    font-size: 9.5px; font-weight: 700; color: #fff; line-height: 1;
    background: var(--color-brand);
}

.has-photo { background: var(--color-overlay) !important; padding: 0 !important; overflow: hidden; }
.has-photo > img {
    width: 100%; height: 100%;
    object-fit: cover; object-position: center;
    border-radius: inherit; display: block;
}

/* ============================================================================
   UNREAD COUNT BADGE
   ----------------------------------------------------------------------------
   One badge for one question: how many unread items need me?

   The bell wore Bootstrap's red pill and the sidebar wore a teal one, so the
   same idea -- an unread count -- arrived in two colours and two shapes. The
   bell's pill also grew with its number, and because it is pinned to the
   icon's corner a two-digit count pushed further across the bell than a
   one-digit count did.

   Height and radius are fixed here, and only the width grows, so the badge
   keeps its shape at "1", at "12" and at "99+". It is positioned against the
   icon, never in the icon's own flow, so the icon cannot move.

   A status dot is a different component and is deliberately not styled here:
   it answers "what is the state?", not "how many?".
   ========================================================================== */
.qa-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--color-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    /* Digits of equal width, so the badge does not twitch as the count
       changes between, say, 11 and 17. */
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    white-space: nowrap;
    box-sizing: border-box;
}

/* Pinned to the icon's top-right corner, out of the icon's layout. */
.qa-count-badge-pin {
    position: absolute;
    top: 2px;
    right: 2px;
    transform: translate(40%, -40%);
    z-index: 2;
}

/* In a sidebar row the count sits at the end of the line, not over an icon. */
.sidebar-badge {
    background: var(--color-danger);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* ============================================================================
   UNDO QUEUE
   ----------------------------------------------------------------------------
   One toast per bulk delete, stacked at the bottom of the viewport, each with
   its own countdown. Deleting 10 and then 5 shows two toasts and a line saying
   15 can be undone; one running out never touches the other.

   Floating, because the way back has to be findable from a scrolled list.
   Dark brand surface, flat: a temporary overlay is the one place a shadow is
   earned.

   Visible the moment it is in the page. Nothing about being visible may wait
   on an animation or a frame: a tab that is not being rendered never delivers
   requestAnimationFrame and freezes animations at their first keyframe, and a
   toast held at opacity 0 there left a deletion with no visible way back. So
   the entrance animates only the slide; opacity is 1 throughout.
   ========================================================================== */
.qa-undo-queue {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 1080;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: min(92vw, 440px);
    pointer-events: none;
}
.qa-undo-queue > * { pointer-events: auto; }
.qa-undo-summary {
    align-self: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: var(--color-surface);
    color: var(--color-brand-dark);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.qa-undo-summary[hidden] { display: none; }
.qa-undo-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 12px 12px;
    border-radius: 10px;
    background: var(--color-brand-dark);
    color: #fff;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    opacity: 1;
    animation: qaUndoIn .18s ease-out;
}
.qa-undo-item.is-leaving { opacity: 0; transition: opacity .2s ease; }
@keyframes qaUndoIn {
    from { transform: translateY(8px); }
    to   { transform: translateY(0); }
}
.qa-undo-icon {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .1);
    font-size: 14px;
}
.qa-undo-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.qa-undo-title { font-weight: 600; }
.qa-undo-status { font-size: 12px; opacity: .78; font-variant-numeric: tabular-nums; }
.qa-undo-item.is-error .qa-undo-status { opacity: 1; color: #ffd8d4; }
.qa-undo-item.is-restored .qa-undo-icon { background: var(--color-success); }
.qa-undo-item.is-expired .qa-undo-icon,
.qa-undo-item.is-error .qa-undo-icon { background: rgba(176, 42, 33, .85); }
.qa-undo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 6px 14px;
    border: 1px solid var(--color-brand);
    border-radius: var(--radius-full);
    background: var(--color-brand);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
/* The hover is a lighter brand tone: the darker one would read as the
   button sinking into the dark surface behind it. */
.qa-undo-btn:hover:not(:disabled) { background: #2494b0; border-color: #2494b0; transform: translateY(-1px); }
.qa-undo-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.qa-undo-btn:disabled { cursor: default; opacity: .85; }
.qa-undo-item.is-restored .qa-undo-btn { background: var(--color-success); border-color: var(--color-success); }
.qa-undo-item.is-expired .qa-undo-btn,
.qa-undo-item.is-error .qa-undo-btn:disabled { background: transparent; border-color: rgba(255, 255, 255, .35); }
.qa-undo-close {
    flex-shrink: 0;
    border: 0;
    background: none;
    color: #fff;
    opacity: .55;
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
}
.qa-undo-close:hover { opacity: 1; }
/* The remaining time, drained rather than counted. Width is set from the
   batch's own deadline on every tick, so each toast runs on its own clock. */
.qa-undo-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, .16);
}
.qa-undo-progress i {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--color-brand);
    transition: width .25s linear;
}
@media (max-width: 575px) {
    .qa-undo-queue { bottom: 12px; }
    .qa-undo-item { flex-wrap: wrap; }
    .qa-undo-text { flex-basis: calc(100% - 80px); }
}
@media (prefers-reduced-motion: reduce) {
    .qa-undo-item { animation: none; }
    .qa-undo-item.is-leaving, .qa-undo-progress i { transition: none; }
    .qa-undo-btn:hover:not(:disabled) { transform: none; }
}

/* DOCUMENT HISTORY TIMELINE
   Used in the document details panel and on the Document History page. One
   vertical rail, one dot per event, coloured only by what happened. */
.doc-timeline{list-style:none;margin:0;padding:0;position:relative}
.doc-timeline-item{position:relative;display:flex;gap:12px;padding:0 0 14px 0}
.doc-timeline-item:last-child{padding-bottom:0}
.doc-timeline-item:not(:last-child)::before{content:"";position:absolute;left:13px;top:28px;bottom:2px;width:2px;background:var(--color-border)}
.doc-timeline-dot{flex:0 0 28px;width:28px;height:28px;border-radius:var(--radius-full);display:inline-flex;align-items:center;justify-content:center;font-size:13px;background:var(--color-overlay);color:var(--color-text-secondary)}
.doc-timeline-item.is-upload .doc-timeline-dot{background:var(--color-brand-light);color:var(--color-brand-on-overlay)}
.doc-timeline-item.is-restore .doc-timeline-dot{background:var(--color-success-light);color:var(--color-success-text)}
.doc-timeline-item.is-delete .doc-timeline-dot{background:var(--color-warning-light);color:var(--color-warning-text)}
.doc-timeline-item.is-purge .doc-timeline-dot{background:var(--color-danger-light);color:var(--color-danger)}
.doc-timeline-body{min-width:0;flex:1;padding-top:3px}
.doc-timeline-head{font-size:var(--text-sm);color:var(--color-text-primary);display:flex;flex-wrap:wrap;gap:4px 6px}
.doc-timeline-head span{color:var(--color-text-secondary)}
.doc-timeline-body time{display:block;font-size:var(--text-xs);color:var(--color-text-muted);font-variant-numeric:tabular-nums}
.doc-timeline-note{font-size:var(--text-xs);color:var(--color-text-secondary);margin-top:2px;overflow-wrap:anywhere}
.doc-timeline-empty{font-size:var(--text-sm);color:var(--color-text-muted)}

/* A live figure that just changed: a brief tint, so a number updating under
   the reader's eyes is noticed without anything moving. */
@keyframes qaLiveFlash { from { background: var(--color-brand-light); } to { background: transparent; } }
.qa-live-flash { animation: qaLiveFlash 1.2s ease-out; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { .qa-live-flash { animation: none; } }

/* OFFLINE SCREEN
   The offline page (templates/status/), full screen, over the page that lost
   its connection -- the same full-page design as every status page. The page
   stays underneath, untouched; "Keep browsing" brings it back. */
.qa-offline-overlay{position:fixed;inset:0;z-index:2000;overflow:auto;background:#f5f9fb}
.qa-offline-overlay[hidden]{display:none}
.qa-offline-overlay .err-page{min-height:100%}
.qa-offline-pill{position:fixed;top:12px;left:50%;transform:translateX(-50%);z-index:2000;display:inline-flex;align-items:center;gap:8px;padding:7px 14px;border:1px solid #fecaca;border-radius:9999px;background:#fff;color:#7f1d1d;font-size:13px;font-weight:600;box-shadow:var(--shadow-md);cursor:pointer}
.qa-offline-pill[hidden]{display:none}
.qa-offline-pill-dot{width:8px;height:8px;border-radius:50%;background:#DC2626;animation:errPulse 1.2s ease-in-out infinite}
@media (prefers-reduced-motion: reduce){.qa-offline-pill-dot{animation:none}}

/* ACCORDIONS (Area Submissions, Clusters)
   Bootstrap's own accordion colours -- a #cfe2ff fill and navy text on the
   open row, and a blue glow ring after every click -- are the only blue in a
   teal system, and the open row read as selected-and-alarmed. They now use the
   brand tokens: a light tint when open, the table row tint on hover, and a
   focus outline that appears for the keyboard only. */
.accordion{
    --bs-accordion-border-color:var(--color-border);
    --bs-accordion-active-bg:var(--color-brand-light);
    --bs-accordion-active-color:var(--color-text-primary);
    --bs-accordion-btn-color:var(--color-text-primary);
    --bs-accordion-btn-focus-box-shadow:none;
    --bs-accordion-btn-focus-border-color:var(--color-border);
    --bs-accordion-btn-icon:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%232f576a' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 5L8 11L14 5'/%3e%3c/svg%3e");
    --bs-accordion-btn-active-icon:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23156376' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 5L8 11L14 5'/%3e%3c/svg%3e");
}
.accordion-button{transition:background-color var(--transition-fast),color var(--transition-fast)}
.accordion-button:hover:not(:disabled){background-color:var(--row-hover)}
.accordion-button:not(.collapsed){box-shadow:inset 3px 0 0 var(--color-brand),inset 0 -1px 0 var(--color-border)}
.accordion-button:not(.collapsed):hover{background-color:var(--color-overlay)}
.accordion-button:focus{box-shadow:none}
.accordion-button:not(.collapsed):focus{box-shadow:inset 3px 0 0 var(--color-brand),inset 0 -1px 0 var(--color-border)}
.accordion-button:focus-visible{outline:2px solid var(--color-brand);outline-offset:-2px}
.accordion-button:disabled{color:var(--color-text-secondary);background:transparent;cursor:default}
/* The file list inside an open row: the Repository's light header, not the
   tinted wash, so the row above stays the emphasis. */
.accordion-body .table thead th{background:hsl(205,30%,98%);border-bottom:1px solid var(--color-border)}

/* WIDE TABLES AS CARDS
   A table that does not fit its panel -- every table of four or more columns
   on a phone, and the wide ones on a tablet -- is shown as one card per row:
   the row's name (Title, Document, User...) across the top, then the other
   cells side by side, each with its column's name above its value. Before
   this, such a table scrolled sideways inside its panel with the scrollbar
   hidden, so the Cluster, Area and Actions columns were not seen unless the
   page was zoomed out. static/js/mobile-tables.js labels the cells and adds
   qa-stack-cards only where the table would not fit; a table that fits stays
   a table. */
table.qa-stack-cards,
table.qa-stack-cards > tbody {
    display: block;
    width: auto !important;
    min-width: 0 !important;
}
table.qa-stack-cards { border: 0; margin-bottom: 0; }
table.qa-stack-cards > thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}
/* Sort buttons stay: a row of chips above the cards. */
table.qa-stack-cards.has-stack-sort > thead {
    position: static; display: block; width: auto; height: auto;
    overflow: visible; clip: auto; white-space: normal;
}
table.qa-stack-cards.has-stack-sort > thead > tr { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; }
table.qa-stack-cards.has-stack-sort > thead > tr > th { display: none; }
table.qa-stack-cards.has-stack-sort > thead > tr > th.qa-stack-sort {
    display: block;
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 4px 10px !important;
    border: 1px solid var(--color-border) !important;
    border-radius: 999px;
    background: var(--color-surface) !important;
    box-shadow: none !important;
}
table.qa-stack-cards > tbody > tr {
    position: relative;
    display: grid;
    /* Two cells to a line on a phone, more where the card is wider. */
    grid-template-columns: repeat(auto-fill, minmax(min(140px, calc(50% - 6px)), 1fr));
    gap: 8px 12px;
    margin: 0 10px 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
}
table.qa-stack-cards > tbody > tr:first-child { margin-top: 10px; }
table.qa-stack-cards > tbody > tr.table-secondary { background: var(--bs-secondary-bg-subtle, #e9ecef); }
table.qa-stack-cards > tbody > tr > td,
table.qa-stack-cards > tbody > tr > th {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 2px 6px;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    white-space: normal !important;
    text-align: left !important;
    overflow-wrap: anywhere;
}
/* A value never runs into the cell beside it: text that is kept on one
   line in the wide table wraps inside its half of the card. */
table.qa-stack-cards > tbody > tr > td > *,
table.qa-stack-cards > tbody > tr > th > * { max-width: 100%; min-width: 0; }
table.qa-stack-cards > tbody > tr > td :not(.badge):not(.btn):not(i),
table.qa-stack-cards > tbody > tr > th :not(.badge):not(.btn):not(i) { white-space: normal !important; }
table.qa-stack-cards > tbody > tr > [data-label]::before {
    content: attr(data-label);
    flex: 0 0 100%;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}
/* The row's name heads the card, full width, and may wrap. */
table.qa-stack-cards > tbody > tr > .qa-stack-primary {
    display: block;
    grid-column: 1 / -1;
    padding: 0 30px 8px 0 !important;
    border-bottom: 1px solid var(--color-border) !important;
}
table.qa-stack-cards > tbody > tr > .qa-stack-primary a,
table.qa-stack-cards > tbody > tr > .qa-stack-primary span {
    white-space: normal;
    overflow-wrap: anywhere;
}
/* A row's select box sits in the card's top-right corner, as large as a
   finger needs: a 20px box inside a 40px target. At 13px, with the faint
   border of an unchecked box, it was easy to miss on a phone altogether. */
table.qa-stack-cards > tbody > tr > .qa-stack-check {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 40px !important;
    height: 40px;
    justify-content: center;
}
table.qa-stack-cards > tbody > tr > .qa-stack-check .repo-check-hit { width: 40px; height: 40px; padding: 0; }
table.qa-stack-cards > tbody > tr > .qa-stack-check .form-check-input {
    width: 20px; height: 20px; margin: 0; border-width: 1.5px; border-color: var(--color-border-strong);
}
table.qa-stack-cards > tbody > tr > .qa-stack-check .form-check-input:checked { border-color: var(--color-brand); }
table.qa-stack-cards > tbody > tr > .qa-stack-primary { padding-right: 44px !important; }
/* A selected card says so, as a selected row does in the table. */
table.qa-stack-cards > tbody > tr.is-selected {
    border-color: var(--color-brand);
    box-shadow: inset 0 0 0 1px var(--color-brand);
    background: var(--row-selected, var(--color-brand-light));
}
/* A ticked box or an on switch is the brand colour, as in the dark theme
   (dark.css), not Bootstrap's own blue, which appears nowhere else here. */
.form-check-input:checked,
.form-check-input[type="checkbox"]:indeterminate { background-color: var(--color-brand); border-color: var(--color-brand); }
/* The select box's cell is its target, in the table as on a card. */
.repo-check-hit { display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 4px; cursor: pointer; }
table.qa-stack-cards > tbody > tr > .qa-stack-index { grid-column: 1 / -1; font-size: 12px; color: var(--color-text-secondary); }
table.qa-stack-cards > tbody > tr > .qa-stack-index::before { flex: 0 0 auto; }
table.qa-stack-cards > tbody > tr > .qa-stack-full { display: block; grid-column: 1 / -1; text-align: center !important; }
table.qa-stack-cards > tbody > tr > .qa-stack-blank { display: none !important; }

/* Tightened: on most laptops enough to bring the last column on screen
   without turning the table into cards. */
.main-content table.qa-table-compact > :not(caption) > * > * {
    padding-left: 6px !important;
    padding-right: 6px !important;
}

/* ===== LIVE PASSWORD CHECKLIST =====
   templates/includes/password_checklist.html, on the account form and on the
   Change password form in Settings. A rule is grey until there is something to
   check, then a red cross until it is met and a green tick, struck through,
   once it is.
   The box only reports; nothing in it can be clicked or selected. A click used
   to select the text, and the browser then opened its own menu above it. */
.pw-check { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); pointer-events: none; cursor: default; -webkit-user-select: none; user-select: none; }
.pw-check-title { font-size: 12.5px; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 8px; }
.pw-rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 20px; }
.pw-rule { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.4; color: var(--color-text-primary); }
.pw-rule i { flex-shrink: 0; font-size: 15px; line-height: 1.25; color: var(--color-text-muted); }
.pw-rule.is-ok { color: var(--color-text-secondary); }
.pw-rule.is-ok span { text-decoration: line-through; }
.pw-rule.is-ok i { color: var(--color-success); }
.pw-rule.is-bad, .pw-rule.is-bad i { color: var(--color-danger); }
.pw-rule.is-checking i { color: var(--color-brand); }
.pw-summary { margin: 10px 0 0; font-size: 12.5px; color: var(--color-text-secondary); }
.pw-summary:empty { display: none; }
.pw-summary.is-ok { color: var(--color-success-text); font-weight: 600; }
/* 2026-11-10 UX audit. The floating assistant button covered the last row's
   actions at the foot of long pages; this lets the page scroll clear of it. */
.main-content{padding-bottom:84px}
.repo-sort-btn{min-height:24px;min-width:24px}
/* Contrast (measured 2026-11-10): the logo's sub-line was dimmed to 2.9:1. */
.sidebar-logo-sub{opacity:1;color:var(--color-text-muted)}

/* Similar Documents rows in the details pop-up: the match %, and an eye to say the row opens that document. */
.qa-sim-pct { font-size: 11px; font-weight: 600; color: var(--color-text-secondary); }
.qa-sim-eye { font-size: 13px; color: var(--color-brand); margin-left: 2px; }

/* Pop-up titles that hold a long name with no spaces (a scanner file name such as
   "Republic of the Philippines_20261103_194449_0000.pdf") break inside the box,
   and the close button stays in its corner (full browser test, 2026-11-11). */
.modal-header { gap: 8px; }
.modal-header .modal-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.modal-header .modal-title.text-truncate { overflow-wrap: normal; word-break: normal; }
.modal-header .btn-close { flex-shrink: 0; margin-left: auto; align-self: flex-start; }

/* The floating chat button (56 px, 28 px from the bottom) sat over the last
   row of short pages for good -- Recently Deleted's View and Delete, the
   Archive's last row. Room at the end of every page lets that row scroll
   clear of it (full browser test, 2026-11-11). Print keeps its own padding. */
@media screen { body:has(#qaDockFab) .main-content { padding-bottom: 96px; } }
/* ...and inside the pop-up: "File: <long name>", "Into: <long path>". */
.qa-modal-compact { max-width: 440px; }
.qa-modal-compact .modal-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; min-width: 0; }
/* The compact confirmation (window.qaConfirm, js/main.js, 2026-11-15): discard
   changes, delete, revoke. Small, flat, one question and two buttons. */
.qa-confirm-dialog { max-width: 400px; }
.qa-confirm .modal-content { border: 0; border-radius: 12px; padding: 16px 16px 12px; }
.qa-confirm-main { display: flex; gap: 12px; align-items: flex-start; }
.qa-confirm-ico { flex: none; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center;
    justify-content: center; font-size: 17px; background: var(--color-brand-light); color: var(--color-brand); }
.qa-confirm.is-danger .qa-confirm-ico { background: var(--color-danger-light); color: var(--color-danger); }
.qa-confirm-text { min-width: 0; }
.qa-confirm-title { font-size: 15px; font-weight: 700; line-height: 1.35; margin: 2px 0 4px; overflow-wrap: anywhere; }
.qa-confirm-body { font-size: 13px; line-height: 1.5; color: var(--color-text-muted); margin: 0; }
.qa-confirm-body[hidden] { display: none; }
.qa-confirm-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.qa-confirm-foot .btn { min-width: 96px; }
/* The Repository's compact viewer (#qaDocViewModal, js/doc-view.js, 2026-11-15):
   the file's details beside a scrolling preview, sized to the content. */
.qa-view-dialog { max-width: min(1040px, calc(100vw - 32px)); }
.qa-view .modal-content { border: 0; border-radius: 12px; overflow: hidden; height: min(84vh, 820px); display: flex; flex-direction: column; }
.qa-view-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--card-border, #e5e7eb); }
.qa-view-ico { flex: none; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--color-brand-light); color: var(--color-brand); font-size: 16px; }
.qa-view-heading { flex: 1 1 auto; min-width: 0; line-height: 1.2; }
.qa-view-kicker { display: block; font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--color-brand); }
.qa-view-title { font-size: 14px; font-weight: 700; margin: 1px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-view-sub { display: block; font-size: 12px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-view-sub:empty { display: none; }
.qa-view-body { flex: 1 1 auto; min-height: 0; display: flex; }
.qa-view-side { flex: 0 0 236px; display: flex; flex-direction: column; gap: 12px; padding: 12px 14px; overflow-y: auto;
    border-right: 1px solid var(--card-border, #e5e7eb); }
.qa-view-meta { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.qa-view-meta > div[hidden] { display: none; }
.qa-view-meta dt { font-size: 11px; font-weight: 600; color: var(--color-text-muted); margin: 0; }
.qa-view-meta dd { font-size: 13px; margin: 0; overflow-wrap: anywhere; }
.qa-view-actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.qa-view-actions .btn { text-align: left; }
.qa-view-actions [hidden] { display: none; }
.qa-view-preview { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--color-canvas, #f4f5f7); }
.qa-view-frame { flex: 1 1 auto; width: 100%; border: 0; display: block; }
/* Zoom (pictures, sheets, text) and the "cannot be shown here" panel (2026-11-16). */
.qa-view-zoom { display: inline-flex; align-items: center; gap: 4px; }
.qa-view-zoom[hidden] { display: none; }
.qa-view-zoom .btn { padding: 2px 8px; }
.qa-view-zoom-val { font-size: 12px; min-width: 40px; text-align: center; color: var(--color-text-muted); }
.qa-view-none { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: 24px; text-align: center; color: var(--color-text-secondary, #4b5563); }
.qa-view-none[hidden], .qa-view-frame[hidden], .qa-view-foot[hidden] { display: none; }
.qa-view-none i { font-size: 34px; color: var(--color-text-muted); }
.qa-view-none p { margin: 0; font-size: 13px; }
.qa-view-foot { font-size: 12px; color: var(--color-text-muted); padding: 6px 14px; border-top: 1px solid var(--card-border, #e5e7eb); background: var(--color-surface, #fff); }
@media (max-width: 767.98px) {
    .qa-view .modal-content { height: calc(100dvh - 24px); }
    .qa-view-body { flex-direction: column; }
    .qa-view-side { flex: none; max-height: 34vh; border-right: 0; border-bottom: 1px solid var(--card-border, #e5e7eb); }
    .qa-view-actions { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
}
/* User Management: View pop-up (templates/accounts/_user_detail_panel.html). */
.qa-modal-user { max-width: 880px; }
/* Wider (2026-11-16): details on the left, Recent activity on the right in a
   list that scrolls on its own; stacked on a phone. */
.ud-pop-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 20px; }
.ud-pop-side { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid var(--color-border); padding-left: 20px; }
.ud-pop-side .ud-pop-acts-head { border-top: 0; padding-top: 0; }
.ud-pop-acts-n { font-weight: 500; text-transform: none; letter-spacing: 0; margin-left: 4px; }
.ud-pop-side .ud-pop-acts { height: 340px; overflow-y: auto; overscroll-behavior: contain; margin-bottom: 0; padding-right: 4px; }
.ud-pop-grid + .ud-pop-foot { margin-top: 14px; }
@media (max-width: 767.98px) {
    .ud-pop-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .ud-pop-side { border-left: 0; padding-left: 0; }
    .ud-pop-side .ud-pop-acts-head { border-top: 1px solid var(--color-border); padding-top: 10px; }
    .ud-pop-side .ud-pop-acts { height: auto; max-height: 260px; }
}
.ud-pop-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.ud-pop-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-flex;
    align-items: center; justify-content: center; font-weight: 700; background: var(--color-brand-light); color: var(--color-brand); }
.ud-pop-who { min-width: 0; display: flex; flex-direction: column; }
.ud-pop-who strong { font-size: 15px; overflow-wrap: anywhere; }
.ud-pop-sub { font-size: 12px; color: var(--color-text-muted); }
.ud-pop-chips { display: flex; gap: 6px; margin-top: 4px; }
.ud-pop-chip { font-size: 11px; font-weight: 600; background: var(--color-overlay); color: var(--color-text-secondary); }
.ud-pop-chip.is-on { background: var(--color-success-light); color: var(--color-success-text); }
.ud-pop-chip.is-off { background: var(--color-danger-light); color: var(--color-danger); }
.ud-pop-rows { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: 13px; }
.ud-pop-rows dt { font-weight: 500; color: var(--color-text-muted); }
.ud-pop-rows dd { margin: 0; color: var(--color-text-primary); overflow-wrap: anywhere; }
.ud-pop-acts-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--color-text-muted);
    border-top: 1px solid var(--color-border); padding-top: 10px; margin-bottom: 6px; }
.ud-pop-acts { list-style: none; margin: 0 0 12px; padding: 0; font-size: 12.5px; }
.ud-pop-acts li { display: flex; gap: 8px; align-items: center; padding: 4px 0; white-space: nowrap; overflow: hidden; }
.ud-pop-when { color: var(--color-text-muted); flex-shrink: 0; width: 118px; }   /* fits "Nov 16, 11:25 AM" (it ran into the badge at 92px) */
.ud-pop-acts .audit-action-badge { padding: 1px 7px; font-size: 10.5px; flex-shrink: 0; }
.ud-pop-desc { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ud-pop-foot { display: flex; gap: 8px; border-top: 1px solid var(--color-border); padding-top: 10px; }
.modal-body { overflow-wrap: break-word; }
/* Document details (templates/documents/detail_panel.html, 2026-11-16): a
   summary, a duplicate banner when one is open, tabs, and compact two-column
   facts. Flat: borders and tints, no shadows stacked card on card. */
.dp { font-size: 13px; }
.dp-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 14px; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface); }
.dp-head-main { flex: 1 1 260px; min-width: 0; }
.dp-title { font-size: 14px; font-weight: 600; color: var(--color-text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-file { font-size: 12px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.dp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border: 1px solid var(--color-border); border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--color-text-secondary); background: var(--color-overlay); line-height: 1.6; }
.dp-chip-type { background: hsl(220, 20%, 20%); color: #fff; border-color: transparent; }
.dp-chip-ok { background: var(--color-success-light); color: var(--color-success-text); border-color: transparent; }
.dp-chip-bad { background: var(--color-danger-light); color: var(--color-danger); border-color: transparent; }
.dp-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dp-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 10px; padding: 10px 14px; border: 1px solid var(--color-warning); border-radius: 12px; background: var(--color-warning-light); }
.dp-banner-text { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.dp-banner-text > .bi { font-size: 18px; color: var(--color-warning-text); }
.dp-banner-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dp-muted { color: var(--color-text-muted); font-size: 12px; }
.dp-tabs { display: flex; gap: 2px; margin: 12px 0 0; border-bottom: 1px solid var(--color-border); overflow-x: auto; scrollbar-width: none; }
.dp-tabs::-webkit-scrollbar { display: none; }
.dp-tab { flex-shrink: 0; border: 0; background: none; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--color-text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.dp-tab:hover { color: var(--color-text-primary); }
.dp-tab.is-active { color: var(--color-brand); border-bottom-color: var(--color-brand); }
.dp-tab:focus-visible { outline: 2px solid var(--color-brand); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.dp-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 3px; border-radius: 999px; background: var(--color-overlay); color: var(--color-text-secondary); font-size: 11px; text-align: center; }
.dp-count-warn { background: var(--color-warning-light); color: var(--color-warning-text); }
.dp-pane { padding: 12px 2px 2px; }
.dp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 0; }
.dp-grid > div { min-width: 0; }
.dp-grid .dp-wide { grid-column: 1 / -1; }
.dp-grid dt, .dp-label { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--color-text-muted); margin: 0 0 2px; }
.dp-grid dd { margin: 0; color: var(--color-text-primary); overflow-wrap: anywhere; }
.dp-desc { font-size: 12.5px; line-height: 1.45; }
.dp-section-foot { margin-top: 8px; font-size: 11.5px; color: var(--color-text-muted); }
.dp-problems { margin-top: 12px; border: 1px solid var(--color-danger-light); border-radius: 10px; }
.dp-problem { display: flex; gap: 10px; align-items: baseline; padding: 7px 12px; border-top: 1px solid var(--color-danger-light); font-size: 12.5px; }
.dp-problem:first-child { border-top: 0; }
.dp-problem-k { flex-shrink: 0; width: 120px; font-weight: 600; color: var(--color-text-secondary); }
.dp-tags { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--color-border); }
.dp-tags-head { display: flex; align-items: center; gap: 8px; }
.dp-tags-head .dp-label { margin: 0; }
.dp-tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.dp-tag-form:not([hidden]) { display: flex; gap: 4px; margin-top: 8px; }
.dp-link { border: 0; background: none; padding: 0; font-size: 12px; font-weight: 600; color: var(--color-brand); cursor: pointer; }
.dp-link:hover { text-decoration: underline; }
.dp-sim-summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding-bottom: 8px; font-size: 12px; border-bottom: 1px solid var(--color-border); }
.dp-sim-summary .dp-label { flex-basis: 100%; }
.dp-sim-fold > summary { font-size: 12px; cursor: pointer; color: var(--color-text-secondary); padding: 8px 0; }
.dp-sim-list .list-group-item { padding-left: 4px !important; padding-right: 4px !important; }
.dp-versions { list-style: none; margin: 0 0 10px; padding: 0; }
.dp-versions li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.dp-version-form { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 10px; }
@media (max-width: 575.98px) {
    .dp-grid { grid-template-columns: minmax(0, 1fr); }
    .dp-actions { width: 100%; }
    .dp-problem { flex-direction: column; gap: 2px; }
    .dp-problem-k { width: auto; }
}
/* Finger-sized on touch screens of any width (a tablet in landscape included). */
@media (pointer: coarse) { .repo-sort-btn, .acc-comments, .qa-batch-close, .qa-thread-del, .acc-tool { min-height: 32px; min-width: 32px; } }
/* Where the chat button is raised above sticky form buttons (Upload Document, phones), the
   room at the end is taller, so Cancel ends above the button rather than under it. */
@media screen and (max-width: 767.98px) { body:has(.qa-form-actions):has(#qaDockFab) .main-content { padding-bottom: 168px; } }

/* A control just clicked shows no tooltip until the pointer leaves it (js/tooltips.js, 2026-11-12). */
.qa-tip-off::after,
.qa-tip-off:hover::after,
.qa-tip-off:focus-visible::after { display: none !important; }
