/* UAT round 2 theme, taken from the round 2 mock-ups ("Dashboard with Aging V2", "Q-Tracker Visuals V2"): deep navy
   sidebar, cool grey-blue page, white rounded cards, KPMG blue #00338D as the primary colour, slate text, line icons
   (apps/core/icons.py). The THK logo stays in the sidebar. */
:root { --qt-night: #0B2241; --qt-night-2: #07162B; --qt-blue: #00338D; --qt-mid: #00338D; --qt-light: #38BDF8;
        --qt-bg: #E8EEF5; --qt-link: #1D4ED8; --qt-tint: #EFF6FF; --qt-accent-tint: #EFF6FF; --qt-muted: #64748B;
        --qt-border: #E2E8F0; --qt-ink: #0F172A; --qt-surface-2: #F8FAFC;
        --qt-success: #047857; --qt-danger: #BE123C; --qt-highlight: #6D28D9; --qt-warn: #EA580C;
        --qt-radius: .75rem; --qt-shadow: 0 1px 2px rgba(15, 23, 42, .05);
        --qt-shadow-hover: 0 8px 18px -6px rgba(11, 34, 65, .16);
        --bs-primary: #00338D; --bs-primary-rgb: 0, 51, 141; --bs-link-color: #1D4ED8; --bs-link-color-rgb: 29, 78, 216;
        --bs-link-hover-color: #00338D; --bs-link-hover-color-rgb: 0, 51, 141; --bs-body-color: #0F172A;
        --bs-body-color-rgb: 15, 23, 42; --bs-secondary-color: #64748B; --bs-border-color: #E2E8F0;
        --bs-danger: #DC2626; --bs-danger-rgb: 220, 38, 38; --bs-success: #059669; --bs-success-rgb: 5, 150, 105;
        --bs-info: #0284C7; --bs-info-rgb: 2, 132, 199; --bs-warning: #F59E0B; --bs-warning-rgb: 245, 158, 11;
        --bs-focus-ring-color: rgba(0, 51, 141, .25); --bs-border-radius: .5rem; }
