:root {
  --navy-950:#07111f;--navy-925:#091522;--navy-900:#0b1725;--navy-850:#0f1d2b;
  --panel:#101e2c;--panel-raised:#142536;--panel-hover:#172b3e;--canvas:#0a1522;
  --border:#243649;--border-strong:#30465a;--text:#f3f7fb;--text-soft:#c3cfdb;
  --muted:#8596a8;--accent:#16a8f4;--accent-strong:#078ae2;--accent-soft:#0e3654;
  --success:#32d27d;--success-soft:#123d2d;--warning:#ff9f32;--warning-soft:#492b14;
  --error:#f2636c;--error-soft:#472129;--info:#55aaff;--review:#a979ff;
  --space-1:.25rem;--space-2:.5rem;--space-3:.75rem;--space-4:1rem;--space-5:1.25rem;
  --space-6:1.5rem;--space-8:2rem;--radius-sm:5px;--radius:8px;--radius-lg:11px;
  --shadow:0 14px 38px rgba(0,0,0,.24);--sidebar:250px;--topbar:64px;
  --font-xs:.72rem;--font-sm:.82rem;--font-base:.9rem;--font-lg:1.08rem;--font-xl:1.75rem;
}
*{box-sizing:border-box}html{background:var(--canvas)}html,body{margin:0;min-height:100%;font:14px/1.45 Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--text);background:var(--canvas)}body{overflow-x:hidden}a{color:var(--accent);text-underline-offset:3px}button,input,select,textarea{font:inherit}button,a,summary,label{touch-action:manipulation}:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.skip-link{position:fixed;left:-9999px}.skip-link:focus{left:var(--space-4);top:var(--space-4);background:var(--text);color:var(--navy-950);padding:var(--space-3) var(--space-4);z-index:1000;border-radius:var(--radius-sm)}
.app-shell{display:grid;grid-template-columns:var(--sidebar) minmax(0,1fr);min-height:100vh}.sidebar{position:fixed;inset:0 auto 0 0;width:var(--sidebar);display:flex;flex-direction:column;background:linear-gradient(180deg,var(--navy-950),#081522);border-right:1px solid var(--border);z-index:40}.sidebar-head{height:var(--topbar);display:flex;align-items:center;border-bottom:1px solid var(--border);padding:0 var(--space-4)}.brand{display:flex;align-items:center;gap:var(--space-3);color:var(--text);text-decoration:none;min-width:0}.brand-mark{position:relative;display:grid;place-items:center;width:38px;height:38px;color:#bce9ff;background:linear-gradient(145deg,#07385a,#0a2034);border:1px solid var(--accent);border-radius:10px;box-shadow:0 0 18px rgba(22,168,244,.14)}.brand-mark::before,.brand-mark::after{content:"";position:absolute;background:var(--accent);border-radius:99px}.brand-mark::before{width:4px;height:4px;left:5px;top:7px;box-shadow:24px 16px 0 var(--accent),5px 23px 0 var(--accent)}.brand-mark::after{width:20px;height:1px;transform:rotate(33deg);opacity:.55}.brand-mark span{font-size:.68rem;font-weight:850;letter-spacing:-.04em}.brand-copy{display:grid;line-height:1.05;min-width:0}.brand-copy strong{font-size:1rem;white-space:nowrap}.brand-copy small{margin-top:4px;color:#61c9ff;text-transform:uppercase;letter-spacing:.16em;font-size:.58rem;font-weight:750}.sidebar-close{display:none;margin-left:auto;font-size:1.7rem;color:var(--muted);cursor:pointer}.primary-nav{display:grid;gap:var(--space-1);padding:var(--space-5) var(--space-3)}.primary-nav a{display:flex;align-items:center;gap:var(--space-3);min-height:42px;padding:0 var(--space-3);border:1px solid transparent;border-radius:var(--radius);color:var(--text-soft);text-decoration:none;font-weight:600}.primary-nav a:hover{background:var(--panel);color:var(--text);border-color:var(--border)}.primary-nav a[aria-current=page]{color:#cceeff;background:linear-gradient(90deg,#0c3858,#102b43);border-color:#174b6d;box-shadow:inset 2px 0 var(--accent)}.nav-icon{display:grid;place-items:center;width:22px;height:22px;color:#a9bdd0;font-size:1.25rem}.primary-nav a[aria-current=page] .nav-icon{color:#42bfff}.nav-group{margin:0 var(--space-3);padding-top:var(--space-4);border-top:1px solid var(--border)}.nav-group>p{margin:0 var(--space-3);color:var(--muted);font-size:.66rem;text-transform:uppercase;letter-spacing:.13em;font-weight:750}.nav-group .primary-nav{padding:var(--space-3) 0}.nav-group .primary-nav a{min-height:35px;font-size:var(--font-sm)}.sidebar-foot{margin:auto var(--space-3) var(--space-3);border:1px solid var(--border);background:rgba(15,29,43,.7);border-radius:var(--radius);padding:var(--space-3)}.organisation-context{display:flex;gap:var(--space-3);align-items:center;min-width:0}.context-icon{display:grid;place-items:center;width:32px;height:32px;border-radius:var(--radius-sm);color:#b6dcfa;background:#132e48}.organisation-context>span:last-child{display:grid;min-width:0}.organisation-context small,.system-state small{color:var(--muted);font-size:.67rem}.organisation-context strong{font-size:.78rem;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.system-state{display:flex;align-items:center;gap:var(--space-2);margin-top:var(--space-3);padding-top:var(--space-3);border-top:1px solid var(--border)}.system-state>span{width:8px;height:8px;background:var(--success);border-radius:99px;box-shadow:0 0 9px var(--success)}
.app-frame{grid-column:2;min-width:0}.topbar{height:var(--topbar);position:sticky;top:0;z-index:30;display:grid;grid-template-columns:minmax(150px,1fr) minmax(260px,460px) minmax(150px,1fr);align-items:center;gap:var(--space-4);padding:0 var(--space-8);background:rgba(8,19,31,.96);border-bottom:1px solid var(--border);backdrop-filter:blur(12px)}.topbar-title{display:flex;align-items:center;gap:var(--space-3)}.topbar-icon{color:#a9bdd0;font-size:1.25rem}.menu-button{display:none;color:var(--text);font-size:1.25rem;cursor:pointer}.global-search{display:flex;align-items:center;gap:var(--space-2);height:38px;padding:0 var(--space-3);background:var(--panel);border:1px solid var(--border);border-radius:var(--radius)}.global-search:focus-within{border-color:var(--accent)}.global-search span{color:var(--muted);font-size:1.2rem}.global-search input{width:100%;border:0;outline:0;background:transparent;color:var(--text);padding:0}.global-search input::placeholder{color:var(--muted)}.account-menu{position:relative;justify-self:end}.account-menu>summary{list-style:none;display:flex;align-items:center;gap:var(--space-3);cursor:pointer}.account-menu>summary::-webkit-details-marker{display:none}.avatar{display:grid;place-items:center;width:34px;height:34px;background:linear-gradient(145deg,var(--accent-strong),#3154d4);border-radius:50%;font-size:.75rem;font-weight:800}.account-name{display:grid;line-height:1.2;max-width:170px}.account-name strong{font-size:.78rem;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.account-name small{color:var(--muted);font-size:.67rem}.account-popover{position:absolute;right:0;top:calc(100% + 12px);width:190px;padding:var(--space-2);background:var(--panel-raised);border:1px solid var(--border-strong);border-radius:var(--radius);box-shadow:var(--shadow)}.account-popover a,.account-signout{display:block;width:100%;padding:var(--space-3);border:0;border-radius:var(--radius-sm);background:transparent;color:var(--text-soft);text-align:left;text-decoration:none;cursor:pointer}.account-popover a:hover,.account-signout:hover{background:var(--panel-hover);color:var(--text)}.account-popover form{margin:0;padding:0;border:0;background:none}
.case-nav{display:flex;align-items:center;gap:var(--space-1);padding:0 var(--space-8);height:48px;background:var(--navy-850);border-bottom:1px solid var(--border);overflow:auto}.case-nav>span{margin-right:var(--space-4);font-weight:700;white-space:nowrap}.case-nav a{align-self:stretch;display:flex;align-items:center;padding:0 var(--space-3);color:var(--muted);text-decoration:none;white-space:nowrap;border-bottom:2px solid transparent}.case-nav a[aria-current=page]{color:var(--text);border-color:var(--accent)}
main{width:min(100%,1500px);margin:0 auto;padding:var(--space-6) clamp(var(--space-4),3vw,var(--space-8)) var(--space-8)}.page-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:var(--space-5);margin-bottom:var(--space-5)}.breadcrumbs{display:flex;gap:var(--space-2);color:var(--muted);font-size:var(--font-xs);margin-bottom:var(--space-1)}.breadcrumbs a{color:var(--muted);text-decoration:none}.page-heading h1{margin:0;font-size:var(--font-xl);line-height:1.2;letter-spacing:-.025em}.page-description,.lede{margin:var(--space-2) 0 0;color:var(--text-soft);font-size:var(--font-base)}h1{font-size:var(--font-xl)}h2{font-size:var(--font-lg)}h3{font-size:var(--font-base)}.button,button{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-2);min-height:38px;padding:0 var(--space-4);border:1px solid transparent;border-radius:var(--radius-sm);font-weight:700;text-decoration:none;cursor:pointer}.button-primary,button{background:var(--accent-strong);color:white;border-color:#149eef;box-shadow:0 6px 18px rgba(7,138,226,.18)}.button-primary:hover,button:hover{background:var(--accent)}.button-secondary{background:var(--panel);color:var(--text-soft);border-color:var(--border)}.button-secondary:hover{background:var(--panel-hover);color:var(--text)}.new-case{min-width:126px}.flash{margin:0 0 var(--space-5);padding:var(--space-3) var(--space-4);color:#bce8dc;background:var(--success-soft);border:1px solid #1a6244;border-left:3px solid var(--success);border-radius:var(--radius)}.flash.error{color:#ffd6d9;background:var(--error-soft);border-color:#77333b;border-left-color:var(--error)}
.summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--space-4);margin:0 0 var(--space-5)}.summary-card{min-height:104px;display:flex;align-items:center;gap:var(--space-4);padding:var(--space-4);background:linear-gradient(145deg,var(--panel),#0e1a27);border:1px solid var(--border);border-radius:var(--radius);box-shadow:0 8px 26px rgba(0,0,0,.1)}.summary-icon{display:grid;place-items:center;width:48px;height:48px;flex:0 0 auto;border:1px solid #185783;border-radius:50%;color:var(--accent);background:#0b3150;font-size:1.5rem}.summary-card div{display:grid}.summary-card small{color:var(--text-soft);text-transform:none}.summary-card strong{font-size:1.7rem;line-height:1.15;margin-top:var(--space-1)}.summary-progress .summary-icon{color:var(--review);background:#2c1f4f;border-color:#50357f}.summary-complete .summary-icon{color:var(--success);background:#123a2b;border-color:#1d5c41}.summary-attention .summary-icon{color:var(--warning);background:#422814;border-color:#6b3d1c}
.case-list-panel{padding:0;margin:0;background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);overflow:visible}.case-toolbar{display:flex;align-items:center;gap:var(--space-3);padding:var(--space-4);margin:0;background:transparent;border:0;border-bottom:1px solid var(--border)}.case-toolbar label{margin:0}.case-toolbar select,.case-toolbar input{height:38px;margin:0;color:var(--text);background:var(--navy-850);border:1px solid var(--border-strong);border-radius:var(--radius-sm);padding:0 var(--space-3)}.filter-search{display:flex;align-items:center;gap:var(--space-2);min-width:260px;height:38px;padding:0 var(--space-3);background:var(--navy-850);border:1px solid var(--border-strong);border-radius:var(--radius-sm)}.filter-search:focus-within{border-color:var(--accent)}.filter-search span{color:var(--muted)}.filter-search input{width:100%;height:auto;padding:0;border:0;outline:0}.clear-filters{font-size:var(--font-sm);white-space:nowrap}.case-table-wrap{overflow-x:auto}.case-table{width:100%;min-width:850px;border-collapse:collapse;background:transparent}.case-table th,.case-table td{padding:var(--space-4);border-bottom:1px solid var(--border);text-align:left;vertical-align:middle}.case-table th{height:48px;color:var(--text-soft);font-size:var(--font-xs);font-weight:650;text-transform:uppercase;letter-spacing:.035em}.case-table tbody tr{transition:background .15s}.case-table tbody tr:hover{background:var(--panel-hover)}.case-name{display:flex;align-items:center;gap:var(--space-3);min-width:220px;color:var(--text);text-decoration:none}.case-name>span:last-child{display:grid}.case-name strong{font-size:var(--font-base)}.case-name small,.case-table td>small{color:var(--muted);font-size:var(--font-xs);margin-top:2px}.case-icon{display:grid;place-items:center;width:38px;height:38px;flex:0 0 auto;color:#4bbcff;background:#0d3758;border:1px solid #17527d;border-radius:var(--radius)}.status-chip{display:inline-flex;align-items:center;gap:6px;padding:3px 8px;border:1px solid var(--border);border-radius:999px;color:var(--text-soft);background:#182735;font-size:var(--font-xs);white-space:nowrap}.status-chip>span{width:5px;height:5px;border-radius:50%;background:currentColor}.status-in-progress{color:#5bb4ff;background:#102d49;border-color:#194b72}.status-completed{color:var(--success);background:var(--success-soft);border-color:#1c523c}.status-needs-attention{color:var(--warning);background:var(--warning-soft);border-color:#613819}.status-review{color:#b692ff;background:#2b2145;border-color:#493675}.status-new{color:#7fd7ff}.status-archived{color:var(--muted)}.readiness{display:grid;gap:5px;min-width:145px}.readiness>span{height:5px;background:#263747;border-radius:99px;overflow:hidden}.readiness i{display:block;height:100%;background:var(--accent);border-radius:inherit}.readiness small{color:var(--muted);font-size:var(--font-xs)}.case-table time{color:var(--text-soft);white-space:nowrap}.row-actions{position:relative}.row-actions>summary{display:grid;place-items:center;width:34px;height:34px;list-style:none;color:var(--text-soft);background:var(--navy-850);border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer;font-size:1.25rem}.row-actions>summary::-webkit-details-marker{display:none}.row-actions>div{position:absolute;right:0;z-index:10;width:150px;padding:var(--space-2);background:var(--panel-raised);border:1px solid var(--border-strong);border-radius:var(--radius);box-shadow:var(--shadow)}.row-actions a{display:block;padding:var(--space-2);color:var(--text-soft);text-decoration:none;border-radius:var(--radius-sm)}.row-actions a:hover{background:var(--panel-hover);color:var(--text)}.case-list-footer{padding:var(--space-4);color:var(--muted);font-size:var(--font-xs)}
.form-layout{display:grid;grid-template-columns:minmax(0,680px) minmax(220px,320px);gap:var(--space-5);align-items:start}.case-form{padding:0;background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}.form-section{padding:var(--space-6)}.form-section h2{margin:0}.form-section>p{margin:var(--space-1) 0 var(--space-5);color:var(--muted)}label{display:block;margin:var(--space-4) 0;color:var(--text-soft);font-weight:650}label .optional{float:right;color:var(--muted);font-size:var(--font-xs);font-weight:500}input,select,textarea{display:block;width:100%;margin-top:var(--space-2);padding:var(--space-3);color:var(--text);background:var(--navy-850);border:1px solid var(--border-strong);border-radius:var(--radius-sm)}input::placeholder,textarea::placeholder{color:var(--muted)}input:focus,select:focus,textarea:focus{border-color:var(--accent);outline:1px solid var(--accent)}textarea{min-height:96px;resize:vertical}label>small{display:block;margin-top:var(--space-2);color:var(--muted);font-size:var(--font-xs);font-weight:400}.form-actions{display:flex;justify-content:flex-end;gap:var(--space-3);padding:var(--space-4) var(--space-6);background:var(--navy-850);border-top:1px solid var(--border)}.form-help{display:flex;gap:var(--space-3);padding:var(--space-4);color:var(--text-soft);background:#0c2940;border:1px solid #194a6d;border-radius:var(--radius)}.form-help>span{display:grid;place-items:center;width:24px;height:24px;flex:0 0 auto;border-radius:50%;color:#031521;background:var(--accent);font-weight:850}.form-help p{margin:var(--space-2) 0 0;color:#a7bdce;font-size:var(--font-sm)}
section,.panel,.card,article{min-width:0}.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:var(--space-4)}.card,.panel,main>section:not(.summary-grid):not(.case-list-panel),main>article{padding:var(--space-4);margin-bottom:var(--space-4);background:var(--panel);border:1px solid var(--border);border-radius:var(--radius)}.card strong{display:block}.card span,.muted{color:var(--muted)}.grid{display:grid;gap:var(--space-4)}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}table{border-collapse:collapse;width:100%;background:var(--panel)}th,td{text-align:left;padding:var(--space-3);border-bottom:1px solid var(--border);vertical-align:top}th{color:var(--text-soft);font-size:var(--font-xs);text-transform:uppercase;letter-spacing:.04em}.badge{display:inline-flex;border-radius:999px;background:#1d3042;color:var(--text-soft);padding:.15rem .55rem;font-size:var(--font-xs);font-weight:700}.status-succeeded,.status-connected,.status-ready{background:var(--success-soft);color:var(--success)}.status-failed{background:var(--error-soft);color:var(--error)}.status-partial,.status-processing{background:var(--warning-soft);color:var(--warning)}form{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);padding:var(--space-4)}input[type=checkbox]{display:inline;width:auto}.empty-state{text-align:center;padding:3rem var(--space-4);color:var(--muted)}.empty-state h2{color:var(--text)}.empty-icon{display:grid;place-items:center;width:48px;height:48px;margin:0 auto;color:var(--accent);background:var(--accent-soft);border-radius:50%;font-size:1.5rem}dl{display:grid;grid-template-columns:minmax(160px,240px) 1fr}dt,dd{margin:0;padding:var(--space-3);border-bottom:1px solid var(--border)}dt{font-weight:700;color:var(--text-soft)}code{overflow-wrap:anywhere}.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}.nav-toggle{position:fixed;opacity:0;pointer-events:none}
@media(max-height:790px){.primary-nav{padding-top:var(--space-3);padding-bottom:var(--space-3)}.primary-nav a{min-height:36px}.nav-group{padding-top:var(--space-3)}.nav-group .primary-nav a{min-height:30px}.sidebar-foot{padding:var(--space-2)}.system-state{display:none}}
@media(max-width:1100px){.summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.topbar{grid-template-columns:minmax(140px,1fr) minmax(240px,380px) auto}.account-name{display:none}.case-toolbar{flex-wrap:wrap}.filter-search{flex:1 1 260px}}
@media(max-width:820px){:root{--sidebar:270px}.app-shell{display:block}.app-frame{min-width:0}.sidebar{transform:translateX(-101%);transition:transform .2s ease;box-shadow:var(--shadow)}.nav-toggle:checked~.app-shell .sidebar{transform:translateX(0)}.nav-scrim{display:none;position:fixed;inset:0;background:rgba(2,8,15,.72);z-index:35}.nav-toggle:checked~.app-shell .nav-scrim{display:block}.sidebar-close,.menu-button{display:block}.topbar{grid-template-columns:auto minmax(100px,1fr) auto;padding:0 var(--space-4)}.topbar-title .topbar-icon{display:none}.global-search{justify-self:stretch}.case-nav{padding:0 var(--space-4)}main{padding:var(--space-5) var(--space-4)}.form-layout{grid-template-columns:1fr}.form-help{order:-1}.grid.two{grid-template-columns:1fr}}
@media(max-width:560px){.topbar{grid-template-columns:1fr auto}.global-search{display:none}.summary-grid{grid-template-columns:1fr 1fr;gap:var(--space-3)}.summary-card{min-height:86px;padding:var(--space-3)}.summary-icon{width:38px;height:38px}.summary-card strong{font-size:1.4rem}.page-heading{align-items:flex-start;flex-direction:column}.new-case{width:100%}.case-toolbar{display:grid;grid-template-columns:1fr}.filter-search{min-width:0}.case-toolbar .button{width:100%}.form-section{padding:var(--space-4)}.form-actions{padding:var(--space-4);flex-direction:column-reverse}.form-actions .button{width:100%}}
@media(max-width:390px){.summary-grid{grid-template-columns:1fr}.summary-card{min-height:76px}.topbar-title strong{font-size:.82rem}.account-menu>summary>span:last-child{display:none}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important}}

/* ==========================================================
   BigBlueYonder shell refinement — approved Cases template
   ========================================================== */

:root {
  --sidebar: 280px;
  --topbar: 72px;
}

/* Larger, more confident branding */
.sidebar-head {
  padding: 0 1.15rem;
}

.brand {
  gap: 0.9rem;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 13px;
  box-shadow:
    0 0 22px rgba(22, 168, 244, 0.22),
    inset 0 0 12px rgba(22, 168, 244, 0.08);
}

.brand-mark span {
  font-size: 0.78rem;
}

.brand-copy {
  line-height: 1.08;
}

.brand-copy strong {
  font-size: 1.12rem;
  letter-spacing: -0.025em;
}

.brand-copy small {
  margin-top: 5px;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
}

/* More legible navigation */
.primary-nav {
  gap: 0.32rem;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

.primary-nav a {
  min-height: 46px;
  gap: 0.85rem;
  padding: 0 0.9rem;
  font-size: 0.91rem;
  font-weight: 650;
}

.nav-icon {
  width: 24px;
  height: 24px;
  font-size: 1.32rem;
}

.nav-group {
  margin-left: 0.85rem;
  margin-right: 0.85rem;
}

.nav-group > p {
  font-size: 0.7rem;
}

.nav-group .primary-nav a {
  min-height: 39px;
  font-size: 0.85rem;
}

/* Better organisation/status panel */
.sidebar-foot {
  margin-left: 0.85rem;
  margin-right: 0.85rem;
  margin-bottom: 0.85rem;
  padding: 0.9rem;
}

.context-icon {
  width: 36px;
  height: 36px;
}

.organisation-context strong {
  font-size: 0.84rem;
}

.organisation-context small,
.system-state small {
  font-size: 0.71rem;
}

/* More readable top bar account area */
.avatar {
  width: 38px;
  height: 38px;
  font-size: 0.82rem;
}

.account-name {
  max-width: 210px;
}

.account-name strong {
  font-size: 0.86rem;
}

.account-name small {
  font-size: 0.71rem;
}

/* Use the available desktop space more effectively */
main {
  width: min(100%, 1600px);
}

@media (max-width: 820px) {
  :root {
    --sidebar: 280px;
    --topbar: 64px;
  }
}

/* ==========================================================
   BigBlueYonder desktop scale pass
   ========================================================== */

:root {
  --sidebar: 310px;
  --topbar: 78px;

  --font-xs: 0.8rem;
  --font-sm: 0.92rem;
  --font-base: 1rem;
  --font-lg: 1.25rem;
  --font-xl: 2.15rem;
}

html,
body {
  font-size: 16px;
}

/* Brand */
.sidebar-head {
  padding: 0 1.35rem;
}

.brand {
  gap: 1rem;
}

.brand-mark {
  width: 56px;
  height: 56px;
  flex-basis: 56px;
  border-radius: 15px;
}

.brand-mark span {
  font-size: 0.9rem;
}

.brand-copy strong {
  font-size: 1.28rem;
  letter-spacing: -0.03em;
}

.brand-copy small {
  margin-top: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
}

/* Navigation */
.primary-nav {
  gap: 0.42rem;
  padding: 1.45rem 1rem;
}

.primary-nav a {
  min-height: 52px;
  padding: 0 1rem;
  gap: 1rem;
  font-size: 1rem;
  border-radius: 9px;
}

.nav-icon {
  width: 27px;
  height: 27px;
  font-size: 1.45rem;
}

.nav-group {
  margin: 0 1rem;
  padding-top: 1.25rem;
}

.nav-group > p {
  margin-left: 1rem;
  font-size: 0.76rem;
}

.nav-group .primary-nav {
  padding-top: 0.85rem;
}

.nav-group .primary-nav a {
  min-height: 44px;
  font-size: 0.94rem;
}

/* Sidebar footer */
.sidebar-foot {
  margin: auto 1rem 1rem;
  padding: 1rem;
}

.context-icon {
  width: 40px;
  height: 40px;
}

.organisation-context strong {
  font-size: 0.94rem;
}

.organisation-context small,
.system-state small {
  font-size: 0.78rem;
}

/* Top bar */
.topbar {
  padding: 0 2.25rem;
  grid-template-columns: minmax(220px, 1fr) minmax(340px, 560px) minmax(220px, 1fr);
}

.topbar-title {
  font-size: 1.05rem;
}

.topbar-icon {
  font-size: 1.45rem;
}

.global-search {
  height: 44px;
  padding: 0 1rem;
}

.avatar {
  width: 42px;
  height: 42px;
  font-size: 0.9rem;
}

.account-name {
  max-width: 240px;
}

.account-name strong {
  font-size: 0.95rem;
}

.account-name small {
  font-size: 0.78rem;
}

/* Main canvas */
main {
  width: 100%;
  max-width: 1800px;
  padding: 2rem clamp(2rem, 3vw, 3.5rem) 3rem;
}

.page-heading {
  margin-bottom: 1.6rem;
}

.page-heading h1 {
  font-size: 2.15rem;
}

.page-description,
.lede {
  margin-top: 0.55rem;
  font-size: 1rem;
}

/* Summary cards */
.summary-grid {
  gap: 1.15rem;
  margin-bottom: 1.4rem;
}

.summary-card {
  min-height: 128px;
  padding: 1.25rem;
  gap: 1.1rem;
  border-radius: 10px;
}

.summary-icon {
  width: 56px;
  height: 56px;
  font-size: 1.7rem;
}

.summary-card small {
  font-size: 0.9rem;
}

.summary-card strong {
  font-size: 2rem;
}

/* Case table and filters */
.case-toolbar {
  gap: 0.9rem;
  padding: 1.1rem;
}

.case-toolbar select,
.case-toolbar input,
.filter-search {
  height: 44px;
  font-size: 0.94rem;
}

.filter-search {
  min-width: 300px;
}

.case-table {
  min-width: 980px;
}

.case-table th,
.case-table td {
  padding: 1.15rem;
}

.case-table th {
  height: 54px;
  font-size: 0.78rem;
}

.case-name {
  min-width: 290px;
}

.case-name strong {
  font-size: 1rem;
}

.case-name small,
.case-table td > small {
  font-size: 0.8rem;
}

.case-icon {
  width: 44px;
  height: 44px;
}

.status-chip {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.readiness {
  min-width: 190px;
}

.readiness > span {
  height: 7px;
}

.case-table time {
  font-size: 0.92rem;
}

.row-actions > summary {
  width: 39px;
  height: 39px;
}

.case-list-footer {
  padding: 1rem 1.15rem;
  font-size: 0.82rem;
}

/* Keep tablet/mobile controlled */
@media (max-width: 1100px) {
  html,
  body {
    font-size: 15px;
  }

  :root {
    --sidebar: 280px;
    --topbar: 68px;
  }
}


/* Proper BigBlueYonder visual identity */
.brand-mark {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.brand-mark::before,
.brand-mark::after {
  display: none;
}

.brand-mark img {
  display: block;
  width: 60px;
  height: 60px;
  filter: drop-shadow(0 0 11px rgba(22, 168, 244, .24));
}

.brand-copy strong {
  font-size: 1.32rem;
  font-weight: 760;
}

.brand-copy small {
  font-size: .74rem;
  font-weight: 760;
  color: #5bd2ff;
}

/* Increase BigBlueYonder logo presence */
.sidebar-head {
  min-height: var(--topbar);
}

.brand-mark {
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
}

.brand-mark img {
  width: 76px;
  height: 76px;
}

.brand-copy strong {
  font-size: 1.5rem;
}

.brand-copy small {
  font-size: 0.82rem;
}

/* ==========================================================
   Case Overview dashboard
   ========================================================== */

.page-overview .page-heading {
  margin-bottom: 1rem;
}

.page-overview .page-heading > div:first-child {
  display: none;
}

.case-heading-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.case-actions-menu {
  position: relative;
}

.case-actions-menu > summary {
  list-style: none;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--panel);
  cursor: pointer;
  font-weight: 650;
}

.case-actions-menu > summary::-webkit-details-marker {
  display: none;
}

.case-actions-menu > div {
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  z-index: 20;
  width: 190px;
  padding: 0.45rem;
  background: var(--panel-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.case-actions-menu a {
  display: block;
  padding: 0.72rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  text-decoration: none;
}

.case-actions-menu a:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.case-overview-dashboard {
  display: grid;
  gap: 1rem;
}

/* Hero and metrics */

.overview-hero {
  position: relative;
  min-height: 205px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  overflow: hidden;
  padding: 1.6rem;
  background:
    radial-gradient(circle at 78% 35%, rgba(22,168,244,.13), transparent 28%),
    linear-gradient(145deg, #10283c, #0d1c2a 60%);
  border: 1px solid #1c5277;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 40px rgba(22,168,244,.03);
}

.overview-hero-copy {
  position: relative;
  z-index: 2;
  max-width: 760px;
}

.overview-reference {
  display: inline-flex;
  padding: 0.3rem 0.65rem;
  margin-bottom: 0.8rem;
  color: var(--nav-selected-text);
  background: var(--nav-selected);
  border: 1px solid var(--nav-indicator);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.overview-hero h2 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(1.8rem, 2.6vw, 2.75rem);
  line-height: 1.07;
  letter-spacing: -0.035em;
}

.overview-hero p {
  max-width: 720px;
  margin: 0.85rem 0 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.6;
}

.overview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.overview-meta span {
  position: relative;
}

.overview-meta span:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -0.7rem;
  top: 50%;
  width: 3px;
  height: 3px;
  background: var(--border-strong);
  border-radius: 50%;
}

.overview-ask-button {
  min-width: 190px;
  justify-content: space-between;
}

.overview-hero-graphic {
  display: grid;
  place-items: center;
}

.evidence-network {
  position: relative;
  width: 150px;
  height: 150px;
  opacity: 0.88;
}

.network-ring,
.network-node,
.network-core {
  position: absolute;
  display: block;
}

.network-ring {
  inset: 15%;
  border: 1px solid rgba(45,188,255,.38);
  transform: rotate(45deg);
}

.network-ring-two {
  inset: 28%;
  transform: rotate(12deg);
  border-color: rgba(45,188,255,.54);
}

.network-node {
  width: 8px;
  height: 8px;
  background: #69d5ff;
  border-radius: 50%;
  box-shadow: 0 0 12px #19a9ef;
}

.node-one {
  left: 10%;
  top: 26%;
}

.node-two {
  right: 10%;
  top: 38%;
}

.node-three {
  left: 42%;
  bottom: 7%;
}

.network-core {
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  color: #76dcff;
  font-size: 3.4rem;
  text-shadow: 0 0 24px rgba(22,168,244,.6);
}

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 0.85rem;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
}

.overview-metric {
  min-height: 145px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.overview-metric-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: #0b3150;
  border: 1px solid #175680;
  border-radius: 50%;
  font-size: 1.3rem;
}

.overview-metric > div:last-child {
  display: grid;
}

.overview-metric span {
  color: var(--text-soft);
  font-size: 0.86rem;
}

.overview-metric strong {
  margin: 0.18rem 0;
  font-size: 2rem;
  line-height: 1;
}

.overview-metric small {
  color: var(--muted);
  font-size: 0.73rem;
}

.metric-ready .overview-metric-icon {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1d5c41;
}

.metric-processing .overview-metric-icon {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #6b3d1c;
}

.metric-findings .overview-metric-icon {
  color: var(--review);
  background: #2b2145;
  border-color: #493675;
}

.metric-outputs .overview-metric-icon {
  color: #40d8e9;
  background: #0d3744;
  border-color: #17606e;
}

/* Shared overview panels */

.overview-middle-grid {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1fr);
  align-items: start;
  gap: 1rem;
}

.overview-secondary-stack {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.overview-bottom-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 1rem;
}

.overview-panel {
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.overview-panel-heading {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
}

.overview-panel-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.overview-panel-heading a,
.overview-panel-action {
  color: #45c4ff;
  font-size: 0.8rem;
  text-decoration: none;
}

.overview-panel-action {
  display: flex;
  min-height: 45px;
  align-items: center;
  justify-content: flex-start;
  padding: 0 1rem;
  border-top: 1px solid var(--border);
}

/* Document sections */

.section-list {
  padding: 0.4rem 0;
}

@media (min-width: 901px) {
  .overview-middle-grid {
    align-items: stretch;
  }

  /*
   * Size containment keeps a long document list from increasing the grid row.
   * The natural height of the readiness/activity stack therefore sets the row,
   * while the panel's middle track receives any remaining space.
   */
  .document-sections-panel {
    display: grid;
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
    contain: size;
  }

  .document-sections-panel .section-list {
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
  }

  .document-sections-panel .section-list::-webkit-scrollbar {
    width: 0.45rem;
  }

  .document-sections-panel .section-list::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
  }
}

.document-section-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  color: var(--text);
  text-decoration: none;
}

.document-section-row:hover {
  background: var(--panel-hover);
}

.section-folder {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #48bfff;
  background: #0b3554;
  border: 1px solid #18577e;
  border-radius: 50%;
}

.supporting-folder {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1c5b40;
}

.section-copy {
  display: grid;
  min-width: 0;
}

.section-copy strong {
  font-size: 0.9rem;
}

.section-copy small {
  margin-top: 0.18rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-copy > span {
  margin-top: 0.3rem;
  color: var(--text-soft);
  font-size: 0.76rem;
}

.section-arrow {
  color: var(--muted);
  font-size: 1.5rem;
}

/* Readiness */

.readiness-content {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.readiness-ring {
  --readiness: 0deg;
  width: 100px;
  height: 100px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at centre, var(--panel-raised) 58%, transparent 60%),
    conic-gradient(var(--accent) calc(var(--readiness) * 3.6), #263747 0);
  box-shadow: 0 0 24px rgba(22,168,244,.12);
}

.readiness-ring > div {
  width: 74px;
  height: 74px;
  display: grid;
  place-content: center;
  text-align: center;
  background: var(--panel);
  border-radius: 50%;
}

.readiness-ring strong {
  font-size: 1.45rem;
  line-height: 1;
}

.readiness-ring span {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.readiness-checks {
  display: grid;
  gap: 0.62rem;
}

.readiness-checks > div {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.78rem;
}

.readiness-checks strong {
  color: var(--text-soft);
}

.check-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.check-success {
  background: var(--success);
  box-shadow: 0 0 7px rgba(50,210,125,.48);
}

.check-warning {
  background: var(--warning);
}

.check-muted {
  background: var(--muted);
}

/* Recent activity */

.activity-list {
  overflow: visible;
  padding: 0.35rem 0;
}

.activity-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  padding: 0.72rem 1rem;
  color: var(--text);
  text-decoration: none;
}

.activity-row:hover {
  background: var(--panel-hover);
}

.activity-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 50%;
}

.activity-question {
  color: var(--accent);
  background: var(--accent-soft);
}

.activity-row > span:last-child {
  display: grid;
  min-width: 0;
}

.activity-row strong {
  font-size: 0.8rem;
}

.activity-row small {
  margin-top: 0.15rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Recent documents */

.overview-document-table {
  overflow-x: auto;
}

.overview-document-head,
.overview-document-row {
  min-width: 680px;
  display: grid;
  grid-template-columns: 2fr 1fr 0.75fr 1.2fr;
  align-items: center;
  gap: 0.8rem;
}

.overview-document-head {
  min-height: 42px;
  padding: 0 1rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.overview-document-row {
  min-height: 48px;
  padding: 0 1rem;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.77rem;
}

.overview-document-row:hover {
  background: var(--panel-hover);
}

.overview-document-name {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.overview-document-name strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-file-icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #d7eeff;
  background: #15456a;
  border-radius: 5px;
}

/* Suggested questions */

.suggested-question-list {
  display: grid;
}

.suggested-question-list a {
  min-height: 48px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1rem;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.78rem;
}

.suggested-question-list a:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.suggested-question-list span {
  color: var(--accent);
}

.suggested-question-list strong {
  color: var(--muted);
  font-size: 1.2rem;
}

.overview-empty-state {
  display: grid;
  gap: 0.35rem;
  padding: 1.5rem 1rem;
  color: var(--muted);
  text-align: centre;
}

/* Responsive layout */

@media (min-width: 1250px) {
  .case-overview-dashboard {
    grid-template-columns: minmax(0, 1.25fr) minmax(600px, 2fr);
  }

  .overview-hero {
    grid-column: 1;
  }

  .overview-metrics {
    grid-column: 2;
  }

  .overview-middle-grid,
  .overview-bottom-grid {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1249px) {
  .overview-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 900px) {
  .overview-hero {
    grid-template-columns: 1fr;
  }

  .overview-hero-graphic {
    display: none;
  }

  .overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-middle-grid,
  .overview-bottom-grid {
    grid-template-columns: 1fr;
  }

  .document-sections-panel {
    height: auto;
    contain: none;
  }

  .document-sections-panel .section-list {
    overflow: visible;
  }

  .readiness-content {
    grid-template-columns: 104px minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .case-heading-actions {
    width: 100%;
    align-items: stretch;
  }

  .case-heading-actions .button {
    flex: 1;
  }

  .overview-metrics {
    grid-template-columns: 1fr;
  }

  .overview-hero {
    min-height: 0;
    padding: 1.2rem;
  }

  .overview-hero h2 {
    font-size: 1.75rem;
  }

  .readiness-content {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

/* Case Overview refinement pass */
.page-overview main > .page-heading {
  display: none;
}

.page-overview main {
  width: 100%;
  max-width: none;
  padding-top: 1.2rem;
}

.overview-hero {
  grid-template-columns: minmax(0, 1fr) 170px;
  min-height: 190px;
  padding: 1.45rem;
}

.overview-hero-copy {
  max-width: 900px;
}

.overview-hero h2 {
  max-width: 760px;
  font-size: clamp(1.75rem, 2.15vw, 2.35rem);
  line-height: 1.08;
}

.overview-hero p {
  max-width: 760px;
}

.overview-hero-graphic {
  align-self: centre;
}

.evidence-network {
  width: 125px;
  height: 125px;
}

.overview-metric {
  min-height: 126px;
  padding: 1rem;
  gap: 0.55rem;
}

.overview-metric-icon {
  width: 38px;
  height: 38px;
  font-size: 1.12rem;
}

.overview-metric > div:last-child {
  gap: 0.08rem;
}

.overview-metric strong {
  font-size: 1.75rem;
}

.overview-metric small {
  line-height: 1.3;
}

.recent-activity-panel .overview-empty-state {
  place-content: center;
}

/* Remove duplicate Overview heading while preserving case actions */
main:has(.case-overview-dashboard) > .page-heading > div:first-child {
  display: none;
}

main:has(.case-overview-dashboard) > .page-heading {
  justify-content: flex-end;
  margin-bottom: 1rem;
}

/* ==========================================================
   Case Documents workspace
   ========================================================== */

.case-documents-dashboard {
  display: grid;
  gap: 1rem;
}

.documents-summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.35rem 1.5rem;
  background:
    radial-gradient(circle at 85% 20%, rgba(22, 168, 244, 0.11), transparent 25%),
    linear-gradient(145deg, #10283c, #0d1c2a 65%);
  border: 1px solid #1c5277;
  border-radius: var(--radius-lg);
}

.documents-summary h2 {
  margin: 0.2rem 0 0;
  font-size: 1.8rem;
  letter-spacing: -0.025em;
}

.documents-summary p {
  max-width: 760px;
  margin: 0.55rem 0 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.documents-readiness-summary {
  min-width: 410px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 0.8rem 1rem;
  color: var(--text-soft);
  background: rgba(7, 24, 37, 0.75);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.78rem;
}

.documents-readiness-summary > span {
  display: grid;
  gap: 0.15rem;
  min-width: 62px;
}

.documents-readiness-summary strong {
  color: var(--text);
  font-size: 1.1rem;
}

.readiness-pulse {
  width: 9px;
  height: 9px;
  min-width: 9px !important;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(22, 168, 244, 0.4);
  animation: readiness-pulse 1.7s infinite;
}

@keyframes readiness-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 168, 244, 0.42);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(22, 168, 244, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(22, 168, 244, 0);
  }
}

/* Upload workspace */

.upload-workspace {
  padding: 1.25rem;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.upload-workspace-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.upload-workspace-heading h2 {
  margin: 0.25rem 0 0;
}

.upload-workspace-heading p {
  max-width: 700px;
  margin: 0.4rem 0 0;
  color: var(--text-soft);
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text-soft);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
}

.icon-button:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.upload-form-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(360px, 1.3fr);
  gap: 1rem;
}

.upload-form-grid > label:first-child {
  align-self: start;
}

.upload-dropzone {
  min-height: 165px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.4rem;
  padding: 1.2rem;
  color: var(--text-soft);
  background: var(--panel-hover);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: center;
}

.upload-dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-dropzone-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 1.5rem;
}

.upload-dropzone strong {
  color: var(--text);
}

.upload-dropzone small {
  color: var(--muted);
}

.upload-dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.upload-feedback {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.upload-file-preview,
.upload-in-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 0.8rem;
  background: rgba(8, 28, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}

.upload-file-preview strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-preview span,
.upload-file-preview small {
  color: var(--muted);
}

.upload-in-progress {
  display: block;
  color: var(--accent);
}

/* Uploads must inherit the active theme; no Midnight-only surfaces here. */
.upload-dropzone {
  color: var(--text-soft);
  background: var(--panel-hover);
  border-color: var(--border);
}
.upload-dropzone:hover, .upload-dropzone.is-dragging {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.upload-dropzone-icon { color: var(--accent); background: var(--accent-soft); border-color: var(--border); }
.upload-file-preview { background: var(--panel-hover); border: 1px solid var(--border); }
.upload-file-preview small { color: var(--text-soft); }
.upload-file-preview.state-failed { border-color: var(--error); }
.upload-file-preview.state-duplicate { border-color: var(--warning); }
.upload-file-preview progress { width: 9rem; accent-color: var(--accent); }
.upload-summary, .upload-batch-summary { color: var(--text-soft); margin: .4rem 0; }
.upload-file-preview.state-failed { color: var(--error); background: var(--error-soft); border-color: var(--error); }
.upload-file-preview.state-failed small { color: var(--error); font-weight: 650; }
.upload-queue-resolved { color: var(--text-soft); margin: .4rem 0; }

.upload-actions,
.section-editor-actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1rem;
}

/* Section panels */

.document-section-grid {
  display: grid;
  gap: 1rem;
}

.document-section-panel {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.document-section-heading {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.document-section-identity {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.document-section-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent);
  background: #0b3554;
  border: 1px solid #18577e;
  border-radius: 50%;
  font-size: 1.2rem;
}

.document-section-icon.supporting {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1c5b40;
}

.document-section-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.document-section-title-row h2 {
  margin: 0;
  font-size: 1rem;
}

.document-section-identity p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.material-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 0.55rem;
  color: #7fd6ff;
  background: #0b3554;
  border: 1px solid #18577e;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.material-badge.supporting {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1c5b40;
}

.document-section-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 0 0 auto;
}

.document-section-actions > strong {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.button.compact {
  min-height: 34px;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}

/* Section editor */

.section-editor {
  padding: 1rem 1.15rem;
  background: rgba(7, 24, 37, 0.82);
  border-bottom: 1px solid var(--border);
}

.section-editor-grid,
.new-section-grid {
  display: grid;
  grid-template-columns: 1fr 0.7fr 0.4fr;
  gap: 0.9rem;
}

.section-editor-grid .wide,
.new-section-grid .wide {
  grid-column: 1 / -1;
}

.archive-option {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.8rem;
  color: var(--text-soft);
}

.archive-option input {
  width: auto;
}

/* Document table */

.case-document-table {
  overflow-x: auto;
}

.case-document-table-head,
.case-document-row {
  min-width: 900px;
  display: grid;
  grid-template-columns:
    minmax(260px, 2fr)
    0.65fr
    0.85fr
    1fr
    0.85fr
    24px;
  align-items: center;
  gap: 0.8rem;
}

.case-document-table-head {
  min-height: 41px;
  padding: 0 1.15rem;
  color: var(--muted);
  background: rgba(7, 24, 37, 0.42);
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.case-document-row {
  min-height: 58px;
  padding: 0 1.15rem;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.76rem;
}

.case-document-row:last-child {
  border-bottom: 0;
}

.case-document-row:hover {
  background: var(--panel-hover);
}

.case-document-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.case-document-name strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-document-file-icon {
  min-width: 36px;
  height: 31px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #d7eeff;
  background: #15456a;
  border: 1px solid #28658f;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 800;
}

.case-document-arrow {
  color: var(--muted);
  font-size: 1.4rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-ready {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1c5b40;
}

.status-processing,
.status-checking {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #23638c;
}

.status-needs-attention {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #6b3d1c;
}

/* Empty sections */

.document-section-empty {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.15rem;
  color: var(--muted);
}

.document-section-empty > div {
  flex: 1;
}

.document-section-empty strong {
  color: var(--text);
}

.document-section-empty p {
  margin: 0.25rem 0 0;
}

.document-section-empty-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(12, 39, 58, 0.75);
  border: 1px solid var(--border);
  border-radius: 50%;
}

/* Administration and search */

.document-administration-panel,
.document-search-panel {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.document-administration-panel summary,
.document-search-panel summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 1.15rem;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 700;
}

.document-administration-panel summary:hover,
.document-search-panel summary:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.new-section-form {
  display: grid;
  grid-template-columns: minmax(240px, 0.65fr) minmax(430px, 1.35fr);
  gap: 1.5rem;
  padding: 1.15rem;
  border-top: 1px solid var(--border);
}

.new-section-form h2 {
  margin: 0;
  font-size: 1rem;
}

.new-section-form p {
  color: var(--muted);
  line-height: 1.5;
}

.document-search-form {
  display: flex;
  align-items: end;
  gap: 0.8rem;
  padding: 1.15rem;
  border-top: 1px solid var(--border);
}

.document-search-form label {
  flex: 1;
}

.search-result-count {
  margin: 0;
  padding: 0 1.15rem 0.8rem;
  color: var(--text-soft);
}

.prepared-evidence-results {
  display: grid;
  gap: 0.75rem;
  padding: 0 1.15rem 1.15rem;
}

.prepared-evidence-results article {
  margin: 0;
  padding: 1rem;
  background: rgba(7, 24, 37, 0.62);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.prepared-evidence-results article p {
  margin-top: 0;
  line-height: 1.6;
}

.prepared-evidence-results article small {
  color: var(--muted);
}

.prepared-evidence-results article form {
  margin-top: 0.8rem;
}

/* Responsive Documents layout */

@media (max-width: 1100px) {
  .documents-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .documents-readiness-summary {
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .upload-form-grid,
  .new-section-form {
    grid-template-columns: 1fr;
  }

  .section-editor-grid,
  .new-section-grid {
    grid-template-columns: 1fr 1fr;
  }

  .section-editor-grid .wide,
  .new-section-grid .wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .document-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-section-actions {
    width: 100%;
    justify-content: space-between;
  }

  .documents-readiness-summary {
    flex-wrap: wrap;
  }

  .section-editor-grid,
  .new-section-grid {
    grid-template-columns: 1fr;
  }

  .section-editor-grid .wide,
  .new-section-grid .wide {
    grid-column: auto;
  }

  .document-section-empty {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .document-search-form {
    align-items: stretch;
    flex-direction: column;
  }
}

.sidebar-foot .organisation-context small, .sidebar-foot .system-state small { color: var(--nav-muted); }
.sidebar-foot .context-icon { color: var(--accent-strong); background: var(--accent-soft); }

@media (max-width: 820px) {
  .sidebar-scroll { flex: 1 1 auto; }
  .sidebar-scroll .primary-nav a, .sidebar-scroll .case-primary-nav a { min-height: 42px; }
}


/* ==========================================================
   Case Documents workspace
   ========================================================== */

.case-documents-dashboard {
  display: grid;
  gap: 1rem;
}

.documents-summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.35rem 1.5rem;
  background:
    radial-gradient(circle at 85% 20%, rgba(22, 168, 244, 0.11), transparent 25%),
    linear-gradient(145deg, #10283c, #0d1c2a 65%);
  border: 1px solid #1c5277;
  border-radius: var(--radius-lg);
}

.documents-summary h2 {
  margin: 0.2rem 0 0;
  font-size: 1.8rem;
  letter-spacing: -0.025em;
}

.documents-summary p {
  max-width: 760px;
  margin: 0.55rem 0 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.documents-readiness-summary {
  min-width: 410px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 0.8rem 1rem;
  color: var(--text-soft);
  background: rgba(7, 24, 37, 0.75);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.78rem;
}

.documents-readiness-summary > span {
  display: grid;
  gap: 0.15rem;
  min-width: 62px;
}

.documents-readiness-summary strong {
  color: var(--text);
  font-size: 1.1rem;
}

.readiness-pulse {
  width: 9px;
  height: 9px;
  min-width: 9px !important;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(22, 168, 244, 0.4);
  animation: readiness-pulse 1.7s infinite;
}

@keyframes readiness-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 168, 244, 0.42);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(22, 168, 244, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(22, 168, 244, 0);
  }
}

/* Upload workspace */

.upload-workspace {
  padding: 1.25rem;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.upload-workspace-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.upload-workspace-heading h2 {
  margin: 0.25rem 0 0;
}

.upload-workspace-heading p {
  max-width: 700px;
  margin: 0.4rem 0 0;
  color: var(--text-soft);
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text-soft);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
}

.icon-button:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.upload-form-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(360px, 1.3fr);
  gap: 1rem;
}

.upload-form-grid > label:first-child {
  align-self: start;
}

.upload-dropzone {
  min-height: 165px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.4rem;
  padding: 1.2rem;
  color: var(--text-soft);
  background: var(--panel-hover);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: center;
}

.upload-dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-dropzone-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 1.5rem;
}

.upload-dropzone strong {
  color: var(--text);
}

.upload-dropzone small {
  color: var(--muted);
}

.upload-dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.upload-feedback {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.upload-file-preview,
.upload-in-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 0.8rem;
  background: rgba(8, 28, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}

.upload-file-preview strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-preview span,
.upload-file-preview small {
  color: var(--muted);
}

.upload-in-progress {
  display: block;
  color: var(--accent);
}

.upload-actions,
.section-editor-actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1rem;
}

/* Section panels */

.document-section-grid {
  display: grid;
  gap: 1rem;
}

.document-section-panel {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.document-section-heading {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.document-section-identity {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.document-section-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent);
  background: #0b3554;
  border: 1px solid #18577e;
  border-radius: 50%;
  font-size: 1.2rem;
}

.document-section-icon.supporting {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1c5b40;
}

.document-section-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.document-section-title-row h2 {
  margin: 0;
  font-size: 1rem;
}

.document-section-identity p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.material-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 0.55rem;
  color: #7fd6ff;
  background: #0b3554;
  border: 1px solid #18577e;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.material-badge.supporting {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1c5b40;
}

.document-section-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 0 0 auto;
}

.document-section-actions > strong {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.button.compact {
  min-height: 34px;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}

/* Section editor */

.section-editor {
  padding: 1rem 1.15rem;
  background: rgba(7, 24, 37, 0.82);
  border-bottom: 1px solid var(--border);
}

.section-editor-grid,
.new-section-grid {
  display: grid;
  grid-template-columns: 1fr 0.7fr 0.4fr;
  gap: 0.9rem;
}

.section-editor-grid .wide,
.new-section-grid .wide {
  grid-column: 1 / -1;
}

.archive-option {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.8rem;
  color: var(--text-soft);
}

.archive-option input {
  width: auto;
}

/* Document table */

.case-document-table {
  overflow-x: auto;
}

.case-document-table-head,
.case-document-row {
  min-width: 900px;
  display: grid;
  grid-template-columns:
    minmax(260px, 2fr)
    0.65fr
    0.85fr
    1fr
    0.85fr
    24px;
  align-items: center;
  gap: 0.8rem;
}

.case-document-table-head {
  min-height: 41px;
  padding: 0 1.15rem;
  color: var(--muted);
  background: rgba(7, 24, 37, 0.42);
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.case-document-row {
  min-height: 58px;
  padding: 0 1.15rem;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.76rem;
}

.case-document-row:last-child {
  border-bottom: 0;
}

.case-document-row:hover {
  background: var(--panel-hover);
}

.case-document-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.case-document-name strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-document-file-icon {
  min-width: 36px;
  height: 31px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #d7eeff;
  background: #15456a;
  border: 1px solid #28658f;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 800;
}

.case-document-arrow {
  color: var(--muted);
  font-size: 1.4rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-ready {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1c5b40;
}

.status-processing,
.status-checking {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #23638c;
}

.status-needs-attention {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #6b3d1c;
}

/* Empty sections */

.document-section-empty {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.15rem;
  color: var(--muted);
}

.document-section-empty > div {
  flex: 1;
}

.document-section-empty strong {
  color: var(--text);
}

.document-section-empty p {
  margin: 0.25rem 0 0;
}

.document-section-empty-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(12, 39, 58, 0.75);
  border: 1px solid var(--border);
  border-radius: 50%;
}

/* Administration and search */

.document-administration-panel,
.document-search-panel {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.document-administration-panel summary,
.document-search-panel summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 1.15rem;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 700;
}

.document-administration-panel summary:hover,
.document-search-panel summary:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.new-section-form {
  display: grid;
  grid-template-columns: minmax(240px, 0.65fr) minmax(430px, 1.35fr);
  gap: 1.5rem;
  padding: 1.15rem;
  border-top: 1px solid var(--border);
}

.new-section-form h2 {
  margin: 0;
  font-size: 1rem;
}

.new-section-form p {
  color: var(--muted);
  line-height: 1.5;
}

.document-search-form {
  display: flex;
  align-items: end;
  gap: 0.8rem;
  padding: 1.15rem;
  border-top: 1px solid var(--border);
}

.document-search-form label {
  flex: 1;
}

.search-result-count {
  margin: 0;
  padding: 0 1.15rem 0.8rem;
  color: var(--text-soft);
}

.prepared-evidence-results {
  display: grid;
  gap: 0.75rem;
  padding: 0 1.15rem 1.15rem;
}

.prepared-evidence-results article {
  margin: 0;
  padding: 1rem;
  background: rgba(7, 24, 37, 0.62);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.prepared-evidence-results article p {
  margin-top: 0;
  line-height: 1.6;
}

.prepared-evidence-results article small {
  color: var(--muted);
}

.prepared-evidence-results article form {
  margin-top: 0.8rem;
}

/* Responsive Documents layout */

@media (max-width: 1100px) {
  .documents-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .documents-readiness-summary {
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .upload-form-grid,
  .new-section-form {
    grid-template-columns: 1fr;
  }

  .section-editor-grid,
  .new-section-grid {
    grid-template-columns: 1fr 1fr;
  }

  .section-editor-grid .wide,
  .new-section-grid .wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .document-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-section-actions {
    width: 100%;
    justify-content: space-between;
  }

  .documents-readiness-summary {
    flex-wrap: wrap;
  }

  .section-editor-grid,
  .new-section-grid {
    grid-template-columns: 1fr;
  }

  .section-editor-grid .wide,
  .new-section-grid .wide {
    grid-column: auto;
  }

  .document-section-empty {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .document-search-form {
    align-items: stretch;
    flex-direction: column;
  }
}


/* ==========================================================
   Ask the Evidence workspace
   ========================================================== */

.ask-workspace {
  display: grid;
  gap: 1rem;
}

.ask-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.25rem 1.4rem;
  background:
    radial-gradient(circle at 86% 20%, rgba(22, 168, 244, 0.12), transparent 28%),
    linear-gradient(145deg, #10283c, #0d1c2a 65%);
  border: 1px solid #1c5277;
  border-radius: var(--radius-lg);
}

.ask-intro p {
  max-width: 760px;
  margin: 0.4rem 0 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.ask-evidence-count {
  min-width: 150px;
  display: grid;
  justify-items: end;
  gap: 0.15rem;
}

.ask-evidence-count strong {
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
}

.ask-evidence-count span {
  color: var(--muted);
  font-size: 0.74rem;
}

/* Provider state */

.analysis-service-notice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(
    145deg,
    rgba(91, 47, 20, 0.52),
    rgba(42, 28, 20, 0.74)
  );
  border: 1px solid #75451f;
  border-radius: var(--radius-lg);
}

.analysis-service-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid #70441e;
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 800;
}

.analysis-service-notice strong {
  color: #ffd3a5;
}

.analysis-service-notice p {
  margin: 0.25rem 0 0;
  color: #c9ad91;
  font-size: 0.8rem;
  line-height: 1.45;
}

/* Question composer */

.question-composer {
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 12%, rgba(22, 168, 244, 0.08), transparent 26%),
    linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.question-composer-heading {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

.question-composer-heading h2 {
  margin: 0.2rem 0 0;
  font-size: 1.2rem;
}

.question-scope-summary {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 0.75rem;
  color: #7fd6ff;
  background: #0b3554;
  border: 1px solid #18577e;
  border-radius: 999px;
  font-size: 0.7rem;
  white-space: nowrap;
}

.question-composer form {
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
}

#question-prompt {
  min-height: 150px;
  resize: vertical;
  padding: 1rem 1.05rem;
  color: var(--text);
  background: rgba(6, 25, 38, 0.84);
  border: 1px solid #24516f;
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem;
  line-height: 1.55;
}

#question-prompt:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 168, 244, 0.12);
}

#question-prompt::placeholder {
  color: #647b8e;
}

.suggested-question-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.suggested-question {
  min-height: 105px;
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 0.9rem;
  color: var(--text-soft);
  background:
    linear-gradient(145deg, rgba(15, 48, 70, 0.78), rgba(8, 29, 44, 0.9));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}

.suggested-question:hover {
  color: var(--text);
  border-color: #2879aa;
  background:
    linear-gradient(145deg, rgba(19, 61, 89, 0.92), rgba(10, 36, 54, 0.98));
}

.suggested-question strong {
  color: var(--text);
  font-size: 0.82rem;
}

.suggested-question span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

/* Evidence scope */

.evidence-scope-panel {
  overflow: hidden;
  background: rgba(7, 24, 37, 0.56);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.evidence-scope-panel summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
}

.evidence-scope-panel summary:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.evidence-scope-panel summary small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.evidence-scope-content {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.evidence-scope-content > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.evidence-scope-content h3 {
  margin: 0;
  font-size: 0.9rem;
}

.scope-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.scope-option,
.scope-passage {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.7rem;
  margin: 0;
  padding: 0.8rem;
  color: var(--text-soft);
  background: rgba(8, 31, 47, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.scope-option:hover,
.scope-passage:hover {
  background: var(--panel-hover);
}

.scope-option input,
.scope-passage input {
  width: auto;
  margin-top: 0.15rem;
}

.scope-option > span,
.scope-passage > span {
  display: grid;
  min-width: 0;
}

.scope-option strong,
.scope-passage strong {
  color: var(--text);
  font-size: 0.78rem;
}

.scope-option small,
.scope-passage small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.4;
}

.scope-passage-list {
  max-height: 320px;
  display: grid;
  gap: 0.55rem;
  overflow-y: auto;
}

.question-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.question-actions > span {
  color: var(--muted);
  font-size: 0.72rem;
}

.question-actions button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.planner-model-selector {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  white-space: nowrap;
}

.planner-model-selector select {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 0.35rem 1.7rem 0.35rem 0.55rem;
  font-size: 0.78rem;
}

/* Empty state */

.ask-empty-state {
  min-height: 170px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1.3rem;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.ask-empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #23638c;
  border-radius: 50%;
  font-size: 1.4rem;
}

.ask-empty-state h2 {
  margin: 0;
  font-size: 1.05rem;
}

.ask-empty-state p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

/* Progress */

.analysis-progress-panel {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.analysis-progress-list {
  display: grid;
  gap: 0.6rem;
  padding: 1rem;
}

.analysis-progress-row {
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem;
  background: rgba(8, 31, 47, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.analysis-progress-indicator {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(22, 168, 244, 0.42);
  animation: readiness-pulse 1.7s infinite;
}

.analysis-progress-row > span:last-child {
  display: grid;
}

.analysis-progress-row strong {
  font-size: 0.8rem;
}

.analysis-progress-row small {
  margin-top: 0.16rem;
  color: var(--muted);
  font-size: 0.69rem;
}

.live-research-surface {
  display: grid;
  gap: 1rem;
  margin: 1rem;
  padding: 1rem;
  background:
    radial-gradient(circle at 92% 12%, rgba(160, 207, 255, 0.42), transparent 31%),
    linear-gradient(135deg, #1768d8, #2853c9 54%, #522bb8);
  border: 1px solid #79a8ff;
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(42, 74, 188, 0.22);
}

.live-research-brand-heading {
  margin: 0;
  color: var(--state-info-text);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.live-research-surface .live-research-question {
  margin: 0;
  color: var(--state-info-text);
}

.live-research-running {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  color: var(--state-info-text);
  background: var(--surface);
  border: 1px solid var(--state-info-border);
  border-radius: var(--radius-sm);
}

.live-research-current {
  display: block;
  color: var(--state-info-text);
  line-height: 1.4;
}

.live-research-history {
  display: grid;
  gap: 0.35rem;
  max-height: 12.5rem;
  overflow-y: auto;
  margin: 0;
  padding-left: 1.4rem;
  color: var(--state-info-text);
  font-size: 0.8rem;
}

.live-research-new-activity {
  justify-self: start;
  padding: 0.25rem 0.55rem;
  color: var(--state-info-text);
  background: var(--surface);
  border: 1px solid var(--state-info-border);
  border-radius: 999px;
  font-size: 0.72rem;
}

.live-research-activity {
  color: var(--state-info-text);
}

@media (max-width: 680px) {
  .live-research-running {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .live-research-running .live-research-elapsed {
    grid-column: 2;
    justify-items: start;
  }
}

.live-research-question {
  max-width: 58rem;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  line-height: 1.35;
}

.live-research-spinner {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  border: 2px solid var(--state-info-border);
  border-top-color: var(--state-info-text);
  border-radius: 50%;
  animation: live-research-spin 0.9s linear infinite;
}

.live-research-elapsed {
  display: grid;
  justify-items: end;
  min-width: 4.5rem;
  padding: 0.45rem 0.6rem;
  color: var(--state-info-text);
  background: var(--surface);
  border: 1px solid var(--state-info-border);
  border-radius: var(--radius-sm);
  line-height: 1;
}

.live-research-clock {
  color: var(--state-info-text);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.live-research-elapsed span {
  margin-top: 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@keyframes live-research-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 680px) {
  .live-research-elapsed {
    justify-items: start;
  }
}

.current-answer {
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
}

.candidate-findings{margin-top:1.25rem;padding-top:1rem;border-top:1px solid var(--border)}
.candidate-findings h3{margin:.2rem 0 .25rem}
.candidate-findings>div>p{margin:0;color:var(--text-soft)}
.candidate-finding-list{display:grid;gap:.75rem;margin-top:.85rem}
.candidate-finding{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.4rem 1rem;align-items:center;padding:.85rem 1rem;border:1px solid var(--border);border-radius:var(--radius);background:var(--panel)}
.candidate-finding p{grid-column:1;margin:0;font-weight:650}
.candidate-finding small{grid-column:1;color:var(--text-soft)}
.candidate-finding form,.candidate-finding>.status-chip{grid-column:2;grid-row:1 / span 2}
.compact-candidates{margin-top:1rem}
.compact-candidates>summary{cursor:pointer;font-weight:700}
.finding-lineage,.finding-legacy-note{margin:.75rem 0;padding:.75rem 1rem;border-left:3px solid var(--accent);background:var(--evidence-surface-muted,var(--panel))}
.finding-lineage span{color:var(--text-soft);font-size:.78rem;font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.finding-lineage p{margin:.25rem 0}
.finding-evidence-group>h3{margin:.9rem 0 .4rem;font-size:.9rem}
.citation-context-window{display:grid;gap:.5rem;margin-top:.6rem}
.citation-context-window section{padding:.7rem .8rem;border-left:3px solid var(--border);background:var(--evidence-surface-muted,var(--panel))}
.citation-context-window .cited-context{border-left-color:var(--accent);background:var(--accent-soft)}
.citation-context-window p{margin:.35rem 0 0;white-space:pre-wrap}
@media(max-width:720px){.candidate-finding{grid-template-columns:1fr}.candidate-finding form,.candidate-finding>.status-chip{grid-column:1;grid-row:auto}}

.current-answer > h2 {
  margin: 0.35rem 0 0;
}

.answer-metadata {
  color: var(--muted);
  margin: 0.5rem 0 1.5rem;
}

.research-answer-prose p,
.research-answer-prose ul,
.research-answer-prose ol {
  margin: 0 0 1rem;
}

.research-answer-prose h3 {
  margin: 1.5rem 0 0.6rem;
}

.research-answer-prose li + li {
  margin-top: 0.45rem;
}

/* History */

.question-history {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.question-history-heading {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.15rem;
  border-bottom: 1px solid var(--border);
}

.question-history-heading h2 {
  margin: 0.2rem 0 0;
  font-size: 1rem;
}

.question-history-heading > span {
  color: var(--muted);
  font-size: 0.72rem;
}

.question-history-list {
  display: grid;
}

.question-history-item {
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.question-history-item:last-child {
  border-bottom: 0;
}

.question-history-summary {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.15rem;
}

.question-history-summary > div {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.question-history-summary h3 {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.4;
}

.question-history-summary p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.69rem;
}

.question-history-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #23638c;
  border-radius: 50%;
  font-weight: 800;
}

.analysis-unavailable {
  margin: 0 1.15rem 1rem;
  padding: 0.8rem 0.9rem;
  color: #d0b394;
  background: rgba(89, 49, 21, 0.38);
  border: 1px solid #66401f;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.answer-statement {
  margin: 0 1.15rem 1rem;
  overflow: hidden;
  background: rgba(7, 24, 37, 0.58);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.answer-statement-heading {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
  padding: 0.9rem;
}

.answer-statement-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
}

.answer-statement-heading p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.citation-list {
  display: grid;
  border-top: 1px solid var(--border);
}

.citation-item {
  border-bottom: 1px solid var(--border);
}

.citation-item:last-child {
  border-bottom: 0;
}

.citation-item summary {
  min-height: 50px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.9rem;
  cursor: pointer;
}

.citation-item summary:hover {
  background: var(--panel-hover);
}

.citation-item summary > span:last-child {
  display: grid;
}

.citation-item strong {
  font-size: 0.76rem;
}

.citation-item small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.66rem;
}

.citation-marker {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 800;
}

.citation-content {
  padding: 0 0.9rem 0.9rem 3.95rem;
}

.citation-content blockquote {
  margin: 0 0 0.7rem;
  padding: 0.8rem;
  color: var(--text-soft);
  background: rgba(6, 22, 34, 0.75);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.55;
}

.citation-content a {
  color: var(--accent);
  font-size: 0.72rem;
  text-decoration: none;
}

.ask-history-empty {
  min-height: 130px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.5rem;
  color: var(--muted);
  text-align: center;
}

.ask-history-empty > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(10, 42, 63, 0.8);
  border: 1px solid var(--border);
  border-radius: 50%;
}

/* Responsive Ask layout */

@media (max-width: 900px) {
  .ask-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .ask-evidence-count {
    justify-items: start;
  }

  .analysis-service-notice {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .analysis-service-notice .button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .suggested-question-cards {
    grid-template-columns: 1fr;
  }

  .scope-section-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .question-composer-heading,
  .question-history-heading,
  .question-history-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .question-scope-summary {
    white-space: normal;
  }

  .question-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ask-empty-state {
    grid-template-columns: 1fr;
  }

  .answer-statement-heading {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .answer-statement-heading > .status-chip {
    grid-column: 2;
    justify-self: start;
  }

  .citation-content {
    padding-left: 0.9rem;
  }
}


/* ==========================================================
   Ask the Evidence workspace
   ========================================================== */

.ask-workspace {
  display: grid;
  gap: 1rem;
}

.ask-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.25rem 1.4rem;
  background:
    radial-gradient(circle at 86% 20%, rgba(22, 168, 244, 0.12), transparent 28%),
    linear-gradient(145deg, #10283c, #0d1c2a 65%);
  border: 1px solid #1c5277;
  border-radius: var(--radius-lg);
}

.ask-intro p {
  max-width: 760px;
  margin: 0.4rem 0 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.ask-evidence-count {
  min-width: 150px;
  display: grid;
  justify-items: end;
  gap: 0.15rem;
}

.ask-evidence-count strong {
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
}

.ask-evidence-count span {
  color: var(--muted);
  font-size: 0.74rem;
}

/* Provider state */

.analysis-service-notice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(
    145deg,
    rgba(91, 47, 20, 0.52),
    rgba(42, 28, 20, 0.74)
  );
  border: 1px solid #75451f;
  border-radius: var(--radius-lg);
}

.analysis-service-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid #70441e;
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 800;
}

.analysis-service-notice strong {
  color: #ffd3a5;
}

.analysis-service-notice p {
  margin: 0.25rem 0 0;
  color: #c9ad91;
  font-size: 0.8rem;
  line-height: 1.45;
}

/* Question composer */

.question-composer {
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 12%, rgba(22, 168, 244, 0.08), transparent 26%),
    linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.question-composer-heading {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

.question-composer-heading h2 {
  margin: 0.2rem 0 0;
  font-size: 1.2rem;
}

.question-scope-summary {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 0.75rem;
  color: #7fd6ff;
  background: #0b3554;
  border: 1px solid #18577e;
  border-radius: 999px;
  font-size: 0.7rem;
  white-space: nowrap;
}

.question-composer form {
  display: grid;
  gap: 1rem;
  padding: 1.2rem;
}

#question-prompt {
  min-height: 150px;
  resize: vertical;
  padding: 1rem 1.05rem;
  color: var(--text);
  background: rgba(6, 25, 38, 0.84);
  border: 1px solid #24516f;
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem;
  line-height: 1.55;
}

#question-prompt:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 168, 244, 0.12);
}

#question-prompt::placeholder {
  color: #647b8e;
}

.suggested-question-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.suggested-question {
  min-height: 105px;
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 0.9rem;
  color: var(--text-soft);
  background:
    linear-gradient(145deg, rgba(15, 48, 70, 0.78), rgba(8, 29, 44, 0.9));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}

.suggested-question:hover {
  color: var(--text);
  border-color: #2879aa;
  background:
    linear-gradient(145deg, rgba(19, 61, 89, 0.92), rgba(10, 36, 54, 0.98));
}

.suggested-question strong {
  color: var(--text);
  font-size: 0.82rem;
}

.suggested-question span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

/* Evidence scope */

.evidence-scope-panel {
  overflow: hidden;
  background: rgba(7, 24, 37, 0.56);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.evidence-scope-panel summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
}

.evidence-scope-panel summary:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.evidence-scope-panel summary small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.evidence-scope-content {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.evidence-scope-content > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.evidence-scope-content h3 {
  margin: 0;
  font-size: 0.9rem;
}

.scope-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.scope-option,
.scope-passage {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.7rem;
  margin: 0;
  padding: 0.8rem;
  color: var(--text-soft);
  background: rgba(8, 31, 47, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.scope-option:hover,
.scope-passage:hover {
  background: var(--panel-hover);
}

.scope-option input,
.scope-passage input {
  width: auto;
  margin-top: 0.15rem;
}

.scope-option > span,
.scope-passage > span {
  display: grid;
  min-width: 0;
}

.scope-option strong,
.scope-passage strong {
  color: var(--text);
  font-size: 0.78rem;
}

.scope-option small,
.scope-passage small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.4;
}

.scope-passage-list {
  max-height: 320px;
  display: grid;
  gap: 0.55rem;
  overflow-y: auto;
}

.question-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.question-actions > span {
  color: var(--muted);
  font-size: 0.72rem;
}

.question-actions button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Empty state */

.ask-empty-state {
  min-height: 170px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1.3rem;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.ask-empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #23638c;
  border-radius: 50%;
  font-size: 1.4rem;
}

.ask-empty-state h2 {
  margin: 0;
  font-size: 1.05rem;
}

.ask-empty-state p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

/* Progress */

.analysis-progress-panel {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.analysis-progress-list {
  display: grid;
  gap: 0.6rem;
  padding: 1rem;
}

.analysis-progress-row {
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem;
  background: rgba(8, 31, 47, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.analysis-progress-indicator {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(22, 168, 244, 0.42);
  animation: readiness-pulse 1.7s infinite;
}

.analysis-progress-row > span:last-child {
  display: grid;
}

.analysis-progress-row strong {
  font-size: 0.8rem;
}

.analysis-progress-row small {
  margin-top: 0.16rem;
  color: var(--muted);
  font-size: 0.69rem;
}

/* History */

.question-history {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.question-history-heading {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.15rem;
  border-bottom: 1px solid var(--border);
}

.question-history-heading h2 {
  margin: 0.2rem 0 0;
  font-size: 1rem;
}

.question-history-heading > span {
  color: var(--muted);
  font-size: 0.72rem;
}

.question-history-list {
  display: grid;
}

.question-history-item {
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.question-history-item:last-child {
  border-bottom: 0;
}

.question-history-summary {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.15rem;
}

.question-history-summary > div {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.question-history-summary h3 {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.4;
}

.question-history-summary p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.69rem;
}

.question-history-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #23638c;
  border-radius: 50%;
  font-weight: 800;
}

.analysis-unavailable {
  margin: 0 1.15rem 1rem;
  padding: 0.8rem 0.9rem;
  color: #d0b394;
  background: rgba(89, 49, 21, 0.38);
  border: 1px solid #66401f;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.answer-statement {
  margin: 0 1.15rem 1rem;
  overflow: hidden;
  background: rgba(7, 24, 37, 0.58);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.answer-statement-heading {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
  padding: 0.9rem;
}

.answer-statement-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
}

.answer-statement-heading p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.citation-list {
  display: grid;
  border-top: 1px solid var(--border);
}

.citation-item {
  border-bottom: 1px solid var(--border);
}

.citation-item:last-child {
  border-bottom: 0;
}

.citation-item summary {
  min-height: 50px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.9rem;
  cursor: pointer;
}

.citation-item summary:hover {
  background: var(--panel-hover);
}

.citation-item summary > span:last-child {
  display: grid;
}

.citation-item strong {
  font-size: 0.76rem;
}

.citation-item small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.66rem;
}

.citation-marker {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 800;
}

.citation-content {
  padding: 0 0.9rem 0.9rem 3.95rem;
}

.citation-content blockquote {
  margin: 0 0 0.7rem;
  padding: 0.8rem;
  color: var(--text-soft);
  background: rgba(6, 22, 34, 0.75);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.55;
}

.citation-content a {
  color: var(--accent);
  font-size: 0.72rem;
  text-decoration: none;
}

.ask-history-empty {
  min-height: 130px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.5rem;
  color: var(--muted);
  text-align: center;
}

.ask-history-empty > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(10, 42, 63, 0.8);
  border: 1px solid var(--border);
  border-radius: 50%;
}

/* Responsive Ask layout */

@media (max-width: 900px) {
  .ask-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .ask-evidence-count {
    justify-items: start;
  }

  .analysis-service-notice {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .analysis-service-notice .button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .suggested-question-cards {
    grid-template-columns: 1fr;
  }

  .scope-section-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .question-composer-heading,
  .question-history-heading,
  .question-history-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .question-scope-summary {
    white-space: normal;
  }

  .question-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ask-empty-state {
    grid-template-columns: 1fr;
  }

  .answer-statement-heading {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .answer-statement-heading > .status-chip {
    grid-column: 2;
    justify-self: start;
  }

  .citation-content {
    padding-left: 0.9rem;
  }
}


/* Ask workspace refinement */
main:has(.ask-workspace) > .page-heading > div:first-child {
  display: none;
}

main:has(.ask-workspace) > .page-heading {
  justify-content: flex-end;
  margin-bottom: 0.8rem;
}

.ask-intro {
  padding: 1rem 1.2rem;
}

.analysis-service-notice {
  padding: 0.8rem 1rem;
}

.question-composer-heading {
  min-height: 66px;
}

.question-composer form {
  gap: 0.8rem;
  padding: 1rem;
}

#question-prompt {
  min-height: 120px;
}

.suggested-question {
  min-height: 88px;
  padding: 0.75rem;
}

.question-history-heading {
  min-height: 60px;
}

/* ==========================================================
   Findings workspace
   ========================================================== */

.findings-workspace {
  display: grid;
  gap: 1rem;
}

main:has(.findings-workspace) > .page-heading > div:first-child {
  display: none;
}

main:has(.findings-workspace) > .page-heading {
  justify-content: flex-end;
  margin-bottom: 0.8rem;
}

/* Intro and summary */

.findings-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.15rem 1.3rem;
  background:
    radial-gradient(circle at 86% 20%, rgba(22, 168, 244, 0.12), transparent 28%),
    linear-gradient(145deg, #10283c, #0d1c2a 65%);
  border: 1px solid #1c5277;
  border-radius: var(--radius-lg);
}

.findings-intro p {
  max-width: 740px;
  margin: 0.4rem 0 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.findings-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  gap: 0.55rem;
}

.findings-summary > span {
  min-width: 82px;
  display: grid;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  color: var(--muted);
  background: rgba(7, 24, 37, 0.72);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.66rem;
  text-align: center;
}

.findings-summary strong {
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
}

/* Finding cards */

.findings-list {
  display: grid;
  gap: 1rem;
}

.finding-card {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.finding-card.finding-accepted {
  border-color: #1f6748;
  box-shadow: inset 3px 0 0 var(--success);
}

.finding-card.finding-needs-review {
  border-color: #6a451f;
  box-shadow: inset 3px 0 0 var(--warning);
}

.finding-card-heading {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.finding-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.finding-title-group h2 {
  margin: 0;
  font-size: 1rem;
}

.finding-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #23638c;
  border-radius: 50%;
  font-weight: 800;
}

.finding-accepted .finding-icon {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1c5b40;
}

.finding-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.finding-citation-count {
  color: var(--muted);
  font-size: 0.68rem;
}

.output-eligibility {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 0.7rem;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #1c5b40;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-accepted {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1c5b40;
}

.status-needs-review {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #6b3d1c;
}

.status-rejected,
.status-superseded {
  color: #df8d98;
  background: rgba(94, 31, 42, 0.5);
  border-color: #773746;
}

.status-draft {
  color: var(--text-soft);
  background: rgba(30, 47, 61, 0.75);
  border-color: var(--border-strong);
}

/* Statement and citations */

.finding-statement {
  padding: 1rem 1.15rem;
  background: rgba(7, 24, 37, 0.44);
  border-bottom: 1px solid var(--border);
}

.finding-statement p {
  max-width: 1100px;
  margin: 0.4rem 0 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.6;
}

.finding-citations {
  border-bottom: 1px solid var(--border);
}

.finding-citations > summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.15rem;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.finding-citations > summary:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.finding-citations > summary span {
  min-width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 0.65rem;
}

.finding-citation-list {
  display: grid;
  border-top: 1px solid var(--border);
}

.finding-citation {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 0.8rem;
  margin: 0;
  padding: 0.9rem 1.15rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.finding-citation:last-child {
  border-bottom: 0;
}

.finding-citation blockquote {
  margin: 0;
  padding: 0.75rem 0.85rem;
  color: var(--text-soft);
  background: rgba(6, 22, 34, 0.76);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.55;
}

.finding-citation p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.69rem;
}

.finding-review-note {
  margin: 1rem 1.15rem 0;
  padding: 0.8rem 0.9rem;
  color: var(--text-soft);
  background: rgba(9, 35, 52, 0.66);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.finding-review-note strong {
  font-size: 0.76rem;
}

.finding-review-note p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

/* Review and chronology actions */

.finding-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 1rem 1.15rem;
}

.finding-review-panel,
.chronology-action {
  position: relative;
}

.finding-review-panel > summary,
.chronology-action > summary {
  list-style: none;
  cursor: pointer;
}

.finding-review-panel > summary::-webkit-details-marker,
.chronology-action > summary::-webkit-details-marker {
  display: none;
}

.finding-review-panel[open],
.chronology-action[open] {
  width: 100%;
}

.finding-review-panel form,
.chronology-action form {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.8rem;
  padding: 1rem;
  background: rgba(7, 24, 37, 0.82);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.finding-review-panel form textarea[name="statement"] {
  min-height: 110px;
}

.finding-review-grid {
  display: grid;
  grid-template-columns: 0.45fr 1fr;
  gap: 0.8rem;
}

.finding-review-grid textarea {
  min-height: 80px;
}

.chronology-action form {
  min-width: 320px;
}

/* Empty findings */

.findings-empty-state {
  min-height: 160px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.findings-empty-state > span {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #23638c;
  border-radius: 50%;
  font-size: 1.3rem;
}

.findings-empty-state h2 {
  margin: 0;
  font-size: 1rem;
}

.findings-empty-state p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

/* Finding sources */

.finding-source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.finding-source-panel,
.chronology-panel {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.finding-source-heading {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.05rem;
  border-bottom: 1px solid var(--border);
}

.finding-source-heading h2 {
  margin: 0.18rem 0 0;
  font-size: 0.95rem;
}

.finding-source-heading > span {
  color: var(--muted);
  font-size: 0.7rem;
}

.finding-source-list {
  max-height: 460px;
  display: grid;
  overflow-y: auto;
}

.finding-source-list > article {
  margin: 0;
  padding: 1rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.finding-source-list > article:last-child {
  border-bottom: 0;
}

.finding-source-list blockquote {
  margin: 0;
  padding: 0.75rem;
  color: var(--text-soft);
  background: rgba(7, 24, 37, 0.62);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.5;
}

.finding-source-list article > p {
  margin: 0.45rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.69rem;
}

.finding-source-list form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.7rem;
}

.finding-source-list form label {
  min-width: 0;
}

.finding-source-empty {
  min-height: 105px;
  display: grid;
  place-content: center;
  padding: 1rem;
  color: var(--muted);
  text-align: center;
}

/* Chronology */

.chronology-list {
  display: grid;
}

.chronology-list article {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 1rem;
  margin: 0;
  padding: 1rem 1.05rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.chronology-list article:last-child {
  border-bottom: 0;
}

.chronology-list time {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
}

.chronology-list h3 {
  margin: 0;
  font-size: 0.84rem;
}

.chronology-list p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

/* Responsive findings layout */

@media (max-width: 1050px) {
  .findings-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .findings-summary {
    width: 100%;
  }

  .finding-source-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .findings-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finding-card-heading,
  .finding-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .finding-review-panel,
  .chronology-action,
  .finding-review-panel[open],
  .chronology-action[open] {
    width: 100%;
  }

  .finding-review-grid {
    grid-template-columns: 1fr;
  }

  .findings-empty-state {
    grid-template-columns: 1fr;
  }

  .finding-source-list form {
    grid-template-columns: 1fr;
  }

  .chronology-list article {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================
   Outputs workspace
   ========================================================== */

.outputs-workspace {
  display: grid;
  gap: 1rem;
}

main:has(.outputs-workspace) > .page-heading > div:first-child {
  display: none;
}

main:has(.outputs-workspace) > .page-heading {
  justify-content: flex-end;
  margin-bottom: 0.8rem;
}

/* Intro */

.outputs-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.15rem 1.3rem;
  background:
    radial-gradient(circle at 86% 20%, rgba(22, 168, 244, 0.12), transparent 28%),
    linear-gradient(145deg, #10283c, #0d1c2a 65%);
  border: 1px solid #1c5277;
  border-radius: var(--radius-lg);
}

.outputs-intro p {
  max-width: 760px;
  margin: 0.4rem 0 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.outputs-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(76px, 1fr));
  gap: 0.55rem;
}

.outputs-summary > span {
  min-width: 86px;
  display: grid;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  color: var(--muted);
  background: rgba(7, 24, 37, 0.72);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.66rem;
  text-align: center;
}

.outputs-summary strong {
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
}

/* Create output */

.output-create-panel,
.outputs-list-panel {
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.output-create-heading,
.outputs-list-heading {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.output-create-heading h2,
.outputs-list-heading h2 {
  margin: 0.18rem 0 0;
  font-size: 1rem;
}

.output-create-heading p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.output-rule {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 0.7rem;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #1c5b40;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.output-create-form {
  display: grid;
  gap: 1rem;
  padding: 1.15rem;
}

.output-details-grid {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: 0.9rem;
}

.output-findings-selector {
  margin: 0;
  padding: 0;
  border: 0;
}

.output-findings-selector legend {
  margin-bottom: 0.7rem;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.output-finding-options {
  display: grid;
  gap: 0.65rem;
}

.output-finding-option {
  display: grid !important;
  grid-template-columns: auto 30px minmax(0, 1fr);
  align-items: start;
  gap: 0.7rem;
  margin: 0;
  padding: 0.85rem;
  color: var(--text-soft);
  background: rgba(8, 31, 47, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.output-finding-option:hover {
  background: var(--panel-hover);
  border-color: #2879aa;
}

.output-finding-option input {
  width: auto;
  margin-top: 0.35rem;
}

.output-finding-check {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #1c5b40;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
}

.output-finding-option > span:last-child {
  display: grid;
  min-width: 0;
}

.output-finding-option strong {
  color: var(--text);
  font-size: 0.82rem;
}

.output-finding-option small {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.output-finding-option em {
  margin-top: 0.35rem;
  color: var(--accent);
  font-size: 0.68rem;
  font-style: normal;
}

.output-create-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.output-create-actions > span {
  color: var(--muted);
  font-size: 0.72rem;
}

.output-create-empty {
  min-height: 135px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem;
}

.output-create-empty > span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #23638c;
  border-radius: 50%;
}

.output-create-empty strong {
  color: var(--text);
}

.output-create-empty p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

/* Outputs register */

.outputs-list-heading > span {
  color: var(--muted);
  font-size: 0.7rem;
}

.output-card-list {
  display: grid;
  gap: 0;
}

.output-card {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.output-card:last-child {
  border-bottom: 0;
}

.output-card-heading {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  background: rgba(7, 24, 37, 0.36);
}

.output-card-identity {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.output-card-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #23638c;
  border-radius: 50%;
}

.output-card-identity h3 {
  margin: 0;
  font-size: 0.88rem;
}

.output-card-identity p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.output-version-list {
  display: grid;
  border-top: 1px solid var(--border);
}

.output-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0.85rem 1.15rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.output-version-row:last-child {
  border-bottom: 0;
}

.output-version-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.output-version-meta > div {
  display: grid;
}

.output-version-meta strong {
  font-size: 0.78rem;
}

.output-version-meta small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.66rem;
}

.output-version-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.output-version-actions form {
  margin: 0;
}

.output-export-menu {
  position: relative;
}

.output-export-menu > summary {
  list-style: none;
  cursor: pointer;
}

.output-export-menu > summary::-webkit-details-marker {
  display: none;
}

.output-export-menu > div {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 20;
  min-width: 150px;
  padding: 0.4rem;
  background: var(--panel-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.output-export-menu a {
  display: block;
  padding: 0.65rem 0.7rem;
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.75rem;
}

.output-export-menu a:hover {
  color: var(--text);
  background: var(--panel-hover);
}

.status-in-review {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #23638c;
}

.status-reviewed {
  color: var(--review);
  background: #2b2145;
  border-color: #493675;
}

.status-approved-for-circulation {
  color: var(--success);
  background: var(--success-soft);
  border-color: #1c5b40;
}

.outputs-empty-state {
  min-height: 140px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: 1.2rem;
}

.outputs-empty-state > span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(12, 39, 58, 0.75);
  border: 1px solid var(--border);
  border-radius: 50%;
}

.outputs-empty-state h2 {
  margin: 0;
  font-size: 1rem;
}

.outputs-empty-state p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

/* Responsive Outputs layout */

@media (max-width: 1000px) {
  .outputs-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .outputs-summary {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .outputs-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .output-details-grid {
    grid-template-columns: 1fr;
  }

  .output-create-heading,
  .output-version-row,
  .output-create-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .output-create-empty {
    grid-template-columns: 1fr;
  }

  .output-version-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .output-version-actions .button {
    width: 100%;
  }

  .output-export-menu,
  .output-export-menu > summary {
    width: 100%;
  }

  .output-export-menu > div {
    left: 0;
    right: auto;
  }
}

/* Harbor Glass theme foundation: geometry stays shared across named themes. */
:root,[data-theme="harbor-glass"]{--canvas:#e8eef3;--navy-950:#172737;--navy-925:#1c2d3e;--navy-900:#213447;--navy-850:#eef4f7;--panel:#f9fcfd;--panel-raised:#fff;--panel-hover:#edf6fa;--border:#cedbe3;--border-strong:#b4c8d3;--text:#183044;--text-soft:#426075;--muted:#657b8b;--accent:#087eb9;--accent-strong:#056b9f;--accent-soft:#d9eff9;--success:#16865b;--success-soft:#def3e9;--warning:#a96508;--warning-soft:#fff0d9;--error:#bd3f4c;--error-soft:#fbe5e7;--shadow:0 16px 40px rgba(27,54,74,.12);--radius:10px;--radius-sm:7px}.app-shell{background:radial-gradient(circle at 85% 5%,rgba(82,193,238,.18),transparent 30%),var(--canvas)}.sidebar{background:linear-gradient(165deg,#16293a,#20394c 58%,#192d3e);border-right-color:rgba(171,207,223,.3)}.topbar{background:rgba(249,252,253,.84);color:var(--text);border-bottom-color:var(--border)}.brand-copy small{color:#7ed7fb}.primary-nav a[aria-current=page]{color:#eaf9ff;background:linear-gradient(90deg,#0b6996,#19546f);border-color:#4c9bc0}.primary-nav a:hover{background:rgba(255,255,255,.1);color:white}.nav-icon{color:#b8d7e6}.sidebar-foot{background:rgba(9,29,45,.28);border-color:rgba(187,216,230,.28)}.workspace-context{margin:1.15rem 1rem .1rem;padding:1rem;border:1px solid rgba(181,216,230,.26);border-radius:var(--radius);background:rgba(3,22,37,.18);color:#ecf8fc}.workspace-context p{margin:0 0 .3rem;color:#9dc4d7;text-transform:uppercase;letter-spacing:.11em;font-size:.67rem;font-weight:750}.workspace-context p:not(:first-child){margin-top:1rem}.workspace-context strong{font-size:.9rem}.context-picker{position:relative}.context-picker summary{display:flex;justify-content:space-between;gap:.5rem;cursor:pointer;font-weight:700;font-size:.88rem;list-style:none}.context-picker summary::-webkit-details-marker{display:none}.context-picker>div{position:absolute;z-index:60;left:-.5rem;right:-.5rem;top:calc(100% + .65rem);padding:.45rem;background:#fff;border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}.context-picker a{display:block;padding:.5rem;color:var(--text);text-decoration:none;border-radius:var(--radius-sm)}.context-picker a:hover{background:var(--panel-hover)}.case-primary-nav{padding-top:.9rem}.case-nav{display:none}.page-heading h1{color:var(--text)}.overview-hero{box-shadow:var(--shadow)}
[data-theme="clean-horizon"]{--canvas:#f4f8fb;--panel:#fff;--accent:#1673ad}[data-theme="ivory-beacon"]{--canvas:#f6f1e8;--panel:#fffdf8;--accent:#8c641d}[data-theme="midnight-intelligence"]{--canvas:#0a1522;--panel:#101e2c;--text:#f3f7fb;--text-soft:#c3cfdb;--muted:#8596a8;--border:#243649;--accent:#16a8f4}
@media(max-width:820px){.workspace-context{display:none}}

/* Harbor Glass refinement: a restrained, light intelligence workspace. */
[data-theme="harbor-glass"] {
  --canvas: #e6eef3;
  --panel: rgba(252, 254, 255, .84);
  --panel-raised: rgba(255, 255, 255, .94);
  --panel-hover: #eef7fb;
  --border: rgba(112, 143, 160, .28);
  --border-strong: rgba(91, 130, 151, .42);
  --text: #132b40;
  --text-soft: #36566c;
  --muted: #6c8190;
  --accent: #087fb9;
  --accent-strong: #066a9f;
  --accent-soft: #d7eef8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 18px 45px rgba(24, 55, 76, .12);
}
body { background: radial-gradient(900px 560px at 88% -8%, rgba(109, 205, 239, .26), transparent 62%), radial-gradient(720px 480px at 38% 100%, rgba(180, 209, 224, .25), transparent 65%), var(--canvas); }
.sidebar { width: var(--sidebar); background: linear-gradient(164deg, #11283a 0%, #1d4055 54%, #173346 100%); box-shadow: 10px 0 34px rgba(22, 54, 73, .08); }
.sidebar-head { height: var(--topbar); min-height: 0; padding: 0 1.35rem; border-bottom-color: rgba(191, 222, 235, .2); }
.brand-mark { background: linear-gradient(145deg, #0a80bd, #14516e); border-color: rgba(160, 223, 248, .78); box-shadow: 0 8px 22px rgba(0, 157, 222, .2); }
.workspace-context { margin: 1.1rem 1rem .35rem; padding: 1rem; border-color: rgba(183, 220, 235, .25); background: linear-gradient(135deg, rgba(255,255,255,.09), rgba(255,255,255,.025)); box-shadow: inset 0 1px rgba(255,255,255,.08); }
.workspace-context p { color: #9cc8dc; }
.workspace-context strong { display: block; color: #f2fbff; font-size: .9rem; letter-spacing: -.01em; }
.context-selector select { width: 100%; margin-top: .1rem; padding: .48rem .55rem; color: #f2fbff; background: rgba(4, 25, 40, .62); border: 1px solid rgba(158, 224, 247, .5); border-radius: var(--radius-sm); font: inherit; font-weight: 700; }
.context-selector select:focus { outline: 2px solid #8dddf8; outline-offset: 2px; }
.case-context-link { display: flex; align-items: center; min-height: 42px; margin-top: .35rem; padding: .55rem .65rem; color: #f5fcff; background: rgba(4, 24, 37, .24); border: 1px solid rgba(189, 224, 237, .18); border-radius: var(--radius-sm); font-size: .84rem; font-weight: 700; line-height: 1.3; text-decoration: none; }
.case-context-link::after { content: "›"; margin-left: auto; color: #79d5f5; font-size: 1.25rem; }
.case-primary-nav { gap: .3rem; padding: .65rem 1rem 1rem; }
.case-primary-nav a { min-height: 46px; border-radius: 9px; color: #d0e2ea; }
.case-primary-nav a:hover { background: rgba(255,255,255,.09); border-color: rgba(190,222,235,.13); }
.case-primary-nav a[aria-current=page] { color: #fff; background: linear-gradient(90deg, #0c80b9, #176682); border-color: rgba(133, 213, 244, .58); box-shadow: inset 3px 0 #9ee6ff, 0 6px 16px rgba(0, 20, 33, .15); }
.case-primary-nav a[aria-current=page] .nav-icon { color: #e8fbff; }
.nav-group { margin: .25rem 1rem 0; padding-top: 1rem; border-top-color: rgba(185,220,234,.2); }
.nav-group > p { color: #a4c9d9; }
.topbar { height: var(--topbar); min-height: 0; padding: 0 clamp(1.5rem, 3vw, 3rem); grid-template-columns: 1fr auto; background: rgba(248, 252, 254, .7); backdrop-filter: blur(20px) saturate(130%); box-shadow: 0 1px rgba(255,255,255,.76); }
.account-menu { padding: .35rem .2rem .35rem .65rem; border: 1px solid rgba(123, 154, 170, .2); border-radius: 999px; background: rgba(255,255,255,.42); }
.avatar { color: var(--nav-selected-text); background: var(--nav-selected); box-shadow: 0 3px 11px color-mix(in srgb, var(--nav-selected) 22%, transparent); }
main { max-width: 1660px; padding-top: 2.35rem; }
.page-heading { margin-bottom: 1.8rem; }
.breadcrumbs { color: #6c8392; letter-spacing: .02em; }
.page-heading h1 { font-size: clamp(2rem, 2.6vw, 2.75rem); font-weight: 720; letter-spacing: -.045em; }
.overview-hero { border: 1px solid rgba(105, 151, 174, .28); background: linear-gradient(125deg, rgba(255,255,255,.92), rgba(238,248,252,.83)); box-shadow: 0 18px 42px rgba(35, 78, 101, .11); }
.overview-metric, .overview-panel { border-color: var(--border); background: var(--panel); box-shadow: 0 8px 24px rgba(37, 75, 94, .055); }
.card, .panel, main > section:not(.summary-grid):not(.case-list-panel), main > article { background: var(--panel); border-color: var(--border); box-shadow: 0 8px 25px rgba(30, 67, 87, .05); }
@media (max-width: 820px) { :root { --topbar: 64px; } main { padding-top: 1.5rem; } }

/* Phase 2 shared working-page controls */
.document-group-accordion{display:block;margin-bottom:.7rem;border:1px solid var(--border);border-radius:var(--radius);background:var(--panel);overflow:hidden}.document-group-accordion>summary{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.15rem;cursor:pointer;list-style:none}.document-group-accordion>summary::-webkit-details-marker{display:none}.document-group-accordion>summary::after{content:'⌄';color:var(--accent);font-size:1.1rem}.document-group-accordion[open]>summary{border-bottom:1px solid var(--border)}.document-group-accordion summary small{display:block;margin-top:.2rem;color:var(--muted)}.document-group-accordion summary>span:last-child{color:var(--text-soft);font-size:.8rem}.document-group-accordion .document-section-panel{margin:0;border:0;border-radius:0;box-shadow:none}.requires-review{margin:0 0 1rem;padding:1rem 1.2rem;background:var(--warning-soft);border:1px solid color-mix(in srgb,var(--warning) 35%,var(--border));border-radius:var(--radius)}.requires-review h2{margin:0 0 .6rem;color:var(--text);font-size:1rem}.requires-review a{display:flex;justify-content:space-between;gap:1rem;padding:.55rem 0;color:var(--text);text-decoration:none;border-top:1px solid color-mix(in srgb,var(--warning) 20%,transparent)}.requires-review a span{color:var(--text-soft);font-size:.82rem}.question-history{display:block;margin-top:1.25rem;padding:1rem 1.2rem;background:var(--panel);border:1px solid var(--border);border-radius:var(--radius)}.question-history>summary{cursor:pointer;font-size:1rem;font-weight:750}.question-history>summary span{margin-left:.5rem;color:var(--muted);font-size:.8rem;font-weight:500}.question-history[open]>summary{margin-bottom:1rem}.current-answer-heading{display:flex;justify-content:space-between;align-items:center}.history-remove{min-height:32px;padding:0 .6rem;background:transparent;color:var(--error);border-color:var(--error);box-shadow:none;font-size:.76rem}.appearance-control{margin:.3rem 0;padding:.55rem .75rem;color:var(--text-soft);font-size:.78rem}.appearance-control select{margin:.25rem 0 0;padding:.35rem;width:100%;background:var(--panel);color:var(--text)}.document-review-surface{padding:1.25rem;background:var(--panel);border:1px solid var(--border);border-radius:var(--radius)}.document-review-surface header{display:flex;justify-content:space-between;gap:1rem}.document-review-surface h2{margin:.25rem 0 .6rem}.document-review-tabs{margin:1.25rem 0 .75rem;padding-bottom:.65rem;border-bottom:2px solid var(--accent);color:var(--accent-strong)}.prepared-pages article{padding:1rem 0;border-bottom:1px solid var(--border)}.prepared-pages h3{margin:0 0 .5rem}.prepared-pages p{white-space:pre-wrap}.page-navigation{display:flex;justify-content:space-between;gap:.75rem;margin-top:1rem}@media(max-width:720px){.document-review-surface header{align-items:flex-start;flex-direction:column}.document-group-accordion>summary,.requires-review a{align-items:flex-start;flex-direction:column;gap:.35rem}}
.documents-utility{background:var(--panel)!important;color:var(--text)!important;border-color:var(--border)!important;box-shadow:0 8px 25px rgba(30,67,87,.05)!important}.working-page-title{padding:.1rem .1rem .8rem}.working-page-title h2{margin:0;font-size:1.25rem}.working-page-title p{margin:.25rem 0 0;color:var(--muted)}.findings-intro{background:var(--panel)!important;color:var(--text)!important;border-color:var(--border)!important}.findings-intro .eyebrow,.findings-intro p{color:var(--text-soft)!important}.findings-summary{display:none!important}.ask-workspace textarea#question-prompt{color:var(--field-text);background:var(--field-surface);border-color:var(--border-strong);box-shadow:none}.ask-workspace textarea#question-prompt:focus{border-color:var(--focus-ring);box-shadow:0 0 0 3px color-mix(in srgb,var(--focus-ring) 20%,transparent)}.ask-workspace textarea#question-prompt::placeholder{color:var(--placeholder);opacity:1}.finding-source-list article,.finding-citation,.finding-statement{background:rgba(255,255,255,.62)!important;color:var(--text)!important;border-color:var(--border)!important}.finding-source-list blockquote,.finding-citation blockquote{color:var(--text)!important}

/* Phase 3B: one evidence reading surface, controlled by the active theme. */
.ocr-request-form { display: inline-flex; margin-left: .5rem; }
.ocr-request-form .button { min-height: 32px; padding: 0 .7rem; font-size: .78rem; }
:root { --evidence-surface: color-mix(in srgb, var(--panel-raised) 88%, var(--accent-soft)); --evidence-surface-muted: color-mix(in srgb, var(--panel) 92%, var(--accent-soft)); --evidence-quote: color-mix(in srgb, var(--panel-raised) 82%, var(--accent-soft)); }
[data-theme="midnight-intelligence"] { --evidence-surface: #142536; --evidence-surface-muted: #101e2c; --evidence-quote: #102c40; }
.prepared-evidence-result,.finding-citation,.finding-statement,.finding-source-list > article,.output-finding-option,.output-card-heading,.output-version-row { background:var(--evidence-surface)!important; color:var(--text)!important; border-color:var(--border)!important; }
.prepared-evidence-result { margin:0 0 .65rem; border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.prepared-evidence-result > summary { display:grid; grid-template-columns:minmax(220px,.8fr) minmax(0,1.2fr); gap:1rem; padding:.85rem 1rem; cursor:pointer; list-style:none; }
.prepared-evidence-result > summary::-webkit-details-marker { display:none; }
.prepared-evidence-result summary small,.prepared-evidence-snippet,.prepared-evidence-provenance { display:block; color:var(--text-soft); font-size:.78rem; }
.prepared-evidence-snippet { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.prepared-evidence-result-body { padding:0 1rem 1rem; border-top:1px solid var(--border); }
.prepared-evidence-result-body > p:first-child { white-space:pre-wrap; color:var(--text); line-height:1.6; }
.prepared-evidence-result form { margin: .75rem 0 0; padding:0; background:transparent; border:0; }
.finding-citation blockquote,.finding-source-list blockquote { background:var(--evidence-quote)!important; color:var(--text)!important; border-left-color:var(--accent); }
.output-create-panel,.outputs-list-panel,.finding-card,.finding-source-panel,.chronology-panel { background:var(--panel)!important; border-color:var(--border)!important; }
.question-scope-summary { cursor:default; }
@media (max-width:720px) { .prepared-evidence-result > summary { grid-template-columns:1fr; gap:.35rem; } }

/* A history removal is a visibility action, not a destructive control. */
.history-remove { color:var(--text-soft); border-color:var(--border-strong); }
.history-remove:hover { color:var(--text); border-color:var(--text-soft); background:var(--panel-subtle); }

/* Group-centred evidence intake */
.group-upload { margin: 0 1.15rem 1rem; }
.file-type-badge { display:inline-flex; align-items:center; min-height:1.65rem; box-sizing:border-box; margin-left:.5rem; padding:.2rem .55rem; border:1px solid var(--state-info-border); border-radius:999px; color:var(--state-info-text); background:var(--state-info-surface); font-size:.7rem; font-weight:800; letter-spacing:.04em; line-height:1; vertical-align:middle; }
.document-move-form { display:flex; align-items:end; gap:.5rem; margin:1rem 0; padding:.7rem; border:1px solid var(--border); border-radius:var(--radius); background:var(--panel); }
.document-move-form label { display:grid; gap:.25rem; color:var(--text-soft); font-size:.8rem; }
@media(max-width:720px){.document-move-form{align-items:stretch;flex-direction:column}}

/* Client document detail: one action family, with status activity kept secondary. */
.document-status-row { display:flex; align-items:center; flex-wrap:wrap; gap:.45rem; }
.document-status-row .file-type-badge,
.document-status-row .status-chip { box-sizing:border-box; min-height:1.7rem; margin:0; padding:.28rem .62rem; border-radius:999px; font-size:.72rem; font-weight:750; line-height:1.1; }
.document-actions { display:flex; align-items:center; flex-wrap:wrap; gap:.6rem; margin:1.15rem 0 1rem; padding-top:1rem; border-top:1px solid var(--border); }
.document-actions form { display:contents; }
.document-actions .button { min-height:40px; padding:0 .9rem; border-radius:var(--radius-sm); font-weight:750; }
.document-actions .button-secondary { color:var(--nav-selected); background:transparent; border-color:var(--nav-selected); box-shadow:none; }
.document-actions .button-secondary:hover { color:var(--nav-selected); background:var(--surface-hover); border-color:var(--nav-selected); }
.document-actions .button-danger { color:var(--state-danger-text); background:var(--state-danger-surface); border-color:var(--state-danger-border); box-shadow:none; }
.document-actions .button-danger:hover { color:var(--state-danger-text); background:color-mix(in srgb,var(--state-danger-surface) 78%,var(--state-danger-border)); border-color:var(--state-danger-border); }
.document-move-form { align-items:end; gap:.65rem; margin:0 0 1rem; padding:.85rem 0 1rem; border-width:1px 0; border-radius:0; background:transparent; }
.document-move-form label { flex:1 1 18rem; margin:0; gap:.35rem; color:var(--text-soft); font-size:.78rem; font-weight:700; }
.document-move-form select { height:40px; margin:0; }
.document-move-form .button { min-height:40px; min-width:78px; }
.processing-activity { margin-top:0; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-subtle); }
.processing-activity summary { display:flex; align-items:center; gap:.6rem; padding:.85rem 1rem; color:var(--text); cursor:pointer; list-style:none; }
.processing-activity summary::-webkit-details-marker { display:none; }
.processing-activity summary::before { content:'▸'; color:var(--accent); transition:transform .15s ease; }
.processing-activity[open] summary::before { transform:rotate(90deg); }
.processing-activity summary span { color:var(--muted); font-size:.78rem; font-weight:500; }
.processing-activity ul { margin:0; padding:0 1rem .9rem 2.1rem; color:var(--text-soft); font-size:.82rem; }
.processing-activity li + li { margin-top:.35rem; }
.processing-activity small { color:var(--muted); }
@media(max-width:720px){.document-actions{align-items:stretch;flex-direction:column}.document-actions .button{width:100%}.document-move-form{align-items:stretch;flex-direction:column}.document-move-form .button{width:100%}.processing-activity summary{align-items:flex-start;flex-direction:column;gap:.2rem;padding-left:.8rem}.processing-activity summary::before{position:absolute;margin-left:-.3rem}}

/* Upload and other flash errors use semantic tokens across all themes. */
.flash { color: #174f3a; }
:root { --error-bg: var(--error-soft); --error-text: #7b1724; --error-border: #b63445; }
[data-theme="midnight-intelligence"] { --error-bg: #472129; --error-text: #ffd6d9; --error-border: #c95662; }
.flash.error { color: var(--error-text); background: var(--error-bg); border-color: var(--error-border); border-left-color: var(--error); }
.flash.error::first-line { font-weight: 750; }
.flash.error { white-space: pre-line; }

/*
   Application shell colour normalisation
   Keep navigation geometry and behaviour shared with the rest of the app while
   giving the shell a light, cool BigBlueYonder surface in every appearance.
*/
:root {
  --shell-surface: #edf5f9;
  --shell-surface-raised: #f9fcfe;
  --shell-border: #c7dbe6;
  --shell-text: #143149;
  --shell-text-soft: #547188;
  --shell-accent: #076e9f;
  --shell-accent-strong: #056b9f;
  --shell-accent-soft: #d9eff9;
}

.sidebar {
  background: var(--shell-surface);
  border-right-color: var(--shell-border);
  box-shadow: 8px 0 24px rgba(38, 78, 102, .06);
  color: var(--shell-text);
}

.sidebar-head {
  border-bottom-color: var(--shell-border);
}

.brand {
  color: var(--shell-text);
}

.brand-mark {
  background: #e3f4fb;
  border-color: #8ccce5;
  box-shadow: 0 7px 18px rgba(8, 127, 186, .14);
}

.brand-copy small {
  color: var(--shell-accent);
}

.brand-copy em {
  color: var(--shell-accent);
  font-style: normal;
}

.workspace-context {
  border-color: var(--shell-border);
  background: var(--shell-surface-raised);
  box-shadow: none;
  color: var(--shell-text);
}

.workspace-context p,
.nav-group > p {
  color: var(--shell-text-soft);
}

.workspace-context strong {
  color: var(--shell-text);
}

.context-selector select {
  color: var(--shell-text);
  background: #fff;
  border-color: var(--shell-border);
}

.context-selector select:hover,
.case-context-link:hover {
  border-color: #8bc4db;
  background: #f3f9fc;
}

.context-selector select:focus {
  outline-color: var(--shell-accent);
}

.case-context-link {
  color: var(--shell-text);
  background: #fff;
  border-color: var(--shell-border);
}

.case-context-link::after {
  color: var(--shell-accent);
}

.nav-group {
  border-top-color: var(--shell-border);
}

.primary-nav a,
.case-primary-nav a {
  color: var(--shell-text);
}

.nav-icon {
  color: var(--shell-text-soft);
}

.primary-nav a:hover,
.case-primary-nav a:hover {
  color: var(--shell-text);
  background: #e4f2f8;
  border-color: #c6e1ed;
}

.primary-nav a[aria-current=page],
.case-primary-nav a[aria-current=page] {
  color: #fff;
  background: var(--shell-accent);
  border-color: var(--shell-accent-strong);
  box-shadow: inset 3px 0 #85d8f6, 0 4px 12px rgba(8, 127, 186, .16);
}

.primary-nav a[aria-current=page] .nav-icon,
.case-primary-nav a[aria-current=page] .nav-icon {
  color: #fff;
}

.sidebar-foot {
  color: var(--shell-text);
  background: var(--shell-surface-raised);
  border-color: var(--shell-border);
}

.organisation-context small,
.system-state small {
  color: var(--shell-text-soft);
}

.context-icon {
  color: var(--shell-accent-strong);
  background: var(--shell-accent-soft);
}

.system-state {
  border-top-color: var(--shell-border);
}

.topbar {
  background: rgba(249, 252, 254, .94);
  color: var(--shell-text);
  border-bottom-color: var(--shell-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9);
}

.topbar-icon,
.menu-button {
  color: var(--shell-text-soft);
}

.account-menu {
  border-color: var(--shell-border);
  background: var(--shell-surface-raised);
}

.account-name strong {
  color: var(--shell-text);
}

.account-name small {
  color: var(--shell-text-soft);
}

.account-popover {
  background: #fff;
  border-color: var(--shell-border);
  box-shadow: 0 12px 30px rgba(38, 78, 102, .15);
}

.account-popover a,
.account-signout {
  color: var(--shell-text);
}

.account-popover a:hover,
.account-signout:hover {
  color: var(--shell-text);
  background: var(--shell-accent-soft);
}

.appearance-control {
  color: var(--shell-text-soft);
}

.appearance-control select {
  color: var(--shell-text);
  background: #fff;
  border-color: var(--shell-border);
}

.primary-nav a:focus-visible,
.case-context-link:focus-visible,
.context-selector select:focus-visible,
.account-menu > summary:focus-visible {
  outline-color: var(--shell-accent);
}

.context-selector select:disabled {
  color: #7b91a0;
  background: #e8f0f4;
  border-color: #d4e1e8;
}

/* Findings: present the established workflow in plain, source-led terms. */
.findings-intro h1 {
  margin: 0;
  color: var(--text);
  font-size: 1.35rem;
}

.findings-intro p,
.finding-source-heading p {
  color: var(--text-soft);
}

.finding-source-heading {
  align-items: flex-start;
  padding: 1rem 1.05rem;
}

.finding-source-heading p {
  margin: .25rem 0 0;
  font-size: .78rem;
  line-height: 1.45;
}

.finding-badges .finding-support-status {
  color: var(--shell-text);
  background: var(--shell-accent-soft);
  border-color: #9ccfe2;
}

.finding-action-context {
  flex-basis: 100%;
  color: var(--text-soft);
  font-size: .76rem;
}

.finding-review-panel form,
.chronology-action form {
  background: var(--panel-raised);
}

.finding-source-provenance {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .65rem;
}

.finding-source-provenance > div {
  display: grid;
  gap: .1rem;
  min-width: 0;
}

.finding-source-provenance strong {
  color: var(--text);
  font-size: .82rem;
}

.finding-source-provenance span,
.finding-answer-label,
.finding-answer-citations {
  color: var(--text-soft);
  font-size: .72rem;
}

.finding-source-provenance a {
  flex: 0 0 auto;
  font-size: .74rem;
  font-weight: 700;
}

.finding-source-list .finding-source-excerpt {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.finding-answer-label {
  display: block;
  margin-bottom: .4rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.finding-source-list .finding-answer-citations {
  margin: .55rem 0 .8rem;
  color: var(--text-soft);
  font-weight: 700;
}

@media (max-width: 560px) {
  .finding-source-provenance {
    flex-direction: column;
  }
}

/* Shared case-workspace anatomy */
.case-workspace-hero {
  margin-bottom: 1.5rem;
}

.case-workspace-page-heading {
  align-items: flex-start;
  margin: 0 0 1.5rem;
  padding: .1rem 0 1.2rem;
  border-bottom: 1px solid var(--border);
}

.case-workspace-page-heading > div:first-child {
  display: block !important;
  max-width: 760px;
}

.case-workspace-page-heading .breadcrumbs {
  display: none;
}

.case-workspace-page-heading h1 {
  font-size: clamp(1.65rem, 2.2vw, 2.2rem);
}

.case-workspace-page-heading .page-description {
  max-width: 720px;
  margin-top: .45rem;
  line-height: 1.55;
}

main:has(.case-documents-dashboard) > .case-workspace-page-heading,
main:has(.ask-workspace) > .case-workspace-page-heading,
main:has(.findings-workspace) > .case-workspace-page-heading,
main:has(.outputs-workspace) > .case-workspace-page-heading {
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.case-documents-dashboard,
.ask-workspace,
.findings-workspace,
.outputs-workspace {
  gap: 1.25rem;
}

.working-page-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.working-page-metric {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  padding: .8rem .9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 18px rgba(30, 67, 87, .04);
}

.working-page-metric > span {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 50%;
  font-weight: 800;
}

.working-page-metric.success > span {
  color: var(--success);
  background: var(--success-soft);
}

.working-page-metric.warning > span {
  color: var(--warning);
  background: var(--warning-soft);
}

.working-page-metric.error > span {
  color: var(--error);
  background: var(--error-soft);
}

.working-page-metric > div {
  display: grid;
  min-width: 0;
}

.working-page-metric strong {
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1.1;
}

.working-page-metric small {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.25;
}

@media (max-width: 720px) {
  .case-workspace-page-heading {
    gap: .9rem;
  }

  .working-page-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* UI normalisation phase 2: shared geometry, compact evidence, and complete themes. */

/* Keep Overview on the same workspace width as the other case pages. */
.case-overview-dashboard {
  grid-template-columns: minmax(0, 1fr) !important;
}

.case-overview-dashboard > .overview-hero,
.case-overview-dashboard > .overview-metrics,
.case-overview-dashboard > .overview-middle-grid,
.case-overview-dashboard > .overview-bottom-grid {
  grid-column: 1 / -1;
}

.overview-metrics {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .75rem;
  width: 100%;
}

.overview-metric {
  min-height: 138px;
}

@media (max-width: 560px) {
  .overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 390px) {
  .overview-metrics {
    grid-template-columns: 1fr;
  }
}

/* Citation text remains available, but the review surface starts with the passage a
   reviewer can assess rather than an unbounded extraction payload. */
.finding-citation {
  align-items: start;
}

.finding-citation-content {
  min-width: 0;
}

.finding-citation-provenance {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: .9rem;
  margin-bottom: .65rem;
}

.finding-citation-provenance > div {
  display: grid;
  min-width: 0;
  gap: .12rem;
}

.finding-citation-provenance strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: .82rem;
}

.finding-citation-provenance span,
.citation-excerpt-label,
.finding-citation-status {
  color: var(--text-soft);
  font-size: .72rem;
}

.finding-citation-provenance a {
  flex: 0 0 auto;
  font-size: .74rem;
  font-weight: 750;
}

.citation-excerpt-label {
  display: block;
  margin-bottom: .35rem;
  font-weight: 800;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.finding-citation blockquote {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.finding-citation-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: .55rem;
  padding: 0 .5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--evidence-surface-muted);
  font-weight: 700;
}

.finding-citation-context {
  margin-top: .7rem;
  border-top: 1px solid var(--border);
}

.finding-citation-context summary {
  padding: .65rem 0 0;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: .76rem;
  font-weight: 750;
}

.finding-citation-context > div {
  max-height: 22rem;
  margin-top: .55rem;
  overflow: auto;
  overflow-wrap: anywhere;
  padding: .75rem;
  color: var(--text-soft);
  background: var(--evidence-surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

@media (max-width: 560px) {
  .finding-citation-provenance {
    flex-direction: column;
    gap: .45rem;
  }
}

/* Shell colours are semantic tokens.  This replaces the previous late light-shell
   overrides so every retained appearance can colour the whole application. */
:root,
[data-theme="harbor-glass"] {
  --shell-surface: #edf5f9;
  --shell-surface-raised: #f9fcfe;
  --shell-border: #c7dbe6;
  --shell-text: #143149;
  --shell-text-soft: #547188;
  --shell-accent: #076e9f;
  --shell-accent-strong: #056b9f;
  --shell-accent-soft: #d9eff9;
  --shell-field: #ffffff;
  --shell-hover: #e4f2f8;
  --shell-topbar: rgba(249, 252, 254, .94);
  --shell-shadow: rgba(38, 78, 102, .12);
  --focus-ring: #056b9f;
  --placeholder: #567184;
  --disabled-bg: #e8f0f4;
  --disabled-text: #536d7d;
}

[data-theme="clean-horizon"] {
  --canvas: #f4f8fb;
  --panel: #ffffff;
  --panel-raised: #ffffff;
  --panel-hover: #eaf4f9;
  --border: #c8dce7;
  --border-strong: #a9c6d5;
  --text: #173249;
  --text-soft: #3e6179;
  --muted: #617c90;
  --accent: #1673ad;
  --accent-strong: #075f97;
  --accent-soft: #d9edf8;
  --shell-surface: #f1f7fa;
  --shell-surface-raised: #ffffff;
  --shell-border: #c8dce7;
  --shell-text: #173249;
  --shell-text-soft: #4d6d82;
  --shell-accent: #1673ad;
  --shell-accent-strong: #075f97;
  --shell-accent-soft: #d9edf8;
  --shell-field: #ffffff;
  --shell-hover: #e1f0f7;
  --shell-topbar: rgba(255, 255, 255, .95);
  --shell-shadow: rgba(33, 75, 101, .10);
  --focus-ring: #075f97;
  --placeholder: #58778d;
  --disabled-bg: #e8f0f4;
  --disabled-text: #526f82;
}

[data-theme="ivory-beacon"] {
  --canvas: #f6f1e8;
  --panel: #fffdf8;
  --panel-raised: #ffffff;
  --panel-hover: #f7efdf;
  --border: #d8cab3;
  --border-strong: #bca982;
  --text: #3d3021;
  --text-soft: #685741;
  --muted: #7c6c59;
  --accent: #8c641d;
  --accent-strong: #6e4b12;
  --accent-soft: #f4e6c8;
  --shell-surface: #efe4d2;
  --shell-surface-raised: #fffaf0;
  --shell-border: #d4c19f;
  --shell-text: #3d3021;
  --shell-text-soft: #6b5941;
  --shell-accent: #8c641d;
  --shell-accent-strong: #6e4b12;
  --shell-accent-soft: #f4e6c8;
  --shell-field: #fffdf8;
  --shell-hover: #f5e9d2;
  --shell-topbar: rgba(255, 250, 240, .95);
  --shell-shadow: rgba(91, 70, 40, .12);
  --focus-ring: #6e4b12;
  --placeholder: #765f45;
  --disabled-bg: #eee4d3;
  --disabled-text: #746653;
}

[data-theme="midnight-intelligence"] {
  --canvas: #091725;
  --navy-950: #081522;
  --navy-925: #0b1c2c;
  --navy-900: #0d2234;
  --navy-850: #10283b;
  --panel: #102336;
  --panel-raised: #152b40;
  --panel-hover: #19344b;
  --border: #2b4860;
  --border-strong: #41617a;
  --text: #edf5fa;
  --text-soft: #bfd0dc;
  --muted: #91a8b9;
  --accent: #35b9ef;
  --accent-strong: #1396cd;
  --accent-soft: #103c56;
  --success: #55c995;
  --success-soft: #123d34;
  --warning: #f2b257;
  --warning-soft: #4b3318;
  --error: #f28a93;
  --error-soft: #4a2630;
  --shell-surface: #081827;
  --shell-surface-raised: #10263a;
  --shell-border: #29485f;
  --shell-text: #edf5fa;
  --shell-text-soft: #b9cbd8;
  --shell-accent: #087bab;
  --shell-accent-strong: #1396cd;
  --shell-accent-soft: #103c56;
  --shell-field: #10283b;
  --shell-hover: #15334a;
  --shell-topbar: rgba(8, 24, 39, .96);
  --shell-shadow: rgba(0, 8, 16, .42);
  --focus-ring: #7bd7f7;
  --placeholder: #91a8b9;
  --disabled-bg: #1a3043;
  --disabled-text: #8da3b3;
  --evidence-surface: #142b40;
  --evidence-surface-muted: #0e2234;
  --evidence-quote: #102d43;
}

body,
.app-shell {
  background: var(--canvas);
}

.sidebar {
  background: var(--shell-surface);
  border-right-color: var(--shell-border);
  box-shadow: 8px 0 24px var(--shell-shadow);
  color: var(--shell-text);
}

.sidebar-head,
.nav-group,
.system-state {
  border-color: var(--shell-border);
}

.brand,
.workspace-context,
.workspace-context strong,
.primary-nav a,
.case-primary-nav a,
.sidebar-foot,
.account-name strong {
  color: var(--shell-text);
}

.brand-mark {
  background: var(--shell-accent-soft);
  border-color: var(--shell-accent);
  box-shadow: 0 7px 18px var(--shell-shadow);
}

.brand-copy small,
.case-context-link::after {
  color: var(--shell-accent);
}

.workspace-context,
.sidebar-foot,
.account-menu {
  background: var(--shell-surface-raised);
  border-color: var(--shell-border);
  box-shadow: none;
}

.workspace-context p,
.nav-group > p,
.organisation-context small,
.system-state small,
.account-name small,
.topbar-icon,
.menu-button,
.nav-icon {
  color: var(--shell-text-soft);
}

.context-selector select,
.case-context-link,
.appearance-control select,
.account-popover {
  color: var(--shell-text);
  background: var(--shell-field);
  border-color: var(--shell-border);
}

.context-selector select:hover,
.case-context-link:hover,
.primary-nav a:hover,
.case-primary-nav a:hover,
.account-popover a:hover,
.account-signout:hover {
  color: var(--shell-text);
  background: var(--shell-hover);
  border-color: var(--shell-border);
}

.primary-nav a[aria-current=page],
.case-primary-nav a[aria-current=page] {
  color: #fff;
  background: var(--shell-accent);
  border-color: var(--shell-accent-strong);
  box-shadow: inset 3px 0 color-mix(in srgb, var(--shell-accent) 45%, #fff), 0 4px 12px var(--shell-shadow);
}

.primary-nav a[aria-current=page] .nav-icon,
.case-primary-nav a[aria-current=page] .nav-icon {
  color: #fff;
}

.context-icon {
  color: var(--shell-accent-strong);
  background: var(--shell-accent-soft);
}

.topbar {
  color: var(--shell-text);
  background: var(--shell-topbar);
  border-bottom-color: var(--shell-border);
  box-shadow: 0 1px 0 var(--shell-border);
}

.account-popover {
  box-shadow: 0 12px 30px var(--shell-shadow);
}

.account-popover a,
.account-signout,
.appearance-control {
  color: var(--shell-text);
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

:focus-visible,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

button:disabled,
.button[aria-disabled="true"],
input:disabled,
select:disabled,
textarea:disabled {
  color: var(--disabled-text);
  background: var(--disabled-bg);
  border-color: var(--border);
  box-shadow: none;
  cursor: not-allowed;
  opacity: .78;
}

/* Output register defect repair: preserve the menu's document flow while allowing
   an open export choice-list to layer above following register rows. */
.outputs-list-panel,
.output-card {
  overflow: visible;
}

.output-card {
  position: relative;
}

.output-card:has(.output-export-menu[open]) {
  z-index: 1;
}

.output-version-row:has(.output-export-menu[open]) {
  position: relative;
  z-index: 2;
}

.output-export-menu > div {
  z-index: 3;
}

/* Output states use semantic, theme-owned surfaces rather than a shared dark pill. */
:root,
[data-theme="harbor-glass"] {
  --output-status-draft-surface: #eef3f6;
  --output-status-draft-text: #314c5e;
  --output-status-draft-border: #a9c0cb;
  --output-status-review-surface: #e0f1f8;
  --output-status-review-text: #075b84;
  --output-status-review-border: #78b9d4;
  --output-status-reviewed-surface: #f0eafd;
  --output-status-reviewed-text: #573a88;
  --output-status-reviewed-border: #b69ad8;
  --output-status-approved-surface: #e0f3e9;
  --output-status-approved-text: #176641;
  --output-status-approved-border: #8bc4a8;
}

[data-theme="clean-horizon"] {
  --output-status-draft-surface: #edf3f6;
  --output-status-draft-text: #314e62;
  --output-status-draft-border: #a7c1ce;
  --output-status-review-surface: #e0f1f8;
  --output-status-review-text: #075f8b;
  --output-status-review-border: #78bad6;
  --output-status-reviewed-surface: #f0eafd;
  --output-status-reviewed-text: #573a88;
  --output-status-reviewed-border: #b69ad8;
  --output-status-approved-surface: #e1f4ea;
  --output-status-approved-text: #176943;
  --output-status-approved-border: #8cc5aa;
}

[data-theme="ivory-beacon"] {
  --output-status-draft-surface: #f4f0e8;
  --output-status-draft-text: #514537;
  --output-status-draft-border: #cbbda4;
  --output-status-review-surface: #e8f1f4;
  --output-status-review-text: #1d5f7b;
  --output-status-review-border: #9bbfce;
  --output-status-reviewed-surface: #f2eaf7;
  --output-status-reviewed-text: #603f75;
  --output-status-reviewed-border: #c2a8d0;
  --output-status-approved-surface: #e6f1e5;
  --output-status-approved-text: #2c653c;
  --output-status-approved-border: #9dbca2;
}

[data-theme="midnight-intelligence"] {
  --output-status-draft-surface: #1b3347;
  --output-status-draft-text: #d1e0ea;
  --output-status-draft-border: #45647a;
  --output-status-review-surface: #10405a;
  --output-status-review-text: #b5e6fb;
  --output-status-review-border: #347a98;
  --output-status-reviewed-surface: #33294b;
  --output-status-reviewed-text: #ddcfff;
  --output-status-reviewed-border: #67558a;
  --output-status-approved-surface: #123d34;
  --output-status-approved-text: #bdf0d7;
  --output-status-approved-border: #397860;
}

.output-status.status-draft {
  color: var(--output-status-draft-text);
  background: var(--output-status-draft-surface);
  border-color: var(--output-status-draft-border);
}

.output-status.status-in-review {
  color: var(--output-status-review-text);
  background: var(--output-status-review-surface);
  border-color: var(--output-status-review-border);
}

.output-status.status-reviewed {
  color: var(--output-status-reviewed-text);
  background: var(--output-status-reviewed-surface);
  border-color: var(--output-status-reviewed-border);
}

.output-status.status-approved-for-circulation {
  color: var(--output-status-approved-text);
  background: var(--output-status-approved-surface);
  border-color: var(--output-status-approved-border);
}

.output-version-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}

.output-version-meta > div {
  gap: .28rem;
}

/* The persistent hero is a shared component; Midnight supplies its own quiet,
   deep-navy surface and subdued evidence graphic through this one theme hook. */
[data-theme="midnight-intelligence"] .case-workspace-hero.overview-hero {
  background:
    radial-gradient(circle at 78% 32%, rgba(53, 185, 239, .11), transparent 30%),
    linear-gradient(145deg, #112c43, #0c2032 64%);
  border-color: #31536b;
  box-shadow: 0 18px 42px rgba(0, 10, 21, .28), inset 0 1px rgba(166, 215, 239, .04);
}

[data-theme="midnight-intelligence"] .case-workspace-hero h2 {
  color: var(--text);
}

[data-theme="midnight-intelligence"] .case-workspace-hero p,
[data-theme="midnight-intelligence"] .case-workspace-hero .overview-meta {
  color: var(--text-soft);
}

[data-theme="midnight-intelligence"] .case-workspace-hero .overview-meta span:not(:last-child)::after {
  background: #618097;
}

[data-theme="midnight-intelligence"] .case-workspace-hero .network-ring {
  border-color: rgba(117, 193, 226, .28);
}

[data-theme="midnight-intelligence"] .case-workspace-hero .network-ring-two {
  border-color: rgba(117, 193, 226, .42);
}

[data-theme="midnight-intelligence"] .case-workspace-hero .network-node {
  background: #6fc6e8;
  box-shadow: none;
}

[data-theme="midnight-intelligence"] .case-workspace-hero .network-core {
  color: #91d5ee;
  text-shadow: none;
}

/* POC presentation: semantic information and research-failure surfaces.
   These replace inherited dark slabs in light appearances without changing
   form or research behaviour. */
:root,
[data-theme="harbor-glass"] {
  --info-surface: #e5f2f8;
  --info-text: #1d4b65;
  --info-border: #9fc7d9;
  --info-icon-surface: #0a6f9f;
  --info-icon-text: #ffffff;
  --research-failure-surface: #fbe7e9;
  --research-failure-text: #741d2a;
  --research-failure-border: #cf8790;
  --research-failure-icon-surface: #a83242;
}

[data-theme="clean-horizon"] {
  --info-surface: #e5f2f8;
  --info-text: #1c4e69;
  --info-border: #9fc9dc;
  --info-icon-surface: #0a6899;
  --info-icon-text: #ffffff;
  --research-failure-surface: #fce8e9;
  --research-failure-text: #751d29;
  --research-failure-border: #d18c93;
  --research-failure-icon-surface: #a83242;
}

[data-theme="ivory-beacon"] {
  --info-surface: #f5ead5;
  --info-text: #59421d;
  --info-border: #d4ba8a;
  --info-icon-surface: #755415;
  --info-icon-text: #ffffff;
  --research-failure-surface: #f9e7e4;
  --research-failure-text: #70232b;
  --research-failure-border: #cd9191;
  --research-failure-icon-surface: #983846;
}

[data-theme="midnight-intelligence"] {
  --info-surface: #123a53;
  --info-text: #d3edfa;
  --info-border: #3b7898;
  --info-icon-surface: #5cc6ef;
  --info-icon-text: #071923;
  --research-failure-surface: #492832;
  --research-failure-text: #ffe0e3;
  --research-failure-border: #b4606b;
  --research-failure-icon-surface: #f3959d;
}

.form-help {
  color: var(--info-text);
  background: var(--info-surface);
  border-color: var(--info-border);
}

.form-help > span {
  color: var(--info-icon-text);
  background: var(--info-icon-surface);
}

.form-help p {
  color: var(--info-text);
}

.field-label { display:flex; align-items:center; gap:.45rem; }
.field-help { display:inline-grid; place-items:center; width:1.25rem; height:1.25rem; margin:0; padding:0; border:1px solid var(--info-border); border-radius:50%; color:var(--info-icon-text); background:var(--info-icon-surface); font-size:.72rem; font-weight:800; line-height:1; cursor:help; }
.field-help-text { display:none; margin-top:.35rem; padding:.45rem .6rem; color:var(--info-text); background:var(--info-surface); border:1px solid var(--info-border); border-radius:var(--radius-sm); font-size:var(--font-xs); font-weight:400; }
.field-label:has(.field-help:hover) + .field-help-text, .field-label:has(.field-help:focus-visible) + .field-help-text { display:block; }
.answer-style-control { max-width:18rem; margin-top:var(--space-3); }
.answer-style-control small { display:block; margin-top:var(--space-2); color:var(--muted); font-size:var(--font-xs); font-weight:400; }

.analysis-unavailable {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .7rem;
  align-items: start;
  margin: 0 1.15rem 1rem;
  padding: .85rem .95rem;
  color: var(--research-failure-text);
  background: var(--research-failure-surface);
  border: 1px solid var(--research-failure-border);
  border-left: 4px solid var(--research-failure-icon-surface);
  border-radius: var(--radius-sm);
  font-size: .82rem;
}

.analysis-unavailable-icon {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: .05rem;
  color: var(--info-icon-text);
  background: var(--research-failure-icon-surface);
  border-radius: 50%;
  font-weight: 850;
}

.analysis-unavailable strong,
.analysis-unavailable p,
.analysis-unavailable a {
  color: inherit;
}

/* Case research workspace additions */
.case-more-group { margin-top: .25rem; opacity: .9; }
.ask-examples { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.ask-examples h3 { margin: 0 0 .65rem; color: var(--text-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.ask-example-list { display: flex; flex-wrap: wrap; gap: .55rem; }
.ask-example { max-width: 100%; padding: .55rem .7rem; color: var(--text-soft); background: var(--panel); border: 1px solid var(--border); border-radius: 999px; text-align: left; cursor: pointer; }
.ask-example:hover, .ask-example:focus-visible { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
.history-list { display: grid; gap: 1rem; }
.history-card { padding: 1.2rem; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.history-card-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.history-card h2 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.history-card time, .history-card-meta { color: var(--muted); font-size: .8rem; }
.history-card-preview { max-width: 72rem; margin: .75rem 0 0; color: var(--text-soft); line-height: 1.55; }
.history-card-actions { display: flex; justify-content: space-between; gap: .75rem; align-items: center; margin-top: 1rem; }
.history-detail { max-width: 880px; }
.history-detail-question { margin: 0; font-size: clamp(1.35rem, 2vw, 2rem); line-height: 1.25; }
.history-detail-meta { color: var(--muted); }
.history-detail-answer, .history-detail-evidence { margin-top: 1.25rem; padding: 1.25rem; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.history-detail-answer h2, .history-detail-evidence h2 { margin-top: 0; }
.history-detail-answer .research-answer { max-width: 72ch; line-height: 1.7; }
.history-detail-empty { color: var(--text-soft); }
@media (max-width: 640px) {
  .history-card-heading, .history-card-actions { display: grid; }
  .ask-example-list { display: grid; }
  .ask-example { border-radius: var(--radius-sm); }
}

.analysis-unavailable p {
  margin: .12rem 0 0;
}

.analysis-unavailable a {
  display: inline-block;
  margin-top: .4rem;
  font-weight: 750;
}

.benchmark-details { display: grid; gap: 1rem; }
.benchmark-details-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.benchmark-details-heading h2 { margin: .2rem 0; }
.benchmark-details-heading p { margin: .25rem 0 0; color: var(--text-soft); }
.benchmark-details-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.benchmark-summary-grid, .benchmark-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.benchmark-summary-section { padding: 1rem 1.15rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.benchmark-summary-section h3, .benchmark-summary-section h4 { margin: 0 0 .7rem; }
.benchmark-summary-section dl { margin: 0; }
.benchmark-summary-section dl > div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-top: 1px solid var(--border); }
.benchmark-summary-section dl > div:first-child { border-top: 0; }
.benchmark-summary-section dt { color: var(--text-soft); }
.benchmark-summary-section dd { margin: 0; text-align: right; font-weight: 650; overflow-wrap: anywhere; }
.benchmark-summary-section ul { margin: .25rem 0 0; padding-left: 1.2rem; }
.benchmark-json-preview, .benchmark-raw-json pre { max-height: 26rem; overflow: auto; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .78rem; }
.benchmark-raw-json { padding: 1rem 1.15rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.benchmark-raw-json summary { cursor: pointer; font-weight: 700; }
.benchmark-raw-json[open] summary { margin-bottom: .85rem; }
@media (max-width: 720px) {
  .benchmark-details-heading { align-items: start; flex-direction: column; }
  .benchmark-summary-grid, .benchmark-detail-grid { grid-template-columns: 1fr; }
  .benchmark-summary-section dl > div { align-items: start; flex-direction: column; gap: .15rem; }
  .benchmark-summary-section dd { text-align: left; }
}

/* Canonical semantic colour roles. */
:root {
  --surface: #f9fcfe; --surface-raised: #ffffff; --surface-subtle: #edf5f9; --surface-hover: #e4f2f8;
  --field-surface: #ffffff; --field-text: #132b40; --nav-surface: #edf5f9; --nav-text: #143149; --nav-muted: #547188;
  --nav-hover: #e4f2f8; --nav-selected: #076e9f; --nav-selected-text: #ffffff; --nav-indicator: #056b9f;
  --state-neutral-surface: #eef3f6; --state-neutral-text: #314c5e; --state-neutral-border: #a9c0cb;
  --state-info-surface: #e5f2f8; --state-info-text: #1d4b65; --state-info-border: #9fc7d9;
  --state-review-surface: #f0eafd; --state-review-text: #573a88; --state-review-border: #b69ad8;
  --state-success-surface: #def3e9; --state-success-text: #176641; --state-success-border: #8bc4a8;
  --state-warning-surface: #fff0d9; --state-warning-text: #7b4b08; --state-warning-border: #c99042;
  --state-danger-surface: #fbe5e7; --state-danger-text: #741d2a; --state-danger-border: #cf8790;
  --scrollbar-thumb: #9ab5c4; --scrollbar-track: #e3edf2; --danger: #bd3f4c; --panel-subtle: #edf5f9;
}
[data-theme="harbor-glass"] { --surface: rgba(252,254,255,.84); --surface-raised:#f9fcfe; --surface-subtle:#edf5f9; --surface-hover:#eef7fb; --field-surface:#fff; --field-text:#132b40; --nav-surface:#edf5f9; --nav-text:#143149; --nav-muted:#547188; --nav-hover:#e4f2f8; --nav-selected:#076e9f; --nav-selected-text:#fff; --nav-indicator:#056b9f; --scrollbar-thumb:#9ab5c4; --scrollbar-track:#e3edf2; }
[data-theme="clean-horizon"] { --surface:#fff; --surface-raised:#fff; --surface-subtle:#f1f7fa; --surface-hover:#eaf4f9; --field-surface:#fff; --field-text:#173249; --nav-surface:#f1f7fa; --nav-text:#173249; --nav-muted:#4d6d82; --nav-hover:#e1f0f7; --nav-selected:#075f97; --nav-selected-text:#fff; --nav-indicator:#064e7d; --scrollbar-thumb:#9bb8c8; --scrollbar-track:#e5eff4; }
[data-theme="ivory-beacon"] { --surface:#fffdf8; --surface-raised:#fffaf0; --surface-subtle:#efe4d2; --surface-hover:#f7efdf; --field-surface:#fffdf8; --field-text:#3d3021; --nav-surface:#efe4d2; --nav-text:#3d3021; --nav-muted:#6b5941; --nav-hover:#f5e9d2; --nav-selected:#6e4b12; --nav-selected-text:#fffaf0; --nav-indicator:#4f350b; --scrollbar-thumb:#b8a27e; --scrollbar-track:#eadfcd; }
[data-theme="midnight-intelligence"] { --surface:#102336; --surface-raised:#152b40; --surface-subtle:#0e2234; --surface-hover:#19344b; --field-surface:#10283b; --field-text:#edf5fa; --nav-surface:#081827; --nav-text:#edf5fa; --nav-muted:#b9cbd8; --nav-hover:#15334a; --nav-selected:#087bab; --nav-selected-text:#fff; --nav-indicator:#7bd7f7; --scrollbar-thumb:#41617a; --scrollbar-track:#0d2234; }
[data-theme="midnight-intelligence"] { --state-neutral-surface:#1b3347; --state-neutral-text:#d1e0ea; --state-neutral-border:#45647a; --state-info-surface:#123a53; --state-info-text:#d3edfa; --state-info-border:#3b7898; --state-review-surface:#33294b; --state-review-text:#ddcfff; --state-review-border:#67558a; --state-success-surface:#123d34; --state-success-text:#bdf0d7; --state-success-border:#397860; --state-warning-surface:#4b3318; --state-warning-text:#ffe0b5; --state-warning-border:#a87532; --state-danger-surface:#4a2630; --state-danger-text:#ffe0e3; --state-danger-border:#b4606b; }
[data-theme="clean-horizon"] { --state-neutral-surface:#edf3f6; --state-neutral-text:#314e62; --state-neutral-border:#a7c1ce; --state-success-surface:#e1f4ea; --state-success-text:#176943; --state-success-border:#8cc5aa; }
[data-theme="ivory-beacon"] { --state-neutral-surface:#f4f0e8; --state-neutral-text:#514537; --state-neutral-border:#cbbda4; --state-info-surface:#f5ead5; --state-info-text:#59421d; --state-info-border:#d4ba8a; --state-review-surface:#f2eaf7; --state-review-text:#603f75; --state-review-border:#c2a8d0; --state-success-surface:#e6f1e5; --state-success-text:#2c653c; --state-success-border:#9dbca2; --state-warning-text:#70420b; --state-danger-surface:#f9e7e4; --state-danger-text:#70232b; --state-danger-border:#cd9191; }

/* Final cascade for the canonical visual system. */
input, select, textarea { color: var(--field-text); background: var(--field-surface); border-color: var(--border-strong); }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input:focus, select:focus, textarea:focus { outline-color: var(--focus-ring); border-color: var(--focus-ring); }
.question-scope-summary { color: var(--state-info-text); background: var(--state-info-surface); border-color: var(--state-info-border); }
.file-type-badge, .case-document-file-icon { color: var(--nav-selected-text); background: var(--nav-selected); border-color: var(--nav-indicator); }
.icon-button { color: var(--nav-selected-text); background: var(--nav-selected); border-color: var(--nav-indicator); }
.suggested-question, .scope-option, .scope-passage, .analysis-progress-row { color: var(--text-soft); background: var(--surface-subtle); border-color: var(--border); }
.suggested-question:hover, .scope-option:hover, .scope-passage:hover { color: var(--text); background: var(--surface-hover); border-color: var(--accent); }
.answer-statement, .citation-content blockquote, .finding-statement { color: var(--text); background: var(--surface-subtle); border-color: var(--border); }
.finding-source-list article, .finding-citation, .finding-statement, .output-finding-option, .output-card-heading, .output-version-row { color: var(--text) !important; background: var(--surface) !important; border-color: var(--border) !important; }
.finding-source-list blockquote, .finding-citation blockquote { color: var(--text) !important; background: var(--evidence-quote) !important; }

.status-chip, .badge, .material-badge, .output-eligibility, .status-draft, .status-new { color: var(--state-neutral-text); background: var(--state-neutral-surface); border-color: var(--state-neutral-border); }
.status-in-progress, .status-processing, .status-checking { color: var(--state-info-text); background: var(--state-info-surface); border-color: var(--state-info-border); }
.status-review, .status-needs-review, .status-in-review { color: var(--state-review-text); background: var(--state-review-surface); border-color: var(--state-review-border); }
.status-completed, .status-succeeded, .status-connected, .status-ready, .status-accepted { color: var(--state-success-text); background: var(--state-success-surface); border-color: var(--state-success-border); }
.status-needs-attention, .status-partial { color: var(--state-warning-text); background: var(--state-warning-surface); border-color: var(--state-warning-border); }
.status-uploaded { color: var(--state-info-text); background: var(--state-info-surface); border-color: var(--state-info-border); }
.status-failed, .status-rejected, .status-superseded { color: var(--state-danger-text); background: var(--state-danger-surface); border-color: var(--state-danger-border); }
.status-archived { color: var(--muted); background: var(--surface-subtle); border-color: var(--border); }
.output-status.status-draft { color: var(--state-neutral-text); background: var(--state-neutral-surface); border-color: var(--state-neutral-border); }
.output-status.status-in-review { color: var(--state-review-text); background: var(--state-review-surface); border-color: var(--state-review-border); }
.output-status.status-reviewed { color: var(--state-review-text); background: var(--state-review-surface); border-color: var(--state-review-border); }
.output-status.status-approved-for-circulation { color: var(--state-success-text); background: var(--state-success-surface); border-color: var(--state-success-border); }

.live-research-surface { color: var(--state-info-text); background: var(--state-info-surface); border-color: var(--state-info-border); box-shadow: none; }
.live-research-surface .live-research-brand-heading, .live-research-surface .live-research-question, .live-research-current, .live-research-activity, .live-research-clock { color: var(--state-info-text); }
.live-research-history li.live-research-activity { color: var(--state-info-text); }
.live-research-running, .live-research-elapsed, .live-research-new-activity { color: var(--state-info-text); background: var(--surface); border-color: var(--state-info-border); }
.live-research-spinner { border-color: var(--state-info-border); border-top-color: var(--state-info-text); }

.sidebar { overflow: hidden; background: var(--nav-surface); color: var(--nav-text); scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
.sidebar-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
.sidebar-scroll::-webkit-scrollbar { width: 9px; }
.sidebar-scroll::-webkit-scrollbar-track { background: var(--scrollbar-track); }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border: 2px solid var(--scrollbar-track); border-radius: 999px; }
.sidebar-scroll .nav-group { margin-top: .15rem; padding-top: .55rem; }
.sidebar-scroll .primary-nav { gap: .18rem; padding-top: .45rem; padding-bottom: .55rem; }
.sidebar-scroll .primary-nav a, .sidebar-scroll .case-primary-nav a { min-height: 40px; padding-top: 7px; padding-bottom: 7px; color: var(--nav-text); font-weight: 650; }
.sidebar-scroll .nav-group > p { color: var(--nav-muted); }
.sidebar-scroll .primary-nav a:hover { color: var(--nav-text); background: var(--nav-hover); border-color: var(--border); }
.sidebar-scroll .primary-nav a[aria-current=page] { color: var(--nav-selected-text); background: var(--nav-selected); border-color: var(--nav-indicator); box-shadow: inset 4px 0 var(--nav-indicator); font-weight: 800; }
.sidebar-scroll .primary-nav a[aria-current=page] .nav-icon { color: var(--nav-selected-text); }
.sidebar-scroll .nav-icon { color: var(--nav-muted); }
.sidebar-foot { flex: 0 0 auto; margin: 0 .85rem .85rem; color: var(--nav-text); background: var(--surface-raised); border-color: var(--border); }
@media (max-width: 820px) { .sidebar-scroll .primary-nav a, .sidebar-scroll .case-primary-nav a { min-height: 42px; } }

/* Bounded visual-shell refinement: global context belongs in the shared header. */
.sidebar-head,
.topbar { height: var(--topbar); min-height: 0; box-sizing: border-box; }
.sidebar-head { padding-block: .35rem; }
.brand { height: 100%; }
.brand-mark,
.brand-mark img { max-width: min(60px, calc(var(--topbar) - .7rem)); max-height: min(60px, calc(var(--topbar) - .7rem)); }

.topbar { display: flex; gap: clamp(.65rem, 1.5vw, 1.25rem); }
.topbar-title { flex: 0 1 auto; min-width: 0; }
.global-context { display: flex; flex: 1 1 auto; align-items: center; gap: .65rem; min-width: 0; }
.header-context-control { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .45rem; min-width: 0; margin: 0; color: var(--text-soft); font-size: .72rem; font-weight: 700; }
.header-context-control > span { color: var(--muted); white-space: nowrap; }
.header-context-control select,
.header-context-control > strong { width: min(20rem, 26vw); min-width: 0; margin: 0; padding: .43rem .6rem; overflow: hidden; color: var(--field-text); background: var(--field-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; font-size: .82rem; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.header-context-control > strong { display: block; }
.header-case-link { color: var(--text-soft); text-decoration: none; }
.header-case-link:hover > strong { border-color: var(--accent); background: var(--surface-hover); }
.account-menu { flex: 0 0 auto; margin-left: auto; }

/* Primary actions and selected navigation share each theme's strong-action role. */
.button-primary,
button:not(.button-secondary):not(.button-danger):not(.account-signout):not(.history-remove) { background: var(--nav-selected); border-color: var(--nav-indicator); box-shadow: 0 6px 18px color-mix(in srgb, var(--nav-selected) 22%, transparent); }
.button-primary:hover,
button:not(.button-secondary):not(.button-danger):not(.account-signout):not(.history-remove):hover { background: var(--accent-strong); border-color: var(--accent-strong); }

/* Midnight attention is a navy-owned surface with an amber signal, not a brown slab. */
[data-theme="midnight-intelligence"] .requires-review { color: var(--text); background: var(--surface-raised); border-color: var(--state-warning-border); border-left: 4px solid var(--warning); box-shadow: inset 0 1px rgba(255, 224, 181, .05); }
[data-theme="midnight-intelligence"] .requires-review h2 { color: var(--state-warning-text); }
[data-theme="midnight-intelligence"] .requires-review a { color: var(--text); border-top-color: color-mix(in srgb, var(--state-warning-border) 48%, transparent); }
[data-theme="midnight-intelligence"] .requires-review a span,
[data-theme="midnight-intelligence"] .requires-review small { color: var(--text-soft); }
[data-theme="midnight-intelligence"] .requires-review .button-primary,
[data-theme="midnight-intelligence"] .requires-review button { color: #fff; background: var(--nav-selected); border-color: var(--nav-indicator); }

@media (max-width: 1050px) {
  .header-context-control select,
  .header-context-control > strong { width: min(16rem, 24vw); }
  .account-name { display: none; }
}

@media (max-width: 820px) {
  .topbar { height: auto; min-height: var(--topbar); flex-wrap: wrap; align-content: center; padding-top: .45rem; padding-bottom: .45rem; }
  .global-context { order: 3; flex-basis: 100%; padding-left: 2rem; }
  .header-context-control { flex: 1 1 min(13rem, 100%); }
  .header-context-control select,
  .header-context-control > strong { width: 100%; }
}

@media (max-width: 560px) {
  .global-context { gap: .45rem; padding-left: 0; }
  .header-context-control { flex-basis: 100%; }
  .header-context-control > span { min-width: 5.8rem; }
}
