/* Metosu Import prototype
   Shape rule: surfaces 10px, controls 6px, status badges full pill. Nothing else.
   One accent: copper. Navy is the brand ink for primary actions. */

:root {
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --surface-2: #faf7f0;
  --sunken: #efeadf;
  --ink: #1a1a1a;
  --ink-2: #3d3b37;
  --muted: #625f58;
  --line: rgba(14, 26, 53, .12);
  --line-strong: rgba(14, 26, 53, .22);
  --navy: #0e1a35;
  --navy-ink: #f5f1e8;
  --copper: #a45a2a;
  --copper-soft: #f3e4d8;
  --ok: #2c6638; --ok-bg: #e5f0e1;
  --warn: #7f5300; --warn-bg: #f9eccb;
  --bad: #9a2b28; --bad-bg: #f9e2e0;
  --info: #1d5888; --info-bg: #e1edf8;
  --focus: 0 0 0 3px rgba(164, 90, 42, .35);
  --shadow: 0 1px 2px rgba(14, 26, 53, .05), 0 8px 24px rgba(14, 26, 53, .06);
  --r: 10px; --rc: 6px;
  --sans: 'Source Sans 3', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --serif: 'Source Serif 4', Georgia, serif;
  --side: 236px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0b1222;
  --surface: #111a2e;
  --surface-2: #152038;
  --sunken: #0e1628;
  --ink: #ece8df;
  --ink-2: #d4d0c6;
  --muted: #a3a9b7;
  --line: rgba(255, 255, 255, .10);
  --line-strong: rgba(255, 255, 255, .20);
  --navy: #ece8df;
  --navy-ink: #0e1a35;
  --copper: #df9663;
  --copper-soft: rgba(223, 150, 99, .14);
  --ok: #8fd19b; --ok-bg: rgba(143, 209, 155, .12);
  --warn: #f0c46b; --warn-bg: rgba(240, 196, 107, .13);
  --bad: #f2948f; --bad-bg: rgba(242, 148, 143, .13);
  --info: #8cc0ef; --info-bg: rgba(140, 192, 239, .13);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.num, td.n, .amt { font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--rc); }
i.ph, i[class^="ph"] { font-size: 1.15em; line-height: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 2px;
  padding: 18px 12px; border-right: 1px solid var(--line); background: var(--surface-2); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand img { height: 22px; width: auto; }
[data-theme="dark"] .brand img { filter: invert(1) hue-rotate(180deg) brightness(1.4); }
.brand b { font-weight: 600; font-size: 13px; letter-spacing: .02em; color: var(--muted); border-left: 1px solid var(--line-strong); padding-left: 10px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: var(--rc);
  color: var(--ink-2); font-weight: 500;
}
.nav a:hover { background: var(--sunken); }
.nav a.on { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.nav a.on i { color: var(--copper); }
.nav a .cnt { margin-left: auto; font-size: 12px; font-weight: 600; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; background: var(--bad-bg); color: var(--bad); }
.nav .sep { height: 1px; background: var(--line); margin: 10px 8px; }
.side .foot { margin-top: auto; padding: 12px 10px 0; font-size: 12.5px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.search-btn {
  display: flex; align-items: center; gap: 10px; height: 40px; flex: 0 1 420px; padding: 0 12px; border-radius: var(--rc);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); cursor: pointer; text-align: left;
}
.search-btn span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 11.5px; padding: 2px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.top .grow { flex: 1; }
.sample-chip { font-size: 12.5px; font-weight: 600; color: var(--warn); background: var(--warn-bg); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--rc); overflow: hidden; background: var(--surface); }
.seg button { min-width: 44px; height: 38px; border: 0; background: transparent; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); padding: 0 10px; }
.seg button.on { background: var(--navy); color: var(--navy-ink); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--rc); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--sunken); }
.user { display: flex; align-items: center; gap: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--copper-soft); color: var(--copper); }
.user select { height: 38px; border: 1px solid var(--line-strong); border-radius: var(--rc); background: var(--surface); padding: 0 8px; }

.content { padding: 26px 28px 80px; max-width: 1600px; width: 100%; }

