/* ============================================================================
   OKKI AI · V5 Flagship Commercial SaaS Design System
   Refined Depth + Bespoke SVG Icons + Responsive Mobile + Interactive Sandbox
   ============================================================================ */

:root {
  --bg-canvas: #f7f8fb;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-subtle: #f3f5f9;
  --bg-hover: #eef1f6;
  --bg-bubble: #eef0fe;

  --ink-1: #0f172a;
  --ink-2: #475569;
  --ink-3: #7d899d;
  --ink-4: #a2adbe;

  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef2ff;
  --brand-line: #c7d2fe;

  --green: #059669;
  --green-soft: #ecfdf5;
  --green-line: #a7f3d0;

  --amber: #d97706;
  --amber-soft: #fffbeb;
  --amber-line: #fde68a;

  --red: #dc2626;
  --red-soft: #fef2f2;
  --red-line: #fecaca;

  --line: #e7eaf0;
  --line-soft: #f0f2f7;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px -4px rgba(15, 23, 42, 0.04), 0 0 0 1px rgba(15, 23, 42, 0.045);
  --shadow-hero: 0 6px 24px -8px rgba(79, 70, 229, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.055);
  --shadow-active: 0 6px 16px -6px rgba(79, 70, 229, 0.22), 0 0 0 1.5px var(--brand);

  --font-sans: "Inter", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --bg-canvas: #0c0f16;
  --bg-sidebar: #111520;
  --bg-surface: #161b28;
  --bg-subtle: #1d2435;
  --bg-hover: #232b3e;
  --bg-bubble: rgba(99, 102, 241, 0.22);

  --ink-1: #f1f5f9;
  --ink-2: #cbd5e1;
  --ink-3: #8998af;
  --ink-4: #5f6f87;

  --brand: #818cf8;
  --brand-2: #a78bfa;
  --brand-soft: rgba(129, 140, 248, 0.14);
  --brand-line: rgba(129, 140, 248, 0.34);

  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.14);
  --green-line: rgba(52, 211, 153, 0.3);

  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.14);
  --amber-line: rgba(251, 191, 36, 0.3);

  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.14);
  --red-line: rgba(248, 113, 113, 0.3);

  --line: #232b3e;
  --line-soft: #1c2232;

  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-hero: 0 10px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(129, 140, 248, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-canvas);
  color: var(--ink-1);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
code, pre, .mono { font-family: var(--font-mono); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(130, 144, 166, 0.24); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(130, 144, 166, 0.44); }

/* ==================== ROOT SHELL ==================== */
.app-root {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ==================== LEFT SIDEBAR ==================== */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 14px;
  min-height: 0;
  overflow-y: auto;
  z-index: 40;
}

.sb-brand { display: flex; align-items: center; gap: 9px; padding: 0 4px 14px; }
.sb-logo { display: grid; place-items: center; flex-shrink: 0; }
.sb-brand-text { flex: 1; min-width: 0; }
.sb-title { font-size: 14.5px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.sb-sub { font-size: 10.5px; color: var(--ink-3); }

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--ink-1); }

.sb-cmd-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--bg-subtle);
  color: var(--ink-3);
  font-size: 12px;
  margin-bottom: 12px;
  text-align: left;
  border: 1px solid transparent;
  transition: all 0.14s;
}
.sb-cmd-trigger:hover { border-color: var(--line); background: var(--bg-hover); color: var(--ink-1); }
.sb-cmd-trigger kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  color: var(--ink-3);
}

.sb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sb-group { font-size: 10.5px; font-weight: 600; color: var(--ink-4); padding: 14px 8px 5px; letter-spacing: 0.03em; }

.sb-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-align: left;
  transition: all 0.12s;
}
.sb-item:hover { background: var(--bg-hover); color: var(--ink-1); }
.sb-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sb-item.active-store { color: var(--ink-1); font-weight: 600; }

