/* ADRO Sales Dashboard v2 — design system
 * Merged from:
 *   - AOX WBS (Apple-inspired) layout shell tokens (.app/.topbar/.segment/.chip/.modal)
 *   - ADRO BX from Stitch — "NOT FOR EVERYBODY" motorsport-telemetry palette,
 *     Outfit/Oxanium typography, channel colors, KPI/target/insight components.
 * Theme: Dark default (motorsport telemetry vibe) with light override.
 */
:root {
  /* === Typography ============================================== */
  /* Stitch BX fonts (loaded via Tweaks panel + index.html link) */
  --font-display: 'Oxanium', system-ui, sans-serif;            /* numbers / KPI */
  --font-ui: 'Outfit', system-ui, sans-serif;                  /* UI labels */
  /* Apple system fallbacks — used by AOX shell components */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Pretendard", "Apple SD Gothic Neo", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --font-serif: "New York", "Times New Roman", "Noto Serif KR", serif;

  /* === Brand & Semantic (Stitch) =============================== */
  --color-brand-primary: #00F100;   /* ADRO Green — signature accent */
  --color-brand-accent:  #FF5000;   /* ADRO Orange — warning */
  --color-danger:  #FF453A;
  --color-good:    #34C759;
  --color-neutral: #8E8E93;

  /* Channel colors (Sales by US / ROW / KR) */
  --color-channel-us:  #007AFF;
  --color-channel-row: #FF9500;
  --color-channel-kr:  #34C759;

  /* === Light theme surfaces (AOX-derived, Apple translucent) === */
  --bg: #f5f5f7;
  --bg-elev: rgba(255,255,255,0.72);
  --bg-solid: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --fg: #1d1d1f;
  --fg-2: #3a3a3c;
  --fg-muted: #6e6e73;
  --fg-subtle: #8e8e93;
  --border: rgba(0,0,0,0.09);
  --border-strong: rgba(0,0,0,0.16);
  --divider: rgba(0,0,0,0.06);
  --hover: rgba(0,0,0,0.04);
  --selected: rgba(0,122,255,0.10);

  /* === Stitch token aliases (light mode) — used by .kpi-card etc */
  --color-bg-primary:    var(--bg);
  --color-bg-secondary:  var(--surface-2);
  --color-bg-card:       var(--surface);
  --color-border-color:  var(--border-strong);
  --color-border-subtle: var(--divider);
  --color-text-primary:   var(--fg);
  --color-text-secondary: var(--fg-2);
  --color-text-tertiary:  var(--fg-muted);
  --color-text-dim:       var(--fg-subtle);

  /* Accent — defaults to ADRO green via Tweaks, system blue otherwise */
  --accent: #007AFF;
  --accent-fg: #ffffff;
  --accent-soft: rgba(0,122,255,0.12);

  /* Phase colors */
  --phase1: #FF9500; /* amber */
  --phase2: #AF52DE; /* violet */
  --phase3: #007AFF; /* blue */
  --phase4: #34C759; /* green */

  /* Track colors — dev green, ops blue, PR orange (Apple system palette) */
  --track-dev: #34C759;
  --track-ops: #007AFF;
  --track-prm: #FF9500;

  /* Status colors */
  --status-notstarted: #8E8E93;
  --status-inprogress: #007AFF;
  --status-blocked: #FF453A;
  --status-done: #34C759;

  /* Risk */
  --risk-low: #34C759;
  --risk-med: #FF9500;
  --risk-high: #FF3B30;

  /* === Spacing & shapes ======================================== */
  --row-h: 40px;
  --row-h-compact: 30px;
  --pad: 12px;

  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  /* === Shadows & motion ======================================== */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.04), 0 1px 1px rgba(0,0,0,0.03);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-3: 0 20px 48px rgba(0,0,0,0.16), 0 8px 16px rgba(0,0,0,0.08);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.08);
  --inner-glow: none; /* dark mode re-enables this */
  --transition-base: 200ms ease-out;

  /* Brand — AOX wordmark. Charcoal on light, silver on dark. */
  --logo-color: #0F0F0F;
  --brand-fg: var(--logo-color);  /* legacy alias */
}

