/* --------------------------------------------------------------------------
   CABuddy visual system — NGRG Finance reference
   One token set drives every page and state. Royal-blue sidebar, pale
   cool-grey app background, white bordered cards, blue primary figures,
   green only for success, restrained radii, low shadow, no gradients.
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  /* Brand & semantic palette */
  --brand: #2F6BE5;          /* royal blue */
  --brand-600: #2557C7;      /* hover */
  --brand-700: #1E48A6;      /* active / dark headings */
  --brand-tint: #EAF0FC;     /* selected/legend tint on white */
  --brand-tint-2: #F2F6FE;   /* hover tint on white */
  --accent: #2F6BE5;         /* legacy accent now maps to brand */
  --brand-dark: var(--brand-700);

  --bg: #F4F6FA;             /* application background */
  --surface: #FFFFFF;        /* cards, top bar */
  --card: var(--surface);
  --border: #D9E1EC;         /* subtle cool-grey borders */
  --border-strong: #C2CEE0;

  --text: #1F2937;           /* dark charcoal body copy */
  --muted: #667085;

  --ok: #35A24A;             /* green: positive/success ONLY */
  --ok-700: #1F7A33;
  --ok-bg: #E9F7EC;
  --warn: #8A5300;           /* accessible amber text */
  --warn-bg: #FFF4E0;
  --danger: #B42318;         /* accessible red text */
  --danger-bg: #FDECEA;

  /* Royal-blue sidebar surface */
  --sb-bg: #2F6BE5;
  --sb-text: rgba(255,255,255,.94);
  --sb-dim: rgba(255,255,255,.66);
  --sb-hover: rgba(255,255,255,.10);
  --sb-active: rgba(14,34,84,.30);

  /* Shape, elevation, motion, layout */
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 12px 32px rgba(15,23,42,.06);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --content-max: 1440px;
  --pad: clamp(18px, 2vw, 36px);
  --topbar-h: 4rem;
  --maxw: 1440px;            /* legacy .wrap (admin console) */

  /* Sidebar width & nav type scale — every menu row stays on ONE line.
     ≥1600px: 360px · 1280–1599: 348px · 1024–1279: 330px · <1024: drawer */
  --sb-w: 360px;
  --nav-fs: 0.871rem;        /* 13.5px */
}
@media (max-width: 1599px) { :root { --sb-w: 348px; --nav-fs: 0.826rem; } }  /* 12.8px */
@media (max-width: 1279px) { :root { --sb-w: 330px; --nav-fs: 0.794rem; } }  /* 12.3px */

/* ---------------------------------------------------------------- base --- */
* { box-sizing: border-box; }
html { font-size: 15.5px; }                 /* rem root: readable, dense */
html, body { overflow-x: clip; }            /* never page-level horizontal scroll */
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.sidebar :focus-visible { outline-color: #fff; }
body.no-scroll { overflow: hidden; }

/* --------------------------------------------------------- app shell ---- */
.app { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; }
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 96% 2%, rgba(47,107,229,.07) 0, rgba(47,107,229,0) 24rem),
    var(--bg);
}
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--pad); }