.sb-pill { margin-left: auto; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; }
.sb-pill.indigo { background: var(--brand-soft); color: var(--brand); }
.sb-pill.amber { background: var(--amber-soft); color: var(--amber); }

.sdot { width: 7px; height: 7px; border-radius: 99px; flex-shrink: 0; }
.sdot.all { background: var(--ink-3); }
.sdot.tmall { background: #ef4444; }
.sdot.douyin { background: #18181b; }
[data-theme="dark"] .sdot.douyin { background: #e2e8f0; }
.sdot.jd { background: #e11d48; }

.sb-footer { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }

.sb-demo-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--bg-subtle);
  font-size: 11px;
  color: var(--ink-2);
}
.sb-demo-pill:hover { background: var(--bg-hover); }

.dot-live { width: 7px; height: 7px; border-radius: 99px; background: var(--green); display: inline-block; flex-shrink: 0; box-shadow: 0 0 0 3px var(--green-soft); }

.sb-user { display: flex; align-items: center; gap: 9px; padding: 2px 4px; }
.sb-avatar {
  width: 30px;
  height: 30px;
  border-radius: 99px;
  background: linear-gradient(135deg, #1e293b, #475569);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.sb-uname { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.sb-urole { font-size: 11px; color: var(--ink-3); }

/* ==================== MAIN STAGE ==================== */
.stage-wrap { height: 100vh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.page { display: none; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
.page.active { display: flex; }

.top-bar {
  height: 54px;
  padding: 0 22px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.tb-left, .tb-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-title { font-size: 15.5px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.tb-divider { width: 1px; height: 16px; background: var(--line); }
.tb-meta { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mobile-menu-btn, .mobile-only { display: none; }
.mobile-fab { display: none; }
.mobile-mask { display: none; }

.filter-pills { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--bg-subtle); gap: 2px; }
.fp-btn { padding: 4px 10px; border-radius: 7px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.fp-btn.active { background: var(--bg-surface); color: var(--ink-1); font-weight: 600; box-shadow: var(--shadow-xs); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--ink-1); }

.btn-solid {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 8px;
  background: var(--ink-1);
  color: var(--bg-surface);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-solid:hover { opacity: 0.88; }
.btn-solid.hidden { display: none; }

/* ==================== SLEEK COMPACT SKU RIBBON ==================== */
.sku-ribbon-wrap {
  padding: 10px 22px;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sku-ribbon {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 1px 4px;
}

.sku-card {
  flex: 1 0 186px;
  max-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 11px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  text-align: left;
  transition: transform 0.14s, box-shadow 0.14s;
  position: relative;
}

.sku-card:hover { transform: translateY(-1px); }
.sku-card.active { box-shadow: var(--shadow-active); }

.sku-card-img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.sku-card-info { flex: 1; min-width: 0; }
.sku-card-name { font-size: 12px; font-weight: 600; color: var(--ink-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sku-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 3px; gap: 4px; }

.delta-badge { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 5px; }
.delta-badge.down { background: var(--red-soft); color: var(--red); }
.delta-badge.warn { background: var(--amber-soft); color: var(--amber); }
.delta-badge.ok { background: var(--green-soft); color: var(--green); }

.status-dot-sm { width: 7px; height: 7px; border-radius: 99px; flex-shrink: 0; }
.status-dot-sm.approval { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.status-dot-sm.investigating { background: var(--brand); }
.status-dot-sm.resolved { background: var(--green); }

/* ==================== 2-ZONE STUDIO SPLIT ==================== */
.studio-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(336px, 1fr);
  overflow: hidden;
}

/* LEFT EDITORIAL CANVAS */
.canvas-pane {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bento-card {
  background: var(--bg-surface);
  border-radius: 15px;
  padding: 17px 19px;
  box-shadow: var(--shadow-card);
}

/* Flagship Hero Card with subtle ambient gradient */
.hero-card {
  background:
    radial-gradient(600px circle at 0% 0%, rgba(79, 70, 229, 0.055), transparent 52%),
    var(--bg-surface);
  box-shadow: var(--shadow-hero);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-left { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1; }

.hero-photo-wrap { position: relative; flex-shrink: 0; }
.hero-photo {
  width: 72px;
  height: 72px;
  border-radius: 15px;
  object-fit: cover;
  background: var(--bg-subtle);
  box-shadow: var(--shadow-card);
  display: block;
}
.hero-store-tag {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--ink-1);
  color: var(--bg-surface);
  white-space: nowrap;
}

.hero-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-name { font-size: 17px; font-weight: 700; letter-spacing: -0.025em; }

.status-chip { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 99px; display: inline-flex; align-items: center; gap: 4px; }
.status-chip.approval { background: var(--amber-soft); color: var(--amber); }
.status-chip.investigating { background: var(--brand-soft); color: var(--brand); }
.status-chip.resolved { background: var(--green-soft); color: var(--green); }

.hero-meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }

.hero-kpis { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.hk-sep { width: 1px; height: 30px; background: var(--line); }
.hk-item { text-align: right; }
.hk-label { font-size: 11px; color: var(--ink-3); }
.hk-val { font-size: 18px; font-weight: 700; letter-spacing: -0.03em; margin-top: 1px; }
.hk-val.red { color: var(--red); }
.hk-val.green { color: var(--green); }

/* Primary Focal Row: Chart (Left) + 4-Dim Cross-Check & Stock (Right) */
.focal-grid {
  display: grid;
  grid-template-columns: 1.48fr 1fr;
  gap: 14px;
}

.card-h { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 10px; }
.card-h h3 { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; }
.card-h p { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.chart-host { position: relative; }

.chart-legend { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--ink-3); }
.cl-item { display: inline-flex; align-items: center; gap: 5px; }
.cl-dot { width: 7px; height: 7px; border-radius: 99px; }
.cl-dot.indigo { background: var(--brand); }
.cl-dot.red { background: var(--red); }
.cl-dot.green { background: var(--green); }

/* 4-Dim Verification List (Clean Bespoke SVG Status Icons!) */
.v-list { display: flex; flex-direction: column; gap: 8px; }
.v-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-subtle);
  font-size: 12px;
}
.v-row.bad { background: var(--red-soft); }
.v-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.v-ico {
  width: 20px;
  height: 20px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.v-ico.ok { background: var(--green-soft); color: var(--green); }
.v-ico.bad { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-line); }
.v-dim { font-weight: 600; color: var(--ink-1); }
.v-right { text-align: right; }
.v-cur { font-family: var(--font-mono); font-weight: 700; font-size: 12px; }
.v-diff { font-size: 10.5px; color: var(--ink-3); }
.v-diff.bad { color: var(--red); font-weight: 600; }
.v-diff.ok { color: var(--green); font-weight: 600; }

.wh-mini-wrap { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.wh-row { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; }
.wh-top { display: flex; justify-content: space-between; color: var(--ink-2); }
.bar-track { height: 5px; border-radius: 99px; background: var(--bg-subtle); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--green); transition: width 0.3s ease; }
.bar-fill.indigo { background: var(--brand); }
.bar-fill.amber, .bar-fill.mid { background: var(--amber); }
.bar-fill.red, .bar-fill.low { background: var(--red); }

/* ==================== INTERACTIVE BUDGET SANDBOX + APPROVAL STUDIO ==================== */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }

.plan-option {
  text-align: left;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg-surface);
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.plan-option:hover { border-color: var(--brand-line); }
.plan-option.selected { border-color: var(--brand); background: var(--brand-soft); }
.po-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.po-title { font-size: 12.5px; font-weight: 700; color: var(--ink-1); }
.po-tag { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--brand); color: #fff; }
.po-desc { font-size: 12px; color: var(--ink-2); line-height: 1.5; }

/* Budget Simulation Sandbox Slider */
.sandbox-box {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.sbx-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sbx-label { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-1); }
.sbx-val { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--brand); }

.budget-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: var(--line);
  outline: none;
  cursor: pointer;
}
.budget-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 99px;
  background: var(--brand);
  border: 3px solid var(--bg-surface);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
  cursor: pointer;
}

.sbx-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.sbx-m {
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
}
.sbx-mk { font-size: 10.5px; color: var(--ink-3); }
.sbx-mv { font-family: var(--font-mono); font-size: 14px; font-weight: 700; margin-top: 2px; }
.sbx-mv.ok { color: var(--green); }
.sbx-mv.warn { color: var(--amber); }

/* Executive Approval Bar + 24h Review Trigger */
.approval-box {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-left: 3.5px solid var(--brand);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.approval-box.approved { border-left-color: var(--green); background: var(--green-soft); border-color: var(--green-line); }
.approval-box.rejected { border-left-color: var(--ink-4); opacity: 0.78; }

.ap-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ap-title { font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; }
.ap-diff { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.diff-old { text-decoration: line-through; color: var(--ink-3); font-family: var(--font-mono); }
.diff-new { font-weight: 700; color: var(--brand); font-family: var(--font-mono); }

.ap-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; border-top: 1px dashed var(--line); }

.ap-steps { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); flex-wrap: wrap; }
.ap-step { padding: 2px 8px; border-radius: 99px; background: var(--bg-subtle); }
.ap-step.done { background: var(--green-soft); color: var(--green); font-weight: 600; }
.ap-step.now { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.ap-btns { display: flex; gap: 8px; }
.btn-approve { padding: 7px 15px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; }
.btn-approve:hover { opacity: 0.92; }
.btn-review { padding: 7px 14px; border-radius: 8px; background: var(--green); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn-review:hover { opacity: 0.92; }
.btn-reject { padding: 7px 12px; border-radius: 8px; background: var(--bg-surface); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.btn-reject:hover { background: var(--bg-hover); color: var(--ink-1); }
.btn-link-xs { font-size: 11.5px; color: var(--ink-3); padding: 5px 8px; border-radius: 7px; }
.btn-link-xs:hover { background: var(--bg-hover); color: var(--ink-1); }

.ap-exec-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
}
.ap-receipt {
  font-size: 11.5px;
  color: var(--ink-2);
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--green-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.ap-receipt code { color: var(--green); font-weight: 600; }

.cp-bk-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
}
.cp-offline-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: var(--red-soft);
  border-bottom: 1px solid var(--red-line);
  color: var(--red);
  font-size: 11.5px;
  font-weight: 500;
  flex-shrink: 0;
}
.cp-offline-bar.hidden { display: none; }
.cp-offline-btn {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.cause-row {
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: 9px;
  transition: background 0.14s;
}
.cause-row:hover { background: var(--bg-subtle); }

.int-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.int-actions { display: flex; gap: 7px; }
.empty-state-box {
  padding: 28px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
}

.review-result-banner {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--green-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.rrb-kpis { display: flex; gap: 16px; }
.rrb-k { font-size: 10.5px; color: var(--ink-3); }
.rrb-v { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--green); }

/* ==================== RIGHT LIVE STREAMING COPILOT ==================== */
.copilot-pane {
  height: 100%;
  min-height: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cp-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.cp-head-left { display: flex; align-items: center; gap: 9px; }
.cp-spark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-soft), rgba(124, 58, 237, 0.14));
  color: var(--brand);
  display: grid;
  place-items: center;
}
.cp-title { font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.cp-sub { font-size: 11px; color: var(--ink-3); }

.cp-trace-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.cp-trace-chip:hover { background: var(--bg-hover); color: var(--ink-1); }

.cp-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cp-time { text-align: center; font-size: 11px; color: var(--ink-4); }
.cp-user-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cp-meta { font-size: 11px; color: var(--ink-4); display: inline-flex; align-items: center; gap: 5px; }

.cp-user-bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  background: var(--bg-bubble);
  color: var(--ink-1);
  font-size: 13px;
  line-height: 1.6;
}

.cp-ai-wrap { display: flex; flex-direction: column; gap: 8px; }
.cp-ai-text { font-size: 13px; line-height: 1.68; color: var(--ink-1); }

.cp-steps-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--bg-canvas);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cp-step-row { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-2); }
.cp-step-sys { font-weight: 600; color: var(--ink-1); min-width: 72px; }
.cp-step-ms { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-4); }

.thinking-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--brand);
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--brand-soft);
  width: fit-content;
}
.spinner-xs {
  width: 11px;
  height: 11px;
  border: 2px solid var(--brand-line);
  border-top-color: var(--brand);
  border-radius: 99px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cp-composer-wrap {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: var(--bg-surface);
}
.cp-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cp-chip {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--bg-canvas);
}
.cp-chip:hover { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand); }

