/* LOA Processing design system
   Read: internal operations console, trust-first, calm, data-dense.
   Colours: EastWest Healthcare brand (same family as Account Connect); see the
   "EastWest brand theme" block at the end of this file, which sets every colour token.
   Type: Geist, one family; scale 12 / 13 / 14 / 15 / 18 / 24, tabular numbers in data.
   Radius: controls 8px, panels 12px, pills full.
   Motion: product UI used all day, so motion is only feedback: press 100ms,
   hover colour 150ms ease, things that appear 200ms ease-out. Everything off
   under prefers-reduced-motion. */

@font-face {
  font-family: "Geist";
  src: url("fonts/geist-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f6f4;
  --surface: #ffffff;
  --surface-2: #f0f3f1;
  --sidebar: #eef2ef;
  --ink: #16211d;
  --muted: #4f5d56;
  --line: #dbe2dd;
  --line-strong: #b7c3bc;
  --accent: #0d6b5e;
  --accent-hover: #0a5a4f;
  --accent-soft: #e2f0ec;
  --accent-ink: #0a5247;
  --on-accent: #ffffff;
  --ok: #1f6a4a;
  --ok-soft: #e3f2ea;
  --warn: #8a5300;
  --warn-soft: #fbefd9;
  --danger: #a3321f;
  --danger-soft: #fbe9e5;
  --shadow: 0 1px 2px rgba(22, 33, 29, 0.05), 0 10px 28px rgba(22, 33, 29, 0.07);
  --r-control: 8px;
  --r-panel: 12px;
  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);
  --sidebar-w: 236px;
  --z-sticky: 10; --z-sidebar: 20; --z-applybar: 30; --z-toast: 50;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --surface: #161d1a;
    --surface-2: #1c2521;
    --sidebar: #121916;
    --ink: #e5ece8;
    --muted: #a3b0a9;
    --line: #26312c;
    --line-strong: #3a4842;
    --accent: #55b8a6;
    --accent-hover: #74c8b8;
    --accent-soft: #15302a;
    --accent-ink: #a6dfd3;
    --on-accent: #0b1714;
    --ok: #74c99c;
    --ok-soft: #13301f;
    --warn: #e5ac57;
    --warn-soft: #382910;
    --danger: #f0a091;
    --danger-soft: #3a1914;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
  .brand img, .login-intro img { box-shadow: 0 0 0 1px var(--line-strong); }
}

[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
code { font-family: var(--mono); font-size: 0.9em; }
.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 50;
  padding: 10px 14px; border-radius: var(--r-control);
  background: var(--accent); color: var(--on-accent); text-decoration: none;
}
.skip-link:focus { top: 12px; }

.icon { width: 18px; height: 18px; flex: none; }

/* ---------- App shell: sidebar + content ---------- */
body.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
body.app > * { grid-column: 2; }
body.app > .sidebar { grid-column: 1; grid-row: 1 / span 20; }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: var(--z-sidebar);
  display: flex; flex-direction: column; gap: 20px; padding: 18px 12px;
  background: var(--sidebar); border-right: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--ink); text-decoration: none; font-weight: 640; font-size: 15px; letter-spacing: -0.01em; }
.brand img { border-radius: 8px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px;
  border-radius: var(--r-control); color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 550;
  transition: background-color 150ms ease, color 150ms ease;
}
.side-link .icon { width: 18px; height: 18px; }
.side-label { flex: 1; white-space: nowrap; }
.side-link.is-on { background: var(--surface); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent), 0 1px 2px rgba(22, 33, 29, 0.06); }
.side-link.is-on .icon { color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .side-link:not(.is-on):hover { color: var(--ink); background: var(--surface-2); } }
.side-divider { height: 1px; background: var(--line); margin: 8px 10px; }
.side-account { display: flex; align-items: center; gap: 8px; padding: 10px 8px 0; border-top: 1px solid var(--line); }
.side-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.side-who strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-who small { font-size: 12px; color: var(--muted); }

