/* ============================================================
   Tiskalnica Portal — Cockpit design system
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Accent (from Tiskalnica logo — coral dot) */
  --accent: #f2683f;
  --accent-600: #e35530;
  --accent-700: #c8472a;
  --accent-soft: #fdebe4;
  --accent-soft-2: #fbd6c9;

  /* Ink */
  --ink: #1a2030;
  --ink-2: #44506a;
  --ink-3: #6b7790;
  --ink-4: #9aa4ba;

  /* Surfaces */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e7eaf0;
  --border-2: #eef1f5;

  /* Sidebar (dark) */
  --side-bg: #161b24;
  --side-bg-2: #1d2330;
  --side-ink: #c4cbd8;
  --side-ink-dim: #7c869a;
  --side-label: #626d82;
  --side-active-bg: rgba(239,106,61,0.16);
  --side-hover-bg: rgba(255,255,255,0.05);

  /* Semantic */
  --good: #2f9e6b;
  --good-soft: #e6f4ec;
  --info: #3a73d6;
  --info-soft: #e8effb;
  --warn: #d98a17;
  --warn-soft: #fbf0db;
  --critical: #d6453d;
  --critical-soft: #fbe7e6;

  /* Geometry */
  --r-sm: 7px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20,28,46,0.05);
  --shadow: 0 1px 3px rgba(20,28,46,0.06), 0 4px 12px rgba(20,28,46,0.04);
  --topbar-bg: rgba(255,255,255,0.85);
  --shadow-lg: 0 8px 30px rgba(20,28,46,0.12);
  --info-border: #cfe0f7;

  --side-w: 248px;
  --topbar-h: 60px;
  --density: 1;

  font-family: 'Hanken Grotesk', system-ui, sans-serif;
}

[data-theme="dark"] {
  /* Warm graphite palette — matches Starfiniti Hub dark theme */
  --accent: #f37a54;
  --accent-600: #f2683f;
  --accent-700: #f79b7d;
  --accent-soft: #3d2a21;
  --accent-soft-2: #55362a;
  --ink: #e5e4df;
  --ink-2: #c0bfb9;
  --ink-3: #a09f99;
  --ink-4: #7d7c76;
  --bg: #1f1f1e;
  --surface: #292927;
  --surface-2: #2c2c2a;
  --border: #3a3a37;
  --border-2: #333330;
  --side-bg: #262625;
  --side-bg-2: #2c2c2a;
  --good: #3bb87c; --good-soft: #26382d;
  --info: #5b97f0; --info-soft: #273648;
  --info-border: #3c5170;
  --warn: #e0a23c; --warn-soft: #3e3423;
  --critical: #e76b72; --critical-soft: #3d292a;
  --topbar-bg: rgba(41,41,39,0.85);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.24);
  --shadow: 0 1px 2px rgba(0,0,0,0.22), 0 1px 3px rgba(0,0,0,0.16);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.38), 0 2px 8px rgba(0,0,0,0.24);
  color-scheme: dark;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #4a4a46; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #5c5c56; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.mono { font-family: 'JetBrains Mono', monospace; font-feature-settings: 'tnum'; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c8cedb; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b3bbcc; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  background: var(--side-bg);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width .22s ease, flex-basis .22s ease;
}
.sidebar.collapsed { width: 70px; flex-basis: 70px; }
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px;
  flex: 0 0 auto;
}
.side-brand .logo-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), var(--accent-700));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 2px 8px rgba(239,106,61,0.4);
}
.side-brand img.side-logo-img { height: 25px; width: auto; display: block; }
.side-brand .side-mini-mark { display: none; }
.sidebar.collapsed .side-logo-img { display: none; }
.sidebar.collapsed .side-mini-mark { display: grid; }
body:not(.side-light) .side-logo-img { filter: brightness(0) invert(1); opacity: .94; }
.sidebar.collapsed .wordmark, .sidebar.collapsed .nav-label, .sidebar.collapsed .nav-group-label, .sidebar.collapsed .side-foot-txt, .sidebar.collapsed .nav-badge { display: none; }

.side-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 4px 12px 16px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-color: transparent; }
.nav-group { margin-top: 14px; }
.nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--side-label); padding: 0 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--side-ink); font-size: 13.5px; font-weight: 500;
  cursor: pointer; position: relative; margin-bottom: 1px;
  transition: background .12s, color .12s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--side-hover-bg); color: #fff; }