.cp-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-canvas);
}
.cp-form:focus-within { border-color: var(--brand); background: var(--bg-surface); }
.cp-form input { flex: 1; border: none; outline: none; background: transparent; font-size: 12.5px; color: var(--ink-1); }

.cp-send {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* ==================== OTHER PAGES ==================== */
.scroll-page { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 26px; display: flex; flex-direction: column; gap: 14px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.k-label { font-size: 12px; color: var(--ink-3); }
.k-val { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; margin: 4px 0; }
.k-val small { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.k-note { font-size: 11.5px; font-weight: 500; }
.k-note.green { color: var(--green); }
.k-note.amber { color: var(--amber); }
.k-note.red { color: var(--red); }

.analytics-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; }
.cause-list { display: flex; flex-direction: column; gap: 13px; }
.cause-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; }

.clean-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.clean-table th { text-align: left; padding: 8px 10px; font-size: 11.5px; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.clean-table td { padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.clean-table tbody tr { cursor: pointer; }
.clean-table tbody tr:hover { background: var(--bg-hover); }

.int-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.int-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.int-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.int-chip { font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--bg-subtle); color: var(--ink-2); }

/* ==================== MODALS / ⌘K / DRAWER / TOOLTIP ==================== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  z-index: 920;
  padding: 16px;
}
.modal-mask.hidden { display: none; }

.modal-box {
  width: 100%;
  max-width: 620px;
  background: var(--bg-surface);
  border-radius: 15px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.modal-box.sm { max-width: 460px; }

.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; font-weight: 700; }
.modal-head p { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.modal-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--bg-canvas); }

.scan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--bg-subtle);
  font-size: 12.5px;
}
.scan-row.done { background: var(--green-soft); color: var(--green); font-weight: 500; }
.scan-row.found { background: var(--amber-soft); color: var(--amber); font-weight: 600; }

.export-pre {
  font-size: 11.5px;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-canvas);
  border: 1px solid var(--line);
  color: var(--ink-1);
  white-space: pre-wrap;
}

/* ⌘K Command Palette */
.cmd-box {
  width: 100%;
  max-width: 540px;
  background: var(--bg-surface);
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  overflow: hidden;
  align-self: start;
  margin-top: 10vh;
}
.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
}
.cmd-input-row input { flex: 1; border: none; outline: none; background: transparent; font-size: 13.5px; color: var(--ink-1); }
.cmd-input-row kbd { font-family: var(--font-mono); font-size: 10px; padding: 2px 5px; border-radius: 4px; background: var(--bg-subtle); color: var(--ink-3); }
.cmd-results { max-height: 320px; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.cmd-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-1);
  text-align: left;
}
.cmd-item:hover { background: var(--bg-hover); }
.cmd-item-sub { font-size: 11px; color: var(--ink-3); }

