@font-face {
  font-family: "Lexend";
  src: url("assets/Lexend-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --mission-navy: #071B2B;
  --signal-gold: #F1B944;
  --focus-ring: #071B2B;
  --ink: var(--mission-navy);
  --ink-soft: #183247;
  --muted: #607181;
  --line: #d9e1e7;
  --paper: #F5F2EA;
  --panel: #ffffff;
  --soft: #e8eef2;
  --green: #176f3d;
  --green-soft: #e8f5ec;
  --amber: #946617;
  --amber-soft: #fff5db;
  --red: #a53b30;
  --red-soft: #fbe9e6;
  --blue: #285d77;
  --blue-soft: #eaf3f7;
  --shadow: 0 10px 28px rgba(7, 27, 43, .08);
  color: var(--ink);
  background: var(--paper);
  font-family: "Lexend", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: hidden; scroll-behavior: smooth; }
body { max-width: 100%; margin: 0; min-width: 320px; overflow-x: hidden; background: var(--paper); }
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.app-shell { min-height: 100vh; }
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 315px minmax(390px, 1fr) auto;
  align-items: center;
  gap: 22px;
  width: min(100%, 1760px);
  margin: 0 auto;
  padding: 14px 24px;
  border-bottom: 4px solid var(--signal-gold);
  color: white;
  background: rgba(7, 27, 43, .98);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 44px; text-decoration: none; }