.nav-item.active { background: var(--side-active-bg); color: #fff; font-weight: 600; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item .nav-ic { flex: 0 0 auto; color: inherit; opacity: .9; }
.nav-item.active .nav-ic { opacity: 1; }
.nav-label { flex: 1 1 auto; white-space: nowrap; }
.nav-badge {
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
  background: rgba(255,255,255,0.12); color: #cfd6e2; min-width: 18px; text-align: center;
}
.nav-badge.critical { background: var(--critical); color: #fff; }
.nav-badge.warn { background: var(--warn); color: #fff; }

.side-foot { flex: 0 0 auto; padding: 12px; border-top: 1px solid rgba(255,255,255,0.07); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); cursor: pointer; }
.side-user:hover { background: var(--side-hover-bg); }
.side-foot-txt { min-width: 0; }
.side-foot-txt .nm { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot-txt .rl { font-size: 11px; color: var(--side-ink-dim); }

/* ---------- Main ---------- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  background: var(--topbar-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .search {
  flex: 1 1 auto; max-width: 460px; display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
  padding: 8px 12px; color: var(--ink-4); font-size: 13.5px; cursor: text;
}
.topbar .search:hover { border-color: var(--ink-4); }
.topbar .search kbd {
  margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--ink-4);
}
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: none; display: grid; place-items: center; color: var(--ink-3); position: relative;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 1.5px solid var(--surface); }
.topbar-user { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: var(--r-sm); cursor: pointer; }
.topbar-user:hover { background: var(--surface-2); }
.topbar-user .nm { font-size: 13px; font-weight: 600; }

/* ---------- Page ---------- */
.page { flex: 1 1 auto; overflow-y: auto; padding: 22px 26px 40px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; margin: 0; color: var(--ink); }
.page-sub { font-size: 13.5px; color: var(--ink-3); margin: 3px 0 0; }
.page-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { font-size: 15px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.section-sub { font-size: 12.5px; color: var(--ink-3); margin: 2px 0 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border-radius: var(--r-sm); font-weight: 600; border: 1px solid transparent;
  transition: background .12s, border-color .12s, color .12s; white-space: nowrap;
}
.btn-md { padding: 8px 14px; font-size: 13px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-default { background: var(--surface); border-color: var(--border); color: var(--ink-2); }
.btn-default:hover { border-color: #d3d9e4; background: var(--surface-2); color: var(--ink); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(239,106,61,.3); }
.btn-primary:hover { background: var(--accent-600); }
.btn-ghost { background: none; color: var(--ink-3); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-soft { background: var(--accent-soft); color: var(--accent-700); }
.btn-soft:hover { background: var(--accent-soft-2); }
.btn.is-active { background: var(--accent-soft); color: var(--accent-700); border-color: transparent; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 6px; letter-spacing: 0.01em; white-space: nowrap; line-height: 1.5;
}
.badge .badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-neutral.soft { background: #eef1f5; color: var(--ink-3); }
.badge-good.soft { background: var(--good-soft); color: var(--good); }
.badge-info.soft { background: var(--info-soft); color: var(--info); }
.badge-warn.soft { background: var(--warn-soft); color: var(--warn); }
.badge-critical.soft { background: var(--critical-soft); color: var(--critical); }
.badge-accent.soft { background: var(--accent-soft); color: var(--accent-700); }
.badge.solid { color: #fff; }
.badge-good.solid { background: var(--good); }
.badge-critical.solid { background: var(--critical); }
.badge-warn.solid { background: var(--warn); }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 14px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cols-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.cols-2-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1180px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .cols-2, .cols-2-eq { grid-template-columns: 1fr; } }

/* ---------- KPI tile ---------- */
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 15px 16px; display: flex; flex-direction: column; gap: 9px; position: relative; box-shadow: var(--shadow-sm); min-height: 122px;
}
.kpi .kpi-val { margin-top: auto; }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .kpi-label { font-size: 12.5px; color: var(--ink-3); font-weight: 600; line-height: 1.3; }
.kpi .kpi-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.kpi .kpi-val { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-family: 'Hanken Grotesk'; }
.kpi .kpi-foot { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi.alert-state { border-color: var(--accent-soft-2); }
.kpi.alert-state::after { content: ''; position: absolute; inset: 0; border-radius: var(--r-lg); box-shadow: inset 0 0 0 1px var(--accent-soft-2); pointer-events: none; }
.kpi.warn-state { box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--warn-soft); border-color: #f0d9a8; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: 12px; }
.delta.up { color: var(--good); } .delta.down { color: var(--critical); }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-4); padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { text-align: right; font-family: 'JetBrains Mono', monospace; font-feature-settings: 'tnum'; }
.tbl .strong { font-weight: 600; color: var(--ink); }
.tbl .muted { color: var(--ink-3); }
.tbl-wrap { overflow-x: auto; }
.pf-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pf-pager-range { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.pf-pager-btns { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.pf-pg { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); border-radius: var(--r-sm); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .12s; }
.pf-pg:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-700); }
.pf-pg.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pf-pg:disabled { opacity: .4; cursor: not-allowed; }
.pf-pg-ell { padding: 0 4px; color: var(--ink-4); }
.row-link { color: var(--accent-700); font-weight: 600; cursor: pointer; }
.row-link:hover { text-decoration: underline; }
.cell-id { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.cell-sub { font-size: 11.5px; color: var(--ink-4); }

/* ---------- Pipeline / kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .kanban { grid-auto-flow: column; grid-auto-columns: 280px; grid-template-columns: none; overflow-x: auto; padding-bottom: 8px; } }
.kan-col { background: transparent; border: none; border-radius: 0; display: flex; flex-direction: column; min-height: 200px; }
.kan-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 12px; border-bottom: none; }
.kan-head .kan-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.kan-head .kan-title { font-size: 13px; font-weight: 700; flex: 0 0 auto; white-space: nowrap; }
.kan-head .kan-count { font-size: 11px; font-weight: 700; color: var(--ink-3); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px; }
.kan-head .kan-sum { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-family: 'JetBrains Mono', monospace; }
.kan-body { padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; }
.kan-empty { font-size: 12px; color: var(--ink-4); text-align: center; padding: 14px 0; }
.kan-add { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 9px; margin-top: 2px;
  border: 1px dashed var(--border-strong, #d3d8e2); border-radius: var(--r); background: transparent; color: var(--ink-3);
  font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer; transition: all .12s; }
.kan-add:hover { border-color: var(--accent); color: var(--accent-700); background: var(--accent-soft); }
.deal-card { background: var(--surface); border: none; border-radius: var(--r); padding: 13px; cursor: grab; box-shadow: 0 1px 2px rgba(20,28,46,0.06), 0 1px 1px rgba(20,28,46,0.04); transition: box-shadow .12s, transform .12s; }
.deal-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.deal-card .dc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.deal-card .dc-text { flex: 1 1 auto; min-width: 0; }
.deal-card .dc-title { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 700; color: var(--ink); line-height: 1.3; overflow-wrap: anywhere; }
.deal-card .dc-co { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.deal-card .dc-co svg { color: var(--ink-4); flex: 0 0 auto; }
.deal-card .dc-co span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-card .dc-val { flex: 0 0 auto; font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 13px; color: var(--ink); }

/* ---------- Funnel / flow ---------- */
.flow { display: flex; align-items: stretch; gap: 0; }
.flow-step { flex: 1 1 0; padding: 13px 14px; position: relative; background: var(--surface-2); border: 1px solid var(--border); }
.flow-step:first-child { border-radius: var(--r) 0 0 var(--r); }
.flow-step:last-child { border-radius: 0 var(--r) var(--r) 0; }
.flow-step + .flow-step { border-left: none; }
.flow-step .fs-label { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.flow-step .fs-val { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.flow-step .fs-sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; }
.flow-arrow { display: grid; place-items: center; color: var(--ink-4); width: 22px; flex: 0 0 auto; }

/* ---------- Alert feed ---------- */
.alert-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border-2); }
.alert-row:last-child { border-bottom: none; }
.alert-bar { width: 3px; align-self: stretch; border-radius: 3px; flex: 0 0 auto; }
.alert-bar.critical { background: var(--critical); }
.alert-bar.warning { background: var(--warn); }
.alert-main { flex: 1 1 auto; min-width: 0; }
.alert-tags { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.alert-src { font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--ink-4); }
.alert-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.alert-reason { font-size: 12px; color: var(--ink-3); }
.alert-acts { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* ---------- Misc ---------- */
.progress { background: #edf0f5; border-radius: 20px; overflow: hidden; width: 100%; }
.progress-fill { height: 100%; border-radius: 20px; }
.progress-fill.tone-accent { background: var(--accent); }
.progress-fill.tone-good { background: var(--good); }
.progress-fill.tone-warn { background: var(--warn); }
.progress-fill.tone-info { background: var(--info); }
.avatar { border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; background-size: cover; }
.spark.tone-accent { color: var(--accent); }
.spark.tone-good { color: var(--good); }
.spark.tone-info { color: var(--info); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); }
.health-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-2); }
.health-row:last-child { border-bottom: none; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.health-dot.healthy { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.health-dot.not_configured { background: #c2c9d6; box-shadow: 0 0 0 3px #eef1f5; }
.health-dot.stale { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg button { border: none; background: none; padding: 5px 12px; border-radius: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.field select, .field input { padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 13px; font-family: inherit; background: var(--surface); color: var(--ink); }
.field select:focus, .field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.empty-box { padding: 28px; text-align: center; color: var(--ink-4); font-size: 13px; border: 1px dashed var(--border); border-radius: var(--r); background: var(--surface-2); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }

/* placeholder pages */
.placeholder-hero { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 24px; gap: 14px; }
.placeholder-hero .ph-ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-700); }
.placeholder-hero h2 { font-size: 19px; font-weight: 800; margin: 0; }
.placeholder-hero p { font-size: 13.5px; color: var(--ink-3); max-width: 440px; margin: 0; }

/* ---------- Tweak: light sidebar ---------- */
body.side-light .sidebar { background: var(--surface); color: var(--ink-2); border-right: 1px solid var(--border); }
body.side-light .side-brand .wordmark { color: var(--ink); }
body.side-light .nav-group-label { color: var(--ink-4); }
body.side-light .nav-item { color: var(--ink-2); }
body.side-light .nav-item:hover { background: var(--surface-2); color: var(--ink); }
body.side-light .nav-item.active { background: var(--accent-soft); color: var(--accent-700); }
body.side-light .nav-badge { background: #eef1f5; color: var(--ink-3); }
body.side-light .side-foot { border-color: var(--border); }
body.side-light .side-foot-txt .nm { color: var(--ink); }
body.side-light .side-user:hover { background: var(--surface-2); }
body.side-light .side-nav::-webkit-scrollbar-thumb { background: #c8cedb; }

/* ---------- Tweak: compact density ---------- */
body.compact { font-size: 13px; }
body.compact .page { padding: 16px 20px 32px; }
body.compact .card-pad { padding: 14px; }
body.compact .tbl thead th { padding: 7px 12px; }
body.compact .tbl tbody td { padding: 8px 12px; }
body.compact .kpi { min-height: 104px; padding: 12px 14px; gap: 7px; }
body.compact .kpi .kpi-val { font-size: 26px; }
body.compact .page-title { font-size: 21px; }
body.compact .grid, body.compact .kpi-grid, body.compact .cols-2, body.compact .cols-2-eq { gap: 12px; }

/* ---------- Pipeline module ---------- */
.stage-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 1180px) { .stage-strip { grid-template-columns: repeat(2, 1fr); } }
.stage-card { background: transparent; border: none; border-radius: var(--r); padding: 4px 4px 2px; box-shadow: none; cursor: pointer; transition: opacity .12s; }
.stage-card:hover { opacity: .72; box-shadow: none; }
.stage-card.is-active { border: none; box-shadow: none; }
.stage-card .sc-head { display: flex; align-items: center; gap: 7px; }
.stage-card .sc-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.stage-card .sc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); flex: 1 1 auto; }
.stage-card .sc-count { font-size: 20px; font-weight: 800; letter-spacing: -.02em; line-height: 1; flex: 0 0 auto; }
.stage-card .sc-bar { height: 4px; border-radius: 4px; background: #edf0f5; overflow: hidden; margin: 11px 0 6px; }
.stage-card .sc-bar > i { display: block; height: 100%; border-radius: 4px; }
.stage-card .sc-val { font-size: 12px; color: var(--ink-3); font-family: 'JetBrains Mono', monospace; }

.pipe-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pipe-toolbar .ti { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 7px 11px; color: var(--ink-4); font-size: 13px; min-width: 200px; }
.pipe-toolbar .ti input { border: none; outline: none; background: none; font: inherit; color: var(--ink); width: 100%; }
.pipe-toolbar select { padding: 7px 11px; border: 1px solid var(--border); border-radius: var(--r-sm); font: inherit; font-size: 12.5px; background: var(--surface); color: var(--ink-2); font-weight: 600; }
.pipe-summary { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.pipe-summary b { color: var(--ink); font-family: 'JetBrains Mono', monospace; }

.deal-card .dc-chips { display: flex; align-items: center; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.focus-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 6px; white-space: nowrap; max-width: 100%; }
.focus-tag .ft-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.deal-card .dc-qty { margin-left: auto; font-size: 11px; color: var(--ink-4); font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.deal-card .dc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border-2); }
.deal-card .dc-owner { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); }
.prob-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.prob-chip .pc-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.prob-mini { display: flex; align-items: center; gap: 6px; }
.prob-mini .pm-bar { width: 38px; height: 4px; border-radius: 4px; background: #edf0f5; overflow: hidden; }
.prob-mini .pm-bar > i { display: block; height: 100%; }
.prob-mini .pm-txt { font-size: 11.5px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--ink-2); }

.stage-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 6px; }
.stage-pill .sp-dot { width: 6px; height: 6px; border-radius: 50%; }

/* Forecast */
.fc-row { display: grid; grid-template-columns: 150px 56px 1fr 110px; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border-2); }
.fc-row:last-child { border-bottom: none; }
.fc-stage { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.fc-stage .sp-dot { width: 8px; height: 8px; border-radius: 50%; }
.fc-track { position: relative; height: 26px; background: var(--surface-2); border-radius: 6px; overflow: hidden; border: 1px solid var(--border-2); }
.fc-track .fc-full { position: absolute; inset: 0; border-radius: 6px; opacity: .18; }
.fc-track .fc-weighted { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 6px; display: flex; align-items: center; padding-left: 9px; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; }
.fc-num { text-align: right; font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 13px; }
.fc-meta { font-size: 11px; color: var(--ink-4); font-family: 'JetBrains Mono', monospace; text-align: center; }

/* ============================================================
   Deal detail
   ============================================================ */
.deal-cols { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.deal-rail { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1120px) { .deal-cols { grid-template-columns: 1fr; } .deal-rail { position: static; } }
/* balanced equal-width two-column grid; each side is an independent stack (no stretch) */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1120px) { .detail-grid { grid-template-columns: 1fr; } }

/* header bar */
.deal-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.deal-hero .dh-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 0; color: var(--ink); }
.deal-hero .dh-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); margin-top: 5px; flex-wrap: wrap; }
.deal-hero .dh-meta > span { white-space: nowrap; }
.deal-hero .dh-meta .sep { color: var(--ink-4); }
.deal-hero .dh-badges { display: flex; align-items: center; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
.deal-hero .dh-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); background: none; border: none; padding: 0 0 10px; cursor: pointer; }
.back-link:hover { color: var(--accent-700); }

/* stage stepper */
.stepper { display: flex; align-items: center; gap: 0; }
.step { flex: 1 1 0; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.step-top { display: flex; align-items: center; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--border); color: var(--ink-4); z-index: 1; }
.step-dot.done { background: var(--good); border-color: var(--good); color: #fff; }
.step-dot.current { border-color: var(--accent); color: var(--accent-700); background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); }
.step-line { flex: 1 1 auto; height: 3px; border-radius: 3px; background: var(--border); }
.step-line.done { background: var(--good); }
.step:last-child .step-line { display: none; }
.step-label { font-size: 12px; font-weight: 700; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.is-pending .step-label { color: var(--ink-4); font-weight: 600; }
.step-sub { font-size: 11px; color: var(--ink-4); }

/* interactive stepper (v2 — centered dots, clickable) */
.stepper2 { display: flex; align-items: flex-start; }
.step2 { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 8px; background: none; border: none; padding: 6px 0 2px; font: inherit; cursor: pointer; border-radius: var(--r-sm); transition: background .12s; }
.step2:hover { background: var(--surface-2); }
.s2-track { display: flex; align-items: center; width: 100%; }
.s2-line { flex: 1 1 auto; height: 3px; background: var(--border); border-radius: 3px; transition: background .25s ease; }
.s2-line.done { background: var(--good); }
.s2-line.inv { visibility: hidden; }
.s2-dot { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--border); color: var(--ink-4); transition: all .2s ease; }
.s2-dot .s2-inner { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.s2-dot.done { background: var(--good); border-color: var(--good); color: #fff; }
.s2-dot.current { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-700); box-shadow: 0 0 0 4px var(--accent-soft); }
.step2:hover .s2-dot { border-color: var(--accent); }
.step2.pending:hover .s2-dot { color: var(--accent-700); }
.s2-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); text-align: center; line-height: 1.2; }
.step2.pending .s2-label { color: var(--ink-4); font-weight: 600; }
.step2:hover .s2-label { color: var(--accent-700); }
.s2-sub { font-size: 11px; color: var(--ink-4); }
.s2-sub.cur { color: var(--accent-700); font-weight: 700; }
.progress-chip { font-size: 11.5px; font-weight: 700; color: var(--good); background: var(--good-soft); padding: 3px 11px; border-radius: 20px; white-space: nowrap; }

/* stat strip */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 0; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.stat-cell { padding: 11px 14px; border-right: 1px solid var(--border-2); border-bottom: 1px solid var(--border-2); }
.stat-cell .sl { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-4); }
.stat-cell .sv { font-size: 16px; font-weight: 700; margin-top: 3px; font-family: 'JetBrains Mono', monospace; color: var(--ink); letter-spacing: -.01em; }
.stat-cell .sv.accent { color: var(--accent-700); }
.stat-cell .sv.good { color: var(--good); }
.stat-cell .sv.warn { color: var(--warn); }