/* === Dark Theme (default for ADRO BX) ========================== */
[data-theme="dark"] {
  /* Stitch BX dark palette — true-black telemetry */
  --bg: #000000;
  --bg-elev: rgba(10,10,10,0.72);
  --bg-solid: #0A0A0A;
  --surface: #121212;
  --surface-2: #0A0A0A;
  --fg: #FFFFFF;
  --fg-2: #A0A0A0;
  --fg-muted: #606060;
  --fg-subtle: #464646;
  --border: rgba(255,255,255,0.08);
  --border-strong: #3C3C3C;
  --divider: #1F1F1F;
  --hover: rgba(255,255,255,0.06);
  --selected: rgba(10,132,255,0.20);

  /* Stitch token aliases (dark) */
  --color-bg-primary:    #000000;
  --color-bg-secondary:  #0A0A0A;
  --color-bg-card:       #121212;
  --color-border-color:  #3C3C3C;
  --color-border-subtle: #1F1F1F;
  --color-text-primary:   #FFFFFF;
  --color-text-secondary: #A0A0A0;
  --color-text-tertiary:  #606060;
  --color-text-dim:       #464646;

  --accent: #0A84FF;
  --accent-soft: rgba(10,132,255,0.22);

  --phase1: #FF9F0A;
  --phase2: #BF5AF2;
  --phase3: #0A84FF;
  --phase4: #30D158;

  --status-notstarted: #8E8E93;
  --status-inprogress: #0A84FF;
  --status-blocked: #FF453A;
  --status-done: #30D158;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-3: 0 20px 48px rgba(0,0,0,0.6);
  --shadow-card: 0 4px 24px -4px rgba(0,0,0,0.5);
  --inner-glow: inset 0 1px 1px rgba(255,255,255,0.05);

  --logo-color: #EAEAEA;  /* silver */
  --brand-fg: var(--logo-color);
}

[data-density="compact"] {
  --row-h: 30px;
  --pad: 8px;
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01","cv11";
  letter-spacing: -0.003em;
  min-height: 100vh;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
input, textarea, select { outline: none; }
button { cursor: pointer; border: none; background: none; padding: 0; }

/* App shell */
.app {
  display: grid;
  grid-template-rows: auto auto 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Top bar — Apple-style toolbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  min-width: 240px;
}
.brand-mark {
  display: flex; align-items: center;
  color: var(--logo-color);
  line-height: 0;
}

/* === AOX wordmark — PNG asset (see assets/aox-logo-*.png) === */
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--fg-muted); }

/* Segment control — Apple style */
.segment {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border-radius: 9px;
  border: 1px solid var(--border);
  gap: 0;
}
[data-theme="dark"] .segment { background: rgba(120,120,128,0.24); border-color: transparent; }
.segment-item {
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-2);
  border-radius: 7px;
  letter-spacing: -0.005em;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.segment-item:hover { color: var(--fg); }
.segment-item.active {
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
}
[data-theme="dark"] .segment-item.active { background: #636366; color: #fff; box-shadow: none; }

.spacer { flex: 1; }

/* Icon button */
.iconbtn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--fg-2);
  transition: background .15s;
}
.iconbtn:hover { background: var(--hover); color: var(--fg); }
.iconbtn.active { background: var(--accent-soft); color: var(--accent); }

/* Primary button */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
}
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; }

/* Search */
.search {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  width: 200px;
}
.search input {
  flex: 1; border: none; background: transparent;
  font-size: 12.5px; color: var(--fg);
}
.search svg { color: var(--fg-muted); flex: none; }

/* Secondary bar — filters, counts */
.subbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-muted);
  overflow-x: auto;
  scrollbar-width: none;
}
.subbar::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--fg-2);
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.chip:hover { background: var(--hover); }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}

