/* ============================================================
   CC TOBACCO — Distribution OS
   Warm dark theme · Amber/tobacco accent · Geist + Geist Mono
   ============================================================ */

:root {
  /* surfaces — warm dark (lifted one shade) */
  --bg:       #1c1814;
  --bg-2:     #211c16;
  --panel:    #28221c;
  --panel-2:  #302a22;
  --panel-3:  #3a3228;
  --hover:    rgba(255,235,180,0.04);
  --hover-2:  rgba(255,235,180,0.08);
  --border:   rgba(255,235,180,0.11);
  --border-2: rgba(255,235,180,0.18);
  --border-3: rgba(255,235,180,0.28);

  /* text — warm tones (brightened for readability) */
  --text:   #f0ebe2;
  --text-2: #ccc0b0;
  --text-3: #a89e94;
  --text-4: #857a70;

  /* accent — tobacco amber/gold */
  --accent:        #c8893a;
  --accent-2:      #b37828;
  --accent-ink:    #1e0e02;
  --accent-soft:   rgba(200,137,58,0.15);
  --accent-softer: rgba(200,137,58,0.07);
  --accent-line:   rgba(200,137,58,0.38);

  /* semantic */
  --pos:       #4ab87a;
  --pos-bg:    rgba(74,184,122,0.12);
  --warn:      #d4a030;
  --warn-bg:   rgba(212,160,48,0.13);
  --danger:    #e05252;
  --danger-bg: rgba(224,82,82,0.12);
  --info:      #5b8def;
  --info-bg:   rgba(91,141,239,0.12);

  /* dimensions */
  --radius:    14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --sb-w:      256px;
  --top-h:     62px;
  --pad:       24px;
  --row-h:     48px;

  /* shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.55);
  --shadow:    0 4px 18px -4px rgba(0,0,0,0.65), 0 2px 6px -2px rgba(0,0,0,0.5);
  --shadow-lg: 0 24px 64px -12px rgba(0,0,0,0.85), 0 8px 28px -8px rgba(0,0,0,0.65);
  --shadow-pop:0 16px 44px -8px rgba(0,0,0,0.75), 0 0 0 1px var(--border-2);

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01","cv01","cv03";
  letter-spacing: -0.011em;
  overflow: hidden;
}
#root { height: 100vh; }
::selection { background: var(--accent-soft); color: var(--text); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,235,180,0.08); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,235,180,0.15); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); font-feature-settings: "tnum","zero"; letter-spacing: -0.02em; }
.tnum { font-variant-numeric: tabular-nums; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  height: 100vh;
  background:
    radial-gradient(1400px 700px at 60% -6%, rgba(200,137,58,0.05), transparent 60%),
    var(--bg);
}

/* ---- Sidebar ---- */
.sb {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg) 100%);
  min-height: 0;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 16px;
  height: var(--top-h);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(148deg, var(--accent) 0%, var(--accent-2) 100%);
  display: grid; place-items: center;
  color: var(--accent-ink); font-weight: 800; font-size: 13px;
  box-shadow: 0 0 0 1px rgba(255,235,180,0.15), 0 3px 12px -2px rgba(200,137,58,0.55), inset 0 1px 0 rgba(255,255,255,0.22);
  font-family: var(--mono); letter-spacing: -0.04em;
}
.brand-name { font-weight: 600; font-size: 13.5px; letter-spacing: -0.02em; line-height: 1.15; }
.brand-sub { font-size: 9.5px; color: var(--text-4); letter-spacing: 0.09em; text-transform: uppercase; margin-top: 3px; }

.sb-nav { flex: 1; overflow-y: auto; padding: 10px 8px; min-height: 0; }
.sb-group-label {
  font-size: 9.5px; font-weight: 600; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 14px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-3); font-weight: 450;
  position: relative; transition: background .12s, color .12s;
  width: 100%; text-align: left; line-height: 1;
  margin-bottom: 1px;
}
.nav-item svg { width: 15.5px; height: 15.5px; flex-shrink: 0; opacity: .9; transition: opacity .12s; }
.nav-item:hover { background: var(--hover); color: var(--text-2); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: var(--hover-2); color: var(--text); font-weight: 500; }
.nav-item.active::before {
  content: ""; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 20px; min-width: 20px; text-align: center;
  font-family: var(--mono); background: var(--panel-3); color: var(--text-3);
}
.nav-badge.warn { background: var(--warn-bg); color: var(--warn); }
.nav-badge.accent { background: var(--accent-soft); color: var(--accent); }