/* overview field grid */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.fg-item .fg-label { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 3px; }
.fg-item .fg-val { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.fg-item .fg-val.mono { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.fg-link { display: inline-flex; align-items: center; gap: 3px; background: none; border: none; padding: 0; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--accent-700); cursor: pointer; }
.fg-link:hover { text-decoration: underline; }
.fg-link svg { color: var(--ink-4); }
.meta-link { background: none; border: none; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.meta-link:hover { color: var(--accent-700); text-decoration: underline; }
.contact-name-link { background: none; border: none; padding: 0; font: inherit; font-weight: 700; font-size: 14px; color: var(--ink); cursor: pointer; text-align: left; }
.contact-name-link:hover { color: var(--accent-700); text-decoration: underline; }
.inline-link { background: none; border: none; padding: 0; font: inherit; font-size: 12px; color: var(--ink-3); cursor: pointer; }
.inline-link:hover { color: var(--accent-700); text-decoration: underline; }

/* delivery address card */
.addr-block { display: flex; flex-direction: column; gap: 9px; }
.addr-ship { display: flex; align-items: flex-start; gap: 9px; color: var(--ink-3); }
.addr-ship svg { margin-top: 1px; flex: 0 0 auto; }
.addr-co { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.addr-to { font-size: 12px; color: var(--ink-3); }
.addr-lines { font-size: 13.5px; color: var(--ink-2); padding-left: 25px; line-height: 1.5; }
.addr-ok { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border-2); font-size: 12px; font-weight: 600; color: var(--good); }
.addr-warn { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border-2); font-size: 12px; font-weight: 600; color: var(--critical); }

/* proforma → order footer / gate */
.pf-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-2); display: flex; flex-direction: column; gap: 9px; align-items: flex-start; }
.pf-gate { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--critical); background: var(--critical-soft); padding: 7px 11px; border-radius: var(--r-sm); width: 100%; }