/* Developer Drawer */
.drawer-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.34); backdrop-filter: blur(2px); display: flex; justify-content: flex-end; z-index: 910; }
.drawer-mask.hidden { display: none; }
.dev-drawer { width: 450px; max-width: 94vw; height: 100%; background: var(--bg-surface); border-left: 1px solid var(--line); box-shadow: -12px 0 36px rgba(0, 0, 0, 0.14); display: flex; flex-direction: column; }
.dd-head { display: flex; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.dd-title { font-size: 14.5px; font-weight: 700; }
.dd-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.dd-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-canvas); }
.ddt-btn { font-size: 11.5px; font-weight: 600; padding: 6px 4px; border-radius: 7px; color: var(--ink-3); }
.ddt-btn.active { background: var(--bg-surface); color: var(--ink-1); box-shadow: var(--shadow-xs); }
.dd-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.dd-pane { display: none; flex-direction: column; gap: 12px; }
.dd-pane.active { display: flex; }
.dev-card { border: 1px solid var(--line); border-radius: 11px; padding: 13px; background: var(--bg-canvas); display: flex; flex-direction: column; gap: 9px; }
.dc-top { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 700; }
.dc-desc { font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.dc-desc code { background: var(--bg-surface); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); color: var(--brand); font-size: 11px; }
.dev-tag { font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.dev-tag.ok { background: var(--green-soft); color: var(--green); }
.dev-tag.err { background: var(--red-soft); color: var(--red); }
.dev-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border-radius: 8px; background: var(--bg-surface); border: 1px solid var(--line); }
.dseg-btn { padding: 6px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.dseg-btn.active { background: var(--brand); color: #fff; }
.dev-pre { font-size: 11px; line-height: 1.55; padding: 10px; border-radius: 8px; background: var(--bg-surface); border: 1px solid var(--line); color: var(--ink-2); white-space: pre-wrap; word-break: break-all; }
.dev-actions { display: flex; gap: 8px; }
.btn-solid-xs { padding: 6px 11px; border-radius: 7px; background: var(--ink-1); color: var(--bg-surface); font-size: 11.5px; font-weight: 600; }
.btn-ghost-xs { padding: 6px 11px; border-radius: 7px; background: var(--bg-surface); border: 1px solid var(--line); font-size: 11.5px; }
.dev-list { display: flex; flex-direction: column; gap: 6px; }
.ds-line { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 8px; background: var(--bg-surface); border: 1px solid var(--line); font-size: 12px; }
.dev-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--red); cursor: pointer; }