/* Sidebar: royal blue top to bottom, own vertical scroll */
.sidebar {
  display: flex; flex-direction: column;
  background: var(--sb-bg); color: var(--sb-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: clip;
  overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent;
}
.sidebar > * { flex-shrink: 0; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 8px; }
.sb-brand {
  position: sticky; top: 0; z-index: 1; box-sizing: border-box; width: 100%;
  background: var(--sb-bg); color: var(--sb-text); padding: 0;
}
.sb-tag { color: var(--sb-dim); font-size: .72rem; margin-top: 1px; }
.sb-firm {
  color: #fff; font-size: .95rem; font-weight: 700; line-height: 1.35;
  overflow-wrap: anywhere; padding: .7rem 1.05rem 0;
}
.sb-wallet {
  display: flex; align-items: baseline; justify-content: space-between; gap: .6rem;
  color: var(--sb-dim); font-size: .8rem; padding: .35rem 1.05rem .8rem;
  border-bottom: 1px solid rgba(255,255,255,.18);
}
.sb-wallet strong { color: #fff; font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sb-nav { padding: .3rem .55rem 1.3rem; }
.sb-note { color: var(--sb-dim); font-size: .76rem; padding: .4rem .6rem; line-height: 1.45; }
.pane-disclaimer {
  margin-top: auto;
  position: sticky;
  bottom: 0;
  z-index: 30;
  padding: .5rem var(--pad);
  font-size: .65rem;
  border-top: 1px solid #f0d5d7;
  background: #fff7f7;
  color: #c3444d;
  line-height: 1.65;
}
.pane-disclaimer-logo {
  display: inline-block;
  width: auto;
  height: 1rem;
  max-width: 100%;
  vertical-align: -.2rem;
}
.pane-disclaimer a { color: inherit; text-decoration: underline; white-space: nowrap; }
.sidebar .muted { color: var(--sb-dim); font-size: .76rem; }

/* Phase labels: readable but subordinate */
.navgroup {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--sb-dim); font-weight: 700; padding: .95rem .6rem .3rem;
}
.navgroup:first-child { padding-top: .45rem; }

/* Menu rows: icon + number + label; long statutory labels wrap cleanly. */
.navitem {
  display: flex; align-items: flex-start; gap: .42rem; width: 100%;
  background: transparent; color: var(--sb-text); border: 0;
  border-radius: 10px; padding: .5rem .7rem; margin: 1px 0;
  font-size: var(--nav-fs); font-weight: 500; line-height: 1.25;
  text-align: left; white-space: normal; cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.navitem .navico { flex: 0 0 16px; width: 16px; height: 16px; opacity: .92; }
.navitem .navnum {
  flex: 0 0 auto; min-width: 1.05rem; text-align: right;
  font-size: .82em; font-weight: 600; color: var(--sb-dim);
  font-variant-numeric: tabular-nums;
}
.navitem .navlabel { flex: 0 1 auto; min-width: 0; letter-spacing: -.015em; overflow-wrap: anywhere; }
.navitem:hover:not(:disabled):not(.static) { background: rgba(255,255,255,.12); }
.navitem.active {
  background: rgba(14,34,84,.34); color: #fff; font-weight: 600;
  box-shadow: inset 3px 0 0 rgba(255,255,255,.92);
}
.navitem.active .navnum { color: rgba(255,255,255,.85); }
.navitem:disabled { opacity: .45; cursor: not-allowed; }
.navitem.static { pointer-events: none; }
.navbadge { font-size: .72rem; font-weight: 800; margin-left: .1rem; }
.navbadge.done { color: #9FE8B0; }            /* success on blue */
.navbadge.lock { opacity: .6; font-weight: 400; }
.navbadge.pln { color: rgba(255,255,255,.5); font-weight: 400; }
.navbadge.prt { color: #FFD79B; font-weight: 700; }
.navbadge.soon { margin-left: auto; color: rgba(255,255,255,.58); font-size: .64rem; white-space: nowrap; }
.navitem .navlock { margin-left: auto; font-size: .72rem; color: var(--sb-dim); font-weight: 600; }
.navitem .navcost { font-size: .72rem; color: var(--sb-dim); font-variant-numeric: tabular-nums; }
.ws-nav { padding: 0; }                        /* nav container inside the sidebar */

/* ------------------------------------------------------------ top bar ---- */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner {
  display: flex; align-items: center; gap: .75rem;
  min-height: var(--topbar-h); padding: .5rem var(--pad);
}
.tb-ctx { display: flex; align-items: center; gap: .6rem; min-width: 0; font-weight: 700; font-size: 1.05rem; }
.tb-ctx.deliverables-header-title { color: var(--brand-700); }
.tb-co { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--brand-700); }
.spacer { flex: 1; }
.who { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.badge-env { font-size: .68rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.brand-logo {
  display: inline-flex; align-items: center; flex: 0 0 auto; line-height: 0;
}
.brand-logo img { display: block; width: auto; height: 2rem; }
.brand-logo--sidebar {
  display: flex; align-items: center; justify-content: center;
  width: auto; max-width: calc(100% - 1.9rem); height: auto;
  margin: .9rem .95rem .5rem; padding: .55rem .8rem;
  box-sizing: border-box; border-radius: 14px; background: #fff;
  border: 0; box-shadow: 0 8px 22px rgba(15,23,42,.18);
}
.brand-logo--sidebar img { width: min(100%, 11.5rem); height: auto; max-height: none; object-fit: contain; }
.brand-logo--icon img { width: 2rem; height: 2rem; }
.brand-logo__mark { display: none !important; }
.brand-context {
  display: inline-flex; align-items: center; margin-left: .45rem;
  color: var(--muted); font-size: .78rem; font-weight: 650;
}
.brand-context::before { content: "·"; margin-right: .45rem; color: var(--border-strong); }
.topbar-mobile-brand { display: none; line-height: 0; }

/* Drawer toggle (hidden on desktop) */
.menu-toggle { display: none; align-items: center; justify-content: center; padding: .4rem .55rem; }

/* ------------------------------------------- off-canvas drawer <1024px --- */
.backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity 150ms var(--ease-out); }
.backdrop.show { opacity: 1; pointer-events: auto; }
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(348px, 88vw); height: 100vh;
    transform: translateX(-104%); transition: transform 200ms var(--ease-out);
    z-index: 60; box-shadow: 0 0 24px rgba(15,23,42,.25);
  }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .topbar-mobile-brand { display: inline-flex; }
  :root { --nav-fs: 0.826rem; }
}
@media (max-width: 1599px) and (min-width: 1280px) {
  .brand-logo--sidebar img { width: min(100%, 11rem); }
}
@media (max-width: 1279px) and (min-width: 1024px) {
  .brand-logo--sidebar { margin-inline: .8rem; max-width: calc(100% - 1.6rem); }
  .brand-logo--sidebar img { width: min(100%, 10.5rem); }
}
@media (max-width: 760px) { .badge-env, .who { display: none; } }
@media (max-width: 560px) {
  .topbar .brand-logo--adaptive .brand-logo__full { display: none; }
  .topbar .brand-logo--adaptive .brand-logo__mark { display: block !important; }
}

/* legacy admin-console wrapper (no sidebar there) */
.wrap { max-width: var(--maxw); margin: 1.5rem auto; padding: 0 var(--pad); }

/* --------------------------------------------------------------- cards --- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 1.5rem 1.65rem; }
.card h2 { margin: 0 0 .3rem; font-size: 1.1rem; font-weight: 700; color: var(--brand-700); }
.card .sub { color: var(--muted); font-size: .88rem; margin-bottom: 1rem; }
.kpi { font-size: 2.2rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.15; color: var(--brand); font-variant-numeric: tabular-nums; }
.add-company-panel {
  margin-top: 1rem; padding: 1.5rem 1.65rem; border: 1px solid var(--border);
  border-radius: 16px; background: var(--surface); box-shadow: var(--shadow);
}
.add-company-options { display: flex; flex-wrap: wrap; gap: .55rem; }
.company-method { margin-top: .75rem; padding-top: .25rem; }
.company-search { max-width: 32rem; }
.admin-firms-wrap { margin-bottom: 0; }
.admin-firms-table { table-layout: auto; font-size: .84rem; }
.admin-firms-table th,
.admin-firms-table td { padding: .48rem .55rem; vertical-align: middle; }
.admin-firms-table th:first-child { width: 24%; }
.admin-firms-table th:nth-child(2) { width: 10%; }
.admin-firms-table th:nth-child(3) { width: 24%; }
.admin-firm-name,
.admin-firm-email { display: block; }
.admin-firm-name { color: var(--brand-700); line-height: 1.25; }
.admin-firm-email {
  margin-top: .1rem; color: var(--muted); font-size: .76rem;
  line-height: 1.25; overflow-wrap: anywhere;
}
.admin-bonus { display: flex; align-items: center; gap: .35rem; min-width: 10rem; }
.admin-bonus input { width: 6.5rem; min-width: 5.5rem; margin: 0; padding: .42rem .55rem; }
.admin-bonus button { flex: 0 0 auto; }
.admin-firm-actions { display: flex; align-items: center; justify-content: flex-end; gap: .3rem; flex-wrap: wrap; }
.admin-firm-actions button { padding: .4rem .55rem; white-space: nowrap; }
.danger-button {
  color: #fff; background: var(--danger); border-color: var(--danger);
}
.danger-button:hover:not(:disabled) { background: #912018; border-color: #912018; }
.admin-remove-confirm {
  margin-top: 1rem; border-color: rgba(180,35,24,.35);
  box-shadow: none;
}
.admin-remove-confirm input { max-width: 28rem; }
@media (max-width: 900px) {
  .admin-firms-table { min-width: 760px; }
}
.kpi.small { font-size: 1.35rem; }
.card.stat { position: relative; overflow: hidden; padding: 1.25rem 1.4rem 1.25rem 1.55rem; }
.card.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brand); }
.card.stat .sub { margin-bottom: .3rem; }

/* Metric/status cards: 4 → 3 → 2 → 1 columns, content-driven heights */
.stats { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }

/* Legacy 12-column grid (wallet / companies / statement) */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(12, 1fr); }
.grid > * { min-width: 0; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
@media (max-width: 1100px) { .col-4, .col-6, .col-8 { grid-column: span 12; } .col-3 { grid-column: span 6; } }
@media (max-width: 560px) { .col-3 { grid-column: span 12; } }

/* --------------------------------------------------------------- forms --- */
label { display: block; font-size: .84rem; font-weight: 600; color: var(--text); margin: .7rem 0 .35rem; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: .65rem .8rem; border: 1px solid var(--border);
  border-radius: 12px; font-size: .95rem; font-family: inherit;
  background: var(--surface); color: var(--text);
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(47,107,229,.16); }
input:disabled, select:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"], input[type="file"] { min-height: 0; }
.row { display: flex; gap: .65rem; flex-wrap: wrap; } .row > * { flex: 1; min-width: 9rem; }
.check { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; }
.check input { width: auto; }

/* ------------------------------------------------------------- buttons --- */
button {
  cursor: pointer; border: 0; border-radius: 12px; padding: .7rem 1.15rem;
  font-size: .95rem; font-weight: 600; font-family: inherit; white-space: nowrap;
  background: var(--brand); color: #fff;
  box-shadow: 0 6px 16px rgba(47,107,229,.22);
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
button:hover:not(:disabled) { background: var(--brand-600); }
button:active:not(:disabled) { background: var(--brand-700); transform: scale(.98); }
button.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
button.ghost:hover:not(:disabled) { background: var(--brand-tint-2); border-color: var(--border-strong); }
button.accent { background: var(--brand); } button.accent:hover:not(:disabled) { background: var(--brand-600); }
button.sm { padding: .42rem .7rem; border-radius: 10px; font-size: .82rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.running { position: relative; opacity: .85; }
button.running::after {
  content: ""; display: inline-block; width: .72rem; height: .72rem; margin-left: .45rem;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%;
  vertical-align: -2px; animation: cb-spin .8s linear infinite;
}
button.ghost.running::after { border-color: rgba(31,41,55,.25); border-top-color: var(--text); }
@keyframes cb-spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- tables --- */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--border); }
th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--brand-tint-2); }
tbody tr:last-child td { border-bottom: 0; }
/* Wide data tables scroll inside their own labelled container, never the page */
.tbl-wrap { overflow-x: auto; margin: .75rem 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.tbl-wrap:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
table.md { font-size: .82rem; }
table.md th { background: var(--bg); white-space: nowrap; }
table.md td { vertical-align: top; }

/* ------------------------------------------------- badges, tags, pills --- */
.tag { font-size: .74rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.tag.locked { background: var(--warn-bg); color: var(--warn); }
.tag.unlocked { background: var(--ok-bg); color: var(--ok-700); }
.tag.high { background: var(--danger-bg); color: var(--danger); }
.tag.normal { background: var(--brand-tint); color: var(--brand-700); }
.tag.draft { background: var(--warn-bg); color: var(--warn); }
.tag.recharge-pending { background: var(--warn-bg); color: var(--warn); }
.tag.recharge-succeeded { background: var(--ok-bg); color: var(--ok-700); }
.tag.recharge-rejected { background: var(--danger-bg); color: var(--danger); }
.code-pill { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.1rem; font-weight: 700; letter-spacing: .12em; background: var(--brand-tint); color: var(--brand-700); padding: .35rem .75rem; border-radius: var(--radius-sm); display: inline-block; }
.pill-ok { color: var(--ok-700); font-weight: 700; } .pill-no { color: var(--muted); }
.av-badge { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: .02em; white-space: nowrap; }
.av-badge.avl { background: var(--ok-bg); color: var(--ok-700); }
.av-badge.prt { background: var(--warn-bg); color: var(--warn); }
.av-badge.pln { background: #EDF0F5; color: var(--muted); }
.av-badge.ref { background: var(--brand-tint); color: var(--brand-700); }
.av-badge.slot { background: var(--brand-tint); color: var(--brand-700); }

/* ------------------------------------------------------------- notices --- */
.notice { padding: .8rem 1rem; border-radius: 12px; font-size: .9rem; margin: .7rem 0; border: 1px solid transparent; }
.notice.err { background: var(--danger-bg); color: var(--danger); border-color: #F6C9C4; }
.notice.ok { background: var(--ok-bg); color: var(--ok-700); border-color: #C4E8CC; }
.notice.info { background: var(--brand-tint); color: var(--brand-700); border-color: #CCDCF7; }
.muted, .sub, .run-note, .itr-processing-time, .do-run-progress p { color: var(--muted); font-size: .88rem; }

/* ITR long-running workbook generation */
.itr-processing {
  width: 100%;
  max-width: none;
  padding: 1.5rem 1.65rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
}
.itr-processing-head {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--brand-700);
}
.itr-processing-spinner {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  border: 3px solid #C8D8F3;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: cb-spin .8s linear infinite;
}
.itr-processing-time { color: var(--muted); font-size: .8rem; font-weight: 500; }
.itr-processing p { margin: .6rem 0 0 1.6rem; line-height: 1.55; font-size: .88rem; }
.legal-consent-dialog { max-width: 38rem; width: calc(100% - 2rem); }
.legal-consent-dialog::backdrop { background: rgba(15, 23, 42, .62); }
.legal-consent-dialog label { display: block; margin: .8rem 0; }
.legal-consent-dialog input[type="checkbox"] { width: auto; margin-right: .55rem; }

@media (prefers-reduced-motion: reduce) {
  .itr-processing-spinner { animation-duration: 1.8s; }
}

/* Menu-item instructions — prominent usage guidance, not fine print */
.guide {
  font-size: .95rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--brand-tint-2);
  border-left: 3px solid var(--brand);
  padding: 1rem;
  border-radius: 0 12px 12px 0;
  margin-top: .5rem;
}
.guide b { color: var(--brand-700); }
.guide a { font-weight: 600; }
/* Every guide block starts with a red bold label — never hand-write it in markup */

/* Folder connection — simplified status block */
.fstat-line { font-size: .9rem; margin-top: .35rem; }
.st-ok { color: var(--ok-700); font-weight: 700; }
.st-err { color: var(--danger); font-weight: 700; }
.st-warn { color: var(--warn); font-weight: 700; }
.rdy-line { margin-top: .35rem; }
.fdetails { margin-top: .5rem; }
.fdetails > summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .85rem; width: max-content; }
.fdetails[open] > summary { margin-bottom: .35rem; }

/* Excel-style compact table (statutory matrix) */
table.xl th, table.xl td { border: 1px solid var(--border); padding: 3px 8px; font-size: .8rem; line-height: 1.4; }
table.xl thead th { background: #EEF2F8; }
table.xl .mx-move { font-size: .75rem; white-space: nowrap; }
tr.mx-band td { font-weight: 700; }
tr.mx-band.ok td { background: var(--ok-bg); color: var(--ok-700); }
tr.mx-band.err td { background: var(--danger-bg); color: var(--danger); }
.mt { margin-top: .9rem; } .mb { margin-bottom: .9rem; }

/* --------------------------------------------------------------- login --- */
.login-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 52fr) minmax(0, 48fr);
  background: var(--bg);
  overflow-x: hidden;
}
.auth-brand-panel {
  --auth-panel-pad-y: clamp(1.5rem, 3.5vh, 3.5rem);
  position: relative;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  overflow: clip;
  contain: paint;
  padding: var(--auth-panel-pad-y) clamp(2rem, 4vw, 4.5rem);
  background: var(--brand-700);
  color: #fff;
}
.auth-brand-panel::before {
  content: "";
  position: absolute;
  z-index: 0;
  width: 40rem;
  height: 40rem;
  top: -22rem;
  right: -20rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .14) 0%, rgba(255, 255, 255, .05) 44%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}
.auth-brand-panel::after {
  content: "";
  position: absolute;
  z-index: 0;
  width: 36rem;
  height: 36rem;
  left: -18rem;
  bottom: -22rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .08) 0%, rgba(255, 255, 255, .03) 46%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}