/* scrollable timeline so a long history never clashes with notes */
.timeline-scroll { max-height: 540px; overflow-y: auto; overflow-x: hidden; padding-right: 6px; }
.timeline-scroll::-webkit-scrollbar { width: 8px; }

/* margin viz */
.margin-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.margin-pct { font-size: 30px; font-weight: 800; letter-spacing: -.03em; color: var(--good); line-height: 1; }
.margin-bar { display: flex; height: 12px; border-radius: 7px; overflow: hidden; margin: 14px 0 10px; background: var(--surface-2); }
.margin-bar > i { display: block; height: 100%; }
.margin-bar .seg-cost { background: #c6cdda; }
.margin-bar .seg-profit { background: var(--good); }
.margin-legend { display: flex; gap: 18px; }
.margin-legend .ml { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); }
.margin-legend .ml b { color: var(--ink); font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.margin-legend .dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.money-rows { margin-top: 4px; }
.money-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border-2); font-size: 13px; }
.money-row:last-child { border-bottom: none; }
.money-row .mr-l { color: var(--ink-3); }
.money-row .mr-v { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.money-row.total { padding-top: 12px; }
.money-row.total .mr-l { color: var(--ink); font-weight: 700; }
.money-row.total .mr-v { font-size: 18px; font-weight: 800; color: var(--accent-700); }

/* activity composer (manual log — deal page) */
.act-composer { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); margin-bottom: 16px; overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.act-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.act-tabs { display: flex; gap: 2px; padding: 7px 8px 0; }
.act-tab { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; padding: 6px 11px; border-radius: var(--r-sm); font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; transition: background .1s, color .1s; }
.act-tab:hover { background: var(--surface-2); color: var(--ink); }
.act-tab.active { background: var(--accent-soft); color: var(--accent-700); }
.act-input { display: block; width: 100%; border: none; background: none; resize: vertical; min-height: 62px; padding: 10px 12px; font: inherit; font-size: 13.5px; line-height: 1.5; color: var(--ink); outline: none; box-sizing: border-box; }
.act-input::placeholder { color: var(--ink-4); }
.act-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 12px; border-top: 1px solid var(--border-2); background: var(--surface-2); }
.act-hint { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-4); }
.act-kbd { font-family: inherit; font-size: 10.5px; font-weight: 700; color: var(--ink-3); background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }

/* timeline */
.timeline { position: relative; padding-left: 6px; }
.tl-row { display: flex; gap: 13px; position: relative; padding-bottom: 18px; }
.tl-row:last-child { padding-bottom: 0; }
.tl-rail { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; }
.tl-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; z-index: 1; }
.tl-stem { width: 2px; flex: 1 1 auto; background: var(--border); margin: 3px 0 -3px; }
.tl-row:last-child .tl-stem { display: none; }
.tl-body { padding-top: 4px; min-width: 0; flex: 1 1 auto; }
.tl-title { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.35; overflow-wrap: anywhere; }
.tl-detail { font-size: 12px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; overflow-wrap: anywhere; }
.tl-time { font-size: 11px; color: var(--ink-4); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }
.tl-verb { font-weight: 400; color: var(--ink-3); }
.tl-bubble { margin: 5px 0 3px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); font-size: 13px; color: var(--ink-2); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-bubble.is-note { background: var(--warn-soft); border-color: #f0dcb2; }

/* linked order card */
.link-card { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); cursor: pointer; transition: border-color .12s, background .12s; }
.link-card:hover { border-color: var(--accent-soft-2); background: var(--accent-soft); }
.link-card .lc-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); flex: 0 0 auto; }
.link-card .lc-id { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 13px; color: var(--ink); }
.link-card .lc-sub { font-size: 11.5px; color: var(--ink-3); }