/* ---------- type ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.ph-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.15; letter-spacing: -.01em; margin: 0; }
h1 em { font-style: italic; color: var(--copper); }
h2 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.005em; }
h3 { font-size: 14.5px; font-weight: 600; margin: 0; }
.sub { color: var(--muted); margin: 4px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--rc);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--sunken); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.btn.primary:hover { filter: brightness(1.2); }
.btn.copper { background: var(--copper); border-color: var(--copper); color: #fff; }
[data-theme="dark"] .btn.copper { color: #1a0f07; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card .body { padding: 16px 20px 20px; }
.grid { display: grid; gap: 18px; }
.g-today { grid-template-columns: 1.55fr 1fr; align-items: start; }
.g-2 { grid-template-columns: 1fr 1fr; }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin-bottom: 18px; }
.kpi { padding: 16px 20px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi .l { font-size: 13.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.kpi .v { font-size: 26px; font-weight: 600; letter-spacing: -.01em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 14px; font-weight: 500; color: var(--muted); }
.kpi .h { font-size: 13px; color: var(--muted); }
.kpi.accent .v { color: var(--copper); }

/* badges */
.b { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--sunken); color: var(--ink-2); }
.b.ok { background: var(--ok-bg); color: var(--ok); }
.b.warn { background: var(--warn-bg); color: var(--warn); }
.b.bad { background: var(--bad-bg); color: var(--bad); }
.b.info { background: var(--info-bg); color: var(--info); }
.b.cop { background: var(--copper-soft); color: var(--copper); }

/* action list on Today */
.alist { list-style: none; margin: 0; padding: 0; }
.alist li { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.alist li:first-child { border-top: 0; }
.alist .ic { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; font-size: 18px; }
.ic.bad { background: var(--bad-bg); color: var(--bad); }
.ic.warn { background: var(--warn-bg); color: var(--warn); }
.ic.info { background: var(--info-bg); color: var(--info); }
.ic.ok { background: var(--ok-bg); color: var(--ok); }
.alist .t { font-weight: 600; }
.alist .d { font-size: 13.5px; color: var(--muted); }
.alist a.t:hover { text-decoration: underline; }
.group-h { padding: 14px 20px 6px; font-size: 13px; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.link { cursor: pointer; }
table.t tbody tr.link:hover td { background: var(--surface-2); }
table.t td.n, table.t th.n { text-align: right; white-space: nowrap; }
table.t td .p { font-weight: 600; }
table.t td .s { font-size: 13px; color: var(--muted); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar input[type=search], .toolbar select { height: 38px; border: 1px solid var(--line-strong); border-radius: var(--rc); background: var(--surface); padding: 0 12px; }
.toolbar input[type=search] { flex: 1 1 260px; min-width: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.chip.on { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }

/* margin bar: number first, thin bar without track */
.mbar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.mbar i.bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--copper); opacity: .8; }

/* ---------- supplier header ---------- */
.ent-head { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; margin-bottom: 18px; }
.mono-mark { width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; font-family: var(--serif); font-size: 26px; background: var(--navy); color: var(--navy-ink); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 20px; }
.facts .l { font-size: 13px; color: var(--muted); }
.facts .v { font-weight: 600; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { height: 44px; padding: 0 14px; border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--copper); }
.tabs button .c { font-size: 12px; color: var(--muted); margin-left: 4px; }

.bank { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); align-items: center; }
.bank + .bank { margin-top: 10px; }
.bank .lk { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); font-size: 20px; }
.bank.old { opacity: .72; }
.bank.old .lk { background: var(--sunken); color: var(--muted); }

.banner { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start; padding: 14px 18px; border-radius: var(--r); margin-bottom: 18px; border: 1px solid; }
.banner.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.banner.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner.info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.banner > i { font-size: 22px; margin-top: 1px; }
.banner.bad > i, .banner.bad b { color: var(--bad); }
.banner.warn > i { color: var(--warn); }
.banner.info > i { color: var(--info); }
.banner p { margin: 2px 0 0; color: var(--ink-2); }

/* contacts */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.person { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); }
.person .nm { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.person .ln { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }

/* ---------- stage tracker ---------- */
.stages { display: grid; grid-template-columns: repeat(var(--n, 7), 1fr); gap: 0; margin: 4px 0 6px; }
.st { position: relative; padding-top: 30px; text-align: left; }
.st::before { content: ''; position: absolute; top: 11px; left: 0; right: 0; height: 2px; background: var(--line-strong); }
.st:first-child::before { left: 11px; }
.st:last-child::before { right: auto; width: 0; }
.st .dot { position: absolute; top: 0; left: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-strong); font-size: 13px; color: var(--muted); }
.st.done::before { background: var(--navy); }
.st.done .dot { background: var(--navy); border-color: var(--navy); color: var(--navy-ink); }
.st.cur .dot { border-color: var(--copper); color: var(--copper); background: var(--copper-soft); }
.st .nm { font-size: 13.5px; font-weight: 600; padding-right: 8px; }
.st .dt { font-size: 12.5px; color: var(--muted); padding-right: 8px; }
.st.cur .nm { color: var(--copper); }
.mini-stages { display: flex; gap: 3px; align-items: center; }
.mini-stages i { width: 16px; height: 6px; border-radius: 3px; background: var(--line-strong); display: block; }
.mini-stages i.d { background: var(--navy); }
.mini-stages i.c { background: var(--copper); }