/* ---------- Page ---------- */
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 32px 64px; }
.page-title { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 20px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Steps ---------- */
.steps { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.step {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 16px;
}
.step-head { display: flex; align-items: center; gap: 12px; }
.step-head h2 { font-size: 17px; font-weight: 620; letter-spacing: -0.01em; flex: 1; }
.step-num {
  width: 26px; height: 26px; border-radius: 999px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 650;
}

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.grow { flex: 1 1 260px; }
label { font-size: 14px; font-weight: 550; }
textarea, select, input[type="password"], input[type="text"] {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-control);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea { padding: 10px 12px; font-family: var(--mono); font-size: 14px; resize: vertical; min-height: 140px; }
select, input[type="password"], input[type="text"] { min-height: 44px; padding: 0 12px; }
textarea:focus, select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select:disabled { opacity: 0.6; }
.hint { font-size: 13px; color: var(--muted); }
p.hint { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#code-count { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Months table ---------- */
.months { border: 1px solid var(--line); border-radius: var(--r-control); overflow-x: auto; animation: enter 200ms var(--ease-out); }
.months table { width: 100%; border-collapse: collapse; font-size: 14px; }
.months caption { text-align: left; padding: 10px 12px 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.months th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 12px; border-bottom: 1px solid var(--line); }
.months td { padding: 8px 12px; border-top: 1px solid var(--line); }
.months tbody tr:first-child td { border-top: 0; }
.months .num { text-align: right; font-variant-numeric: tabular-nums; }
.months td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.months tr.ambiguous td:nth-child(2)::after { content: " (day/month unclear)"; color: var(--warn); font-size: 12px; }
.months tr.unknown td { color: var(--warn); }

/* ---------- Smartsheet ---------- */
.sheet-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.selected { font-size: 13px; color: var(--muted); padding: 0 2px 12px; }
.selected strong { color: var(--ink); font-weight: 600; margin-left: 4px; }
.tree-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.tree-actions { display: flex; align-items: center; gap: 4px; }
.tree {
  border: 1px solid var(--line); border-radius: var(--r-control);
  max-height: 360px; overflow: auto; padding: 4px 0;
}
.tree-placeholder { padding: 16px; font-size: 14px; color: var(--muted); }
.tree-placeholder.error { color: var(--danger); }
.tree-node > .tree-children { padding-left: 24px; }
.tree-row {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 12px;
  font-weight: 450; cursor: pointer;
}
.tree-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.tree-row .tree-icon { width: 16px; height: 16px; color: var(--muted); flex: none; }
.tree-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.tree-text strong { font-weight: 500; overflow-wrap: anywhere; }
.tree-text small { font-size: 12px; color: var(--muted); }
.tree-node.folder > .tree-row .tree-text strong { font-weight: 600; }
.match-badge {
  margin-left: auto; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--ok-soft); color: var(--ok); font-size: 12px; font-weight: 600;
}

/* ---------- Upload ---------- */
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 24px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-panel); background: var(--surface-2);
  transition: border-color 150ms ease, background-color 150ms ease;
}
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop.dragging { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 24px; height: 24px; color: var(--accent); margin-bottom: 4px; }
.drop-title { font-weight: 550; }
.drop-title u { color: var(--accent); text-underline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .drop:hover { border-color: var(--accent); } }

.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.files:empty { display: none; }
.file-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-control); animation: enter 200ms var(--ease-out);
}
.file-badge { padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 650; }
.file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-meta strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta span { font-size: 12px; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: var(--r-control); border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { cursor: not-allowed; opacity: 0.7; }
.btn-lg { min-height: 52px; font-size: 16px; font-weight: 600; padding: 0 22px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-link { background: transparent; color: var(--accent); min-height: 40px; padding: 0 10px; }
.btn-icon { width: 40px; padding: 0; background: transparent; color: var(--muted); border-color: var(--line); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
  .btn-outline:hover, .btn-icon:hover { border-color: var(--accent); color: var(--accent); }
  .btn-soft:hover { border-color: var(--accent); }
  .btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
  .btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
}

.submit { display: flex; flex-direction: column; gap: 10px; }
.submit .btn { width: 100%; }
.fine { font-size: 12px; color: var(--muted); text-align: center; }

.spinner {
  width: 16px; height: 16px; border-radius: 999px;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 700ms linear infinite;
}

/* ---------- Notices ---------- */
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r-control); font-size: 14px; }
.notice .icon { margin-top: 2px; }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice-danger { background: var(--danger-soft); color: var(--danger); }
.page > .notice { margin-bottom: 16px; }

/* ---------- Result ---------- */
.side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 960px) { .side { position: static; } }
.result {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow);
}

.result-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.empty-icon { width: 28px; height: 28px; }