/* contact card */
.contact-card { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.contact-line { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--border-2); }
.contact-line:last-child { border-bottom: none; }
.contact-line .cl-ic { color: var(--ink-4); flex: 0 0 auto; }
.contact-line a { color: var(--ink-2); text-decoration: none; font-weight: 500; }
.contact-line a:hover { color: var(--accent-700); text-decoration: underline; }

/* proforma list rows */
.pf-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border-2); flex-wrap: wrap; }
.pf-row:last-child { border-bottom: none; }
.pf-row.is-superseded { opacity: .55; }
.pf-row.is-superseded:hover { opacity: .72; }
.pf-rev { margin-left: 7px; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; vertical-align: 1px; }
.pf-regen { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 8px; flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 700; transition: all .12s; }
.pf-regen span { white-space: nowrap; }
.pf-regen:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-700); }
.pf-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-700); flex: 0 0 auto; }
.pf-main { flex: 1 1 auto; min-width: 0; }
.pf-id { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 13px; color: var(--accent-700); cursor: pointer; }
.pf-id:hover { text-decoration: underline; }
.pf-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.pf-amt { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 13.5px; color: var(--ink); flex: 0 0 auto; }

/* stock shortfall banner */
.stock-warn { display: flex; align-items: center; gap: 9px; padding: 9px 12px; margin-bottom: 12px; border-radius: var(--r-sm); background: var(--warn-soft); border: 1px solid #f0d9a8; color: var(--warn); font-size: 12.5px; }
.stock-warn b { color: var(--ink); }

/* item table niceties */
.itbl.cozy tbody td { padding: 15px 18px; }
.itbl.cozy thead th { padding: 11px 18px; }
.itbl tbody tr { transition: background .1s; }
.itbl .it-cell { display: flex; align-items: center; gap: 13px; }
.itbl .it-swatch { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.itbl .it-name { font-weight: 600; font-size: 14.5px; color: var(--ink); line-height: 1.25; }
.itbl .it-sub { font-size: 11.5px; color: var(--ink-4); margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.itbl .it-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; letter-spacing: .01em; white-space: nowrap; }
.itbl .it-tag .dot { width: 6px; height: 6px; border-radius: 50%; }
.itbl .it-sku { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-3); }
.itbl .it-dim { color: var(--ink-4); }
.itbl .net-strong { font-size: 14.5px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }
.act-btns { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.act-btn { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-3); display: grid; place-items: center; cursor: pointer; transition: all .12s; }
.act-btn:hover { border-color: #d3d9e4; color: var(--ink); background: var(--surface-2); }
.act-btn.danger:hover { border-color: var(--critical-soft); color: var(--critical); background: var(--critical-soft); }
.disc-tag { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 12.5px; }
.disc-tag.none { color: var(--ink-4); font-weight: 400; }
.disc-tag.has { color: var(--good); }

/* note editor */
.note-area { width: 100%; min-height: 84px; resize: vertical; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 11px 13px; font: inherit; font-size: 13.5px; color: var(--ink); background: var(--surface); line-height: 1.5; }
.note-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.note-empty { font-size: 13px; color: var(--ink-4); font-style: italic; }

/* kpi strip for summary-first layout */
.deal-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 1180px) { .deal-kpis { grid-template-columns: repeat(2, 1fr); } }

/* ============ Order detail page ============ */
/* production readiness checks */
.ready-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.ready-check { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.ready-check .rc-ic { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 999px; flex: 0 0 auto; margin-top: 1px; }
.ready-check.ok .rc-ic { background: var(--good-soft); color: var(--good); }
.ready-check.warn .rc-ic { background: var(--warn-soft); color: var(--warn); }
.ready-check.no .rc-ic { background: var(--critical-soft); color: var(--critical); }
.ready-check .rc-label { font-size: 13px; font-weight: 700; color: var(--ink); }
.ready-check.no .rc-label { color: var(--critical); }
.ready-check.warn .rc-label { color: var(--warn); }
.ready-check .rc-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; }
.ready-check .rc-acts { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex: 0 0 auto; }

/* production task rows */
.task-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-2); }
.task-row:last-child { border-bottom: none; }
.task-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.task-sub { font-size: 11px; color: var(--ink-4); margin-top: 1px; }
.task-unassigned { width: 26px; height: 26px; border-radius: 50%; border: 1.5px dashed var(--border); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-4); flex: 0 0 auto; }
.task-status { border: 1px solid var(--border); background: var(--surface); border-radius: 20px; padding: 4px 12px; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: all .12s; color: var(--ink-3); flex: 0 0 auto; }
.task-status:hover { border-color: var(--accent-soft-2); background: var(--accent-soft); color: var(--accent-700); }
.task-status.in_progress { background: var(--info-soft); color: var(--info); border-color: transparent; }
.task-status.done { background: var(--good-soft); color: var(--good); border-color: transparent; }