.auth-brand-content {
  position: relative;
  z-index: 1;
  width: min(100%, 720px);
  min-height: calc(100vh - (2 * var(--auth-panel-pad-y)));
  min-height: calc(100dvh - (2 * var(--auth-panel-pad-y)));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  align-content: center;
  row-gap: clamp(1rem, 4.5vh, 3rem);
}
.auth-brand-logo {
  position: relative;
  z-index: 2;
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  width: fit-content;
  margin: 0;
  padding: clamp(.55rem, 1.2vh, .85rem) clamp(.85rem, 1.8vh, 1.25rem);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
}
.auth-brand-logo .brand-logo {
  display: flex;
  align-items: center;
}
.auth-brand-logo .brand-logo img {
  display: block;
  width: clamp(11.5rem, 22vh, 19rem);
  height: auto;
}
.auth-brand-copy {
  position: relative;
  z-index: 2;
  grid-column: 1;
  grid-row: 1;
  padding-top: clamp(4.9rem, calc(5.5vh + 2.25rem), 6.5rem);
  max-width: 100%;
}
.auth-brand-eyebrow {
  margin-bottom: clamp(.4rem, .8vh, .65rem);
  color: rgba(255, 255, 255, .72);
  font-size: clamp(.75rem, 1.5vh, 1rem);
  font-weight: 700;
  letter-spacing: .16em;
}
.auth-brand-copy h2 {
  max-width: 30ch;
  margin: 0;
  color: #fff;
  font-size: clamp(1.6rem, 3.6vh, 2.8rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.025em;
}
.auth-brand-copy p {
  max-width: 60ch;
  margin: clamp(.6rem, 1.2vh, .9rem) 0 0;
  color: rgba(255, 255, 255, .82);
  font-size: clamp(.95rem, 1.9vh, 1.2rem);
  line-height: 1.5;
}
.auth-value-list {
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(.35rem, .8vh, .6rem);
  margin-top: 0;
}
.auth-value-pill {
  display: inline-flex;
  align-items: center;
  gap: clamp(.35rem, .7vh, .5rem);
  padding: clamp(.4rem, .9vh, .6rem) clamp(.8rem, 1.6vh, 1.1rem);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .9);
  font-size: clamp(.82rem, 1.7vh, 1.02rem);
  font-weight: 550;
  line-height: 1.25;
}
.auth-value-pill::before {
  content: "✓";
  font-size: .68rem;
  font-weight: 800;
}
.inf-bg {
  display: contents;
  pointer-events: none;
}
.auth-brand-features {
  display: contents;
}
.inf-ribbon {
  position: absolute;
  left: 50%;
  top: 72%;
  z-index: 0;
  width: min(88%, 720px);
  min-width: 320px;
  height: 48%;
  max-height: 48%;
  overflow: hidden;
  overflow: clip;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ribbon-mark {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: .1;
  transform-origin: center;
  animation: cb-ribbon-breathe 18s ease-in-out infinite alternate;
}
@keyframes cb-ribbon-breathe {
  from { transform: scale(.98); opacity: .09; }
  to { transform: scale(1.025); opacity: .12; }
}
.inf-cards {
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  align-items: start;
  flex: 0 0 auto;
  min-height: 0;
  gap: clamp(.8rem, 1.6vh, 1.2rem);
  margin-top: 0;
}
.inf-card {
  --card-opacity: 1;
  min-width: 0;
  min-height: 0;
  height: auto;
  align-self: start;
  padding: clamp(1rem, 2.4vh, 1.6rem);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 14px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  animation: cb-card-in 360ms var(--ease-out) forwards;
}
.inf-card:nth-child(2) { animation-delay: 55ms; }
.inf-card:nth-child(3) { animation-delay: 110ms; }
.inf-card:nth-child(4) { animation-delay: 165ms; }
.inf-card:nth-child(5) { animation-delay: 220ms; }
@keyframes cb-card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: var(--card-opacity); transform: none; }
}
.inf-card--soon {
  --card-opacity: .72;
  border-color: rgba(255, 255, 255, .28);
  border-style: dashed;
}
.inf-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(.5rem, 1vh, .8rem);
  margin-bottom: clamp(.55rem, 1.3vh, .9rem);
}
.inf-card-group {
  font-size: clamp(.95rem, 2vh, 1.25rem);
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
}
.inf-card-badge {
  flex: 0 0 auto;
  padding: .25rem .48rem;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 750;
  line-height: 1;
}
.inf-card-badge--live {
  background: rgba(53, 162, 74, .22);
  color: #9FE8B0;
}
.inf-card-badge--soon {
  background: rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .7);
}
.inf-card-item {
  font-size: clamp(.86rem, 1.8vh, 1.08rem);
  font-weight: 500;
  color: rgba(255, 255, 255, .88);
  margin-bottom: clamp(.55rem, 1.3vh, .9rem);
  display: flex;
  align-items: center;
  gap: .5rem;
  line-height: 1.35;
}
.inf-card-item::before {
  content: "✓";
  flex: 0 0 1.1em;
  width: 1.1em;
  height: 1.1em;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: .62rem;
  font-weight: 800;
  line-height: 1;
}
.inf-card-item--soon::before {
  content: "";
  background: transparent;
}
.inf-card-item:last-child { margin-bottom: 0; }
.auth-signin-panel {
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  overflow-y: visible;
  padding: clamp(2rem, 5vw, 4.5rem);
  background: var(--bg);
}
@supports (overflow: clip) {
  .auth-signin-panel { overflow-x: clip; }
}
.auth-signin-panel::before {
  content: "";
  position: absolute;
  width: 34rem;
  height: 34rem;
  top: -18rem;
  right: -18rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 107, 229, .08) 0%, rgba(47, 107, 229, 0) 70%);
  pointer-events: none;
}
.auth-signin-stack {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 2.5rem 2.25rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 20px 48px rgba(15, 23, 42, .08);
}
.login-card > .brand-logo { display: none; }
.login-card .brand-logo { justify-content: center; width: 100%; margin-bottom: .8rem; }
.login-card .brand-logo img { width: min(100%, 14rem); height: auto; }
.login-card .brand-context { display: flex; justify-content: center; margin: -.1rem 0 .3rem; }
.login-card .brand-context::before { display: none; }
.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: .78rem;
}
.auth-footer a { color: var(--muted); }
.auth-footer a:hover { color: var(--brand); }
@media (min-width: 1024px) and (max-width: 1279px) {
  .login-shell { grid-template-columns: minmax(0, 48fr) minmax(0, 52fr); }
  .auth-brand-panel { padding-inline: 2rem; }
  .auth-signin-panel { padding: clamp(2rem, 4vw, 3rem); }
  .auth-brand-content { width: 94%; max-width: 100%; }
  .auth-brand-logo .brand-logo img { width: clamp(11.5rem, 21vh, 14rem); }
  .inf-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inf-card { padding-inline: clamp(.75rem, 1.8vh, 1rem); }
  .inf-card-group { font-size: clamp(.84rem, 1.7vh, 1rem); }
  .inf-card-item { font-size: .85rem; }
  .inf-card-badge { font-size: .62rem; }
}
@media (min-width: 1600px) {
  .auth-brand-content { width: min(94%, 900px); }
  .inf-ribbon { max-width: 800px; }
  .auth-signin-stack, .login-card { max-width: 460px; }
  .login-card { padding: 2.75rem 2.5rem; }
}
@media (min-width: 1024px) and (max-height: 800px) {
  .auth-brand-panel { --auth-panel-pad-y: 1.5rem; }
  .auth-brand-content { row-gap: clamp(1rem, 4vh, 1.75rem); }
  .auth-brand-logo { padding-block: .45rem; }
  .auth-brand-logo .brand-logo img { width: 11.5rem; }
  .auth-brand-eyebrow { font-size: .75rem; }
  .auth-brand-copy { padding-top: 4.35rem; }
  .auth-brand-copy h2 { font-size: 1.6rem; }
  .auth-brand-copy p { margin-top: .4rem; font-size: .95rem; line-height: 1.4; }
  .auth-value-list { gap: .3rem; }
  .auth-value-pill { padding: .3rem .65rem; font-size: .82rem; }
  .inf-cards { gap: .65rem; }
  .inf-card { padding: .75rem .85rem; }
  .inf-card-group { font-size: .95rem; }
  .inf-card-item { font-size: .85rem; }
  .inf-card-header { margin-bottom: .35rem; }
  .inf-card-item { margin-bottom: .18rem; line-height: 1.28; }
}
@media (max-width: 1023px) {
  .login-shell { grid-template-columns: 1fr; min-height: 100vh; min-height: 100dvh; }
  .auth-brand-panel {
    min-height: 0;
    display: block;
    padding: clamp(1.6rem, 4vw, 2.4rem);
  }
  .auth-signin-panel { position: relative; top: auto; }
  .auth-brand-content {
    width: 100%;
    max-width: none;
    min-height: 0;
    display: block;
  }
  .auth-brand-copy { padding-top: 0; }
  .auth-brand-logo { margin-bottom: 1.25rem; padding: .55rem .8rem; border-radius: 14px; }
  .auth-brand-logo .brand-logo img { width: 13rem; }
  .auth-brand-copy { max-width: 720px; }
  .auth-brand-copy h2 { max-width: 26ch; font-size: 1.35rem; line-height: 1.2; }
  .auth-brand-copy p { max-width: 720px; font-size: .95rem; line-height: 1.5; }
  .auth-brand-features { display: block; max-width: 720px; }
  .auth-value-list { margin-top: .85rem; }
  .inf-cards, .inf-ribbon { display: none; }
  .auth-brand-panel::before { width: 24rem; height: 24rem; top: -15rem; right: -13rem; }
  .auth-brand-panel::after { width: 20rem; height: 20rem; left: -11rem; bottom: -14rem; }
  .auth-signin-panel { min-height: 0; padding: clamp(2rem, 6vw, 4rem) 1.25rem; }
  .login-card > .brand-logo { display: flex; }
}
@media (max-width: 600px) {
  .auth-brand-panel { padding: 1.1rem 1rem 1.25rem; }
  .auth-brand-logo { margin-bottom: .8rem; }
  .auth-brand-logo .brand-logo img { width: 11.5rem; }
  .auth-brand-copy h2 { font-size: 1.25rem; }
  .auth-brand-copy p, .auth-value-list { display: none; }
  .auth-brand-features { margin-top: 0; }
  .auth-signin-panel { display: block; padding: 1.25rem 1rem; }
  .auth-signin-stack { margin: 0 auto; }
  .login-card { max-width: none; padding: 1.6rem 1.25rem; border-radius: 16px; }
  .login-card .brand-logo img { width: 11rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ribbon-mark, .inf-card { animation: none !important; }
  .ribbon-mark { opacity: .08; }
  .inf-card { opacity: 1; }
  .inf-card--soon { opacity: .72; }
}

/* ------------------------------------------------ account flows (OTP) --- */
.auth-card { animation: auth-in 240ms var(--ease-out); }
@keyframes auth-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.auth-title {
  margin: 0 0 .35rem; text-align: center; color: var(--text);
  font-size: 1.6rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em;
}
.auth-sub--login { margin-bottom: 1.75rem; font-size: 0.95rem; }
.auth-card .tag-line { color: var(--brand); font-weight: 700; font-size: 0.95rem; margin-bottom: 0.75rem; }
.auth-sub { text-align: center; color: var(--muted); font-size: 0.95rem; line-height: 1.55; margin-bottom: 1.75rem; overflow-wrap: anywhere; }
.auth-sub b { color: var(--text); }
.auth-optional { font-weight: 400; color: var(--muted); font-size: .72rem; }
.auth-label-row { display: flex; align-items: baseline; justify-content: space-between; margin: .6rem 0 .25rem; }
.auth-links { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: 0.9rem; }
button.linklike {
  background: none; border: 0; padding: 0; margin: 0;
  color: var(--brand); font-size: inherit; font-weight: 650; font-family: inherit;
  cursor: pointer; text-decoration: none; white-space: normal;
  transition: color 140ms var(--ease-out);
}
button.linklike:hover:not(:disabled) { background: none; color: var(--brand-600); text-decoration: underline; }
button.linklike:active:not(:disabled) { background: none; transform: none; }
button.linklike:disabled { opacity: .55; cursor: default; text-decoration: none; }
.login-card label {
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  margin: 0.75rem 0 0.4rem;
  display: block;
}
.login-card input {
  height: 48px;
  padding: 0 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
  width: 100%;
}
.login-card input:hover { border-color: var(--border-strong); }
.auth-card input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(47, 107, 229, .16);
  background: #fff;
}
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 4.3rem; }
.password-toggle {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  width: auto; min-width: 3.2rem; padding: .3rem .55rem; border: 1px solid transparent; background: var(--bg);
  color: var(--muted); font-size: .75rem; font-weight: 600; box-shadow: none; border-radius: 999px;
}
.password-toggle:hover:not(:disabled) { background: var(--brand-50); color: var(--brand); transform: translateY(-50%); }
.password-toggle:active:not(:disabled) { transform: translateY(-50%); }
.forgot-row { margin-top: .6rem; text-align: right; }
button.linklike--quiet { color: var(--muted); font-size: .76rem; font-weight: 500; }
button.linklike--quiet:hover:not(:disabled) { color: var(--brand); }
.signin-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  height: 48px;
  margin-top: 1rem;
  padding: 0 .9rem;
  border-radius: 12px;
  font-size: 1rem;
  background: var(--brand);
  color: #fff;
  border: none;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(47, 107, 229, .28);
  cursor: pointer;
  transition: all 160ms var(--ease-out);
  width: 100%;
}
.signin-btn:hover:not(:disabled) {
  background: var(--brand-600);
  box-shadow: 0 8px 20px rgba(47, 107, 229, .32);
}
.signin-btn:active:not(:disabled) {
  background: var(--brand-700);
  transform: scale(.99);
}
.signin-btn:disabled {
  background: #aab6eb;
  box-shadow: none;
  cursor: not-allowed;
}
.otp-input {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 1.45rem; font-weight: 700; letter-spacing: .55em; text-align: center;
  padding: .6rem .4rem .6rem .95em;
}
.auth-meta { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin-top: .45rem; font-size: .78rem; flex-wrap: wrap; }
.auth-meta .muted { font-variant-numeric: tabular-nums; }
.auth-expiring { color: var(--warn) !important; font-weight: 600; }