/* Main content area */
.main {
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
.view {
  position: absolute; inset: 0;
  overflow: auto;
  padding: 18px;
}
.view.view-gantt { padding: 0; }
.view.view-kanban { padding: 18px; }

/* Pill status indicators */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--fg-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.status-pill.s-not-started { color: var(--fg-muted); }
.status-pill.s-not-started .dot { background: var(--status-notstarted); }
.status-pill.s-in-progress { color: var(--status-inprogress); background: var(--accent-soft); border-color: transparent; }
.status-pill.s-in-progress .dot { background: var(--status-inprogress); }
.status-pill.s-blocked { color: var(--status-blocked); background: rgba(255,69,58,0.12); border-color: transparent; }
.status-pill.s-blocked .dot { background: var(--status-blocked); }
.status-pill.s-done { color: var(--status-done); background: rgba(52,199,89,0.12); border-color: transparent; }
.status-pill.s-done .dot { background: var(--status-done); }

/* Risk pill */
.risk {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.risk-low { color: var(--risk-low); background: rgba(52,199,89,0.14); }
.risk-med { color: var(--risk-med); background: rgba(255,149,0,0.14); }
.risk-high { color: var(--risk-high); background: rgba(255,59,48,0.14); }

/* Progress */
.progress-bar { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .25s ease; }
.progress-fill.done { background: var(--status-done); }

/* Avatar */
.avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex: none;
  box-shadow: 0 0 0 1.5px var(--surface);
}
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -6px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: grid; place-items: center;
  animation: fadein .2s ease;
}
.modal {
  width: min(680px, 92vw);
  max-height: 86vh;
  overflow: auto;
  background: var(--bg-solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  border: 1px solid var(--border);
  animation: modalin .25s cubic-bezier(.3,.8,.3,1);
}
.modal header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
  position: sticky; top:0; background: var(--bg-solid); z-index: 2;
}
.modal h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.modal .body { padding: 18px 20px; }
.modal .field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.modal .field label { font-size: 11px; font-weight: 500; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.modal .field input, .modal .field select, .modal .field textarea {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
}
.modal .field input:focus, .modal .field select:focus, .modal .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Tweaks panel */
.tweaks-panel {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 300px;
  background: var(--bg-elev);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  z-index: 50;
  overflow: hidden;
  animation: modalin .22s cubic-bezier(.3,.8,.3,1);
}
.tweaks-panel header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--divider);
}
.tweaks-panel header h3 {
  margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
}
.tweaks-panel .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 14px; }
.tweak-row { display: flex; flex-direction: column; gap: 6px; }
.tweak-row > label {
  font-size: 10.5px; font-weight: 600; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.tweak-row .seg { display: flex; gap: 0; padding: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
[data-theme="dark"] .tweak-row .seg { background: rgba(120,120,128,0.24); border-color: transparent; }
.tweak-row .seg button {
  flex: 1;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--fg-2);
  border-radius: 6px;
  transition: all .15s;
}
.tweak-row .seg button.active { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
[data-theme="dark"] .tweak-row .seg button.active { background: #636366; color: #fff; }

.swatch-row { display: flex; gap: 8px; }
.swatch {
  flex: 1;
  height: 28px;
  border-radius: 7px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .1s;
  position: relative;
}
.swatch:hover { transform: scale(1.05); }
.swatch.active { border-color: var(--fg); box-shadow: 0 0 0 2px var(--bg-solid); }

/* Sheet connection panel */
.sheet-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg-2);
}
.sheet-pill .led { width: 7px; height: 7px; border-radius: 50%; background: var(--status-notstarted); }
.sheet-pill.connected .led { background: var(--status-done); box-shadow: 0 0 8px rgba(52,199,89,0.6); }

/* Animations */
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalin {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.28); background-clip: padding-box; border: 2px solid transparent; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); background-clip: padding-box; border: 2px solid transparent; }

/* Toast */
.toast {
  position: fixed;
  top: 60px; left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  font-size: 12.5px;
  font-weight: 500;
  z-index: 200;
  animation: toastin .25s cubic-bezier(.3,.8,.3,1);
}
@keyframes toastin {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* utility */
.mono { font-family: var(--font-mono); font-size: 11.5px; }
.muted { color: var(--fg-muted); }
.num-tab { font-variant-numeric: tabular-nums; }

/* Inline "+ Add task" button on Gantt group headers. Fades in on row hover;
   always visible on touch devices so it's reachable without a hover state. */
.group-header-row .group-add-btn {
  opacity: 0;
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-solid);
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 14px; line-height: 1;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.group-header-row:hover .group-add-btn { opacity: 1; }
.group-header-row .group-add-btn:hover {
  color: var(--fg);
  background: var(--hover);
  border-color: var(--border-strong);
}
@media (hover: none) { .group-header-row .group-add-btn { opacity: 1; width: 32px; height: 32px; } }

@keyframes aox-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Row flash when a task was just created via the group-header + button. */
.aox-just-added { animation: aox-row-flash 450ms ease-out 1; }
@keyframes aox-row-flash {
  0%   { background: var(--accent-soft); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .aox-just-added { animation: none; }
}

/* RollingNumber final-frame bounce — "착!" moment when the digit locks. */
.rolling-bounce { animation: aox-rolling-bounce 200ms cubic-bezier(.34,1.56,.64,1); }
@keyframes aox-rolling-bounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .rolling-bounce { animation: none; }
}

/* Refresh icon spinner */
@keyframes aox-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* KPI / overview info-tooltip — pure CSS, no library. */
.info-tip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--fg-muted);
  font-size: 9.5px;
  font-weight: 600;
  font-style: italic;
  font-family: var(--font-serif);
  cursor: help;
  background: var(--surface-2);
  user-select: none;
  line-height: 1;
}
.info-tip:hover { color: var(--fg); border-color: var(--fg-muted); }
.info-tip .info-tip-bubble {
  position: absolute;
  bottom: calc(100% + 8px); right: -4px;
  width: max-content; max-width: 240px;
  padding: 8px 10px;
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-2);
  font-size: 11.5px;
  font-weight: 400;
  font-style: normal;
  font-family: var(--font-sans);
  color: var(--fg-2);
  letter-spacing: 0;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 60;
}
.info-tip:hover .info-tip-bubble,
.info-tip:focus-visible .info-tip-bubble { opacity: 1; }
.info-tip .info-tip-bubble::after {
  content: '';
  position: absolute;
  top: 100%; right: 8px;
  border: 5px solid transparent;
  border-top-color: var(--border);
}