.sb-foot {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 11px;
  border-radius: var(--radius-sm); transition: background .12s; width: 100%;
}
.user-card:hover { background: var(--hover); }
.avatar {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 600;
  color: #fff; letter-spacing: -0.02em;
}
.user-meta { text-align: left; line-height: 1.3; min-width: 0; flex: 1; }
.user-meta .nm { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta .rl { font-size: 11px; color: var(--text-4); }

/* ---- Main column ---- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.topbar {
  height: var(--top-h); flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--pad);
  background: rgba(28,24,20,0.88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-4); }
.crumb .cur { color: var(--text); font-weight: 500; font-size: 13px; }
.crumb svg { width: 12px; height: 12px; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 12px; height: 36px; width: 260px;
  color: var(--text-4); font-size: 13px; cursor: text; transition: border-color .12s;
}
.topbar-search:hover { border-color: var(--border-2); }
.topbar-search svg { width: 14px; height: 14px; }
.topbar-search span { flex: 1; text-align: left; font-size: 12.5px; }
.topbar-spacer { flex: 1; }
.kbd {
  font-family: var(--mono); font-size: 10px; color: var(--text-4);
  background: var(--panel-2); border: 1px solid var(--border-2);
  border-radius: 5px; padding: 1px 5px; line-height: 1.5; white-space: nowrap;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: grid; place-items: center; color: var(--text-3);
  border: 1px solid transparent; transition: .12s; position: relative;
}
.icon-btn:hover { background: var(--hover-2); color: var(--text-2); border-color: var(--border); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }

.content { flex: 1; overflow-y: auto; min-height: 0; }

/* ---- App Footer ---- */
.app-footer {
  height: 34px; flex-shrink: 0;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-4);
  background: var(--bg); letter-spacing: 0.025em;
}
.page { padding: var(--pad) var(--pad) 60px; max-width: 1480px; margin: 0 auto; }
.page-wide { max-width: 1800px; }

/* page header */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.page-desc { font-size: 13px; color: var(--text-3); margin-top: 5px; line-height: 1.55; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; letter-spacing: -0.01em;
  border: 1px solid var(--border-2); background: var(--panel-2);
  color: var(--text); transition: .12s; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: var(--border-3); }
.btn svg { width: 14.5px; height: 14.5px; }
.btn-primary {
  background: linear-gradient(175deg, var(--accent) 0%, var(--accent-2) 100%);
  color: var(--accent-ink); border-color: transparent; font-weight: 600;
  box-shadow: 0 2px 14px -3px rgba(200,137,58,0.55), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover { filter: brightness(1.09); }
.btn-primary:active { filter: brightness(0.96); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-3); }
.btn-ghost:hover { background: var(--hover-2); color: var(--text-2); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 11.5px; border-radius: var(--radius-xs); }
.btn-sm svg { width: 13px; height: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-danger { color: var(--danger); border-color: var(--danger-bg); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; pointer-events: none; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); position: relative; overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent 5%, rgba(255,235,180,0.055) 50%, transparent 95%);
}
.card-pad { padding: 20px; }
.card-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px 13px; border-bottom: 1px solid var(--border);
}
.card-hd h3 { font-size: 13.5px; font-weight: 600; letter-spacing: -0.015em; }
.card-hd .sub { font-size: 12px; color: var(--text-3); }
.card-hd .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }

/* ---- Stat / KPI cards ---- */
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent 5%, rgba(255,235,180,0.05) 50%, transparent 95%);
}
.stat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.stat-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.stat-ico svg { width: 15px; height: 15px; }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 450; }
.stat-val {
  font-size: 30px; font-weight: 600; letter-spacing: -0.04em;
  font-family: var(--mono); line-height: 1; font-feature-settings: "tnum";
}
.stat-val .cur { color: var(--text-4); font-size: 18px; font-weight: 500; margin-right: 2px; }
.stat-foot { display: flex; align-items: center; gap: 8px; margin-top: 13px; }
.trend {
  display: inline-flex; align-items: center; gap: 3px; font-weight: 600;
  font-family: var(--mono); font-size: 10.5px; padding: 2px 6px 2px 4px; border-radius: 6px;
}
.trend svg { width: 11px; height: 11px; }
.trend.up   { color: var(--pos);    background: var(--pos-bg); }
.trend.down { color: var(--danger); background: var(--danger-bg); }
.trend.flat { color: var(--text-3); background: var(--panel-3); }
.stat-foot .ctx { color: var(--text-3); font-size: 11.5px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 20px;
  border: 1px solid transparent; white-space: nowrap; line-height: 1.3; letter-spacing: 0.01em;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.badge-pos     { color: var(--pos);    background: var(--pos-bg); }
.badge-warn    { color: var(--warn);   background: var(--warn-bg); }
.badge-danger  { color: var(--danger); background: var(--danger-bg); }
.badge-info    { color: var(--info);   background: var(--info-bg); }
.badge-neutral { color: var(--text-2); background: var(--panel-3); }
.badge-accent  { color: var(--accent); background: var(--accent-soft); }

/* category chip */
.cat-chip {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 6px;
  background: var(--panel-3); color: var(--text-2); border: 1px solid var(--border-2);
}

/* unit color squares */
.uq { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.uq-case { background: #5b8def; }
.uq-box  { background: #c08bf0; }
.uq-roll { background: #d4a030; }
.uq-can  { background: #4fc4cf; }

/* ============================================================
   TABLES
   ============================================================ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  font-size: 10.5px; font-weight: 600; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 0.065em; text-align: left;
  padding: 0 16px 11px; white-space: nowrap; user-select: none;
}
.tbl thead th.num, .tbl td.num { text-align: right; }
.tbl tbody td {
  padding: 0 16px; height: var(--row-h);
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text); white-space: nowrap;
}
.tbl tbody tr { transition: background .09s; }
.tbl tbody tr:hover { background: var(--hover); cursor: pointer; }
.tbl tbody tr:hover .row-arrow { opacity: 1; transform: translateX(0); }
.row-arrow { opacity: 0; transform: translateX(-3px); transition: .12s; color: var(--text-4); }
.td-sub { color: var(--text-3); font-size: 11.5px; }
.td-strong { font-weight: 500; }
.cell-2 { display: flex; flex-direction: column; gap: 2px; }
.cell-ico { display: flex; align-items: center; gap: 12px; }
.thumb {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  background: var(--panel-3); display: grid; place-items: center;
  border: 1px solid var(--border-2);
}

/* meter */
.meter { height: 5px; border-radius: 4px; background: var(--panel-3); overflow: hidden; position: relative; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 4px; transition: width .35s ease; }
.meter-row { display: flex; align-items: center; gap: 9px; }
.meter-row .meter { flex: 1; min-width: 60px; }

/* ============================================================
   FORMS
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.input, .select {
  height: 38px; border-radius: var(--radius-sm); padding: 0 12px;
  background: var(--panel); border: 1px solid var(--border-2);
  font-size: 13.5px; color: var(--text); outline: none; transition: .13s; width: 100%;
}
.input:focus, .select:focus {
  border-color: var(--accent-line);
  background: var(--panel-2);
  box-shadow: 0 0 0 3px var(--accent-softer);
}
.input::placeholder { color: var(--text-4); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a5f52' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button { padding: 6px 13px; border-radius: 7px; font-size: 12px; font-weight: 500; color: var(--text-3); transition: .11s; white-space: nowrap; }
.seg button:hover { color: var(--text-2); }
.seg button.on { background: var(--panel-3); color: var(--text); box-shadow: var(--shadow-sm); }

.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-inp {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  color: var(--text-3); font-size: 13px; min-width: 240px; transition: border-color .12s;
}
.search-inp:focus-within { border-color: var(--border-3); }
.search-inp input { background: none; border: none; outline: none; flex: 1; color: var(--text); font-size: 13px; }
.search-inp input::placeholder { color: var(--text-4); }
.search-inp svg { width: 14px; height: 14px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.divider { height: 1px; background: var(--border); border: none; }
.kv { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-3); }
.kv .v { font-weight: 500; }
.muted { color: var(--text-3); }
.faint { color: var(--text-4); }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; }
.center { display: flex; align-items: center; }
.gap4{gap:4px}.gap6{gap:6px}.gap8{gap:8px}.gap10{gap:10px}.gap12{gap:12px}.gap14{gap:14px}.gap16{gap:16px}.gap20{gap:20px}
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.mt4{margin-top:4px}.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mt20{margin-top:20px}.mt24{margin-top:24px}.mt28{margin-top:28px}
.mb4{margin-bottom:4px}.mb8{margin-bottom:8px}.mb12{margin-bottom:12px}.mb16{margin-bottom:16px}.mb20{margin-bottom:20px}.mb24{margin-bottom:24px}
.pad20{padding:20px}

.empty { text-align: center; padding: 56px 20px; color: var(--text-4); }
.empty svg { width: 32px; height: 32px; margin: 0 auto 14px; opacity: .3; display: block; }
.empty-title { font-size: 14px; font-weight: 500; color: var(--text-3); margin-bottom: 6px; }
.empty-desc  { font-size: 12.5px; }

/* avatar palette */
.av-1 { background: linear-gradient(135deg,#5b8def,#7a5af0); }
.av-2 { background: linear-gradient(135deg,#4ab87a,#1f9d6b); }
.av-3 { background: linear-gradient(135deg,#c8893a,#b37828); }
.av-4 { background: linear-gradient(135deg,#e05575,#c43055); }
.av-5 { background: linear-gradient(135deg,#4fc4cf,#2f9aa8); }
.av-6 { background: linear-gradient(135deg,#c08bf0,#9a5fd4); }

/* image placeholder / hatch */
.ph {
  background:
    repeating-linear-gradient(135deg, rgba(255,235,180,0.02) 0 7px, transparent 7px 14px),
    var(--panel-2);
  border: 1px dashed var(--border-2); border-radius: var(--radius-sm);
  display: grid; place-items: center; color: var(--text-4);
  font-family: var(--mono); font-size: 10px; text-align: center;
}

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.cmd-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(6,4,2,0.65); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh;
}
.cmd {
  width: min(620px, 92vw); max-height: 64vh;
  display: flex; flex-direction: column;
  background: var(--panel-2); border: 1px solid var(--border-2);
  border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: cmdIn .18s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes cmdIn { from { transform: translateY(-12px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.cmd-search { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.cmd-search input { flex: 1; background: none; border: none; outline: none; font-size: 15px; color: var(--text); }
.cmd-search input::placeholder { color: var(--text-4); }
.cmd-list { overflow-y: auto; padding: 6px; }
.cmd-group { font-size: 10px; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.08em; padding: 10px 12px 4px; }
.cmd-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border-radius: 9px; text-align: left; transition: background .09s; }
.cmd-item.on { background: var(--hover-2); }
.cmd-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--panel-3); display: grid; place-items: center; color: var(--text-3); flex-shrink: 0; }
.cmd-item.on .cmd-ico { background: var(--accent-soft); color: var(--accent); }
.cmd-label { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-foot { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-4); }

/* ============================================================
   TOAST
   ============================================================ */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  background: var(--panel-3); border: 1px solid var(--border-2);
  border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500;
  animation: toastIn .28s cubic-bezier(.2,.9,.3,1);
}
.toast svg { width: 15px; height: 15px; color: var(--pos); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.95); } }

/* ============================================================
   SCREEN TRANSITIONS
   ============================================================ */
.fade-in { animation: fadeIn .26s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.stagger > * { animation: fadeIn .30s ease both; }
.stagger > *:nth-child(2){animation-delay:.04s}
.stagger > *:nth-child(3){animation-delay:.08s}
.stagger > *:nth-child(4){animation-delay:.12s}
.stagger > *:nth-child(5){animation-delay:.16s}
.stagger > *:nth-child(6){animation-delay:.20s}

@media (prefers-reduced-motion: reduce) { *, .fade-in, .stagger > * { animation: none !important; } }

/* ============================================================
   SLIDE-IN DETAIL PANEL
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6,4,2,0.45);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  animation: overlayIn .2s ease;
}
@keyframes overlayIn { from { opacity: 0; } }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 101;
  width: min(520px, 96vw); background: var(--panel);
  border-left: 1px solid var(--border-2); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: drawerIn .24s cubic-bezier(.2,.9,.3,1);
}
@keyframes drawerIn { from { transform: translateX(28px); opacity: 0; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.drawer-title { font-size: 16px; font-weight: 600; letter-spacing: -0.025em; }
.drawer-body { flex: 1; overflow-y: auto; }
.drawer-section { padding: 20px; border-bottom: 1px solid var(--border); }
.drawer-section:last-child { border-bottom: none; }
.drawer-section-label { font-size: 10px; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 12px; }

/* ============================================================
   DASHBOARD — Attention cards
   ============================================================ */
.attn {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; overflow: hidden; position: relative;
  transition: border-color .13s, transform .13s;
}
.attn:hover { border-color: var(--border-2); transform: translateY(-1px); }
.attn::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent 5%, rgba(255,235,180,0.055) 50%, transparent 95%);
}
.attn-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.attn-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.attn-icon svg { width: 18px; height: 18px; }
.attn-title { font-size: 13.5px; font-weight: 600; }
.attn-subtitle { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.attn-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.attn-row:first-child { border-top: none; padding-top: 0; }

/* spotlight banner */
.spotlight {
  background: linear-gradient(180deg, rgba(200,137,58,0.1) 0%, var(--panel) 100%);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  margin-bottom: 20px;
}
.spotlight-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); flex-shrink: 0; }
.spotlight-ico svg { width: 24px; height: 24px; }

/* activity */
.activity-row { display: flex; align-items: center; gap: 12px; padding: 11px 20px; transition: background .09s; }
.activity-row:hover { background: var(--hover); }
.activity-pip { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .sb { position: fixed; z-index: 100; width: var(--sb-w); height: 100vh; transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.9,.3,1); }
  .app.sb-open .sb { transform: translateX(0); box-shadow: var(--shadow-lg); }
  #menuBtn { display: grid !important; }
  .g-4, .g-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1040px) {
  .split { grid-template-columns: 1fr !important; }
}
@media (max-width: 720px) {
  .topbar-search { display: none; }
  .g-2, .g-3, .g-4, .g-5 { grid-template-columns: 1fr; }
  :root { --pad: 16px; }
}

/* ============================================================
   MOBILE APP — role select · bottom tabs · FAB · sheets · steps
   ============================================================ */
:root {
  --tab-h: 64px;
  --fab-size: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ---- Role selection ("Who are you?") ---- */
.role-select {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; justify-content: center;
  padding: 28px 22px calc(28px + var(--safe-b));
  background:
    radial-gradient(1100px 560px at 50% -8%, rgba(200,137,58,0.12), transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  animation: fadeIn .3s ease both;
}
.role-wrap { width: 100%; max-width: 460px; margin: 0 auto; }
.role-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 34px; }
.role-brand .brand-mark { width: 46px; height: 46px; border-radius: 13px; font-size: 16px; }
.role-greet { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 7px; }
.role-q { font-size: 14.5px; color: var(--text-3); margin-bottom: 26px; line-height: 1.55; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.role-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 26px 16px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border-2);
  text-align: center; transition: transform .14s, border-color .14s, background .14s;
  min-height: 168px; justify-content: center;
}
.role-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.role-card:active { transform: scale(.98); }
.role-av {
  width: 58px; height: 58px; border-radius: 17px; display: grid; place-items: center;
  font-size: 21px; font-weight: 700; color: #fff; letter-spacing: -0.02em;
}
.role-name { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.role-role {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--accent); background: var(--accent-soft); padding: 4px 11px; border-radius: 20px;
}

/* ---- Mobile header ---- */
.m-header {
  height: var(--top-h); flex-shrink: 0;
  display: none; align-items: center; gap: 12px; padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(28,24,20,0.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 40;
}
.m-header .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
.m-title { font-size: 15.5px; font-weight: 600; letter-spacing: -0.02em; }
.m-role-chip {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 11px; border-radius: 22px;
  background: var(--panel-2); border: 1px solid var(--border-2);
  font-size: 12px; font-weight: 500; color: var(--text-2);
}

/* ---- Bottom tab bar ---- */
.tabbar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(33,28,22,0.94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  grid-template-columns: repeat(5, 1fr); align-items: stretch;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--text-4); font-size: 10px; font-weight: 500; letter-spacing: 0.01em;
  position: relative; transition: color .14s; min-height: 44px;
}
.tab svg { width: 21px; height: 21px; transition: transform .14s; }
.tab.on { color: var(--accent); }
.tab.on svg { transform: translateY(-1px); }
.tab.on::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---- Floating action button ---- */
.fab {
  display: none;
  position: fixed; right: 18px; z-index: 65;
  bottom: calc(var(--tab-h) + var(--safe-b) + 18px);
  width: var(--fab-size); height: var(--fab-size); border-radius: 18px;
  background: linear-gradient(170deg, var(--accent) 0%, var(--accent-2) 100%);
  color: var(--accent-ink); display: grid; place-items: center;
  box-shadow: 0 10px 26px -6px rgba(200,137,58,0.7), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform .14s, filter .14s;
}
.fab:hover { filter: brightness(1.07); }
.fab:active { transform: scale(.93); }
.fab svg { width: 25px; height: 25px; }

/* ---- Metric cards (mobile dashboard) ---- */
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; position: relative; overflow: hidden;
  transition: border-color .13s, transform .13s;
}
.metric:active { transform: scale(.985); }
.metric::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent 5%, rgba(255,235,180,0.06) 50%, transparent 95%);
}
.metric-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 14px; }
.metric-ico svg { width: 16px; height: 16px; }
.metric-val { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.metric-val .cur { color: var(--text-4); font-size: 15px; margin-right: 1px; }
.metric-label { font-size: 11.5px; color: var(--text-3); margin-top: 7px; }

/* section heading */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; }
.sec-title { font-size: 14px; font-weight: 600; letter-spacing: -0.015em; }
.sec-link { font-size: 12px; color: var(--accent); font-weight: 500; display: inline-flex; align-items: center; gap: 3px; }

/* ---- Shipment / list cards ---- */
.list-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 12px;
  animation: cardUp .3s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes cardUp { from { opacity: 0; transform: translateY(10px); } }
.lc-head {
  display: flex; align-items: center; gap: 13px; padding: 15px 16px;
  width: 100%; text-align: left; transition: background .1s;
}
.lc-head:active { background: var(--hover); }
.lc-ico {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.lc-ico svg { width: 19px; height: 19px; }
.lc-main { flex: 1; min-width: 0; }
.lc-title { font-size: 14.5px; font-weight: 600; letter-spacing: -0.015em; display: flex; align-items: center; gap: 8px; }
.lc-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.lc-amt { font-family: var(--mono); font-size: 14.5px; font-weight: 600; text-align: right; flex-shrink: 0; }
.lc-amt .sub { display: block; font-family: var(--font); font-size: 10.5px; font-weight: 400; color: var(--text-4); margin-top: 3px; }
.lc-chev { color: var(--text-4); transition: transform .2s; flex-shrink: 0; }
.lc-chev.open { transform: rotate(90deg); }

.lc-body {
  border-top: 1px solid var(--border); padding: 4px 16px 14px;
  animation: expandIn .24s ease both;
}
@keyframes expandIn { from { opacity: 0; } }
.lc-actions { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); }
.lc-actions .btn { flex: 1; height: 44px; }

/* ---- Slide-up sheet (modal) ---- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(6,4,2,0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: overlayIn .2s ease;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh;
  background: var(--panel-2); border: 1px solid var(--border-2);
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: sheetUp .3s cubic-bezier(.2,.9,.3,1) both;
  padding-bottom: var(--safe-b);
}
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--border-3); margin: 10px auto 4px; flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 8px 20px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sheet-head h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; flex: 1; }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 22px; max-height: 86vh; }
}

/* ---- Stepper / progress ---- */
.progressbar { height: 4px; border-radius: 4px; background: var(--panel-3); overflow: hidden; margin-bottom: 4px; }
.progressbar > span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s cubic-bezier(.2,.9,.3,1); }
.steplabel { font-size: 11px; color: var(--text-4); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 18px; }
.step-card { animation: stepIn .26s ease both; }
@keyframes stepIn { from { opacity: 0; transform: translateX(14px); } }
.step-q { font-size: 19px; font-weight: 600; letter-spacing: -0.025em; margin-bottom: 6px; }
.step-hint { font-size: 13px; color: var(--text-3); margin-bottom: 22px; line-height: 1.5; }

/* big number input */
.bignum {
  width: 100%; height: 64px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--border-2);
  font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -0.03em;
  text-align: center; color: var(--text); outline: none; transition: .13s;
}
.bignum:focus { border-color: var(--accent-line); background: var(--panel-2); box-shadow: 0 0 0 3px var(--accent-softer); }
.bignum.prefixed { padding-left: 34px; }
.bignum-wrap { position: relative; }
.bignum-cur { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 22px; color: var(--text-4); pointer-events: none; }

/* read-only calc cells */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.calc-cell {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 15px; transition: background .3s;
  animation: fadeIn .3s ease both;
}
.calc-cell .ck { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.calc-cell .cv { font-family: var(--mono); font-size: 19px; font-weight: 600; letter-spacing: -0.03em; margin-top: 5px; }
.calc-cell.accent { background: var(--accent-softer); border-color: var(--accent-line); }
.calc-cell.accent .cv { color: var(--accent); }

/* big choice buttons (brand / role) */
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 20px 14px; border-radius: var(--radius);
  background: var(--panel); border: 1.5px solid var(--border-2);
  transition: .14s; min-height: 96px; justify-content: center;
}
.choice:active { transform: scale(.98); }
.choice.on { border-color: var(--accent); background: var(--accent-softer); }
.choice-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--panel-3); color: var(--text-2); }
.choice.on .choice-ico { background: var(--accent-soft); color: var(--accent); }
.choice-name { font-size: 14.5px; font-weight: 600; }

/* sticky action bar inside forms */
.sticky-actions {
  position: sticky; bottom: 0; display: flex; gap: 10px;
  padding: 14px 0 4px; margin-top: 22px;
  background: linear-gradient(180deg, transparent, var(--panel-2) 30%);
}
.sticky-actions .btn { flex: 1; height: 50px; font-size: 14.5px; }

/* review summary */
.review-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.review-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.review-row:last-child { border-bottom: none; }
.review-row .rk { color: var(--text-3); }
.review-row .rv { font-weight: 500; font-family: var(--mono); }
.review-row.total { background: var(--accent-softer); }
.review-row.total .rk { color: var(--text); font-weight: 600; font-family: var(--font); }
.review-row.total .rv { color: var(--accent); font-size: 17px; font-weight: 700; }

/* ---- Skeleton loaders ---- */
.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%);
  background-size: 200% 100%; border-radius: var(--radius-sm);
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-card { height: 74px; border-radius: var(--radius); margin-bottom: 12px; }

/* ---- Pull to refresh ---- */
.ptr {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 0; overflow: hidden; color: var(--text-3); font-size: 12px;
  transition: height .2s ease;
}
.ptr.on { height: 40px; }
.ptr svg { width: 15px; height: 15px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* mobile copyright footer (in-flow) */
.m-foot { display: none; text-align: center; font-size: 11px; color: var(--text-4); padding: 26px 0 8px; letter-spacing: 0.02em; }

/* status pip colors for activity */
.pip-sent { background: var(--info); }
.pip-received { background: var(--pos); }
.pip-disputed { background: var(--danger); }
.pip-purchase { background: var(--accent); }

/* ============================================================
   RESPONSIVE SWITCH — phones use bottom tabs
   ============================================================ */
@media (max-width: 768px) {
  body { overflow: hidden; }
  .app { display: block; height: 100dvh; }
  .sb { display: none; }
  .topbar { display: none; }
  #menuBtn { display: none !important; }
  .main { height: 100dvh; }
  .m-header { display: flex; }
  .tabbar { display: grid; }
  .fab { display: grid; }
  .app-footer { display: none; }
  .m-foot { display: block; }
  .content { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 26px); }
  .page { padding: 18px 16px 8px; }
  .role-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 769px) {
  .tabbar, .fab, .m-header, .m-foot { display: none !important; }
}