.result-card, .result-error { display: flex; flex-direction: column; gap: 16px; animation: enter 200ms var(--ease-out); }
.result-ok { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ok); font-weight: 550; }
.result-ok span { color: var(--ink); font-weight: 450; overflow-wrap: anywhere; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.stat { background: var(--surface-2); border-radius: var(--r-control); padding: 10px 12px; display: flex; flex-direction: column-reverse; }
.stat dt { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stat dd { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat.warn { background: var(--warn-soft); }
.stat.warn dd, .stat.warn dt { color: var(--warn); }

.counts { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.counts dt, .counts dd { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.counts dt { color: var(--muted); }
.counts dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.counts dt:first-of-type, .counts dd:first-of-type { border-top: 0; }
.counts dd.good { color: var(--ok); }
.counts dd.bad { color: var(--warn); }

.result-error-title { display: flex; align-items: center; gap: 8px; color: var(--danger); font-weight: 600; }
#error-message { font-size: 14px; color: var(--ink); }

/* Loading skeleton: same shape as the result */
.result-loading { display: flex; flex-direction: column; gap: 10px; }
.sk { display: block; height: 14px; border-radius: 6px; background: var(--line); animation: pulse 1.2s ease-in-out infinite; }
.sk-wide { width: 70%; }
.sk-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sk-box { height: 58px; border-radius: var(--r-control); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell {
  width: min(100%, 860px); display: grid; grid-template-columns: 1fr 1fr; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); box-shadow: var(--shadow);
  animation: enter 240ms var(--ease-out-quint);
}
.login-intro { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 32px; background: var(--accent); color: var(--on-accent); }
.login-intro img { border-radius: 10px; background: var(--surface); }
.login-flow { display: flex; flex-direction: column; gap: 0; counter-reset: step; }
.login-flow span { counter-increment: step; display: flex; align-items: center; gap: 12px; padding: 10px 0; font-size: 15px; font-weight: 520; border-top: 1px solid rgba(255, 255, 255, 0.18); }
.login-flow span::before { content: counter(step); width: 24px; height: 24px; flex: none; display: inline-grid; place-items: center; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.5); font-size: 12px; font-variant-numeric: tabular-nums; }
.login-card { padding: 36px 32px; display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.login-form input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: inherit; }
@media (max-width: 720px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { padding: 20px 24px; gap: 16px; }
  .login-flow { display: none; }
  .login-card { padding: 24px; }
}

/* ---------- Motion ---------- */
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.5; } }

@media (prefers-reduced-motion: reduce) {
  .months, .file-item, .result-card, .result-error { animation: none; }
  .sk, .spinner { animation: none; }
  .btn, .drop, textarea, select, input { transition: none; }
  .btn:active:not(:disabled) { transform: none; }
}

@media (max-width: 560px) {
  .page { padding-left: 16px; padding-right: 16px; }
  .brand span { font-size: 15px; }
  .connection { display: none; }
  .step, .result, .panel { padding: 16px; }
  .btn-ghost span { display: none; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat dd { font-size: 19px; }
}


/* ======================================================================
   Connected workflow: tabs, status board, PF check, ERP upload
   Stage colours: waiting = neutral, needs action = amber, ready = blue, done = green.
   ====================================================================== */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page-lead { color: var(--muted); max-width: 75ch; margin: -12px 0 20px; }
.page-wide { display: flex; flex-direction: column; gap: 16px; padding-bottom: 120px; }
.page-wide > .page-title, .page-wide > .page-lead { margin-bottom: 0; }
.page-wide > .page-lead { margin-top: -10px; margin-bottom: 4px; }

.tab-count {
  min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn);
  font-size: 12px; font-weight: 650; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
}
.tab-count[data-count="all"] { display: none; }
.tab-count:empty { display: none; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.panel-head { display: flex; flex-direction: column; gap: 4px; }
.panel-head h2, .supplier-row h2, .ready-row h2 { font-size: 17px; font-weight: 620; letter-spacing: -0.01em; }
.row-head { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* add codes */
.add-codes { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.add-codes textarea { width: 100%; min-height: 96px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: inherit; font-family: var(--mono); font-size: 13px; resize: vertical; }
.add-codes-side { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.add-result { font-size: 14px; padding: 10px 12px; border-radius: var(--r-control); background: var(--ok-soft); color: var(--ok); }
.add-result p { margin: 0 0 4px; }
.add-result.has-issues { background: var(--danger-soft); color: var(--danger); }
.add-result .add-list { margin: 2px 0 8px 18px; padding: 0; font-family: ui-monospace, monospace; font-size: 13px; word-break: break-word; }
.add-result .add-bad { font-weight: 600; }
.add-result .add-warn { font-style: italic; }

/* stage filter */
.stages { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.stage {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit;
}
.stage .stage-label { font-size: 12px; color: var(--muted); line-height: 1.3; }
.stage strong { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stage small { font-size: 11px; color: var(--muted); }
.stage.is-on { border-color: var(--accent); background: var(--accent-soft); }
.stage-not_found strong, .stage-detail_issue strong, .stage-pf_check strong { color: var(--warn); }
.stage-ready strong, .stage-in_file strong { color: var(--accent); }
.stage-uploaded strong { color: var(--ok); }
@media (max-width: 1100px) { .stages { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.search { width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: inherit; }

/* status board */
.table-wrap { overflow-x: auto; }
.board { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.board th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.board td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.board td > span, .board td > small { display: block; }
.board tbody tr { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .board tbody tr:hover { background: var(--surface-2); } }
.cell-code { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 550; }
.cell-note { font-size: 12px; color: var(--muted); margin-top: 2px; max-width: 32ch; }
.chip-stage { display: inline-block !important; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.chip-not_found, .chip-detail_issue, .chip-pf_check { background: var(--warn-soft); color: var(--warn); }
.chip-ready, .chip-in_file { background: var(--accent-soft); color: var(--accent-ink); }
.chip-uploaded { background: var(--ok-soft); color: var(--ok); }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; color: var(--muted); }
.rows-empty { color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; }

/* dialogs */
.dialog { border: 1px solid var(--line); border-radius: var(--r-panel); padding: 22px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dialog-wide { width: min(620px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(16, 28, 40, 0.45); }
.dialog form { display: flex; flex-direction: column; gap: 12px; }
.dialog h2 { font-size: 18px; font-weight: 640; }
.dialog input[type=text] { min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: inherit; }
.dialog-actions { display: flex; justify-content: flex-end; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 14px; max-height: 60vh; overflow-y: auto; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.timeline-head span { font-size: 13px; color: var(--muted); }

/* supplier master / ERP rows */
.supplier-row, .ready-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.supplier-row > div, .ready-row > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.uploads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.upload { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-control); flex-wrap: wrap; }
.upload-name { flex: 1; min-width: 220px; display: flex; flex-direction: column; }
.upload-name strong { font-weight: 550; font-size: 14px; overflow-wrap: anywhere; }
.upload-name span { font-size: 12px; color: var(--muted); }
.badge { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.plain { background: var(--surface-2); color: var(--muted); }

/* PF check cards */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); }
.filter span { font-weight: 650; margin-left: 4px; }
.filter.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; padding: 16px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.who-name { font-weight: 620; overflow-wrap: anywhere; }
.who-facility { font-size: 14px; overflow-wrap: anywhere; }
.who-meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.who-reason { font-size: 13px; color: var(--warn); margin-top: 4px; }
.options { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.option {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-control); cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.option input { margin: 0; accent-color: var(--accent); }
.option-main { display: flex; flex-direction: column; min-width: 0; }
.option-main strong { font-size: 14px; font-weight: 600; white-space: nowrap; }
.option-main span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.option-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.other { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 10px; padding: 4px 10px; }
.other input { min-height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; width: 100%; max-width: 260px; }
.other input.invalid { border-color: var(--danger); }

.applybar { position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: var(--z-applybar); background: var(--surface); border-top: 1px solid var(--line-strong); box-shadow: 0 -6px 20px rgba(16, 28, 40, 0.08); animation: rise 200ms var(--ease-out); }
.applybar-inner { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 12px; }
.applybar-inner span { flex: 1; font-weight: 600; }
@keyframes rise { from { transform: translateY(100%); } }

.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); z-index: var(--z-toast); max-width: min(640px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--r-control); font-size: 14px; background: var(--ok-soft); color: var(--ok); border: 1px solid currentColor; box-shadow: var(--shadow); }
.toast.is-error { background: var(--danger-soft); color: var(--danger); }

/* Find details: what was handed on */
.tracker-result { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--r-control); background: var(--surface-2); font-size: 14px; }
.tracker-title { font-weight: 620; }
.tracker-result a { color: var(--accent); font-weight: 550; }

@media (max-width: 900px) {
  .row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .add-codes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .option { grid-template-columns: 18px minmax(0, 1fr); }
  .option-tags { grid-column: 2; justify-content: flex-start; }
  .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) { .applybar { animation: none; } }

/* ---------- announcement + admin console ---------- */
.announcement { display: flex; gap: 10px; align-items: flex-start; width: calc(100% - 64px); max-width: 1176px; margin: 20px auto 0; padding: 10px 14px; border-radius: var(--r-control); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.announcement .icon { margin-top: 2px; flex: none; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-section { display: flex; flex-direction: column; gap: 16px; }
.admin-section[hidden] { display: none; }
.admin-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.admin-row .field { flex: 1 1 180px; }
.admin-row input, .admin-row select, .admin-dialog input, .admin-dialog select { min-height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: inherit; }
.users-table { min-width: 860px; }
.users-table tbody tr, .audit-table tbody tr { cursor: default; }
.users-table td .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.secret { font-family: ui-monospace, monospace; font-size: 15px; padding: 10px 12px; border-radius: var(--r-control); background: var(--surface-2); user-select: all; word-break: break-all; }
.setting { display: flex; gap: 14px; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting:last-of-type { border-bottom: 0; }
.setting textarea { width: min(460px, 100%); min-height: 64px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: inherit; }
.setting input[type=checkbox] { width: 20px; height: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: var(--r-control); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.stat strong { font-size: 20px; }
.stat small { color: var(--muted); }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.audit-table td { font-size: 13px; word-break: break-word; }


/* ---------- Errors queue, jobs ---------- */
.errors-table { min-width: 820px; }
.errors-table tbody tr, .errors-table tbody tr:hover { cursor: default; }
.cell-note { color: var(--muted); font-size: 12px; }
.jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.job { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.job:last-child { border-bottom: 0; }
.job-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.job-text small { color: var(--muted); }

/* ---------- Interaction details (ui-ux checklist) ---------- */
button, .btn, .filter, .stage, .side-link, summary { cursor: pointer; }
.btn { transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.page-title, .stage strong, .stat strong, .board td { font-variant-numeric: tabular-nums; }
.board tbody tr { transition: background-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .board tbody tr:hover { background: var(--surface-2); } }

/* ---------- Motion: only things that appear ---------- */
.toast:not(.hidden) { animation: toast-in 200ms var(--ease-out); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
dialog[open] { animation: dialog-in 200ms var(--ease-out); }
dialog[open]::backdrop { animation: fade-in 200ms var(--ease-out); }
@keyframes dialog-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.add-result:not(.hidden), .announcement { animation: enter 200ms var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  .toast:not(.hidden), dialog[open], dialog[open]::backdrop, .add-result:not(.hidden), .announcement, .login-shell { animation: none; }
  .btn, .side-link, .board tbody tr { transition: none; }
  .btn:active:not(:disabled) { transform: none; }
}

/* ---------- Narrow screens: sidebar becomes a top bar ---------- */
@media (max-width: 900px) {
  body.app { display: block; }
  .sidebar { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand span, .side-divider, .side-who { display: none; }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 2px; }
  .side-link { flex: none; padding: 0 12px; }
  .side-link.is-on { box-shadow: inset 0 -2px 0 var(--accent); }
  .side-account { border-top: 0; padding: 0; }
  .applybar { left: 0; }
  .announcement { width: calc(100% - 32px); }
}

/* ---------- Status report ---------- */
:root { --phase-admin: #c3dad3; --phase-mpsu: #86b9ac; --phase-erp: #3f8c7c; --phase-done: #0d6b5e; }
@media (prefers-color-scheme: dark) { :root { --phase-admin: #2b4a42; --phase-mpsu: #3f7569; --phase-erp: #4fa391; --phase-done: #7fd2c0; } }
.report-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.report-head .page-lead { margin-bottom: 0; }
.report-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.control { min-height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface-2); }
.segmented button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; transition: background-color 150ms ease, color 150ms ease; }
.segmented button.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(22, 33, 29, 0.08); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); color: var(--ink); font: inherit; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 550; }
.kpi strong { font-size: 30px; line-height: 1.1; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12px; color: var(--muted); min-height: 1.4em; }
.kpi-done strong { color: var(--accent); }
.kpi-attention { cursor: pointer; transition: border-color 150ms ease, background-color 150ms ease; }
.kpi-attention.is-alert { border-color: var(--warn); background: var(--warn-soft); }
.kpi-attention.is-alert strong, .kpi-attention.is-alert small { color: var(--warn); }
@media (hover: hover) and (pointer: fine) { .kpi-attention:hover { border-color: var(--line-strong); } }

.pipeline-bar { display: flex; height: 14px; gap: 3px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.seg { flex-basis: 0; min-width: 6px; transition: flex-grow 300ms var(--ease-out); }
.seg-admin { background: var(--phase-admin); } .seg-mpsu { background: var(--phase-mpsu); }
.seg-erp { background: var(--phase-erp); } .seg-done { background: var(--phase-done); } .seg-empty { flex-grow: 1; }
.pipeline-legend { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pipeline-legend button { width: 100%; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 10px 12px; text-align: left; border: 1px solid transparent; border-radius: var(--r-control); background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; transition: background-color 150ms ease; }
.pipeline-legend strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.pipeline-legend small { grid-column: 2 / 4; color: var(--muted); font-size: 12px; font-weight: 450; }
@media (hover: hover) and (pointer: fine) { .pipeline-legend button:hover { background: var(--surface-2); } }
.dot { width: 10px; height: 10px; border-radius: 999px; }
.dot-admin { background: var(--phase-admin); } .dot-mpsu { background: var(--phase-mpsu); } .dot-erp { background: var(--phase-erp); } .dot-done { background: var(--phase-done); }

.preview { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill-ok { background: var(--accent-soft); color: var(--accent-ink); }
.pill-bad { background: var(--danger-soft); color: var(--danger); }
.issue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.issue-list li { display: grid; grid-template-columns: minmax(180px, auto) 1fr; gap: 12px; padding: 6px 10px; border-radius: 6px; background: var(--danger-soft); color: var(--danger); }
.add-outcome { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; animation: enter 200ms var(--ease-out); }
.outcome { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-control); background: var(--surface-2); font-size: 14px; }
.outcome-mark { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--line); color: var(--ink); }
.outcome-ok, .outcome-done { background: var(--accent-soft); } .outcome-ok .outcome-mark, .outcome-done .outcome-mark { background: var(--accent); color: var(--on-accent); }
.outcome-warn { background: var(--warn-soft); } .outcome-warn .outcome-mark { background: var(--warn); color: var(--surface); }
.outcome-bad { background: var(--danger-soft); } .outcome-bad .outcome-mark { background: var(--danger); color: var(--surface); }
.outcome-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }

.board-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.board-tools .search { flex: 1 1 260px; max-width: 360px; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease; }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.chip-attention.is-on { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.report-table { min-width: 980px; }
.report-table td { vertical-align: top; }
.report-table td small.cell-note, .report-table td .cell-note { display: block; }
.cell-muted { color: var(--muted); font-size: 13px; white-space: nowrap; }
.progress { display: flex; flex-direction: column; gap: 3px; min-width: 170px; }
.psteps { list-style: none; margin: 0 0 3px; padding: 0; display: flex; gap: 4px; }
.pstep { width: 26px; height: 6px; border-radius: 999px; background: var(--line); }
.pstep.is-done { background: var(--accent); }
.pstep.is-now { background: var(--phase-mpsu); }
.pstep.is-trouble { background: var(--warn); }
.progress-label { font-size: 14px; font-weight: 600; }
.progress-label.is-done { color: var(--accent); }
.progress-label.is-trouble { color: var(--warn); }

@media (max-width: 1100px) { .kpis, .pipeline-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis, .pipeline-legend { grid-template-columns: 1fr; } .issue-list li { grid-template-columns: 1fr; gap: 2px; } }
@media (prefers-reduced-motion: reduce) { .seg, .chip, .segmented button, .kpi-attention { transition: none; } .add-outcome { animation: none; } }
.report-controls select.control { width: auto; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Supplier master status (read-only outside Admin) ---------- */
.supplier-strip { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r-panel); background: var(--surface); }
.supplier-strip:empty { display: none; }
.supplier-text { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.supplier-text span { color: var(--muted); }
.supplier-stale { border-left-color: var(--warn); background: var(--warn-soft); }
.supplier-stale strong { color: var(--warn); }
.supplier-missing { border-left-color: var(--danger); background: var(--danger-soft); }
.supplier-missing strong { color: var(--danger); }
main .supplier-strip { margin-bottom: 16px; }
.steps > .supplier-strip { margin-bottom: 0; }
.lookup summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.lookup[open] summary { margin-bottom: 12px; }
.lookup-results { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.lookup-results li { display: grid; grid-template-columns: 170px 1fr; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lookup-results li .cell-note { grid-column: 2; }
.lookup-results li.hint { display: block; }

/* ---------- Find details: next steps ---------- */
.tracker-result { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.tracker-result:empty { display: none; }
.tracker-title { font-size: 13px; font-weight: 600; color: var(--muted); }
.next-step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); }
.next-step > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.next-step strong { font-size: 14px; }
.next-step small { font-size: 12px; color: var(--muted); }
.next-pf_check { border-left-color: var(--phase-mpsu); }
.next-ready { border-left-color: var(--accent); }
.next-detail_issue, .next-not_found { border-left-color: var(--warn); }
.result-checks { margin: 8px 0; }
.result-checks summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); padding: 6px 0; }
#download-again { align-self: flex-start; }
.tracker-result a.btn-primary, .tracker-result a.btn-primary:hover { color: var(--on-accent); text-decoration: none; }
.tracker-result a.btn-outline { text-decoration: none; }
.next-step .btn { flex: none; white-space: nowrap; }

/* ---------- PF check and approval ---------- */
.seg-trouble, .dot-trouble { background: var(--warn); }
.kpi-warn { border-color: var(--warn); background: var(--warn-soft); }
.kpi-warn strong, .kpi-warn small { color: var(--warn); }
.match-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 12px 0 0; padding: 0; font-size: 13px; color: var(--muted); }
.match-legend li { display: inline-flex; align-items: center; gap: 8px; }
.review-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.review-tools .search { flex: 1 1 320px; margin: 0; }
.groups { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.group { border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); overflow: hidden; transition: border-color 150ms ease; }
.group.has-choice { border-color: var(--accent); }
.group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; }
.group-pick, .loa-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.group-title { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.group-title strong { font-size: 15px; }
.group-title small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.pf-control { display: flex; gap: 6px; align-items: center; }
.pf-control select { max-width: 320px; }
.pf-typed { width: 190px; }
.pill-plain { background: var(--surface-2); color: var(--muted); }
.group .table-wrap { border-top: 1px solid var(--line); }
.loa-table { min-width: 1060px; font-size: 13px; }
.loa-table th { white-space: nowrap; }
.loa-table td { vertical-align: top; }
.loa-table td > span:first-child { display: block; }
.loa-table tbody tr, .loa-table tbody tr:hover { cursor: default; }
.loa-table .pill { white-space: normal; text-align: left; min-height: 22px; padding: 2px 8px; }
#bar-text { font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .group { transition: none; } }

.cell-pf { min-width: 210px; }
.cell-pf > * + * { margin-top: 6px; }
.pf-control-row { flex-wrap: wrap; }
.pf-control-row select { max-width: 210px; min-height: 32px; font-size: 13px; }
.pf-control-row .pf-typed { width: 180px; min-height: 32px; font-size: 13px; }

/* ---------- Find details: several LOA workspaces ---------- */
.ws-summary { flex: 1; margin: 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.tree-node.workspace > .tree-row strong { font-size: 15px; }
.tree-node.workspace { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 6px; }
.tree-node.workspace:last-child { border-bottom: 0; }
.ws-options { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; margin: 12px 0; }
.ws-option { display: flex; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.ws-option input { width: 18px; height: 18px; accent-color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .ws-option:hover { background: var(--surface-2); } }

/* ---------- ERP upload: Smartsheet intake ---------- */
.ready-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.intake { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.intake-text { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 14px; }
.intake-meter { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.intake-meter span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 300ms var(--ease-out); }
.intake-full .intake-meter span { background: var(--warn); }
.intake-full #intake-title { color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .intake-meter span { transition: none; } }

/* ---------- Codes returned to the requester ---------- */
.notices { margin-bottom: 16px; padding: 16px 18px; border: 1px solid var(--warn); border-left: 4px solid var(--warn); border-radius: var(--r-panel); background: var(--warn-soft); animation: enter 200ms var(--ease-out); }
.notices.is-done { border-color: var(--line); border-left-color: var(--accent); background: var(--surface); }
.notices-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-start; justify-content: space-between; }
.notices h2 { font-size: 17px; color: var(--warn); }
.notices.is-done h2 { color: var(--ink); }
.notices-message { margin: 4px 0 0; font-size: 14px; max-width: 70ch; }
.notices-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.notices-list li { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.notices-list li.is-sent { opacity: 0.7; }
@media (prefers-reduced-motion: reduce) { .notices { animation: none; } }
.match-badge.is-source { background: var(--accent); color: var(--on-accent); }
.seg-requester, .dot-requester { background: var(--warn); }
.pipeline-legend { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .pipeline-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .pipeline-legend { grid-template-columns: 1fr; } }
.notices-wrap { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.notices-wrap .notices { margin-bottom: 0; }
.notices-wait { border-color: var(--line); border-left-color: var(--phase-mpsu); background: var(--surface); }
.notices-wait h2 { color: var(--ink); }
.notices-done { border-color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }
.notices-done h2 { color: var(--accent-ink); }
.seg-cancelled, .dot-cancelled { background: var(--line-strong); }
.pipeline-legend { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1300px) { .pipeline-legend { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .pipeline-legend { grid-template-columns: 1fr; } }
.update-codes summary { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; cursor: pointer; }
.update-codes summary h2 { font-size: 17px; }
.update-body { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.update-body textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font-family: var(--mono); font-size: 13px; }
.timeline-admin { display: inline-flex; gap: 6px; margin-right: auto; }
.dialog-actions { display: flex; align-items: center; gap: 8px; }
.update-body .segmented { align-self: flex-start; }
/* show that "Update approval codes" opens */
.update-codes summary { list-style: none; position: relative; padding-right: 32px; }
.update-codes summary::-webkit-details-marker { display: none; }
.update-codes summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 200ms var(--ease-out); }
.update-codes[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
@media (hover: hover) and (pointer: fine) { .update-codes summary:hover h2 { color: var(--accent); } }
@media (prefers-reduced-motion: reduce) { .update-codes summary::after { transition: none; } }

/* ---------- Requester messages (compact cards) ---------- */
.notices-wrap { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.rq-notice { --tone: var(--phase-mpsu); --tone-soft: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--tone);
  border-radius: var(--r-panel); background: var(--tone-soft); padding: 14px 16px; animation: enter 200ms var(--ease-out); }
.rq-warn { --tone: var(--warn); --tone-soft: var(--warn-soft); border-color: var(--warn); }
.rq-done { --tone: var(--accent); --tone-soft: var(--accent-soft); }
.rq-cancel { --tone: var(--line-strong); }
.rq-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.rq-icon { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--tone); color: var(--surface); }
.rq-wait .rq-icon { letter-spacing: 1px; }
.rq-text { min-width: 0; }
.rq-text h2 { font-size: 15px; font-weight: 650; }
.rq-warn .rq-text h2 { color: var(--warn); }
.rq-text p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.rq-warn .rq-text p { color: var(--ink); }
.rq-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.rq-body { margin: 8px 0 0 42px; }
.rq-body summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); width: max-content; padding: 2px 0; }
.rq-codes { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 16px; }
.rq-codes li { display: flex; flex-direction: column; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.rq-codes li small { color: var(--muted); font-size: 11px; }
.rq-codes .rq-more { border-bottom: 0; }
@media (max-width: 640px) {
  .rq-head { grid-template-columns: auto 1fr; }
  .rq-tools { grid-column: 1 / -1; justify-content: flex-start; }
  .rq-body { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .rq-notice { animation: none; } }


/* ======================================================================
   EastWest brand theme (reference: Account Connect portal)
   Brand: yellow #f6ce36, orange #f06e40, red #ee4b44, deep orange #cf4a1a,
   deep red #c9382f, ink #14171a, warm borders #e9e5e0 / #d9d3cc.
   Rules: bright orange/yellow/red are decoration only (bars, dots, icons);
   text and buttons use the deep orange/red so they stay readable (WCAG AA).
   Amber = needs action, red = problem, green = done.
   ====================================================================== */
:root {
  --bg: #f7f8f9;
  --surface: #ffffff;
  --surface-2: #fbfaf9;
  --sidebar: #fffaf7;
  --ink: #14171a;
  --text: #41474d;
  --muted: #696e74;
  --line: #e9e5e0;
  --line-strong: #d9d3cc;
  --accent: #cf4a1a;
  --accent-hover: #c9382f;
  --accent-soft: #fff0eb;
  --accent-ink: #a3451c;
  --on-accent: #ffffff;
  --brand-yellow: #f6ce36;
  --brand-orange: #f06e40;
  --brand-red: #ee4b44;
  --grad-brand: linear-gradient(120deg, #f6ce36 0%, #f06e40 55%, #ee4b44 100%);
  --grad-btn: linear-gradient(135deg, #cf4a1a 0%, #c9382f 100%);
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #a16207;
  --warn-soft: #fdf6dc;
  --danger: #a8332f;
  --danger-soft: #fdecea;
  --focus-ring: 0 0 0 3px rgba(240, 110, 64, 0.30);
  --shadow: 0 1px 2px rgba(20, 23, 26, 0.06), 0 4px 20px -4px rgba(20, 23, 26, 0.08);
  --r-control: 9px;
  --r-panel: 16px;
  --phase-admin: #f6ce36;
  --phase-mpsu: #f59e6b;
  --phase-erp: #cf4a1a;
  --phase-done: #15803d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121315;
    --surface: #1a1c1f;
    --surface-2: #202326;
    --sidebar: #16181a;
    --ink: #f2efec;
    --text: #d6d2ce;
    --muted: #a7adb3;
    --line: #2c2f33;
    --line-strong: #3d4146;
    --accent: #f58a5c;
    --accent-hover: #f7a07a;
    --accent-soft: #3a2118;
    --accent-ink: #ffc2a6;
    --on-accent: #1a0f0a;
    --grad-btn: linear-gradient(135deg, #f58a5c 0%, #f17060 100%);
    --ok: #5cc98a;
    --ok-soft: #12301f;
    --warn: #f2c94c;
    --warn-soft: #362a0c;
    --danger: #f28b82;
    --danger-soft: #3a1714;
    --focus-ring: 0 0 0 3px rgba(245, 138, 92, 0.35);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.32);
    --phase-admin: #9aa0a6;
    --phase-mpsu: #f7b48c;
    --phase-erp: #ee5a47;
    --phase-done: #5cc98a;
  }
}

/* Brand touches, used sparingly */
body { color: var(--ink); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary { background: var(--grad-btn); color: var(--on-accent); box-shadow: 0 8px 18px -12px rgba(201, 56, 47, 0.7); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) { filter: saturate(1.08) brightness(1.03); }
}
/* the brand gradient bar: top of the sidebar, the sign-in card and the summary panels */
.sidebar { position: sticky; }
.sidebar::before, .login-shell::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--grad-brand); }
.login-shell { position: relative; }
.side-link.is-on { box-shadow: inset 3px 0 0 var(--brand-orange), 0 1px 2px rgba(20, 23, 26, 0.06); }
.side-link.is-on .icon { color: var(--accent); }
.tab-count { background: var(--accent-soft); color: var(--accent-ink); }
.chip.is-on, .filter.is-on { background: var(--accent-soft); border-color: var(--brand-orange); color: var(--accent-ink); }
.kpi-done strong { color: var(--ok); }
.match-badge.is-source { background: var(--grad-btn); color: var(--on-accent); }
.dot-cancelled, .seg-cancelled { background: var(--line-strong); }
.seg-requester, .dot-requester, .seg-trouble, .dot-trouble { background: var(--warn); }

/* Sign-in: the warm Account Connect hero instead of a solid colour block */
.login-intro {
  position: relative; isolation: isolate; color: var(--ink);
  background: radial-gradient(120% 130% at 100% 0%, #fff6ee 0%, #fef3ec 30%, #fdf6f0 60%, #fefbf7 100%);
}
.login-intro::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(260px 220px at 104% -12%, rgba(246, 206, 54, 0.34), transparent 62%),
              radial-gradient(320px 260px at 108% 108%, rgba(238, 75, 68, 0.16), transparent 62%);
}
.login-intro img { background: transparent; }
.login-flow span { border-top-color: rgba(240, 110, 64, 0.18); color: var(--ink); }
.login-flow span::before { background: var(--grad-btn); color: #fff; border: 2px solid #fff; box-shadow: 0 6px 14px -6px rgba(201, 56, 47, 0.55); }
@media (prefers-color-scheme: dark) {
  .login-intro { background: radial-gradient(120% 130% at 100% 0%, #2a1c15 0%, #1f1916 60%, #1a1c1f 100%); }
  .login-flow span::before { border-color: #1a1c1f; color: #1a0f0a; }
}
.login-shell::before { z-index: 3; } .sidebar::before { z-index: 1; }

/* ---------- EastWest logo and system name ---------- */
.brand { align-items: center; gap: 10px; }
.brand img { width: 28px; height: auto; border-radius: 0; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; white-space: nowrap; }
.brand-text small { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand img { width: 48px; height: auto; background: none; box-shadow: none; border-radius: 0; }
.login-brand strong { display: block; font-size: 18px; font-weight: 750; letter-spacing: -0.02em; color: var(--ink); line-height: 1.2; }
.login-brand span { display: block; font-size: 13px; color: var(--muted); }
.login-intro img { box-shadow: none; }
@media (max-width: 900px) { .brand-text { display: none; } }
@media (prefers-color-scheme: dark) { .brand img, .login-brand img { box-shadow: none; } }
.intake { gap: 14px; }
.intake-row { display: flex; flex-direction: column; gap: 6px; }
.intake-row .intake-meter span { display: block; height: 100%; background: var(--accent); }
.intake-row.intake-full .intake-meter span { background: var(--warn); }
.intake-row.intake-full strong { color: var(--warn); }
.pill-editing { background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--warn); }