/* ---------------------------------------------------- workspace pieces --- */
.wpanel { min-height: 14rem; }
.panel-h, .deliverables-head h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; color: var(--brand-700); }
.run-note { margin-left: .6rem; font-style: italic; }
.draft-bar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.gate { text-align: center; color: var(--muted); padding: 2.2rem .95rem; border: 1px dashed var(--border-strong); border-radius: 14px; font-size: .88rem; background: var(--surface); }

/* Item workspace scaffold */
.item-head { display: flex; gap: 1rem; align-items: flex-start; }
.item-no { flex: 0 0 auto; width: 2.6rem; height: 2.6rem; border-radius: 12px; background: var(--brand-tint); color: var(--brand-700); font-weight: 800; font-size: 1.05rem; display: grid; place-items: center; }
.item-head-t { flex: 1; min-width: 0; }
.item-head-t .panel-h { font-size: 1.25rem; }
.item-badges { margin-top: .25rem; display: flex; gap: .35rem; flex-wrap: wrap; }
.lbl { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; margin-bottom: .25rem; }

/* Contracts, output sections, day-book slots */
.contract { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: .85rem; margin-top: .75rem; }
.contract-col { border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem 1.35rem; background: var(--surface); box-shadow: var(--shadow); }
ul.confirm { margin: 0; padding-left: 1.1rem; }
ul.confirm li { font-size: .82rem; margin: .25rem 0; }
.osecs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .5rem; }
.osec { border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 12px; padding: .7rem .85rem; font-weight: 700; font-size: .84rem; background: var(--surface); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .75rem; }
.slot-card { border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem 1.65rem; background: var(--surface); box-shadow: var(--shadow); }
.slot-h { font-weight: 700; font-size: .86rem; margin-bottom: .25rem; }