.btn-primary { --bs-btn-bg: #00338D; --bs-btn-border-color: #00338D; --bs-btn-hover-bg: #002A75;
  --bs-btn-hover-border-color: #002A75; --bs-btn-active-bg: #0B2241; --bs-btn-active-border-color: #0B2241;
  --bs-btn-disabled-bg: #00338D; --bs-btn-disabled-border-color: #00338D; }
.btn-outline-primary { --bs-btn-color: #00338D; --bs-btn-border-color: #BFDBFE; --bs-btn-bg: #fff; --bs-btn-hover-bg: #EFF6FF;
  --bs-btn-hover-color: #00338D; --bs-btn-hover-border-color: #93C5FD; --bs-btn-active-bg: #DBEAFE;
  --bs-btn-active-color: #00338D; --bs-btn-active-border-color: #93C5FD; }
.btn-outline-secondary { --bs-btn-color: #334155; --bs-btn-border-color: #CBD5E1; --bs-btn-bg: #fff; --bs-btn-hover-bg: #F1F5F9;
  --bs-btn-hover-color: #0F172A; --bs-btn-hover-border-color: #94A3B8; --bs-btn-active-bg: #E2E8F0;
  --bs-btn-active-color: #0F172A; }
.text-bg-info { color: #fff !important; }
.nav-pills { --bs-nav-pills-link-active-bg: #00338D; }
.page-item.active .page-link, .pagination { --bs-pagination-active-bg: #00338D; --bs-pagination-active-border-color: #00338D;
  --bs-pagination-color: #1D4ED8; --bs-pagination-border-radius: .5rem; }
/* Compact scale: 14px base (Bootstrap sizes and spacing are rem, so everything follows). Percent keeps the
   user's browser font setting. */
html { font-size: 87.5%; }
body { background: var(--qt-bg); min-height: 100vh; }
/* Menu. From 992px: a sidebar that stays in place while the page scrolls. Below: hidden, and slid in from the left by
   the top bar's button (Bootstrap offcanvas-lg on .qt-side-wrap). A long menu scrolls by itself. */
.qt-side-wrap { --bs-offcanvas-width: 260px; --bs-offcanvas-bg: var(--qt-night); flex: none; }
.qt-side { width: 180px; font-size: .9rem; background: var(--qt-night); color: #fff; height: 100%; overflow-y: auto; }
@media (min-width: 992px) { .qt-side-wrap { position: sticky; top: 0; height: 100vh; } }
@media (max-width: 991.98px) {
  .qt-side { width: 100%; flex: 1 1 auto; height: auto; min-height: 0; font-size: 1rem; }
  .qt-side a { padding: .5rem 1rem; }  /* bigger touch targets */
}
.qt-topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem;
             padding: .35rem .75rem; background: var(--qt-night); color: #fff; }
.qt-menu-btn { background: none; border: 0; color: #fff; padding: .4rem; border-radius: .375rem; line-height: 0; }
.qt-menu-btn:hover { background: rgba(255,255,255,.1); }
.qt-menu-btn:focus-visible { outline: 2px solid var(--qt-light); outline-offset: 1px; }
.qt-topbar-brand { color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.qt-topbar-brand:hover { color: #fff; }
.min-w-0 { min-width: 0; }
.qt-side a { color: #dce6f5; text-decoration: none; display: block; padding: .28rem .85rem; border-left: 3px solid transparent;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-side a:hover, .qt-side a.active { background: rgba(255,255,255,.08); color: #fff; border-left-color: var(--qt-light); }
.qt-side .section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; opacity: .6; padding: .65rem .85rem .15rem; }
.qt-main { flex: 1; min-width: 0; }
.tile { border: 0; border-left: 4px solid var(--qt-mid); }
.tile .num { font-size: 1.5rem; font-weight: 600; color: var(--qt-blue); }
.status-badge { font-size: .75rem; }
.rich-view { background: #fff; border: 1px solid #dee2e6; border-radius: .375rem; padding: .5rem .75rem; min-height: 2.5rem; }
.rich-view table { border-collapse: collapse; } .rich-view td, .rich-view th { border: 1px solid #ccc; padding: 2px 6px; }
.event { border-left: 3px solid var(--qt-light); padding-left: .75rem; margin-bottom: 1rem; }
table.qt td, table.qt th { vertical-align: middle; }
/* Screen-reader-only text in a table header is positioned absolutely; without this it escapes the table's scroll box
   and makes the whole page scroll sideways on phones. */
.table-responsive { position: relative; }
.qt-logo-preview img { max-height: 48px; max-width: 220px; background: var(--qt-night); padding: .4rem .6rem; border-radius: .375rem; }
.qt-brand .qt-firm { font-size: .75rem; opacity: .85; margin-top: .25rem; }
.qt-logo { max-width: 100%; max-height: 36px; display: block; }
.qt-logo-thk { max-height: 30px; width: auto; }
.qt-login-logo { max-height: 64px; max-width: 240px; }
.qt-login-card { border-top: 4px solid var(--qt-blue); }
.rich-editor { background: #fff; margin-bottom: .25rem; }
.rich-editor .ql-container { min-height: 7rem; font-family: inherit; font-size: .95rem; }
.rich-editor .ql-editor { min-height: 7rem; }
.rich-view p:last-child { margin-bottom: 0; }
/* Dashboard KPIs */
.dash-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #5a6270; margin: 0 0 .5rem; }
.stat { border: 0; border-left: 4px solid var(--qt-mid); color: inherit; }
a.stat:hover { box-shadow: 0 0 0 1px var(--qt-light); }
.stat-alert { border-left-color: #d03b3b; }
.stat-label { font-size: .8rem; color: #5a6270; }
.stat-value { font-size: 1.5rem; font-weight: 600; color: var(--qt-blue); line-height: 1.2; }
.stat-alert .stat-value { color: #b42318; }
.stat-suffix { font-size: 1rem; margin-left: .1rem; }
.stat-note { font-size: .75rem; color: #6c757d; }
.hero { font-size: 2.5rem; font-weight: 600; color: var(--qt-blue); line-height: 1.1; }
.meter { height: .5rem; background: #d6e4f5; border-radius: 4px; overflow: hidden; }
.meter > div { height: 100%; background: var(--qt-mid); border-radius: 4px; min-width: 2px; }
.dash-table .num, .dash-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Control History */
@media (min-width: 992px) {
  .history-pane { display: flex; flex-direction: column; min-height: 0; }
  #history-list .history-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
  #history-list nav[aria-label=Pages] { flex: none; margin-bottom: 0; }
  .history-detail { overflow-y: auto; }
  .history-detail > .card { flex: none; }
}
.history-list .list-group-item { border-left: 3px solid transparent; }
.history-list .list-group-item.active { background: #eaf2fb; color: inherit; border-color: #dee2e6; border-left-color: var(--qt-mid); }
.history-list .hl-name { color: #495057; }
.history-list .hl-meta { color: #6c757d; }
.hd-stat { background: var(--qt-bg); border-radius: .375rem; padding: .5rem .75rem; height: 100%; }
.hd-val { font-size: 1.35rem; font-weight: 600; color: var(--qt-blue); }
.hd-val.hd-small { font-size: .95rem; }
/* Imported SharePoint history */
.legacy-timeline { border-left: 2px solid #d6e4f5; padding-left: 1rem; }
.lt-entry { position: relative; background: #fff; border: 1px solid #e3e8ef; border-radius: .375rem; padding: .5rem .75rem; margin-bottom: .6rem; }
.lt-entry::before { content: ""; position: absolute; left: calc(-1rem - 6px); top: .85rem; width: 10px; height: 10px; border-radius: 50%; background: var(--qt-mid); }
.lt-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; }
.lt-title { font-weight: 600; color: var(--qt-blue); }
.lt-meta { font-size: .8rem; color: #6c757d; }
.lt-note { font-size: .875rem; margin-top: .25rem; }
.lt-note p:last-child { margin-bottom: 0; }
.lt-table { margin-top: .4rem; font-size: .85rem; }
.lt-table th[scope=row] { width: 32%; font-weight: 600; color: #495057; background: #f8fafc; }
.lt-table td p:last-child, .lt-table td ol:last-child, .lt-table td ul:last-child { margin-bottom: 0; }
.legacy-timeline.compact .lt-entry { padding: .35rem .6rem; margin-bottom: .4rem; }
.legacy-timeline.compact .lt-title { font-size: .85rem; }
.lt-raw summary { cursor: pointer; color: #6c757d; }
/* File lists */
.file-row { display: flex; align-items: center; gap: .65rem; padding: .45rem .25rem; border-bottom: 1px solid #eef1f5; }
.file-row:last-child { border-bottom: 0; }
.file-icon { font-size: 1.35rem; width: 1.75rem; text-align: center; flex: none; }
.file-main { flex: 1; min-width: 0; }
.file-name { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: .75rem; color: #6c757d; }
.file-actions { flex: none; display: flex; gap: .35rem; }
@media (max-width: 576px) { .file-actions .btn-outline-secondary { display: none; } }
/* Printing: only the page content (the report), none of the app's navigation or buttons */
.print-only { display: none; }
@media print {
  @page { margin: 14mm 12mm; }
  body { background: #fff !important; }
  .qt-side, .qt-side-wrap, .qt-topbar, .no-print, .alert, .file-actions, .lt-raw, .btn { display: none !important; }
  .qt-wrap { display: block !important; }
  .qt-main { padding: 0 !important; }
  .print-only { display: block !important; }
  .print-banner { font-size: .75rem; color: #555; margin-bottom: .5rem; }
  .card, .lt-entry { border: 1px solid #bbb !important; box-shadow: none !important; }
  .lt-entry, .file-row, .report-summary { break-inside: avoid; }
  .legacy-timeline { border-left-color: #999; }
  .lt-entry::before { background: #666 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit !important; text-decoration: none !important; }
  h2.h6 { break-after: avoid; }
}
/* One content width for every page */
.qt-content { max-width: 1440px; }
.form-actions { display: flex; gap: .5rem; align-items: center; margin-top: .25rem; }
/* Dashboard work queue */
.work-queue td, .work-queue th { padding-left: .75rem; padding-right: .75rem; }
.work-queue .wq-name { max-width: 22rem; }
.work-queue tr.wq-overdue td:first-child { box-shadow: inset 4px 0 0 #d03b3b; }
.work-queue tr.wq-soon td:first-child { box-shadow: inset 4px 0 0 #fab219; }
.wq-kind { font-size: .8rem; padding: .1rem .45rem; border-radius: .25rem; background: #eef2f7; white-space: nowrap; }
.wq-returned { background: #fde8e8; color: #8a1c1c; }
.wq-review, .wq-test, .wq-decide { background: #e7f0fb; color: #0b3d7a; }

/* Dashboard: decisions and trend chart */
.decision { padding: .6rem 0; border-top: 1px solid #e5e8ec; }
.decision:first-of-type { border-top: 0; }
.trend-chart { width: 100%; height: auto; display: block; overflow: visible; }
.trend-grid { stroke: #e5e8ec; stroke-width: 1; }
.trend-axis { font-size: 11px; fill: #6c757d; }
.trend-due { fill: none; stroke: #8a94a3; stroke-width: 2; stroke-dasharray: 5 4; }
.trend-done { fill: none; stroke: #005EB8; stroke-width: 2; }
.trend-dot-due { fill: #8a94a3; stroke: #fff; stroke-width: 2; }
.trend-dot-done { fill: #005EB8; stroke: #fff; stroke-width: 2; }
.trend-hit { fill: transparent; }
.trend-end { font-size: 11px; font-weight: 600; fill: #343a40; }
.trend-key { display: inline-block; width: 18px; height: 0; vertical-align: middle; border-top: 2px solid #005EB8; }
.trend-key-due { border-top: 2px dashed #8a94a3; }

/* Compact main area: tighter cards, tables, forms and vertical rhythm on every page */
.qt-main .card { --bs-card-spacer-y: .65rem; --bs-card-spacer-x: .85rem; --bs-card-cap-padding-y: .4rem;
                 --bs-card-cap-padding-x: .85rem; }
.qt-main .table { --bs-table-cell-padding-y: .35rem; --bs-table-cell-padding-x: .5rem; }
.qt-main .table-sm { --bs-table-cell-padding-y: .2rem; --bs-table-cell-padding-x: .4rem; }
.qt-main .table { margin-bottom: .75rem; }
.qt-main .form-control, .qt-main .form-select { padding-top: .3rem; padding-bottom: .3rem; }
.qt-main .form-label { margin-bottom: .2rem; }
.qt-main .btn:not(.btn-sm):not(.btn-lg):not(.btn-link) { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .7rem; }
.qt-main .alert { --bs-alert-padding-y: .5rem; --bs-alert-margin-bottom: .75rem; }
.qt-main .mb-4 { margin-bottom: 1rem !important; }
.qt-main .mb-3 { margin-bottom: .75rem !important; }
.qt-main .mt-4 { margin-top: 1rem !important; }
.qt-main .g-4 { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }
.qt-main .g-3 { --bs-gutter-x: .75rem; --bs-gutter-y: .75rem; }
.qt-main h2, .qt-main .h5 { margin-bottom: .4rem; }

/* Header user menu */
.qt-user { display: flex; align-items: center; gap: .5rem; padding: .15rem .35rem; color: inherit; border-radius: .5rem; }
.qt-user:hover, .qt-user[aria-expanded="true"] { background: #e9eef6; }
.qt-avatar { width: 2rem; height: 2rem; border-radius: 50%; background: var(--qt-blue); color: #fff; font-size: .75rem;
             font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.qt-user-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.qt-user-name { font-weight: 600; font-size: .85rem; color: #212529; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-user-role { font-size: .72rem; color: #6c757d; }
.qt-user-menu { min-width: 18rem; }
@media (max-width: 576px) { .qt-user-text { display: none; } }

/* Master "View as" (read-only): forms stay visible but cannot be submitted; the server refuses them too. */
.view-as .qt-main form[method="post" i]:not(.qt-view-as) button:not([type="button"]),
.view-as .qt-main form[method="post" i]:not(.qt-view-as) input[type="submit"] { pointer-events: none; opacity: .45; }
.qt-view-as .dropdown-item.active { background: var(--qt-tint, #edf0f5); color: inherit; font-weight: 600; }

/* Audit trail: who each step went to, and returns highlighted (UAT remark) */
.lt-assigned { font-size: .8rem; color: var(--qt-muted, #455362); }
.lt-return { background: #fbeef3; border-radius: .375rem; }
.lt-return .lt-title, .lt-return .lt-assigned strong { color: #b23163; }
.lt-return::before { background: #b23163 !important; }

/* People picker (data-people-select in app.js) */
.people-select { position: relative; padding: .2rem .4rem; cursor: text; }
.people-chips { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.people-chip { font-weight: 500; display: inline-flex; align-items: center; gap: .25rem; }
.people-chip .btn-close { width: .5em; height: .5em; }
.people-input { border: 0; outline: 0; flex: 1; min-width: 10rem; padding: .15rem; background: transparent; }
.people-list { position: absolute; z-index: 1050; left: 0; right: 0; top: 100%; max-height: 16rem; overflow-y: auto;
  background: #fff; border: 1px solid #dee2e6; border-radius: .375rem; box-shadow: 0 .25rem .75rem rgba(5,32,68,.12); margin: 2px 0 0; }
.people-item { padding: .3rem .6rem; cursor: pointer; }
.people-item:hover, .people-item.active { background: var(--qt-accent-tint); }

/* Action Centre component tiles (SoQM Components merged in, UAT round 2) */
.ac-tile { min-width: 7.5rem; }
.ac-tile-on { border-left-color: var(--qt-light); background: var(--qt-accent-tint); }

/* Control performance page: work queue and backlog (UAT round 2) */
.perf-facts dt { font-weight: 500; color: var(--qt-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.perf-facts dd { margin-bottom: .25rem; }
.perf-card { border-left: 4px solid var(--qt-mid); }
.perf-card-first { border-left-color: var(--qt-light); }
.perf-card-locked { border-left-color: #ced4da; background: #f8f9fa; opacity: .85; }
.perf-year > summary { cursor: pointer; list-style-position: inside; }
.queue-locked td { color: var(--qt-muted); background: #f8f9fa; }

/* Backlog page (UAT round 2) */
.backlog-trend { height: 120px; }
.backlog-bar { background: var(--qt-mid); border-radius: 2px 2px 0 0; min-height: 2px; margin: 0 auto; width: 70%; }
.backlog-week { font-size: .65rem; }


/* ===== UAT round 2 theme (mock-ups): layout, sidebar with icons, cards, tables, badges ===== */
body { background: var(--qt-bg); color: var(--qt-ink); -webkit-font-smoothing: antialiased; }
/* Icons */
.qi { width: 1.05em; height: 1.05em; flex: none; vertical-align: -.15em; }
.btn .qi { margin-right: .3rem; }
.btn .qi:only-child { margin-right: 0; }
/* Sidebar */
.qt-side-wrap { --bs-offcanvas-bg: var(--qt-night); }
.qt-side { width: 220px; background: linear-gradient(180deg, #0C2547 0%, var(--qt-night-2) 100%); padding-bottom: .75rem; }
.qt-side .qt-brand { padding: .9rem 1rem .75rem !important; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: .35rem; }
.qt-side a { display: flex; align-items: center; gap: .6rem; margin: 1px .5rem; padding: .42rem .65rem; border-radius: .5rem;
             border-left: 0; color: #CBD5E1; font-weight: 500; transition: background-color 140ms ease, color 140ms ease; }
.qt-side a .qi { width: 1.1rem; height: 1.1rem; opacity: .85; }
.qt-side a span { overflow: hidden; text-overflow: ellipsis; }
.qt-side a:hover { background: rgba(255,255,255,.07); color: #fff; }
.qt-side a.active { background: rgba(56,189,248,.14); color: #fff; box-shadow: inset 3px 0 0 var(--qt-light); }
.qt-side a.active .qi { opacity: 1; color: var(--qt-light); }
.qt-side a .badge { margin-left: auto; }
.qt-side .section { padding: .9rem 1.15rem .3rem; font-size: .66rem; font-weight: 600; letter-spacing: .1em; opacity: .5; }
.qt-topbar { background: var(--qt-night); }
/* Page header */
.qt-pagehead { padding-bottom: .65rem; margin-bottom: .9rem; border-bottom: 1px solid #D5DEE9; }
.qt-pagehead h1 { font-weight: 700; letter-spacing: -.01em; color: var(--qt-ink); }
.qt-user:hover, .qt-user[aria-expanded="true"] { background: #DCE5F0; }
.qt-avatar { background: linear-gradient(135deg, #00338D, #1D4ED8); }
.dropdown-menu { --bs-dropdown-border-color: var(--qt-border); --bs-dropdown-border-radius: .75rem;
  --bs-dropdown-link-active-bg: #EFF6FF; --bs-dropdown-link-active-color: #00338D; box-shadow: 0 12px 28px -8px rgba(11,34,65,.22); }
.dropdown-item { display: flex; align-items: center; gap: .5rem; }
/* Cards */
.qt-main .card { border: 1px solid var(--qt-border); border-radius: var(--qt-radius); box-shadow: var(--qt-shadow);
                 --bs-card-inner-border-radius: calc(var(--qt-radius) - 1px); }
.qt-main .card-header { background: var(--qt-surface-2); }
.tile, .stat, .perf-card { border-left-width: 1px; border-left-color: var(--qt-border); }
.stat { position: relative; transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease; }
.stat::before { content: ""; position: absolute; left: 0; top: .75rem; bottom: .75rem; width: 3px; border-radius: 0 3px 3px 0;
                background: var(--qt-mid); }
.stat-alert::before { background: #DC2626; }
a.stat:hover, a.tile:hover, a.ac-tile:hover { transform: translateY(-1.5px); box-shadow: var(--qt-shadow-hover); border-color: #BFDBFE; }
.stat-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--qt-muted); }
.stat-value { font-size: 1.65rem; font-weight: 700; color: var(--qt-ink); }
.stat-alert .stat-value { color: #B91C1C; }
.stat-note { color: var(--qt-muted); }
.hero { color: var(--qt-ink); font-weight: 700; }
.tile .num { color: var(--qt-ink); font-weight: 700; }
.meter { background: #DBEAFE; border-radius: 99px; }
.meter > div { background: linear-gradient(90deg, #00338D, #2563EB); border-radius: 99px; }
.dash-h { color: var(--qt-muted); font-weight: 700; letter-spacing: .08em; display: flex; align-items: center; gap: .4rem; }
.ac-tile-on { background: #EFF6FF; border-color: #93C5FD; box-shadow: 0 0 0 2px #00338D; }
.perf-card { border-left: 1px solid var(--qt-border); position: relative; }
.perf-card::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 4px;
                     border-radius: var(--qt-radius) 0 0 var(--qt-radius); background: var(--qt-mid); }
.perf-card-first::before { background: var(--qt-light); }
.perf-card-locked { background: var(--qt-surface-2); }
.perf-card-locked::before { background: #CBD5E1; }
/* Tables */
.qt-main .table { --bs-table-border-color: #EEF2F7; --bs-table-hover-bg: #F8FAFC; }
.qt-main .table > thead th { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
                             color: var(--qt-muted); background: var(--qt-surface-2); border-bottom: 1px solid var(--qt-border);
                             white-space: nowrap; }
.table.bg-white { border-radius: var(--qt-radius); overflow: hidden; box-shadow: var(--qt-shadow); }
/* Badges and status pills */
.badge { border-radius: 99px; font-weight: 600; letter-spacing: .01em; }
.status-badge { padding: .3em .65em; }
.text-bg-success { background: #ECFDF5 !important; color: #047857 !important; box-shadow: inset 0 0 0 1px #A7F3D0; }
.text-bg-warning { background: #FFFBEB !important; color: #92400E !important; box-shadow: inset 0 0 0 1px #FCD34D; }
.text-bg-danger { background: #FFF1F2 !important; color: #BE123C !important; box-shadow: inset 0 0 0 1px #FECDD3; }
.text-bg-info { background: #F0F9FF !important; color: #0369A1 !important; box-shadow: inset 0 0 0 1px #BAE6FD; }
.text-bg-primary { background: #EFF6FF !important; color: #1D4ED8 !important; box-shadow: inset 0 0 0 1px #BFDBFE; }
.text-bg-secondary { background: #F1F5F9 !important; color: #475569 !important; box-shadow: inset 0 0 0 1px #CBD5E1; }
.text-bg-dark { background: #1E293B !important; color: #fff !important; }
.qt-side .badge.text-bg-warning { background: #F59E0B !important; color: #0B2241 !important; box-shadow: none; }
.wq-kind { border-radius: 99px; padding: .15rem .55rem; font-weight: 600; font-size: .75rem; }
/* Forms and alerts */
.form-control, .form-select { border-color: #CBD5E1; }
.form-control:focus, .form-select:focus { border-color: #60A5FA; box-shadow: 0 0 0 .2rem rgba(0, 51, 141, .15); }
.alert { border-radius: var(--qt-radius); border-width: 1px; }
.people-select { border-color: #CBD5E1; }
.people-chip { border-radius: 99px; }
/* History timeline dots in the round 2 colours */
.lt-entry { border-color: var(--qt-border); border-radius: .6rem; }
.legacy-timeline { border-left-color: #DBEAFE; }
.lt-title { color: var(--qt-ink); }
.qi-lg { width: 1.4rem; height: 1.4rem; }
/* The menu is a flex column: its links must keep their height and the menu scroll, not squash (phone menu,
   short screens). Dark, thin scrollbar to match. */
.qt-side > a, .qt-side > .section, .qt-side > .qt-brand { flex: 0 0 auto; }
.qt-side, .qt-side-wrap { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
.qt-side::-webkit-scrollbar { width: 8px; }
.qt-side::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 8px; }
.qt-side::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 991.98px) {
  .qt-side-wrap { --bs-offcanvas-width: 280px; }
  .qt-side { overflow-y: auto; background: linear-gradient(180deg, #0C2547 0%, var(--qt-night-2) 100%); }
  .qt-side a { padding: .55rem .75rem; }
}

/* Digital Control Operator's Program (UAT round 2) */
.cop-steps li { margin-bottom: .35rem; }
.cop-table { table-layout: fixed; min-width: 860px; }
.cop-table th.cop-num, .cop-table td.cop-num { width: 3rem; }
.cop-table th:nth-child(2) { width: 34%; }
.cop-table th:nth-child(4) { width: 9rem; }
.cop-table th:nth-child(5) { width: 11rem; }
.cop-badge { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
             background: #EFF6FF; color: #00338D; font-weight: 700; font-size: .8rem; box-shadow: inset 0 0 0 1px #BFDBFE; }
.cop-done .cop-badge { background: #ECFDF5; color: #047857; box-shadow: inset 0 0 0 1px #A7F3D0; }
.cop-desc { font-size: .85rem; }
.cop-cells { display: grid; grid-template-columns: 1fr 9rem 11rem; gap: .5rem; padding: .35rem .5rem; align-items: start; }
.cop-files .qi, .cop-saved .qi { width: .9rem; height: .9rem; }
.cop-new td { background: var(--qt-surface-2); }

/* History side panel (UAT round 2) */
.hp-panel { --bs-offcanvas-width: 440px; }
.hp-round { position: relative; padding-left: 1.9rem; margin-bottom: 1rem; }
.hp-round::before { content: ""; position: absolute; left: .7rem; top: 1.6rem; bottom: 0; width: 2px; background: #DBEAFE; }
.hp-round-head { display: flex; align-items: center; gap: .5rem; margin-left: -1.9rem; margin-bottom: .5rem; }
.hp-round-num { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #0B2241; color: #fff; font-size: .75rem;
                font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.hp-round-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--qt-muted); }
.hp-current .hp-round-num { background: #BE123C; }
.hp-event { position: relative; background: #fff; border: 1px solid var(--qt-border); border-radius: .6rem; padding: .5rem .65rem;
            margin-bottom: .5rem; font-size: .85rem; }
.hp-event::before { content: ""; position: absolute; left: -1.43rem; top: .8rem; width: 10px; height: 10px; border-radius: 50%;
                    background: #2563EB; box-shadow: 0 0 0 3px #fff; }
.hp-return { background: #FFF1F2; border-color: #FECDD3; }
.hp-return::before { background: #DC2626; }
.hp-title { font-weight: 600; }
.hp-when, .hp-meta { font-size: .75rem; color: var(--qt-muted); }
.hp-to { display: inline-block; margin-left: .25rem; padding: 0 .4rem; border-radius: 99px; background: #EFF6FF; color: #1D4ED8; }
.hp-return .hp-to { background: #FFE4E6; color: #BE123C; }
.hp-note { margin-top: .35rem; padding: .35rem .5rem; background: var(--qt-surface-2); border-radius: .4rem; }
.hp-note p:last-child { margin-bottom: 0; }
.hp-returns-only .hp-event:not(.hp-return) { display: none; }

/* Control Operator review: three outcome cards (UAT round 2, screen 2) */
.outcome-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .6rem; }
.outcome { display: flex; flex-direction: column; gap: .15rem; padding: .75rem .85rem; border: 1px solid var(--qt-border);
           border-radius: .75rem; background: #fff; cursor: pointer; transition: border-color 140ms ease, box-shadow 140ms ease; }
.outcome:hover { border-color: #93C5FD; }
.outcome:has(input:checked) { border-color: #00338D; box-shadow: 0 0 0 2px #00338D; background: #F8FBFF; }
.outcome:has(input:focus-visible) { outline: 2px solid #2563EB; outline-offset: 2px; }
.outcome-icon .qi { width: 1.3rem; height: 1.3rem; }
.outcome-ok .outcome-icon { color: #059669; }
.outcome-back .outcome-icon { color: #EA580C; }
.outcome-remediate .outcome-icon { color: #BE123C; }
.outcome-title { font-weight: 700; }
.outcome-text { font-size: .8rem; color: var(--qt-muted); }
.outcome-to { margin-top: .25rem; font-size: .72rem; font-weight: 600; color: #1D4ED8; }
.next-steps { background: var(--qt-surface-2); border: 1px solid var(--qt-border); border-radius: .75rem; padding: .75rem .85rem; }
.next-steps li { display: flex; gap: .6rem; margin-bottom: .6rem; font-size: .85rem; }
.ns-num { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #E2E8F0; color: #334155; font-weight: 700;
          font-size: .75rem; display: inline-flex; align-items: center; justify-content: center; }
.ns-here { background: #00338D; color: #fff; }
.qt-main .cop-table > thead th { white-space: normal; vertical-align: bottom; }
.cop-table { min-width: 720px; }
.cop-table th:nth-child(4), .cop-table th:nth-child(5) { padding-left: .5rem; }

/* Control Testing Program wizard (UAT round 2, screen 3) */
.ctp-step { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .75rem; border-radius: 99px; background: #fff;
            border: 1px solid var(--qt-border); color: var(--qt-muted); text-decoration: none; font-weight: 600; font-size: .85rem; }
.ctp-step:hover { border-color: #93C5FD; color: #00338D; }
.ctp-step.active { background: #00338D; border-color: #00338D; color: #fff; }
.ctp-step-num { width: 1.35rem; height: 1.35rem; border-radius: 50%; background: #E2E8F0; color: #334155; font-size: .72rem;
                display: inline-flex; align-items: center; justify-content: center; }
.ctp-step.active .ctp-step-num { background: #fff; color: #00338D; }
.ctp-step.done .ctp-step-num { background: #059669; color: #fff; }
.ctp-step-num .qi { width: .8rem; height: .8rem; margin: 0; }
.ctp-review, .ctp-attr { padding-bottom: .75rem; border-bottom: 1px solid #EEF2F7; }
.ctp-checks li { color: var(--qt-muted); margin-bottom: .25rem; }
.ctp-checks li .qi { color: #CBD5E1; }
.ctp-checks li.ok { color: var(--qt-ink); }
.ctp-checks li.ok .qi { color: #059669; }
.ctp-sections .nav-link { font-size: .82rem; }

/* Dashboard (UAT round 2, "Dashboard with Aging V2") */
.dash-progress { display: flex; align-items: center; gap: .4rem; font-size: .75rem; color: var(--qt-muted); }
.dash-progress .meter { width: 7rem; }
.kpi { position: relative; transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease; }
.kpi:hover { transform: translateY(-1.5px); box-shadow: var(--qt-shadow-hover); border-color: #BFDBFE; }
.kpi-active { box-shadow: 0 0 0 2.5px #00338D, 0 8px 18px -4px rgba(0,51,141,.25) !important; }
.kpi-link, a.kpi { color: inherit; display: block; }
.kpi-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--qt-muted); }
.kpi-num { font-size: 1.75rem; font-weight: 800; line-height: 1.05; color: var(--qt-ink); }
.kpi-num-sm { font-size: 1.25rem; color: #334155; }
.kpi-unit { font-size: .72rem; color: var(--qt-muted); }
.kpi-ok .kpi-num { color: #047857; }
.kpi-warn .kpi-num { color: #C2410C; }
.kpi-bad .kpi-num { color: #BE123C; }
.kpi-alert { display: block; padding: .3rem .85rem; border-top: 1px solid var(--qt-border); font-size: .75rem; color: var(--qt-muted);
             text-decoration: none; border-radius: 0 0 var(--qt-radius) var(--qt-radius); }
.kpi-alert.on { background: #FFF1F2; color: #BE123C; font-weight: 600; }
.aging-row { display: grid; grid-template-columns: 7rem 1fr 3rem 6rem; align-items: center; gap: .6rem; padding: .35rem .5rem;
             border-radius: .5rem; color: inherit; text-decoration: none; transition: background-color 140ms ease; }
.aging-row:hover { background: #F8FAFC; box-shadow: 0 0 0 1px #BFDBFE; }
.aging-label { font-size: .85rem; font-weight: 600; }
.aging-bar { height: .6rem; background: #F1F5F9; border-radius: 99px; overflow: hidden; }
.aging-fill { display: block; height: 100%; border-radius: 99px; min-width: 2px; }
.aging-1 { background: #38BDF8; } .aging-2 { background: #F59E0B; } .aging-3 { background: #EA580C; } .aging-4 { background: #DC2626; }
.aging-n { font-weight: 800; text-align: right; }
.pipe-h { font-size: .78rem; font-weight: 700; margin-bottom: .4rem; }
.dash-list > summary { cursor: pointer; list-style-position: inside; }
.dash-ctrl { border-bottom: 1px solid #EEF2F7; padding: .35rem 0; }
.dash-ctrl > summary { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; cursor: pointer; }
.nav-sm .nav-link { font-size: .8rem; }

/* Aging buckets as in the mock-up: tab colours, bars scaled to the largest bucket, the last bucket in red */
.aging-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; padding: .25rem; border-radius: .5rem;
              background: #F1F5F9; border: 1px solid var(--qt-border); }
.aging-tabs .nav-link { width: 100%; padding: .3rem .4rem; border-radius: .4rem; font-size: .78rem; font-weight: 700; color: #475569; }
.aging-tabs .nav-link.active { color: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.15); }
.aging-tabs .aging-tab-all.active { background: #0B2241; }
.aging-tabs .aging-tab-pending.active { background: #EA580C; }
.aging-tabs .aging-tab-partial.active { background: #0284C7; }
.aging-tabs .aging-tab-overdue.active { background: #DC2626; }
.aging-total { font-size: 1.6rem; font-weight: 800; }
.aging-all .aging-total { color: #00338D; } .aging-pending .aging-total { color: #EA580C; }
.aging-partial .aging-total { color: #0284C7; } .aging-overdue .aging-total { color: #DC2626; }
.aging-row { grid-template-columns: 7.5rem 1fr 2.5rem; }
.aging-bar { height: 1.5rem; border-radius: .4rem; border: 1px solid rgba(226,232,240,.7); }
.aging-fill { border-radius: .4rem; transition: width 300ms cubic-bezier(.22,1,.36,1); }
.aging-all .aging-fill { background: #00338D; } .aging-pending .aging-fill { background: #EA580C; }
.aging-partial .aging-fill { background: #0284C7; } .aging-overdue .aging-fill { background: #DC2626; }
.aging-fill.shade-1 { opacity: .35; } .aging-fill.shade-2 { opacity: .65; } .aging-fill.shade-3 { opacity: .92; }
.aging-fill.severe { background: #DC2626 !important; opacity: 1; }
.bucket-active { box-shadow: 0 0 0 2px #00338D; background: #EFF6FF; }