/* Interactive Floating Chart Tooltip */
.chart-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 950;
  padding: 8px 11px;
  border-radius: 9px;
  background: #0f172a;
  color: #fff;
  font-size: 11.5px;
  line-height: 1.45;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.24);
}
.chart-tooltip.hidden { display: none; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  z-index: 1000;
}
.toast.hidden { display: none; }

/* ==================== RESPONSIVE MOBILE & TABLET (Upgrade 2) ==================== */
@media (max-width: 1120px) {
  .hide-md { display: none; }
  .focal-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-grid, .int-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-root { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .mobile-menu-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); }
  .mobile-only { display: grid; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 246px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 12px 0 30px rgba(0, 0, 0, 0.18);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-mask {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 35;
  }
  .mobile-mask.hidden { display: none; }

  .studio-split { grid-template-columns: 1fr; }
  .copilot-pane {
    position: fixed;
    inset: 0;
    top: 56px;
    z-index: 60;
    transform: translateY(105%);
    transition: transform 0.24s ease;
    border-left: none;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.18);
  }
  .copilot-pane.mobile-open { transform: translateY(0); }
  .mobile-fab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    position: fixed;
    right: 16px;
    bottom: 18px;
    padding: 10px 16px;
    border-radius: 99px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
    z-index: 50;
  }
  .canvas-pane { padding: 14px 14px 76px; }
  .sku-ribbon-wrap { padding: 8px 14px; }
  .top-bar { padding: 0 14px; }
  .plan-grid, .sbx-metrics { grid-template-columns: 1fr; }
  .hero-kpis { width: 100%; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line-soft); }
  .hk-sep { display: none; }
  .hk-item { text-align: left; }
}