/* Entity profile key-value grid */
.kvgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem 1.2rem; }
.kv { border-bottom: 1px solid var(--border); padding-bottom: .5rem; min-width: 0; }
.kv .k { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv .v { font-size: .88rem; font-weight: 600; margin-top: .1rem; overflow-wrap: anywhere; }
.kv .v .tbc { color: var(--warn); font-weight: 600; }
.kv label.k { display: block; }
.skips { font-size: .78rem; color: var(--warn); }
.skips ul { margin: .25rem 0 0; padding-left: 1.1rem; }

/* Upload cards */
.upl { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; }
.upl-card { display: block; border: 1px dashed var(--border-strong); border-radius: 14px; padding: 1.25rem; cursor: pointer; background: var(--surface); transition: border-color 150ms var(--ease-out), background-color 150ms var(--ease-out); }
.upl-card:hover { border-color: var(--brand); background: var(--brand-tint-2); }
.upl-card .upl-t { font-weight: 700; font-size: .88rem; margin-bottom: .1rem; }
.upl-card .upl-btn { display: inline-block; margin-top: .7rem; font-size: .84rem; font-weight: 600; color: #fff; background: var(--brand); border-radius: 10px; padding: .58rem .85rem; box-shadow: 0 6px 16px rgba(47,107,229,.22); }
.upl-card:hover .upl-btn { background: var(--brand-600); }
label.upl-btn { display: inline-block; font-size: .84rem; font-weight: 600; color: #fff; background: var(--brand); border-radius: 10px; padding: .58rem .85rem; margin: 0; box-shadow: 0 6px 16px rgba(47,107,229,.22); }
details > summary { cursor: pointer; font-size: .8rem; }

/* Documents / findings / rounds (legacy panels) */
.docrow { display: flex; align-items: center; gap: .6rem; padding: .7rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.docrow .dt { flex: 0 0 10.5rem; font-weight: 600; font-size: .82rem; }
.docrow .dst { flex: 0 0 auto; font-size: .76rem; }
.docrow input[type=file] { flex: 1; font-size: .76rem; min-width: 10rem; }
.round { border: 1px solid var(--border); border-radius: 16px; margin: .85rem 0; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.round > .rhead { display: flex; align-items: center; gap: .6rem; padding: .9rem 1.1rem; background: var(--bg); border-bottom: 1px solid var(--border); font-weight: 700; font-size: .84rem; }
.round.closed > .rhead { color: var(--muted); }
.round .rbody { padding: 1.25rem 1.4rem; }
.finding { border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem 1.4rem; margin: .75rem 0; background: var(--surface); box-shadow: var(--shadow); }
.finding .fhead { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; flex-wrap: wrap; }
.finding .src { font-size: .7rem; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; margin-top: .35rem; overflow-wrap: anywhere; }
.kind { font-size: .74rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.kind.opening_diff { background: var(--danger-bg); color: var(--danger); }
.kind.requirement { background: var(--warn-bg); color: var(--warn); }
.kind.query { background: var(--brand-tint); color: var(--brand-700); }
.fstat { font-size: .74rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.fstat.open { background: var(--brand-tint); color: var(--brand-700); }
.fstat.answered { background: var(--warn-bg); color: var(--warn); }
.fstat.closed { background: var(--ok-bg); color: var(--ok-700); }
.fstat.carried { background: #EDF0F5; color: var(--muted); }
.wfrow { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.wfrow .wfl { flex: 1; font-size: .82rem; }

/* Rendered markdown deliverable */
.md-out { font-size: .86rem; line-height: 1.55; }
.md-out .md-h { margin: 1.1rem 0 .5rem; line-height: 1.3; color: var(--brand-700); }
.md-out h2.md-h { font-size: 1.05rem; } .md-out h3.md-h { font-size: .95rem; }
.md-out h4.md-h, .md-out h5.md-h { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.md-out p { margin: .5rem 0; }
.md-out ul { margin: .5rem 0; padding-left: 1.25rem; }
.md-out li { margin: .2rem 0; }
.md-out hr { margin: 1.1rem 0; }
.md-out code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .76rem; background: var(--bg); padding: 1px 5px; border-radius: 5px; }

/* Truthful, persisted Day Book run progress */
.daybook-progress { display: inline-block; vertical-align: top; width: min(35rem, 100%); margin: .75rem 0 0 .75rem; padding: 1.25rem 1.4rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: #1e3a5f; box-shadow: var(--shadow); }
.daybook-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .78rem; }
.daybook-progress-head strong { color: #1d4ed8; font-variant-numeric: tabular-nums; }
.daybook-progress-meter { display: block; width: 100%; height: .7rem; margin-top: .55rem; border: 0; border-radius: 999px; overflow: hidden; background: #dbeafe; }
.daybook-progress-meter::-webkit-progress-bar { background: #dbeafe; border-radius: 999px; }
.daybook-progress-meter::-webkit-progress-value { background: #2563eb; border-radius: 999px; transition: width .25s ease; }
.daybook-progress-meter::-moz-progress-bar { background: #2563eb; border-radius: 999px; }
.daybook-progress-count { margin-top: .4rem; font-size: .72rem; color: #52657a; }
.daybook-progress.failed { border-color: #fed7aa; background: #fff7ed; color: #7c2d12; }
.daybook-progress.failed .daybook-progress-head strong { color: #c2410c; }
.daybook-progress.failed .daybook-progress-meter::-webkit-progress-value { background: #ea580c; }
.daybook-progress.failed .daybook-progress-meter::-moz-progress-bar { background: #ea580c; }
.daybook-progress.complete { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
.daybook-progress.complete .daybook-progress-head strong { color: #15803d; }
.daybook-progress.complete .daybook-progress-meter::-webkit-progress-value { background: #16a34a; }
.daybook-progress.complete .daybook-progress-meter::-moz-progress-bar { background: #16a34a; }

/* Login-scoped Deliverables workspace (not an audit workspace). */
.deliverables-head { display: block; }
.deliverables-head > div:first-child { min-width: 0; }
.deliverables-draft { width: fit-content; max-width: 100%; margin: .85rem 0 0; }
.deliverables-folders { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1rem; }
.deliverables-folder { min-width: 0; padding: 1.5rem 1.65rem; }
.deliverables-folder h2 { margin-bottom: .45rem; }
.deliverables-folder-guidance { color: var(--text); font-size: .88rem; }
.deliverables-folder-guidance ol { margin: .35rem 0 .55rem; padding-left: 1.35rem; }
.deliverables-folder-guidance li { margin: .18rem 0; padding-left: .15rem; }
.deliverables-folder-confirm { display: flex; align-items: center; gap: .45rem; width: max-content; max-width: 100%; margin: .45rem 0 .15rem; color: var(--text); font-size: .88rem; font-weight: 600; white-space: normal; cursor: pointer; }
.deliverables-folder-confirm input { flex: 0 0 auto; width: auto; margin: 0; }
.deliverables-folder button, .deliverables-folder .upl-btn { margin-top: .6rem; }
.deliverables-folder button:disabled, .deliverables-folder .upl-btn.is-disabled { opacity: .5; cursor: not-allowed; filter: saturate(.35); }
.deliverables-server-status { margin-top: .55rem; font-size: .78rem; }
.deliverables-run-actions { display:flex; align-items:center; gap:.7rem; flex-wrap:wrap; }
.deliverables-tb-pin { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.deliverables-tb-pin label { display: block; margin-bottom: .35rem; color: var(--brand-700); font-size: .88rem; }
.deliverables-tb-pin select { width: 100%; }
.deliverables-tb-pin .muted { margin: .35rem 0 0; font-size: .76rem; }
.deliverables-tiers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: .9rem; }
.deliverables-tier-note { margin: .65rem 0 0; font-size: .8rem; }
.deliverables-tier { display: flex; align-items: center; gap: .7rem; min-width: 0; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; }
.deliverables-tier.is-selected { border-color: var(--brand-500); box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.deliverables-tier input { flex: 0 0 auto; width: auto; margin: 0; }
.deliverables-tier span { display: grid; gap: .12rem; min-width: 0; }
.deliverables-tier strong { color: var(--brand-700); }
.deliverables-tier small { color: var(--ink-muted); }
.deliverables-payment { margin: .75rem 0 1rem; }
.payment-summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1.25rem 1.4rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.payment-summary strong { color: var(--brand-700); font-size: 1rem; }
.payment-summary span { color: var(--ink-muted); }
#do-run:disabled { opacity: .55; filter: saturate(.35); cursor: not-allowed; box-shadow: none; }
.do-run-progress { margin-top: .9rem; padding: 1.25rem 1.4rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: #1e3a5f; box-shadow: var(--shadow); }
.do-progress-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; font-size: .82rem; }
.do-progress-head strong { color: #1d4ed8; line-height: 1.55; }
.do-inline-wordmark {
  display: inline-block;
  width: auto;
  height: 1.15em;
  margin: 0 .08em;
  vertical-align: -.2em;
}
.do-progress-head span { color: #52657a; font-variant-numeric: tabular-nums; white-space: nowrap; }
.do-progress-track { position: relative; height: .7rem; margin-top: .6rem; overflow: hidden; border-radius: 999px; background: #dbeafe; }
.do-progress-track span { position: absolute; inset-block: 0; left: -35%; width: 35%; border-radius: inherit; background: #2563eb; animation: do-progress-sweep 1.5s ease-in-out infinite; }
.do-progress-estimated span { left: 0; width: 0; animation: none; transition: width .4s ease-out; }
.do-progress-head [data-do-percent] { color: #2563eb; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .do-progress-estimated span { transition: none; }
}
.do-run-progress p { margin: .5rem 0 0; font-size: .75rem; color: #52657a; }
@keyframes do-progress-sweep { from { left: -35%; } to { left: 100%; } }
.deliverables-output-list .docrow .dt { overflow-wrap: anywhere; }
.deliverables-only h3 { color: var(--brand-700); font-size: .92rem; margin: 1rem 0 .35rem; }
@media (max-width: 700px) {
  .deliverables-head { display: block; }
  .deliverables-draft { margin-top: .8rem; }
  .deliverables-folders { grid-template-columns: 1fr; }
  .deliverables-tiers { grid-template-columns: 1fr; }
  .payment-summary { align-items: flex-start; flex-direction: column; }
}
@media (min-width: 1100px) {
  .deliverables-folders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ------------------------------------------------ authenticated polish --- */
.itr-stepper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.itr-step {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--brand-tint-2);
}
.itr-step label {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 2rem;
  margin: 0 0 .75rem;
}
.itr-step-no {
  display: inline-grid;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand-700);
  font-size: .88rem;
  font-weight: 800;
}
.itr-step button { display: block; width: 100%; min-width: 0; min-height: 44px; white-space: normal; text-align: center; line-height: 1.25; }
.mt:has(> #wk-gen + .run-note),
.mt:has(> #dv-run + .muted) {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.mt:has(> #wk-gen + .run-note) > .run-note,
.mt:has(> #dv-run + .muted) > .muted {
  display: inline-block;
  max-width: 100%;
  margin-left: 0 !important;
}
input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-height: 1rem;
  padding: 0;
  border-radius: 3px;
  vertical-align: middle;
  flex: 0 0 auto;
}
.login-card fieldset label {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  line-height: 1.4;
}
.login-card fieldset input[type="checkbox"] { margin: .15rem 0 0; }
#bal { font-size: 2.6rem; }
.payment-summary, .itr-processing, .daybook-progress, .do-run-progress {
  border-radius: 16px;
}
.do-company-picker { position: relative; width: 100%; }
.do-company-picker input { width: 100%; box-sizing: border-box; }
.do-company-step { display: flex; align-items: stretch; gap: .75rem; }
.do-company-step .do-step-row { flex: 1; min-width: 0; }
.do-connections-toolbar { display: flex; justify-content: flex-end; }
.do-refresh-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; }
.do-refresh-icon[aria-busy="true"] svg { animation: cb-spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .do-refresh-icon[aria-busy="true"] svg { animation: none; } }
.do-reset-action { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.do-reset-action .muted { font-size: .8rem; }
#do-company-options {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  max-height: 260px; overflow-y: auto; background: #fff; color: #172b4d;
  border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 8px 24px #172b4d20;
}
#do-company-options [role="option"] { padding: 12px 14px; cursor: pointer; overflow-wrap: anywhere; }
#do-company-options [role="option"]:hover,
#do-company-options [aria-selected="true"] { background: #e8f0ff; color: #173b83; }

@media (max-width: 760px) {
  .itr-stepper { grid-template-columns: 1fr; }
  .card, .slot-card, .deliverables-folder { padding: 1.2rem; }
}

/* --------------------------------------------------------------- motion --- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .01ms !important; }
  button:active:not(:disabled) { transform: none; }
  .sidebar { transition: none; }
}

/* ---------------------------------------------------- deliverables steps --- */
.do-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.do-step-row {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
  text-align: left;
  width: 100%;
}
.do-step-row:hover:not(:disabled) {
  background: var(--brand-tint-2);
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(47,107,229,.1);
}
.do-step-row:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.do-step-row:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.do-step-row.is-complete {
  border-color: #C4E8CC;
  background: var(--surface);
}
.do-step-number {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--brand-tint);
  color: var(--brand-700);
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 1rem;
}
.do-step-row.is-complete .do-step-number {
  background: var(--ok);
  color: #fff;
}
.do-step-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.do-step-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.do-payment-note {
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
  flex-basis: 100%;
  font-size: .75rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
}
.do-payment-note:empty { display: none; }
.do-step-meta-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.do-step-meta {
  max-width: 100%;
  color: var(--muted);
  font-size: .85rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.do-step-meta-access {
  display: inline;
}
.do-step-action {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 1rem;
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 600;
}
.do-step-row.is-complete .do-step-action {
  color: var(--ok-700);
}

.do-create-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2rem 0;
}
.do-create-btn {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 1.15rem 2.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(47,107,229,.25);
  cursor: pointer;
  transition: transform 150ms var(--ease-out), box-shadow 150ms var(--ease-out), background-color 150ms var(--ease-out);
}
.do-create-btn:hover:not(:disabled) {
  background: var(--brand-600);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(47,107,229,.3);
}
.do-create-btn:active:not(:disabled) {
  transform: scale(0.98);
}
.do-create-btn:disabled {
  background: var(--border-strong);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}
.do-create-btn svg {
  width: 1.8rem;
  height: 1.8rem;
  fill: currentColor;
}
.do-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 38rem;
  width: calc(100% - 2rem);
  padding: 1.5rem 1.65rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
  margin: 0;
  max-height: 90vh;
  overflow-y: auto;
}
.do-history-page { display: grid; gap: 16px; }
.do-history-page > button { justify-self: start; }
.do-history-page > input { width: 100%; max-width: 480px; margin: 0; }
.do-history-grid { overflow-x: auto; border: 1px solid var(--line, #e5e7eb); }
.do-history-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface, #fff); }
.do-history-table th, .do-history-table td {
  padding: 8px 12px; text-align: left; vertical-align: middle;
  border-right: 1px solid var(--line, #e5e7eb);
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.do-history-table th { background: var(--brand-tint, #f3f7f6); font-weight: 600; white-space: nowrap; }
.do-history-table td:nth-child(2) { overflow-wrap: anywhere; min-width: 180px; }
.do-history-table td:nth-child(3), .do-history-table td:nth-child(4) { white-space: nowrap; }
.do-history-table tr:last-child td { border-bottom: 0; }
.do-history-table th:last-child, .do-history-table td:last-child { border-right: 0; }
.do-history-table .notice { display: block; margin: 4px 0 0; padding: 4px; }
.do-history-table .notice[hidden] { display: none; }
.do-dialog::backdrop {
  background: rgba(15, 23, 42, .62);
  backdrop-filter: blur(2px);
}
.do-dialog h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  color: var(--brand-700);
  padding-right: 2rem;
}
.do-dialog-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--muted);
  box-shadow: none;
  padding: 0.25rem;
  border-radius: 50%;
  line-height: 0;
  cursor: pointer;
}
.do-dialog-close:hover {
  background: var(--brand-tint);
  color: var(--brand);
}
.do-dialog-close svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  stroke-width: 2;
}

@media (max-width: 760px) {
  .do-step-content { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
  .do-step-action { margin-left: 0; padding-left: 0; margin-top: 0.3rem; }
  .do-company-step { flex-direction: column; }
}

/* ---- Audit Workings flow (workings-flow.js) — mirrors FS & Notes stepper ---- */
.wkf-title { margin: 0 0 6px; font-size: 1.35rem; color: var(--brand-700); letter-spacing: -.01em; }
.wkf-cap { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: .72rem; font-weight: 600; vertical-align: 2px; }
.wkf .do-step-title { font-weight: 600; }
.wkf-run { gap: 10px; min-width: 200px; letter-spacing: .08em; }
.wkf-run-no { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: rgba(255,255,255,.22); font-size: .85rem; letter-spacing: 0; }
.wkf-run-hint { text-align: center; margin: 6px 0 0; font-size: .85rem; }
.wkf-small { font-size: .8rem; }
.wkf-skel { display: grid; gap: 8px; margin: 8px 0; }
.wkf-skel span { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--brand-tint-2), var(--brand-tint), var(--brand-tint-2)); background-size: 200% 100%; animation: wkf-shimmer 1.2s linear infinite; }
.wkf-skel span:nth-child(2) { width: 78%; } .wkf-skel span:nth-child(3) { width: 56%; }
@keyframes wkf-shimmer { to { background-position: -200% 0; } }
.wkf-bar { display: block; position: relative; overflow: hidden; height: 4px; border-radius: 4px; background: var(--brand-tint); margin-top: 8px; }
.wkf-bar i { position: absolute; inset: 0; width: 35%; background: var(--brand); border-radius: 4px; animation: wkf-slide 1.3s var(--ease-out, ease) infinite; }
@keyframes wkf-slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.wkf-dialog.wkf-wide { width: min(980px, 94vw); max-width: 980px; }
.wkf-dialog-body { display: grid; gap: 10px; }
.wkf-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.wkf-co-list, .wkf-cat-list { max-height: 340px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.wkf-co { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; cursor: pointer; border-radius: 0; }
.wkf-co:hover, .wkf-co.is-on { background: var(--brand-tint-2); }
.wkf-co small, .wkf-cat-item small, .wkf-extract small, .wkf-outs small { color: var(--muted); font-size: .78rem; display: block; }
.wkf-inline { display: flex; gap: 8px; margin-top: 8px; } .wkf-inline input { flex: 1; margin: 0; }
.wkf-tally-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; }
@media (max-width: 860px) { .wkf-tally-grid { grid-template-columns: 1fr; } }
.wkf-extract { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.wkf-extract.is-on { border-color: var(--brand); background: var(--brand-tint-2); }
.wkf-extract input { margin-top: 3px; }
.wkf-connector { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }
.wkf-connector summary, .wkf-checks summary { cursor: pointer; font-weight: 600; color: var(--brand-700); }
.wkf-link { padding: 4px 0; border: 0; background: none; color: var(--brand); }
.wkf-cat-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wkf-cat-tools input { flex: 1; min-width: 180px; margin: 0; }
.wkf-cat-tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.wkf-cat-tabs button { border: 0; border-radius: 0; background: var(--surface); color: var(--text); padding: 6px 12px; }
.wkf-cat-tabs button.is-on { background: var(--brand); color: var(--surface); }
.wkf-cat-count { font-size: .82rem; font-weight: 600; color: var(--brand-700); }
.wkf-cat-item { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-weight: 400; }
.wkf-cat-item small { grid-column: 2; }
.wkf-cat-item span { overflow-wrap: anywhere; }
.wkf-cat-item:hover { background: var(--brand-tint-2); }
.wkf-cat-item.is-off { opacity: .5; cursor: not-allowed; }
.wkf-unlock { border-color: var(--warn); background: var(--warn-bg); margin-top: 16px; }
.wkf-live { margin-top: 16px; }
.wkf-run-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.wkf-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--brand-tint); color: var(--brand-700); }
.wkf-pill.wkf-succeeded { background: var(--ok-bg); color: var(--ok-700); }
.wkf-pill.wkf-failed { background: var(--danger-bg); color: var(--danger); }
.wkf-working p { margin: 8px 0 0; }
.wkf-outs { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.wkf-outs li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; }
.wkf-outs li b { overflow-wrap: anywhere; }
.wkf-out-actions { display: flex; gap: 6px; }
.wkf-errtxt { color: var(--danger) !important; }
.wkf-checks pre { max-height: 260px; overflow: auto; font-size: .75rem; background: var(--bg); padding: 10px; border-radius: 8px; white-space: pre-wrap; }
.wkf-history { margin-top: 24px; }
.wkf-hist-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.wkf-hist-head h2 { margin: 0; }
.wkf-hist-row { border: 1px solid var(--border); border-radius: 10px; margin-top: 8px; background: var(--surface); }
.wkf-hist-row summary { display: flex; gap: 12px; align-items: center; padding: 10px 12px; cursor: pointer; }
.wkf-hist-row summary span:first-child { flex: 1; font-weight: 600; }
.wkf-hist-body { padding: 0 12px 12px; }
.wkf-empty { display: grid; gap: 4px; padding: 22px; border: 1px dashed var(--border-strong); border-radius: 12px; background: var(--brand-tint-2); text-align: center; color: var(--muted); }
.wkf-empty b { color: var(--text); }
.wkf-bill-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 10px; }
.wkf-bill-grid > div { display: grid; gap: 6px; align-content: start; }
.wkf-bill-grid select { margin-left: 6px; }
.wkf-price { font-size: 1.4rem; font-weight: 700; color: var(--brand-700); }
#wkf-tally-billing .wkf-unlock { margin: 0 0 14px; }
@media (max-width: 760px) { .wkf-bill-grid { grid-template-columns: 1fr; } }