/* =================================================================
 * ADRO BX components — from Stitch design system
 * Used by Sales overview / channel / regional / product views.
 * ============================================================== */

/* --- KPI Card -------------------------------------------------- */
.kpi-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  /* Defensive base color so any unstyled inner text (free strings, third-
     party widgets) stays legible in BOTH themes. Children that need
     different colors override via __label/__value/__subtext. */
  color: var(--color-text-primary);
  box-shadow: var(--inner-glow), var(--shadow-card);
  transition: transform var(--transition-base), border-color var(--transition-base);
}
.kpi-card:hover {
  border-color: var(--color-brand-primary);
}
.kpi-card__label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-tertiary);
  margin-bottom: var(--spacing-sm);
}
.kpi-card__value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.2;
}
.kpi-card__subtext {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  margin-top: var(--spacing-xs);
}
.kpi-card__subtext--good    { color: var(--color-good); }
.kpi-card__subtext--warning { color: var(--color-brand-accent); }
.kpi-card__subtext--danger  { color: var(--color-danger); }

/* --- Target progress bar (channel target attainment) ----------- */
.target-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border-subtle);
  border-radius: 3px;
  overflow: hidden;
}
.target-bar__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.target-bar__fill--us  { background: var(--color-channel-us); }
.target-bar__fill--row { background: var(--color-channel-row); }
.target-bar__fill--kr  { background: var(--color-channel-kr); }

/* --- Insight cards (good/risk callouts in overview) ------------ */
.insight-card {
  display: flex;
  gap: var(--spacing-md);
  background: var(--color-bg-card);
  border-radius: var(--radius-sm);
  padding: var(--spacing-md);
  border-left: 3px solid transparent;
  /* Default body text for any insight content. The good/risk modifiers
     keep the same dark-on-light / light-on-dark text — only the LEFT
     BORDER and the (very subtle) background tint differ. */
  color: var(--color-text-primary);
}
.insight-card--good { border-left-color: var(--color-good);   background: rgba(52, 199, 89, 0.05); }
.insight-card--risk { border-left-color: var(--color-danger); background: rgba(255, 69, 58, 0.05); }

/* --- Chart.js container & axis utilities ----------------------- *
 * Reference for Chart.js init:
 *   ctx.defaults.color = getComputedStyle(document.body).getPropertyValue('--color-text-tertiary');
 *   ctx.defaults.font.family = 'Outfit';
 *   ctx.defaults.elements.line.tension = 0.4;
 *   ctx.defaults.elements.bar.borderRadius = 6;
 */
.chart-container {
  position: relative;
  width: 100%;
  background: transparent;
}
.chart-grid-line  { color: var(--color-border-subtle); }
.chart-axis-label { color: var(--color-text-tertiary); font-family: var(--font-ui); }

/* =================================================================
 * === Component classes from migration ===
 * Added when migrating inline styles in view-overview / view-product /
 * view-regional / view-kpi to CSS classes. BEM naming. Anything that
 * needs a runtime/conditional value (color from a percentage, height
 * from a prop, grid template from a count) stays inline; everything
 * else lives here.
 * ============================================================== */