/* artwork / design card — one row per order line */
.design-bulk { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.design-list { border-top: 1px solid var(--border-2); }
.design-row { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border-2); }
.design-row:last-child { border-bottom: none; }
.design-thumb { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.design-info { flex: 1 1 auto; min-width: 0; }
.design-item-name { font-size: 13.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.design-item-sub { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.design-item-sub .it-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.design-item-sub .it-tag .dot { width: 6px; height: 6px; border-radius: 50%; }
.design-place { font-size: 11px; color: var(--ink-4); }
.design-file-line { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.design-file-line svg { color: var(--ink-4); flex: 0 0 auto; }
.design-file-line.none { color: var(--ink-4); font-style: italic; }
.design-fmeta { color: var(--ink-4); }
.design-fmeta::before { content: '·'; margin: 0 5px; }
.design-row-r { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 0 0 auto; }
.design-row-acts { display: flex; align-items: center; gap: 5px; }
.design-mini { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-3); border-radius: 7px; padding: 5px 9px; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; transition: all .12s; white-space: nowrap; }
.design-mini:hover { border-color: var(--accent-soft-2); background: var(--accent-soft); color: var(--accent-700); }
.design-mini.primary { background: var(--accent-soft); color: var(--accent-700); border-color: var(--accent-soft-2); }
.design-mini.primary:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.design-mini.danger:hover { border-color: var(--critical-soft); background: var(--critical-soft); color: var(--critical); }

/* design library — order-level designs assigned to many lines */
.design-row.dz { align-items: flex-start; }
.design-row.dz .design-thumb { margin-top: 2px; }
.dz-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dz-head .design-item-name { flex: 0 1 auto; }
.dz-uncovered { display: flex; align-items: flex-start; gap: 8px; margin: 0 18px 12px; padding: 9px 12px; border-radius: 9px; background: var(--critical-soft); color: var(--critical); font-size: 12px; line-height: 1.45; }
.dz-uncovered svg { flex: 0 0 auto; margin-top: 1px; }
.dz-uncovered b { font-weight: 700; }
.dz-assign-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; }
.dz-usage { font-size: 11px; font-weight: 700; color: var(--ink-4); margin-right: 2px; white-space: nowrap; }
.dz-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 230px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 20px; padding: 3px 5px 3px 10px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.dz-chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-chip-qty { font-size: 10.5px; color: var(--ink-4); flex: 0 0 auto; }
.dz-chip-x { display: grid; place-items: center; width: 16px; height: 16px; border: none; border-radius: 50%; background: transparent; color: var(--ink-4); cursor: pointer; padding: 0; flex: 0 0 auto; transition: all .12s; }
.dz-chip-x:hover { background: var(--critical-soft); color: var(--critical); }
button.dz-chip.add { border-style: dashed; background: var(--surface); color: var(--ink-3); padding: 3px 10px; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; transition: all .12s; }
button.dz-chip.add:hover { border-color: var(--accent-soft-2); background: var(--accent-soft); color: var(--accent-700); }
button.dz-chip.add.attn { border-color: var(--accent-soft-2); color: var(--accent-700); background: var(--accent-soft); }
.dz-assign-wrap { position: relative; display: inline-flex; }
.dz-backdrop { position: fixed; inset: 0; z-index: 30; }
.dz-menu { position: absolute; z-index: 31; top: calc(100% + 6px); left: 0; min-width: 264px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(20, 28, 48, .14); }
.dz-menu-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border-2); }
.dz-mt-label { font-size: 11px; font-weight: 700; color: var(--ink-4); white-space: nowrap; }
.dz-mt-btn { border: none; background: transparent; padding: 0; font: inherit; font-size: 11.5px; font-weight: 700; color: var(--accent-700); cursor: pointer; white-space: nowrap; }
.dz-mt-btn:hover { text-decoration: underline; }
.dz-menu-list { max-height: 226px; overflow: auto; padding: 5px; }
.dz-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: transparent; border-radius: 7px; padding: 8px 9px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; text-align: left; transition: background .1s; }
.dz-menu-item:hover { background: var(--accent-soft); color: var(--accent-700); }
.dz-menu-item.on { color: var(--ink); }
.dz-mi-check { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border); background: var(--surface); display: grid; place-items: center; color: #fff; flex: 0 0 auto; transition: all .12s; }
.dz-menu-item:hover .dz-mi-check { border-color: var(--accent-soft-2); }
.dz-mi-check.on { background: var(--accent); border-color: var(--accent); }
.dz-menu-foot { padding: 8px; border-top: 1px solid var(--border-2); }
.dz-menu-apply { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 8px; background: var(--accent); color: #fff; font: inherit; font-size: 12.5px; font-weight: 700; padding: 8px 10px; cursor: pointer; transition: background .12s; }
.dz-menu-apply:hover { background: var(--accent-600); }
.dz-menu-apply:disabled { opacity: .45; cursor: not-allowed; }
.dz-mi-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-mi-qty { font-size: 11px; color: var(--ink-4); flex: 0 0 auto; }
.dz-mi-flag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--critical); background: var(--critical-soft); border-radius: 20px; padding: 2px 7px; flex: 0 0 auto; }
.dz-menu-empty { padding: 10px 12px; font-size: 12px; color: var(--ink-4); }

/* ---------- Relations detail tabs ---------- */
.rel-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px 0 16px; flex-wrap: wrap; }
.rel-tab { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; padding: 9px 13px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 6px 6px 0 0; }
.rel-tab:hover { color: var(--ink); background: var(--surface-2); }
.rel-tab.active { color: var(--accent-700); border-bottom-color: var(--accent); }
.rel-tab .rel-tab-ct { font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 1px 7px; color: var(--ink-3); }
.rel-tab.active .rel-tab-ct { background: var(--accent-soft); border-color: var(--accent-soft-2); color: var(--accent-700); }