/* ---------- doc checklist ---------- */
.dgroup { border-top: 1px solid var(--line); }
.dgroup:first-child { border-top: 0; }
.dgroup > .gh { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.drow { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 20px; min-height: 52px; border-radius: 0; transition: background .15s; }
.drow.drag { background: var(--copper-soft); outline: 2px dashed var(--copper); outline-offset: -4px; }
.drow .si { font-size: 20px; }
.drow .si.missing { color: var(--muted); }
.drow .si.received { color: var(--info); }
.drow .si.checked { color: var(--ok); }
.drow .si.rejected { color: var(--bad); }
.drow .fn { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow .nm { font-weight: 600; }
.drow.req-miss .nm::after { content: ' *'; color: var(--bad); }
.dropzone { margin: 6px 20px 20px; padding: 18px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.drag { border-color: var(--copper); background: var(--copper-soft); color: var(--copper); }
.progress-line { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--muted); }
.progress-line .pl { flex: 1; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; display: flex; }
.progress-line .pl span { display: block; height: 100%; }

/* key-value */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* landed cost waterfall */
.lc { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.lc td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.lc td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lc tr.tot td { font-weight: 700; border-bottom: 0; border-top: 1.5px solid var(--line-strong); padding-top: 10px; }
.lc tr.x td { color: var(--muted); font-size: 13.5px; }
.lc .sh { width: 34%; padding-left: 14px; }
.lc .sh i { display: block; height: 6px; border-radius: 3px; background: var(--navy); opacity: .55; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.compare > div { padding: 16px 18px; }
.compare > div + div { border-left: 1px solid var(--line); }
.compare .l { font-size: 13px; color: var(--muted); }
.compare .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gain { margin-top: 12px; padding: 16px 18px; border-radius: var(--r); background: var(--copper-soft); }
.gain .v { font-size: 28px; font-weight: 700; color: var(--copper); font-variant-numeric: tabular-nums; }
.gain.neg { background: var(--bad-bg); }
.gain.neg .v { color: var(--bad); }

/* chart */
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid-l { stroke: var(--line); }
.chart .ln { stroke: var(--copper); stroke-width: 2.25; fill: none; }
.chart .pt { fill: var(--surface); stroke: var(--copper); stroke-width: 2; }
.chart text { fill: var(--muted); font-size: 11.5px; font-family: var(--sans); }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(7, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; min-height: 160px; }
.kcol h3 { font-size: 13.5px; display: flex; justify-content: space-between; padding: 2px 4px 10px; color: var(--ink-2); }
.kcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.kcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.kcard .p { font-weight: 600; font-size: 14px; }
.kcard .s { font-size: 13px; color: var(--muted); }

/* sourcing candidates */
.cand { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.cand.pick { border-color: color-mix(in srgb, var(--copper) 55%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--copper) 30%, transparent); }
.cand.out { opacity: .7; }
.cand-h { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 20px; }
.ring { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--sunken) 0); }
.ring span { width: 46px; height: 46px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.cand-price { text-align: right; }
.cand-b { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; padding: 0 20px 14px; }
.ev { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.ev li { display: grid; grid-template-columns: 20px 1fr; gap: 6px; padding: 3px 0; }
.ev li i { color: var(--ok); margin-top: 3px; }
.ev li.fl { color: var(--bad); font-weight: 600; }
.ev li.fl i { color: var(--bad); }
.subs { display: grid; grid-template-columns: auto 1fr auto; gap: 5px 10px; align-items: center; margin: 0; font-size: 13px; }
.subs dt { color: var(--muted); }
.subs dd { margin: 0; }
.subs dd i { display: block; height: 6px; border-radius: 3px; background: var(--navy); opacity: .6; min-width: 2px; }
.subs dd.n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.cand-f { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); }

/* inbox */
.inbox-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.inbox-row:first-child { border-top: 0; }
.fileic { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; background: var(--sunken); font-size: 20px; color: var(--ink-2); }

/* forms + modal */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 24, .45); display: grid; place-items: start center; padding: 8vh 16px 16px; animation: fade .15s ease-out; }
.modal { width: min(640px, 100%); max-height: 84vh; overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: 0 24px 70px rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.modal > header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal > header h2 { font-family: var(--serif); font-weight: 400; font-size: 22px; }
.modal .mb { padding: 20px 22px; }
.modal > footer { display: flex; justify-content: space-between; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.fld label { font-weight: 600; font-size: 14px; }
.fld .help { font-size: 13px; color: var(--muted); }
.fld .err { font-size: 13px; color: var(--bad); font-weight: 600; }
.fld input, .fld select, .fld textarea { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--rc); background: var(--surface); }
.fld input.bad { border-color: var(--bad); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--sunken); }
.steps span.on { background: var(--copper); }
.choice { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer; margin-bottom: 8px; }
.choice:has(input:checked) { border-color: var(--copper); background: var(--copper-soft); }
.choice input { margin-top: 3px; accent-color: var(--copper); }

/* command palette */
.cmdk { width: min(640px, 100%); background: var(--surface); border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0, 0, 0, .3); overflow: hidden; }
.cmdk .in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.cmdk input { flex: 1; height: 56px; border: 0; background: transparent; font-size: 17px; outline: none; }
.cmdk ul { list-style: none; margin: 0; padding: 6px; max-height: 56vh; overflow: auto; }
.cmdk li.h { padding: 10px 12px 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cmdk li a { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px; min-height: 44px; }
.cmdk li a.sel { background: var(--sunken); }
.cmdk .empty { padding: 30px; text-align: center; color: var(--muted); }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--navy); color: var(--navy-ink); padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; display: flex; gap: 10px; align-items: center; animation: up .2s ease-out; max-width: calc(100vw - 32px); }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state i { font-size: 34px; display: block; margin-bottom: 8px; }
.skel { background: linear-gradient(90deg, var(--sunken), var(--surface-2), var(--sunken)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 6px; height: 14px; }

.mobile-tabs, .m-only { display: none; }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .g-side { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1180px) {
  :root { --side: 76px; }
  .side { padding: 16px 10px; align-items: center; }
  .brand b, .nav a span, .side .foot, .nav a .cnt { display: none; }
  .brand { padding: 4px 0 16px; }
  .brand img { height: 18px; }
  .nav a { justify-content: center; width: 52px; height: 48px; padding: 0; position: relative; }
  .nav a i { font-size: 22px; }
  .nav a.has-cnt::after { content: ''; position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
  .g-today, .g-side { grid-template-columns: minmax(0, 1fr); }
  .top { padding: 0 18px; }
  .top .sample-chip { display: none; }
  .search-btn { flex: 1 1 auto; min-width: 0; }
  .user select { max-width: 132px; }
  #newBtn span { display: none; }
  #newBtn { padding: 0 12px; }
  .user .avatar { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 0 14px; height: 56px; padding-top: env(safe-area-inset-top); }
  .top .d-only, .sample-chip.d-only { display: none; }
  .search-btn kbd { display: none; }
  .content { padding: 18px 14px 110px; }
  h1 { font-size: 25px; }
  .m-only { display: initial; }
  .mobile-tabs {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  }
  .mobile-tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; font-size: 11.5px; font-weight: 600; color: var(--muted); position: relative; }
  .mobile-tabs a i { font-size: 23px; }
  .mobile-tabs a.on { color: var(--copper); }
  .mobile-tabs a .dotc { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 4px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px 14px; }
  .kpi .v { font-size: 21px; }
  .g-2, .fgrid, .compare { grid-template-columns: minmax(0, 1fr); }
  .search-btn { flex: 0 0 44px; height: 44px; padding: 0; justify-content: center; }
  .search-btn span { display: none; }
  .top { gap: 8px; }
  .icon-btn { width: 44px; height: 44px; }
  .seg button { height: 42px; }
  .banner { grid-template-columns: 26px minmax(0, 1fr); padding: 14px; }
  .banner > :last-child { grid-column: 2; justify-self: start; }
  .ph-title { margin-bottom: 16px; }
  .ent-head h1 { font-size: 24px; }
  .compare > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .alist li { padding: 12px 14px; grid-template-columns: 36px 1fr; }
  .alist li > :last-child { grid-column: 2; justify-self: start; }
  .card > header { padding: 14px 14px 0; }
  .card .body { padding: 14px; }
  .ent-head { grid-template-columns: 48px 1fr; }
  .ent-head > :last-child { grid-column: 1 / -1; }
  .mono-mark { width: 48px; height: 48px; font-size: 22px; }
  .stages { grid-template-columns: 1fr; gap: 0; }
  .st { padding: 0 0 14px 36px; min-height: 40px; }
  .st::before { top: 0; bottom: 0; left: 11px; right: auto; width: 2px; height: auto; }
  .st:first-child::before { left: 11px; top: 12px; }
  .st:last-child::before { display: none; }
  .drow { padding: 8px 14px; grid-template-columns: 26px minmax(0, 1fr) auto; }
  .drow > .b { display: none; }
  .cand-h { grid-template-columns: 56px minmax(0, 1fr); padding: 14px; }
  .cand-price { grid-column: 2; text-align: left; }
  .cand-b { grid-template-columns: minmax(0, 1fr); padding: 0 14px 12px; }
  .cand-f { padding: 12px 14px; }
  .dgroup > .gh { padding: 12px 14px 4px; }
  .dropzone { margin: 6px 14px 14px; }
  /* tables become stacked rows */
  table.t.stack-m thead { display: none; }
  table.t.stack-m, table.t.stack-m tbody, table.t.stack-m tr, table.t.stack-m td { display: block; width: 100%; }
  table.t.stack-m tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.t.stack-m td { border: 0; padding: 2px 0; text-align: left !important; }
  table.t.stack-m td[data-l]::before { content: attr(data-l) ': '; color: var(--muted); font-size: 13px; }
  table.t.stack-m td.lead::before { content: none; }
  .mbar { justify-content: flex-start; }
  .overlay { padding: 0; place-items: end center; }
  .modal, .cmdk { border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .modal > footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .user select { display: none; }
}

/* ---- refine round 1 ---- */
.overlay:has(.sheet) { place-items: stretch end; padding: 0; }
.modal.sheet { width: min(460px, 100%); height: 100dvh; max-height: none; border-radius: 0; border-width: 0 0 0 1px; display: flex; flex-direction: column; animation: slidein .2s ease-out; }
.modal.sheet .mb { flex: 1; overflow: auto; }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.files { list-style: none; margin: 0 0 12px; padding: 0; }
.files li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--rc); font-weight: 600; }
.files li + li { margin-top: 6px; }
.files li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.benef .body { padding-top: 6px; }
.benef.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.benef-name { font-size: 21px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; margin-bottom: 12px; text-wrap: balance; }
.benef-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 14px; }
.benef-grid .l { font-size: 13px; color: var(--muted); }
.benef-grid .v { font-weight: 600; }
.benef-grid .v.big { font-size: 20px; letter-spacing: .02em; }
.readback { font-size: 14.5px; font-variant-numeric: tabular-nums; min-height: 1.5em; }
.readback:empty { display: none; }
.readback:not(:empty) { padding: 10px 12px; border-radius: var(--rc); background: var(--surface-2); border: 1px solid var(--line); }
table.t tr.tot td { border-top: 1px solid var(--line-strong); }
.mobile-tabs button { all: unset; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; font-size: 11.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.mobile-tabs button .ico { font-size: 23px; line-height: 1; display: grid; place-items: center; }
.mobile-tabs button.cap .ico { width: 44px; height: 30px; border-radius: 999px; background: var(--navy); color: var(--navy-ink); font-size: 20px; }
.mobile-tabs button.cap { color: var(--ink); }
.mobile-tabs button:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.inbox-row:focus-visible { outline: none; box-shadow: inset 3px 0 0 var(--copper); background: var(--surface-2); }
.kbd-hint kbd { font-size: 11px; }
@media (max-width: 760px) {
  .benef-grid { grid-template-columns: 1fr 1fr; }
  .benef-grid > :last-child { grid-column: 1 / -1; }
  .kbd-hint { display: none; }
  .modal.sheet { width: 100%; height: auto; max-height: 92dvh; border-radius: 16px 16px 0 0; border-width: 1px 0 0; margin-top: auto; }
  .overlay:has(.sheet) { place-items: end stretch; }
}
@media (max-width: 760px) {
  .inbox-row { grid-template-columns: 40px minmax(0, 1fr); padding: 12px 16px; }
  .inbox-row > .row { grid-column: 1 / -1; justify-content: flex-start; }
}