.brand-logo { display: block; flex: 0 0 auto; width: 160px; height: 59px; object-fit: contain; }
.brand-symbol { display: none; flex: 0 0 auto; width: 44px; height: 44px; object-fit: contain; }
.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: white;
  background: var(--ink);
  font-weight: 900;
}
.brand-copy { min-width: 0; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; }
.brand small { margin-top: 2px; color: #c8d4dd; }

.tabs { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 4px; padding: 4px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 8px; background: rgba(255, 255, 255, .08); }
.tab { min-height: 44px; border: 0; border-radius: 5px; color: #dce6ed; background: transparent; cursor: pointer; font-weight: 750; }
.tab:hover { color: white; background: rgba(255, 255, 255, .08); }
.tab.active { color: var(--mission-navy); background: var(--signal-gold); box-shadow: none; }

.appbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.system-strip { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; }
.system-item { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; color: #d9e6ef; font-size: .75rem; font-weight: 740; letter-spacing: .01em; line-height: 1.2; white-space: nowrap; }
.system-label { color: #9fb1bf; font-size: .66rem; font-weight: 820; letter-spacing: .08em; text-transform: uppercase; }
.system-status { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: #eaf0f5; font-variant-numeric: tabular-nums; }
.system-item[data-system-item="session"] .system-status { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.system-status.ok { color: #98dfb5; }
.system-status.error { color: #ffb7af; }
.system-status.neutral, .system-status.unavailable { color: #d9e6ef; }
.system-status.test, .system-status.fresh { color: #b9d9ec; }
.system-status.warning, .system-status.stale { color: #ffd887; }
.system-status.live { color: #ffd1ca; }
.appbar .status.neutral { color: #eaf0f5; background: rgba(255, 255, 255, .12); }
.status { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 13px; border-radius: 999px; font-size: .86rem; font-weight: 850; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--green); background: var(--green-soft); }
.status.error { color: var(--red); background: var(--red-soft); }
.status.neutral { color: var(--muted); background: var(--soft); }
.status.test, .status.fresh { color: #d9e6ef; background: rgba(255, 255, 255, .12); }
.status.warning, .status.stale { color: #5c4312; background: var(--amber-soft); }
.status.live { color: white; background: #8b2f28; }
.status.unavailable { color: #d6dee4; background: rgba(255, 255, 255, .1); }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid rgba(255, 255, 255, .28); border-radius: 5px; color: white; background: transparent; cursor: pointer; font-size: 1.35rem; }

main { width: min(100%, 1540px); margin: 0 auto; padding: 38px 24px 72px; }
.screen { display: none; }
.screen.active { display: block; animation: screen-in .18s ease-out; }
@keyframes screen-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 26px; }
.page-head > div { max-width: 920px; }
.page-head.compact { margin-bottom: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow.light { color: #c8d4dd; }
h1 { max-width: 900px; margin: 0; font-size: clamp(2rem, 3.2vw, 3.35rem); line-height: 1.1; letter-spacing: -.025em; }
h1, h2 { overflow-wrap: anywhere; }
.compact h1 { font-size: clamp(1.8rem, 2.65vw, 2.6rem); }
.page-head p:not(.eyebrow) { max-width: 820px; margin: 12px 0 0; color: #475d6d; font-size: 1rem; line-height: 1.55; }
h2 { margin: 0; font-size: 1.3rem; line-height: 1.25; letter-spacing: -.015em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.work-context {
  position: sticky;
  top: 92px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, 1.3fr) repeat(3, minmax(130px, .7fr));
  gap: 10px;
  margin: -18px 0 26px;
  padding: 10px 12px;
  border: 1px solid #ccd7df;
  border-top: 2px solid var(--signal-gold);
  border-radius: 8px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 8px 24px rgba(7, 27, 43, .08);
  backdrop-filter: blur(12px);
}
.work-context-copy, .context-fact { min-width: 0; padding: 4px 8px; }
.context-fact { border-left: 1px solid var(--line); }
.context-label, .context-fact > span:first-child { display: block; margin-bottom: 3px; color: var(--muted); font-size: .68rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.work-context strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .87rem; }
.context-value { display: flex; align-items: center; gap: 7px; min-width: 0; }
.context-value strong { min-width: 0; }
.copy-control { min-height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: white; cursor: pointer; font-size: .7rem; font-weight: 800; }

.development-testlab {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, .8fr);
  gap: 20px 28px;
  margin-bottom: 22px;
  border-color: #bfd2df;
  background: var(--blue-soft);
  box-shadow: none;
}
.development-testlab-copy p:not(.eyebrow) { max-width: 760px; margin: 8px 0 0; color: #405047; line-height: 1.5; }
.development-testlab-action { display: grid; align-content: center; gap: 8px; }
.development-testlab-action .button { width: 100%; }
.development-testlab-action .button:disabled { cursor: wait; opacity: .62; }
.development-testlab-action .deal-resolver-status { margin: 0; }
.development-synthetic-result { grid-column: 1 / -1; display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid #b9dcc6; }
.development-synthetic-identity, .development-synthetic-counts { display: grid; gap: 8px; }
.development-synthetic-identity { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.development-synthetic-counts { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.development-synthetic-result span { min-width: 0; padding: 10px 12px; border-radius: 6px; background: white; color: var(--muted); font-size: .72rem; font-weight: 850; text-transform: uppercase; }
.development-synthetic-result strong { display: block; margin-top: 4px; overflow-wrap: anywhere; color: var(--ink); font-size: .88rem; text-transform: none; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 17px; border: 1px solid var(--line); border-radius: 5px; background: white; cursor: pointer; font-weight: 750; text-decoration: none; white-space: nowrap; }
.button:hover { border-color: #b8c6d0; background: #f8fafb; }
.button.dark { color: white; border-color: var(--mission-navy); background: var(--mission-navy); }
.button.dark:hover { background: #0e2b42; }
.button.primary { color: var(--mission-navy); border-color: var(--signal-gold); background: var(--signal-gold); }
.button.primary:hover { border-color: #d9a536; background: #f5c65a; }
.button.secondary { color: var(--ink); background: white; }
.button.quiet { min-height: 40px; color: #31495b; border-color: #cbd6dd; background: transparent; font-size: .84rem; }
.button:disabled, select:disabled, input:disabled { cursor: not-allowed; opacity: .52; }
.button.full { width: 100%; margin-top: 16px; }
.button:focus-visible, .tab:focus-visible, .icon-button:focus-visible, input:focus-visible, select:focus-visible, .worker-start:focus-visible, .task-open:focus-visible, .review-link:focus-visible, .brand:focus-visible,
.review-batch-toggle:focus-visible, .review-text-toggle:focus-visible, .review-show-more:focus-visible, .selection-mark:has(input:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 3px; box-shadow: 0 0 0 2px var(--signal-gold), 0 0 0 5px var(--focus-ring); }

.notice { margin-bottom: 18px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 8px; line-height: 1.5; }
.notice.error { color: var(--red); border-color: #efc3bd; background: var(--red-soft); }
.notice.info { color: #5c4a20; border-color: #ebd6a5; background: var(--amber-soft); }
#setup-panel:not(.hidden) { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
#setup-panel .button { flex: 0 0 auto; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.metrics article { min-height: 106px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.metrics span { color: var(--muted); font-size: .87rem; font-weight: 800; }
.metrics strong { display: block; margin-top: 13px; color: var(--mission-navy); font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }

.deal-resolver { display: grid; grid-template-columns: minmax(250px, .8fr) minmax(360px, 1.2fr); gap: 20px 28px; margin-bottom: 14px; padding: 22px; }
.deal-resolver > *, .deal-resolver-controls, .stage-sync > div { min-width: 0; }
.deal-resolver-copy h2 { margin: 4px 0 7px; font-size: 1.35rem; }
.deal-resolver-copy p:last-child { max-width: 560px; margin: 0; color: var(--muted); line-height: 1.5; }
.deal-resolver-copy h2, .deal-resolver-copy p, .stage-sync strong, .stage-sync small { overflow-wrap: anywhere; }
.deal-resolver-form { align-self: center; }
.deal-resolver-form > label { display: block; margin-bottom: 7px; font-size: .78rem; font-weight: 850; text-transform: uppercase; }
.deal-resolver-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.deal-resolver-controls input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.deal-resolver-controls .button { min-height: 48px; }
.deal-resolver-status { min-height: 18px; margin: 7px 0 0; color: var(--muted); font-size: .82rem; }
.deal-resolver-status.error { color: var(--red); }
.deal-resolver-status.ok { color: var(--green); }
.stage-sync { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.stage-sync-icon { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 5px rgba(40, 93, 119, .1); }
.stage-sync strong, .stage-sync small { display: block; }
.stage-sync small { margin-top: 2px; color: var(--muted); }

.command-bar { display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; align-items: center; gap: 14px; margin-bottom: 14px; padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.command-bar label { font-weight: 850; }
.command-bar input { width: 100%; min-height: 42px; padding: 0 13px; border: 0; border-left: 1px solid var(--line); color: var(--ink); background: transparent; }
.command-bar input:focus { outline: 0; }
.updated-at { color: var(--muted); font-size: .86rem; white-space: nowrap; }

.workspace { display: grid; gap: 14px; }
.cockpit-grid { grid-template-columns: minmax(0, 1fr) 350px; }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: none; }
.panel-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.panel-head .eyebrow { margin-bottom: 5px; }
.count-badge { display: grid; min-width: 34px; height: 30px; padding: 0 10px; place-items: center; border-radius: 999px; color: var(--muted); background: var(--soft); font-weight: 850; }

.task-table-head, .task-row { display: grid; grid-template-columns: 145px minmax(180px, 1.4fr) minmax(155px, 1fr) minmax(115px, .7fr) 40px; gap: 14px; align-items: center; }
.task-table-head { padding: 14px 12px 8px; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.task-row { min-height: 68px; padding: 12px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: #f8fafb; }
.task-row:focus-within { background: #fffaf0; }
.task-cell strong, .task-cell small { display: block; overflow-wrap: anywhere; }
.task-cell small { margin-top: 3px; color: var(--muted); }
.task-open { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 7px; background: white; cursor: pointer; font-size: 1.1rem; }
.pill { display: inline-flex; width: fit-content; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 999px; font-size: .78rem; font-weight: 850; }
.pill.submitted, .pill.online { color: var(--green); background: var(--green-soft); }
.pill.ready { color: var(--blue); background: var(--blue-soft); }
.pill.running { color: var(--blue); background: var(--blue-soft); }
.pill.error { color: var(--red); background: var(--red-soft); }
.pill.prepared, .pill.neutral, .pill.offline { color: var(--muted); background: var(--soft); }

.worker-list { display: grid; gap: 8px; margin-top: 14px; }
.worker-card { padding: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); }
.worker-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.worker-card small { display: block; margin-top: 6px; color: var(--muted); }
.empty { padding: 34px 12px; color: var(--muted); text-align: center; line-height: 1.5; }

.review-toolbar { display: grid; grid-template-columns: auto minmax(240px, 1fr) auto; align-items: center; gap: 13px; margin-bottom: 14px; padding: 12px 14px; box-shadow: none; }
.review-toolbar label { font-weight: 850; }
.review-toolbar select { min-height: 44px; padding: 0 40px 0 12px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.segmented { display: flex; gap: 3px; padding: 4px; border-radius: 7px; background: var(--soft); }
.segmented button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; cursor: pointer; font-size: .86rem; font-weight: 800; }
.segmented button.active { color: var(--ink); background: white; box-shadow: 0 1px 4px rgba(20, 25, 18, .08); }
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.review-title-row { align-items: center; }
.review-title-row .muted { margin: 5px 0 0; }
.review-main > .notice { margin-top: 14px; margin-bottom: 0; }
.review-list { margin-top: 6px; }
.review-batch { border-bottom: 1px solid var(--line); }
.review-batch:last-child { border-bottom: 0; }
.review-batch-toggle { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; width: 100%; min-height: 44px; gap: 12px; padding: 10px 0; border: 0; color: var(--ink); background: transparent; cursor: pointer; font: inherit; font-weight: 850; text-align: left; }
.review-batch-summary { color: var(--muted); font-size: .8rem; font-weight: 750; overflow-wrap: anywhere; text-align: right; }
.review-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 17px 4px; border-bottom: 1px solid var(--line); }
.review-row:last-child { border-bottom: 0; }
.selection-mark { position: relative; display: grid; place-items: center; width: 44px; height: 44px; margin-top: 0; border: 1px solid #c7cdc2; border-radius: 7px; color: transparent; background: white; cursor: pointer; font-size: .9rem; font-weight: 900; }
.selection-mark input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.selection-mark:has(input:disabled) { cursor: not-allowed; opacity: .58; }
.review-row.selected .selection-mark { color: white; border-color: var(--green); background: var(--green); }
.review-topline { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.review-topline strong { min-width: 0; overflow-wrap: anywhere; }
.review-topline time { color: var(--muted); font-size: .84rem; white-space: nowrap; }
.review-stars { color: var(--amber); }
.review-copy { margin: 8px 0 0; color: #353a33; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.review-copy.clamped { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.review-text-toggle, .review-show-more { display: inline-flex; align-items: center; min-height: 44px; margin-top: 5px; padding: 0 10px; border: 0; color: var(--green); background: transparent; cursor: pointer; font: inherit; font-size: .84rem; font-weight: 850; }
.review-show-more { margin: 4px 0 10px; }
.review-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.review-reason { color: var(--muted); font-size: .84rem; }
.review-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-size: .84rem; font-weight: 800; }
@media (prefers-reduced-motion: reduce) {
  .review-batch-toggle, .review-text-toggle, .review-show-more { transition: none; }
}
.selection-actions { display: grid; grid-template-columns: minmax(210px, .8fr) minmax(520px, 1.5fr); gap: 18px; align-items: end; margin-bottom: 14px; padding: 15px 16px; }
.review-next-step { grid-column: 1 / -1; margin: 0; padding: 11px 13px; border: 1px solid #ebd6a5; border-radius: 6px; color: #384e5e; background: #fff9ea; font-size: .86rem; line-height: 1.45; }
.review-next-step strong, .review-next-step span { display: block; }
.review-next-step span { margin-top: 3px; color: var(--muted); }
.selection-source { display: grid; gap: 3px; min-width: 0; }
.selection-source strong, .selection-source small { overflow-wrap: anywhere; }
.selection-source small { color: var(--muted); }
.source-label { margin-top: 4px; font-size: .75rem; font-weight: 850; color: var(--muted); }
.selection-source select { min-height: 42px; padding: 0 36px 0 11px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.source-state { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; margin-top: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); }
.source-state > span:nth-child(2) { font-size: .82rem; color: var(--muted); line-height: 1.4; }
.source-state .button { grid-column: 1 / -1; width: 100%; min-height: 38px; }
.source-upload { width: max-content; margin-top: 7px; }
.supplement-preview, .source-ledger { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.supplement-preview { display: grid; gap: 10px; }
.supplement-preview-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.supplement-preview-head strong, .supplement-preview-head small { display: block; }
.supplement-preview-head small, .supplement-preview-copy, .supplement-hash { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.supplement-preview-copy { margin: 0; }
.supplement-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--line); }
.supplement-facts span { min-width: 0; padding: 9px 10px; background: var(--soft); color: var(--muted); font-size: .76rem; font-weight: 850; overflow-wrap: anywhere; }
.supplement-facts strong { display: block; margin-top: 3px; color: var(--ink); font-size: .94rem; }
.supplement-emails { display: grid; gap: 3px; margin: 0; padding-left: 18px; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.supplement-hash { display: grid; gap: 4px; margin: 0; }
.supplement-hash code { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: .75rem; }
.supplement-confirm { width: 100%; min-height: 44px; }
.source-ledger { display: grid; gap: 9px; }
.source-ledger h3 { margin: 0; font-size: .9rem; }
.source-ledger-entry { display: grid; gap: 5px; padding-top: 10px; border-top: 1px solid var(--line); }
.source-rollback { width: max-content; margin-top: 4px; }
.source-ledger-entry:first-of-type { padding-top: 0; border-top: 0; }
.source-ledger-entry strong, .source-ledger-entry small { display: block; overflow-wrap: anywhere; }
.source-ledger-entry small { margin-top: 3px; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.legacy-supplement-repair { display: grid; gap: 5px; padding: 12px; border: 1px solid #ebd6a5; border-radius: 7px; background: #fffaf0; }
.legacy-supplement-repair small { color: #5f450b; font-size: .8rem; line-height: 1.4; }
.legacy-supplement-repair .button { width: max-content; margin-top: 4px; }
.legacy-repair-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.legacy-repair-head strong { display: block; }
.legacy-repair-head p, .legacy-repair-preview > p { margin: 5px 0 0; color: #5f450b; font-size: .84rem; line-height: 1.45; }
.legacy-repair-preview, .legacy-repair-result { display: grid; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #ebd6a5; }
.legacy-repair-preview > label { color: #5f450b; font-size: .78rem; font-weight: 850; }
.legacy-repair-preview > input { min-height: 42px; padding: 0 11px; border: 1px solid #d7b968; border-radius: 7px; color: var(--ink); background: white; font: inherit; }
.legacy-repair-batch-changes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid #ebd6a5; border-radius: 7px; background: #ebd6a5; }
.legacy-repair-batch-changes span { min-width: 0; padding: 9px 10px; color: #5f450b; background: #fffaf0; font-size: .75rem; font-weight: 850; overflow-wrap: anywhere; }
.legacy-repair-batch-changes strong { display: block; margin-top: 3px; color: var(--ink); font-size: .9rem; }
.legacy-repair-fingerprints { display: grid; gap: 7px; margin: 0; }
.legacy-repair-fingerprints div { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 3fr); gap: 8px; align-items: baseline; }
.legacy-repair-fingerprints dt { color: #5f450b; font-size: .76rem; font-weight: 850; }
.legacy-repair-fingerprints dd { min-width: 0; margin: 0; }
.legacy-repair-fingerprints code { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: .73rem; }
.legacy-repair-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.legacy-repair-actions .button { margin-top: 0; }
.legacy-repair-actions .muted { color: #5f450b; font-size: .82rem; }
.legacy-repair-result { padding: 12px; border: 1px solid #bfe1c8; border-radius: 7px; color: #176c3a; background: #effaf2; font-size: .84rem; line-height: 1.45; }
.legacy-repair-result strong, .legacy-repair-result span { display: block; }
.legacy-repair-error { margin-top: 12px; }
.apify-run-flow { display: grid; gap: 12px; margin-top: 12px; }
.apify-flow-section, .apify-fallback-panel { padding-top: 14px; border-top: 1px solid var(--line); }
.apify-section-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.apify-section-head h3 { margin: 0; font-size: 1rem; }
.apify-section-head .muted { margin: 4px 0 0; font-size: .84rem; line-height: 1.45; }
.apify-fact-grid, .apify-evidence-grid, .apify-fallback-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--line); }
.apify-fallback-details { border-color: #ebd6a5; background: #ebd6a5; }
.apify-fact { min-width: 0; padding: 10px 11px; background: white; }
.apify-fallback-details .apify-fact { background: #fffaf0; }
.apify-fact span, .apify-fact strong { display: block; overflow-wrap: anywhere; }
.apify-fact span { color: var(--muted); font-size: .72rem; font-weight: 850; text-transform: uppercase; }
.apify-fact strong { margin-top: 4px; font-size: .86rem; line-height: 1.35; }
.apify-limit-breakdown { display: grid; gap: 4px; margin-top: 12px; padding: 11px; border-radius: 7px; color: #5f450b; background: var(--amber-soft); font-size: .84rem; line-height: 1.45; }
.apify-approvals { display: grid; gap: 7px; margin-top: 12px; }
.apify-approvals label, .apify-confirm { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; align-items: start; color: #3e443c; font-size: .84rem; line-height: 1.45; cursor: pointer; }
.apify-approvals input, .apify-confirm input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--green); }
.apify-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.apify-actions .button { min-height: 44px; }
#apify-errors { display: grid; gap: 8px; margin: 0; font-size: .86rem; }
#apify-errors .button { width: fit-content; }
.apify-fallback-panel { color: #5f450b; }
.apify-fallback-panel .pill { color: var(--amber); background: var(--amber-soft); }
.apify-reason { display: block; margin-top: 12px; color: #5f450b; font-size: .78rem; font-weight: 850; }
.apify-fallback-panel textarea { width: 100%; min-height: 76px; margin-top: 7px; padding: 10px 11px; border: 1px solid #d7b968; border-radius: 7px; resize: vertical; color: var(--ink); background: white; font: inherit; line-height: 1.4; }
.apify-fallback-panel .apify-confirm { margin-top: 10px; color: #5f450b; }
.visually-hidden { 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; }
.selection-controls { display: grid; grid-template-columns: minmax(165px, 1fr) auto auto auto; gap: 8px; align-items: end; }
.selection-controls label { grid-column: 1 / -1; font-size: .78rem; font-weight: 850; color: var(--muted); }
.selection-controls select { min-height: 42px; padding: 0 36px 0 11px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.selection-controls .button { min-height: 42px; white-space: nowrap; }
.selection-lock-note { grid-column: 1 / -1; margin: 0; padding-top: 3px; color: var(--danger); font-size: .84rem; }

.reconciliation-panel { margin-bottom: 14px; box-shadow: none; }
.reconciliation-head { align-items: center; }
.reconciliation-head .muted { margin: 6px 0 0; font-size: .88rem; }
.reconciliation-metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); }
.reconciliation-metrics > div { min-width: 0; padding: 14px 16px; border-right: 1px solid var(--line); }
.reconciliation-metrics > div:last-child { border-right: 0; }
.reconciliation-metrics span, .reconciliation-metrics strong { display: block; }
.reconciliation-metrics span { color: var(--muted); font-size: .74rem; font-weight: 850; text-transform: uppercase; }
.reconciliation-metrics strong { margin-top: 5px; font-size: 1.55rem; line-height: 1; }
.reconciliation-metrics strong.negative, .reconciliation-metrics strong.positive { color: var(--red); }
.reconciliation-table-wrap { margin-top: 14px; overflow-x: auto; }
.reconciliation-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.reconciliation-table th, .reconciliation-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.reconciliation-table th { color: var(--muted); font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.reconciliation-table th:first-child, .reconciliation-table td:first-child { text-align: left; }
.reconciliation-table tbody tr:last-child td { border-bottom: 0; }
.reconciliation-table tbody tr.total-row { background: #fafbf8; font-weight: 850; }
.reconciliation-table td::before { content: attr(data-label); display: none; }
.reconciliation-table .difference { color: var(--red); font-weight: 850; }
.reconciliation-table .difference.zero { color: var(--green); }
.row-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 850; }
.row-status::before { width: 7px; height: 7px; border-radius: 999px; background: currentColor; content: ""; }
.row-status.ok { color: var(--green); }
.row-status.warn { color: var(--red); }
.row-status.open { color: var(--amber); }
.quality-line { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.quality-line strong { color: var(--ink); }
.reconciliation-issues { display: grid; gap: 7px; margin-top: 13px; }
.reconciliation-issue { padding: 10px 12px; border-radius: 6px; color: #72540f; background: var(--amber-soft); font-size: .84rem; line-height: 1.45; }
.reconciliation-issue strong { display: block; color: #5f450b; }
.reconciliation-confirm { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 9px; margin-top: 14px; padding: 13px; border: 1px solid #d7b968; border-radius: 7px; color: #5f450b; background: #fff9e9; cursor: pointer; font-size: .88rem; font-weight: 750; line-height: 1.45; }
.reconciliation-confirm input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--green); }

.finalization-panel { margin-bottom: 14px; box-shadow: none; }
.finalization-head { align-items: center; }
.finalization-head .muted { margin: 6px 0 0; font-size: .88rem; }
.finalization-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 15px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--line); }
.finalization-fact { min-width: 0; padding: 13px 14px; background: white; }
.finalization-fact span, .finalization-fact strong { display: block; }
.finalization-fact span { color: var(--muted); font-size: .72rem; font-weight: 850; text-transform: uppercase; }
.finalization-fact strong { margin-top: 5px; overflow-wrap: anywhere; font-size: .9rem; }
.finalization-panel .notice { margin: 14px 0 0; }
.finalization-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.danger-action { color: var(--red) !important; border-color: #e7b3ac !important; background: var(--red-soft) !important; }

.preflight-grid { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(280px, .9fr) minmax(380px, 1.35fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.preflight-card { box-shadow: none; }
.preflight-card .panel-head { margin-bottom: 15px; }
.field-label, .attachment-section-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .78rem; font-weight: 850; }
.preflight-card select { width: 100%; min-height: 44px; padding: 0 38px 0 11px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.compact-copy { min-height: 42px; margin: 10px 0 8px; font-size: .88rem; line-height: 1.45; }
.text-link { color: var(--green); font-size: .88rem; font-weight: 850; text-underline-offset: 3px; }
.readiness-list { display: grid; gap: 6px; }
.readiness-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 39px; padding: 8px 10px; border-radius: 6px; background: var(--soft); font-size: .84rem; }
.readiness-item span { overflow-wrap: anywhere; }
.readiness-item strong { font-size: .75rem; }
.readiness-item.ok strong { color: var(--green); }
.readiness-item.optional strong { color: var(--amber); }
.readiness-item.missing { color: var(--red); background: var(--red-soft); }
.zoho-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-list, .authorization-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.crm-attachment { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.crm-attachment:last-child { border-bottom: 0; }
.crm-attachment strong, .crm-attachment small, .authorization-head strong, .authorization-head small { display: block; overflow-wrap: anywhere; }
.crm-attachment small, .authorization-head small { margin-top: 3px; color: var(--muted); font-size: .8rem; }
.crm-attachment.has-stored-history { padding: 12px; border: 1px solid #b9dcc6; border-radius: 7px; background: var(--green-soft); }
.crm-history-note { color: var(--green) !important; }
.crm-history-note strong { display: inline; }
.authorization-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.approval-note { margin: 10px 0 0; padding: 10px; border-radius: 6px; color: var(--green); background: var(--green-soft); font-size: .84rem; line-height: 1.45; }
.attachment-options { display: grid; gap: 6px; margin-top: 10px; }
.attachment-option { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.attachment-option:has(input:checked) { border-color: #8bb89a; background: var(--green-soft); }
.attachment-option input { margin-top: 3px; accent-color: var(--green); }
.attachment-option strong, .attachment-option small { display: block; overflow-wrap: anywhere; }
.attachment-option small { margin-top: 3px; color: var(--muted); font-size: .78rem; }
.consent-check { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; margin: 12px 0; color: #3e443c; font-size: .84rem; line-height: 1.45; cursor: pointer; }
.consent-check input { margin-top: 3px; accent-color: var(--green); }
.compact-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: .84rem; line-height: 1.45; }
.compact-notice .button { flex: 0 0 auto; }
.compact-empty { padding: 14px 4px; text-align: left; font-size: .86rem; }

.batch-list { display: grid; gap: 9px; margin-top: 14px; }
.batch-card { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fffdf8; }
.batch-card-head { display: flex; justify-content: space-between; gap: 10px; }
.batch-card p { margin: 8px 0 0; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.batch-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; color: var(--ink); }
.batch-group-heading span { color: var(--muted); font-size: .9rem; }
.batch-history { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.batch-history summary { cursor: pointer; color: var(--muted); font-weight: 700; }
.batch-history-list { display: grid; gap: 10px; margin-top: 12px; }
.boundary-note { margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-top: 2px solid var(--mission-navy); background: var(--soft); }
.boundary-note p { margin: 6px 0 0; color: var(--muted); line-height: 1.5; }

.worker-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr) 320px; gap: 14px; align-items: stretch; }
.worker-hero { min-height: 590px; padding: 26px; border-radius: 10px; color: white; background: var(--mission-navy); box-shadow: var(--shadow); }
.worker-mode-line { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.worker-mode-line .eyebrow { margin: 0; }
.worker-mode-line .status { max-width: 100%; margin-left: auto; white-space: normal; line-height: 1.3; text-align: right; }
.worker-hero h2 { max-width: 330px; margin-top: 10px; font-size: clamp(2.5rem, 4.5vw, 4.6rem); line-height: .98; }
.worker-hero > p:not(.eyebrow) { margin: 20px 0; color: #c7cec3; line-height: 1.55; }
.worker-connection { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 30px; padding: 18px 0; border-top: 1px solid #3b4038; border-bottom: 1px solid #3b4038; }
.worker-connection span { color: #aab3a5; }
.worker-connection strong { color: #bde8ca; }
.worker-start { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 13px; margin-top: 22px; padding: 13px; border-radius: 10px; color: var(--ink); background: white; text-decoration: none; }
.worker-start > span:nth-child(2) { min-width: 0; }
.worker-start .play { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 5px; color: var(--mission-navy); background: var(--signal-gold); }
.worker-start strong, .worker-start small { display: block; }
.worker-start small { margin-top: 3px; color: var(--muted); }
.worker-queue { margin-top: 6px; }
.queue-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 15px 2px; border-bottom: 1px solid var(--line); }
.queue-row:first-child { border-top: 2px solid var(--signal-gold); }
.queue-row:last-child { border-bottom: 0; }
.queue-row strong, .queue-row small { display: block; }
.queue-row small { margin-top: 5px; color: var(--muted); line-height: 1.4; }
.queue-meta { text-align: right; }
.queue-meta time { display: block; margin-top: 5px; color: var(--muted); font-size: .78rem; }
.queue-reset { margin-top: 10px; padding: 7px 10px; border: 1px solid #e7b3ac; border-radius: 6px; color: var(--red); background: var(--red-soft); cursor: pointer; font: inherit; font-size: .78rem; font-weight: 800; }
.queue-reset:hover { border-color: var(--red); }
.queue-reset:disabled { cursor: wait; opacity: .55; }
.worker-history { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.worker-history summary { min-height: 44px; padding: 11px 2px; color: var(--muted); cursor: pointer; font-weight: 800; }
.worker-history-list { margin-top: 4px; }
.worker-history .queue-row:first-child { border-top-width: 1px; border-top-color: var(--line); }
.worker-local-guide { margin-top: 14px; border-top: 1px solid var(--line); }
.worker-local-guide summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; cursor: pointer; color: var(--ink); font-weight: 850; list-style: none; }
.worker-local-guide summary::-webkit-details-marker { display: none; }
.worker-local-guide summary span:last-child { color: var(--muted); font-size: .78rem; font-weight: 750; }
.worker-local-guide summary::after { content: '+'; flex: 0 0 auto; color: var(--green); font-size: 1.2rem; line-height: 1; }
.worker-local-guide[open] summary::after { content: '−'; }
.worker-local-guide-body { padding: 2px 0 14px; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.worker-local-guide-body p { margin: 0; }
.worker-local-guide-body ol { display: grid; gap: 8px; margin: 12px 0 0; padding-left: 1.3rem; }
.worker-local-guide-body strong { color: var(--ink); }
.worker-enrollment { grid-column: 1 / -1; }
.worker-enrollment .panel-copy { margin: 0 0 16px; color: var(--muted); }
.worker-enrollment-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto; gap: 12px; align-items: end; }
.worker-enrollment-form label { display: grid; gap: 7px; color: var(--muted); font-size: .82rem; font-weight: 800; }
.worker-enrollment-form input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font: inherit; }
#worker-next-selection-form { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
#worker-next-selection-form label { min-width: 0; }
#worker-next-selection-form input,
#worker-next-selection-form select { width: 100%; min-width: 0; max-width: 100%; }
#worker-next-selection-form select { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font: inherit; }
#worker-next-selection-form .form-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
#worker-next-selection-form .button { width: 100%; min-width: 0; white-space: normal; }
.worker-enrollment-result { margin-top: 16px; padding: 15px; border: 1px solid #b9dcc6; border-radius: 7px; background: var(--green-soft); }
.worker-enrollment-result strong, .worker-enrollment-result code { display: block; }
.worker-enrollment-result code { margin-top: 6px; overflow-wrap: anywhere; color: var(--ink); font-size: .9rem; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); padding: 13px 16px; border-radius: 7px; color: white; background: var(--ink); box-shadow: 0 12px 34px rgba(0,0,0,.2); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .16s ease, transform .16s ease; }
.toast.show { opacity: 1; transform: none; }

.auth-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; overflow-y: auto; background: rgba(21, 23, 19, .48); backdrop-filter: blur(5px); }
.auth-dialog { width: min(100%, 520px); max-height: calc(100vh - 48px); overflow-y: auto; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 24px 70px rgba(0, 0, 0, .2); }
.auth-dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.auth-dialog-head h2 { font-size: 1.55rem; }
.auth-copy { margin: 16px 0; color: var(--muted); line-height: 1.5; }
.auth-embed { min-height: 330px; overflow: hidden; }
.auth-embed iframe { display: block; width: 100% !important; max-width: 100%; min-height: 430px; border: 0; }
.auth-loading { display: grid; min-height: 260px; place-items: center; color: var(--muted); }

@media (max-width: 1180px) {
  .appbar { grid-template-columns: 220px 1fr auto; gap: 14px; }
  .status { display: none; }
  .system-strip { gap: 10px; }
  .system-item[data-system-item="freshness"] { display: none; }
  .worker-mode-line .status { display: inline-flex; }
  .cockpit-grid { grid-template-columns: 1fr 300px; }
  .worker-grid { grid-template-columns: 340px minmax(0, 1fr); }
  .connected-panel { grid-column: 1 / -1; }
  .preflight-grid { grid-template-columns: 1fr 1fr; }
  .zoho-card { grid-column: 1 / -1; }
  .connected-panel .worker-list { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 920px) {
  .appbar { grid-template-columns: 1fr auto; padding: 12px 16px 66px; }
  .tabs { position: absolute; left: 12px; right: 12px; bottom: 8px; }
  .appbar-actions { grid-column: 2; grid-row: 1; }
  .system-strip { gap: 8px; }
  .system-item[data-system-item="environment"], .system-item[data-system-item="freshness"], .system-item[data-system-item="session"] { display: none; }
  .work-context { top: 120px; grid-template-columns: 1fr 1fr 1fr; margin-top: -12px; }
  .work-context-copy { grid-column: 1 / -1; }
  main { padding: 28px 16px 62px; }
  .page-head { align-items: start; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .deal-resolver { grid-template-columns: 1fr; }
  .development-testlab { grid-template-columns: 1fr; }
  .development-synthetic-result { grid-column: 1; }
  .development-synthetic-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage-sync { grid-column: 1; }
  .cockpit-grid, .review-grid, .worker-grid { grid-template-columns: 1fr; }
  .selection-actions { grid-template-columns: 1fr; align-items: stretch; }
  .reconciliation-metrics { grid-template-columns: repeat(2, 1fr); }
  .reconciliation-metrics > div:nth-child(2) { border-right: 0; }
  .reconciliation-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .preflight-grid { grid-template-columns: 1fr; }
  .finalization-facts { grid-template-columns: 1fr 1fr; }
  .zoho-card { grid-column: auto; }
  .worker-summary, .batch-panel { order: -1; }
  .worker-hero { min-height: 0; }
  .connected-panel { grid-column: auto; }
  .connected-panel .worker-list { grid-template-columns: 1fr; }
  .task-table-head { display: none; }
  .task-row { grid-template-columns: auto 1fr auto; gap: 10px; margin-top: 8px; border: 1px solid var(--line); border-radius: 7px; }
  .task-row .task-status { grid-row: 1 / span 2; }
  .task-row .task-deal, .task-row .task-batches { color: var(--muted); font-size: .9rem; }
  .task-row .task-open { grid-column: 3; grid-row: 1 / span 2; }
  .review-toolbar { grid-template-columns: auto 1fr; }
  .segmented { grid-column: 1 / -1; }
  .selection-controls { grid-template-columns: 1fr 1fr; }
  .selection-controls label, .selection-controls select { grid-column: 1 / -1; }
  .selection-controls .button { width: 100%; }
}

@media (max-width: 768px) {
  .appbar { grid-template-columns: minmax(0, 1fr) auto; }
  .brand-copy { display: none; }
  .reconciliation-metrics,
  .finalization-facts,
  .development-synthetic-identity,
  .development-synthetic-counts { grid-template-columns: 1fr; }
  .cockpit-grid, .review-grid, .worker-grid { grid-template-columns: 1fr; }
  .preflight-grid { grid-template-columns: 1fr; }
  .review-toolbar, .selection-actions, .worker-enrollment-form { grid-template-columns: 1fr; }
  .panel, .worker-hero { padding: 18px; }
}

@media (max-width: 560px) {
  .development-synthetic-identity, .development-synthetic-counts { grid-template-columns: 1fr; }
  .selection-controls { grid-template-columns: 1fr 1fr; }
  .selection-controls label, .selection-controls select, #release-task { grid-column: 1 / -1; }
  .selection-controls .button { width: 100%; white-space: normal; }
  .source-upload { width: 100%; }
  .supplement-facts { grid-template-columns: 1fr; }
  .reconciliation-head { align-items: flex-start; }
  .reconciliation-metrics > div { padding: 12px; }
  .reconciliation-metrics strong { font-size: 1.3rem; }
  .reconciliation-table th, .reconciliation-table td { padding: 9px 10px; }
}

@media (max-width: 620px) {
  .appbar { grid-template-columns: minmax(104px, 1fr) minmax(0, auto); gap: 12px; padding-left: 14px; padding-right: 14px; }
  .brand-logo { width: min(160px, 100%); height: 44px; flex-shrink: 1; }
  .system-strip { flex-wrap: wrap; }
  .system-item { white-space: normal; }
  .brand strong { font-size: .98rem; }
  .brand-copy small { display: none; }
  #refresh { display: none; }
  .appbar-actions .button { min-height: 44px; padding: 0 12px; }
  .icon-button { width: 44px; height: 44px; }
  .tabs { left: 8px; right: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); min-width: 0; }
  .tab { min-width: 0; padding: 0 6px; font-size: .86rem; }
  main { padding: 24px 12px 52px; }
  .work-context { top: 118px; grid-template-columns: 1fr 1fr; gap: 7px; margin: -10px 0 20px; padding: 9px; }
  .work-context-copy { grid-column: 1 / -1; }
  .context-fact { border-left: 0; border-top: 1px solid var(--line); padding-top: 8px; }
  .context-fact:last-child { grid-column: 1 / -1; }
  .copy-control { min-height: 36px; }
  .page-head { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; min-width: 0; gap: 18px; margin-bottom: 22px; }
  .page-head > div { width: 100%; min-width: 0; }
  .page-head h1, .compact h1 { font-size: 2.2rem; line-height: 1.04; }
  .page-head p:not(.eyebrow) { font-size: 1rem; }
  .page-head .button { width: 100%; }
  #setup-panel:not(.hidden) { align-items: stretch; flex-direction: column; }
  #setup-panel .button { width: 100%; }
  .metrics { gap: 8px; }
  .metrics article { min-height: 102px; padding: 15px; }
  .metrics strong { margin-top: 13px; font-size: 1.8rem; }
  .deal-resolver { gap: 18px; padding: 17px; }
  .deal-resolver-controls { grid-template-columns: 1fr; }
  .deal-resolver-controls .button { width: 100%; }
  .stage-sync { grid-template-columns: auto 1fr; }
  .stage-sync .button { grid-column: 1 / -1; width: 100%; }
  .command-bar { grid-template-columns: 1fr; gap: 7px; padding: 13px; }
  .command-bar input { border: 1px solid var(--line); border-radius: 7px; }
  .updated-at { white-space: normal; }
  .panel { padding: 15px; box-shadow: none; }
  .review-toolbar { grid-template-columns: minmax(0, 1fr); width: 100%; min-width: 0; }
  .selection-controls { grid-template-columns: 1fr 1fr; }
  .selection-controls label, .selection-controls select { grid-column: 1 / -1; }
  .selection-controls .button { width: 100%; }
  .source-upload { width: 100%; }
  .zoho-actions { display: grid; }
  .zoho-actions .button, .authorization-panel > .button { width: 100%; }
  .crm-attachment { display: grid; }
  .crm-attachment .button { width: 100%; }
  .segmented { grid-column: auto; width: 100%; min-width: 0; overflow-x: auto; }
  .segmented button { flex: 1; white-space: nowrap; }
  .review-topline { display: grid; gap: 5px; }
  .review-topline time { white-space: normal; }
  .review-actions { align-items: start; }
  .reconciliation-table-wrap { overflow: visible; }
  .reconciliation-table, .reconciliation-table tbody, .reconciliation-table tr, .reconciliation-table td { display: block; width: 100%; }
  .reconciliation-table thead { display: none; }
  .reconciliation-table tbody { display: grid; gap: 10px; }
  .reconciliation-table tr { padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: white; }
  .reconciliation-table td { display: grid; grid-template-columns: minmax(110px, .75fr) minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); text-align: right; white-space: normal; }
  .reconciliation-table td:last-child { border-bottom: 0; }
  .reconciliation-table td::before { content: attr(data-label); display: block; color: var(--muted); font-size: .7rem; font-weight: 850; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
  .reconciliation-table th:first-child, .reconciliation-table td:first-child { text-align: right; }
  .worker-hero { min-height: auto; padding: 22px; }
  .worker-hero h2 { font-size: 2.55rem; line-height: 1.02; }
  .worker-start { grid-template-columns: 44px 1fr auto; }
  .queue-row { grid-template-columns: 1fr; }
  .queue-meta { text-align: left; }
  .worker-enrollment-form { grid-template-columns: 1fr; }
  .auth-modal { align-items: start; padding: 10px; }
  .auth-dialog { max-height: calc(100vh - 20px); padding: 16px; }
  .auth-dialog-head h2 { font-size: 1.25rem; }
  .apify-section-head { flex-wrap: wrap; }
  .apify-mobile-copy,
  .apify-fact span,
  .apify-fact strong,
  .apify-limit-breakdown,
  .apify-approvals label,
  .apify-confirm,
  #apify-errors,
  .apify-reason,
  .apify-fallback-panel textarea { font-size: 15px; }
  .apify-fact strong,
  .apify-limit-breakdown,
  #apify-errors { overflow-wrap: anywhere; }
}

@media (max-width: 760px) {
  .apify-fact-grid, .apify-evidence-grid, .apify-fallback-details { grid-template-columns: 1fr; }
  .apify-actions { display: grid; }
  .apify-actions .button, #apify-errors .button { width: 100%; }
  .apify-flow-section, .apify-fallback-panel { padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