/* --- Generic card surface (replaces inline cardStyle objects) ---- */
.surface-card {
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-1);
}

/* --- Page header (h2 at top of each view) ----------------------- */
.view-head {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

/* --- KPI summary grid (4 cards across) -------------------------- *
 * Grid template stays inline so callers can pick repeat(4|5,1fr)
 * — only the static gap/margin lives here. */
.kpi-summary-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

/* --- Lightweight KPI mini-card (used by Overview + Regional + KPI
 *     summary cards). Distinct from the heavier .kpi-card Stitch
 *     component — this one is the "small" variant matching the
 *     legacy inline `cardStyle` blocks. */
.kpi-mini {
  position: relative;
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-1);
}
.kpi-mini__label {
  font-size: 11px;
  color: var(--fg-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kpi-mini__label--padded { padding-right: 22px; } /* leaves room for info-tip */
.kpi-mini__value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.kpi-mini__value--md { font-size: 24px; }
.kpi-mini__value--sm { font-size: 22px; }
.kpi-mini__sub {
  font-size: 11px;
  color: var(--fg-subtle);
  margin-top: 2px;
}
.kpi-mini__subtext {
  font-size: 10.5px;
  color: var(--fg-subtle);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

/* --- Section title ribbon used above target/insights blocks ----- */
.section-eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Channel pill row (Regional view US/ROW/KR selector) -------- *
 * The active state colors are dynamic per channel (US blue, ROW
 * orange, KR green) so background/color/border are kept inline; the
 * shape + padding + transition live here. */
.channel-pill {
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 22px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--fg-2);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}
.channel-pill__amount {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
}

/* --- Period / year filter pill (Overview period bar, Product year
 *     filter). Active state is theme-accent — defaults below; callers
 *     toggle the .is-active class. */
.filter-pill {
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--fg-2);
  border: 1px solid var(--border);
}
.filter-pill.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.filter-pill--sm { font-size: 12px; }

/* --- Period bar wrapper (uses .surface-card + this for layout) -- */
.period-bar {
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.period-bar__label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
}

/* --- Compact text input + select used in toolbars --------------- */
.toolbar-input {
  padding: 4px 8px;
  font-size: 11.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
}
.toolbar-select {
  padding: 3px 8px;
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-2);
}
.toolbar-select--md {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  color: var(--fg);
}

/* --- FX missing notice (Overview top banner) -------------------- */
.fx-notice {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 149, 0, 0.08);
  border: 1px solid rgba(255, 149, 0, 0.25);
  font-size: 11.5px;
  color: var(--fg-2);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- Product category card (Product view tile grid) ------------- *
 * `selected` state is wired via .is-selected; the accent glow ring
 * is part of the class so the tile always remembers its hover/active
 * shape regardless of the inline width-from-percentage on the
 * progress fill. */
.category-card {
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: all 0.15s ease;
}
.category-card.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.category-card__name {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  line-height: 1.3;
}
.category-card__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.category-card.is-selected .category-card__value { color: var(--accent); }
.category-card__pct {
  font-size: 11px;
  color: var(--fg-subtle);
  margin-top: 3px;
}
.category-card__bar {
  margin-top: 8px;
  background: var(--surface-2);
  border-radius: 99px;
  height: 4px;
  overflow: hidden;
}
.category-card__bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--color-channel-us);
  transition: width 0.3s ease;
}
.category-card.is-selected .category-card__bar-fill { background: var(--accent); }

/* --- Generic chart card (per-tab variants share this base; height
 *     stays inline because each view picks a tab-specific value). -- */
.chart-card {
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
}
.chart-card--snug { padding: 14px; }
.chart-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.chart-card__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chart-card__title--sm { font-size: 11px; margin-bottom: 8px; }
.chart-card__body {
  position: relative;
  flex: 1;
  min-height: 0;
}
.chart-card__body--list {
  display: block;
  overflow: auto;
}

/* --- Insights section (Overview GOOD / RISK signals) ------------ */
.insight-list-title {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}
.insight-list-title--good { color: var(--color-good); }
.insight-list-title--risk { color: var(--color-brand-accent); }
.insight-empty {
  font-size: 12px;
  color: var(--fg-subtle);
}

/* --- Cross-metric card (KPI view tri-card row) ------------------- */
.cross-metric-card {
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cross-metric-card__label {
  font-size: 11px;
  color: var(--fg-muted);
  font-weight: 600;
}

