/* VOC Manager — global styles.
 * Design tokens are driven by CSS variables set on :root by the React app,
 * so Tweaks can re-skin the whole UI without re-render.
 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --bg-card: var(--surface); /* alias — use --surface going forward */
  --surface-2: #fbfbfc;
  --surface-sunken: #f2f3f5;
  --surface-hover: #f1f2f5;
  --border: #e7e8eb;
  --border-strong: #d4d6db;
  --text: #15171a;
  --text-muted: #5b6168;
  --text-subtle: #8b9199;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-text: #4338ca;
  --accent-hover: #4338ca;
  --accent-press: #3730a3;
  --ring: color-mix(in oklab, var(--accent) 35%, transparent);
  --scrim: color-mix(in oklab, #0b0d10 40%, transparent);

  /* toast */
  --toast-bg: #1c1d21;
  --toast-fg: #eaecef;

  /* type scale */
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 13px;
  --text-md:   14px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  28px;

  /* radius */
  --r-xs:   4px;
  --r-sm:   6px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-pill: 999px;

  /* spacing */
  --space-1: 4px;  --space-2: 6px;  --space-3: 8px;
  --space-4: 12px; --space-5: 16px; --space-6: 24px;

  /* status colors */
  --st-received: #6366f1;   /* 접수 */
  --st-processing: #f59e0b; /* 처리중 */
  --st-closed: #10b981;     /* 종결 */
  --st-dead: #94a3b8;       /* close */

  --rp-repair: #3b82f6;     /* 수리중 */
  --rp-stock: #10b981;      /* 재고 */
  --rp-out: #64748b;        /* 출고 */
  --rp-dead: #ef4444;       /* 폐기 */

  --dday-red: #ef4444;
  --dday-amber: #f59e0b;
  --dday-green: #10b981;

  --shadow-1: 0 1px 2px rgba(15,17,20,.04), 0 0 0 .5px rgba(15,17,20,.05);
  --shadow-2: 0 2px 4px rgba(15,17,20,.05), 0 8px 24px rgba(15,17,20,.06), 0 0 0 .5px rgba(15,17,20,.05);
  --shadow-peek: -12px 0 48px rgba(15,17,20,.10), 0 0 0 .5px rgba(15,17,20,.06);

  --radius-sm: var(--r-sm);
  --radius: var(--r-md);
  --radius-lg: var(--r-lg);

  --row-h: 34px;
  --sidebar-w: 232px;
  --header-h: 48px;
  --peek-w: 560px;

  --font-ui: "Pretendard", "Pretendard Variable", "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg: #0f1012;
  --surface: #17181b;
  --bg-card: var(--surface);
  --surface-2: #1c1d21;
  --surface-sunken: #121316;
  --surface-hover: #202226;
  --border: #26282d;
  --border-strong: #34363c;
  --text: #eaecef;
  --text-muted: #9aa0aa;
  --text-subtle: #6e747e;
  --accent-soft: rgba(99,102,241,.16);
  --accent-text: #a5b4fc;
  --accent-hover: #6366f1;
  --accent-press: #818cf8;
  --scrim: color-mix(in oklab, #000 55%, transparent);
  --toast-bg: #2a2c31;
  --toast-fg: #f6f7f9;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 0 0 .5px rgba(255,255,255,.04);
  --shadow-2: 0 2px 4px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35), 0 0 0 .5px rgba(255,255,255,.05);
  --shadow-peek: -12px 0 48px rgba(0,0,0,.5), 0 0 0 .5px rgba(255,255,255,.06);
}

:root[data-density="compact"] { --row-h: 28px; --cell-px: 8px;  --cell-fs: 12px; }
:root[data-density="regular"] { --row-h: 34px; --cell-px: 12px; --cell-fs: 12.5px; }
:root[data-density="comfy"]   { --row-h: 44px; --cell-px: 16px; --cell-fs: 13px; }

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss02" on, "cv11" on;
}

button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }

/* ── App shell ──────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden; }
.sidebar {
  background: var(--surface-sunken);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar-brand {
  padding: 14px 14px 10px; display: flex; align-items: center; gap: 8px;
}
.sidebar-brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.sidebar-brand-name { font-weight: 600; font-size: 13.5px; letter-spacing: -.01em; }
.sidebar-brand-sub { font-size: 10.5px; color: var(--text-subtle); margin-left: auto; font-variant-numeric: tabular-nums; }

.sidebar-search {
  margin: 4px 10px 10px; padding: 6px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 12px; color: var(--text-subtle); display: flex; align-items: center; gap: 6px;
  cursor: text; user-select: none;
}
.sidebar-search kbd {
  margin-left: auto; font-family: var(--font-ui); font-size: 10px;
  padding: 1px 5px; border-radius: 4px; background: var(--surface-sunken); color: var(--text-subtle);
  border: 1px solid var(--border);
}

.sidebar-section { padding: 8px 10px 4px; font-size: var(--text-xs); letter-spacing: .04em; text-transform: uppercase; color: var(--text-subtle); font-weight: 600; margin-top: 12px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 6px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px; margin: 1px 0;
  border-radius: var(--r-sm); color: var(--text-muted); cursor: pointer; font-size: 12.5px;
  border: 0; background: transparent; width: 100%; text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active {
  background: var(--surface); color: var(--text); font-weight: 500;
  box-shadow: var(--shadow-1);
}
.nav-item.active::before {
  content: ""; position: absolute;
  left: -6px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-subtle); }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-count { margin-left: auto; font-size: 11px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }

.sidebar-footer { padding: 8px 12px 12px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-subtle); display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff;
  display: grid; place-items: center; font-size: 10px; font-weight: 600;
}
.avatar[data-tone="indigo"] { background: linear-gradient(135deg,#4f46e5,#7c3aed); }
.avatar[data-tone="sky"]    { background: linear-gradient(135deg,#0ea5e9,#4f46e5); }
.avatar[data-tone="teal"]   { background: linear-gradient(135deg,#10b981,#0891b2); }
.avatar[data-tone="amber"]  { background: linear-gradient(135deg,#f59e0b,#dc2626); }
.dot-online { width: 6px; height: 6px; border-radius: 50%; background: #10b981; margin-left: auto; }

/* ── Main region ────────────────────────────────────────────── */
.main { display: grid; grid-template-rows: var(--header-h) 1fr; min-width: 0; min-height: 0; background: var(--surface); overflow: hidden; }
.header {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.crumbs .sep { color: var(--text-subtle); }
.crumbs .cur { color: var(--text); font-weight: 500; }

.hd-spacer { flex: 1; }
.hd-btn {
  height: 28px; padding: 0 10px; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius); display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); cursor: pointer;
}
.hd-btn:hover { background: var(--surface-2); color: var(--text); }
.hd-btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.hd-btn.primary:hover { background: color-mix(in oklab, var(--accent) 90%, #000); }
.hd-btn kbd { font-family: var(--font-ui); font-size: 10px; padding: 1px 5px; border-radius: 3px; background: rgba(255,255,255,.18); color: rgba(255,255,255,.85); margin-left: 3px; }
.hd-btn:not(.primary) kbd { background: var(--surface-sunken); color: var(--text-subtle); }

.hd-avatars { display: flex; margin-left: 8px; }
.hd-avatars .avatar { margin-left: -6px; border: 2px solid var(--surface); width: 24px; height: 24px; font-size: 10px; }
.hd-avatars .avatar:first-child { margin-left: 0; }

.content { overflow-y: auto; overflow-x: auto; min-height: 0; min-width: 0; position: relative; }

/* ── Table ──────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 5;
  flex-wrap: wrap;
}
.chip {
  height: 26px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 12px;
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap;
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip.active { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.chip .x { color: var(--text-subtle); margin-left: 2px; }

.view-tabs { display: flex; align-items: center; gap: 2px; background: var(--surface-sunken); padding: 2px; border-radius: var(--radius); }
.view-tab { padding: 4px 10px; font-size: 12px; color: var(--text-muted); border-radius: 5px; cursor: pointer; border: 0; background: transparent; }
.view-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); font-weight: 500; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.data-table thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface);
  padding: 0 10px; height: 30px; text-align: left;
  font-size: 11px; font-weight: 500; color: var(--text-subtle);
  box-shadow: inset 0 -1px 0 var(--border), 0 4px 8px -8px rgba(0,0,0,.18);
  white-space: nowrap; letter-spacing: .01em;
}
.data-table thead th.num-col { text-align: right; }
.data-table tbody td {
  padding: 0 var(--cell-px, 10px); height: var(--row-h);
  font-size: var(--cell-fs, 12.5px);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 240px;
}
.data-table tbody td.wide { max-width: 420px; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover td { background: color-mix(in oklab, var(--accent) 4%, var(--surface)); }
.data-table tbody tr.selected td { background: var(--accent-soft); }
.data-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.data-table tbody td.c-muted { color: var(--text-muted); }
.data-table tbody td.c-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Status pills ───────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: var(--text-xs); font-weight: 500; line-height: 1;
  white-space: nowrap;
  background: color-mix(in oklab, var(--pill-c) 12%, transparent);
  color: color-mix(in oklab, var(--pill-c) 75%, var(--text));
  border: 1px solid color-mix(in oklab, var(--pill-c) 22%, transparent);
}
:root[data-theme="dark"] .pill {
  background: color-mix(in oklab, var(--pill-c) 18%, transparent);
  color: color-mix(in oklab, var(--pill-c) 35%, var(--text));
}
.pill.sm { height: 18px; padding: 0 6px; font-size: 10.5px; }
.pill.lg { height: 24px; padding: 0 10px; font-size: var(--text-sm); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pill-c); }
.pill.ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.pill.clickable { cursor: pointer; }
.pill.clickable:hover { filter: brightness(.96); }

.pill.st-접수      { --pill-c: var(--st-received); }
.pill.st-처리중    { --pill-c: var(--st-processing); }
.pill.st-종결      { --pill-c: var(--st-closed); }
.pill.st-close     { --pill-c: var(--st-dead); }

.pill.rp-수리중    { --pill-c: var(--rp-repair); }
.pill.rp-재고      { --pill-c: var(--rp-stock); }
.pill.rp-출고      { --pill-c: var(--rp-out); }
.pill.rp-폐기      { --pill-c: var(--rp-dead); }

.pill.vt-고객불만  { --pill-c: #e11d48; }
.pill.vt-고객문의  { --pill-c: #0ea5e9; }

.pill[class*="proc-"] { --pill-c: #6b7280; }
.pill.proc-선출고     { --pill-c: #0891b2; }
.pill.proc-선회수     { --pill-c: #7c3aed; }

/* ── D-Day ──────────────────────────────────────────────────── */
.dday { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-variant-numeric: tabular-nums; }
.dday .marker { font-size: 10px; }
.dday.red   { color: var(--dday-red); font-weight: 600; }
.dday.amber { color: var(--dday-amber); font-weight: 500; }
.dday.green { color: var(--dday-green); }

/* ── Dropdown ───────────────────────────────────────────────── */
.dropdown {
  position: fixed; z-index: 100; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-2);
  padding: 4px; font-size: 12.5px;
}
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 5px; cursor: pointer; color: var(--text);
}
.dropdown-item:hover { background: var(--surface-sunken); }
.dropdown-item.check::before { content: ""; width: 14px; display: inline-block; }
.dropdown-item.checked::before { content: "✓"; color: var(--accent); }
.dropdown-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.dropdown-label {
  padding: 6px 8px 4px; font-size: 10.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-subtle); font-weight: 500;
}

/* ── Grouped table header (엑셀 VOC_접수대장 형식) ───────────── */
.data-table.grouped thead tr.group-row th.group-th {
  top: 0; height: 26px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  text-align: center; padding: 0 8px;
}
.data-table.grouped thead tr.group-row th.group-th:last-child { border-right: none; }
.data-table.grouped thead tr:not(.group-row) th {
  top: 26px; height: 30px;
  font-size: 11px; color: var(--text-muted);
}
.data-table.grouped tbody td { border-right: 1px dashed transparent; }
/* Visual dividers between groups - handled via JS would be cleaner, but this works for the headers */

/* ── Dashboard cards ────────────────────────────────────────── */
.dash { padding: 20px 24px 40px; }
.dash-title { font-size: 22px; font-weight: 650; letter-spacing: -.015em; margin: 0 0 4px; }
.dash-sub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 20px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.metric {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.metric-label { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.metric-icon {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  background: var(--tone-soft); color: var(--tone);
}
.metric-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric-delta { font-size: 11.5px; color: var(--text-subtle); }
.metric-delta.up { color: var(--dday-green); }
.metric-delta.down { color: var(--dday-red); }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.panel-title { font-size: 13px; font-weight: 600; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.panel-title .meta { margin-left: auto; font-size: 11.5px; font-weight: 400; color: var(--text-subtle); }

/* ── Peek panel ─────────────────────────────────────────────── */
.peek-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0); pointer-events: none; }
.peek {
  position: fixed; top: var(--header-h); bottom: 0; right: 0;
  width: var(--peek-w); max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-peek);
  display: flex; flex-direction: column; min-height: 0;
  transform: translateX(100%);
  transition: transform .24s cubic-bezier(.25,.1,.25,1);
  z-index: 40;
}
.peek.open { transform: translateX(0); }
.peek-head { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.peek-head .voc-no { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.peek-head .spacer { flex: 1; }
.icon-btn {
  width: 26px; height: 26px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 5px;
  color: var(--text-subtle); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--text); }

.peek-body { overflow: auto; padding: 18px 20px 40px; }
.peek-title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 4px; color: var(--text); }
.peek-meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 18px; }

.kv-grid { display: grid; grid-template-columns: 120px 1fr; row-gap: 9px; column-gap: 16px; font-size: 12.5px; }
.kv-key { color: var(--text-subtle); font-size: 11.5px; padding-top: 2px; }
.kv-val { color: var(--text); }
.kv-val.editable { padding: 2px 6px; margin: -2px -6px; border-radius: 5px; cursor: text; }
.kv-val.editable:hover { background: var(--surface-sunken); }
.kv-val.muted { color: var(--text-subtle); font-style: normal; }

.section-h { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-subtle); margin: 24px 0 10px; }

.text-block { font-size: 13px; line-height: 1.6; color: var(--text); background: var(--surface-sunken); border-radius: var(--radius); padding: 10px 12px; white-space: pre-wrap; }

/* ── Timeline ───────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 1.5px; background: var(--border); }
.tl-item { position: relative; padding: 4px 0 14px; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 6px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--dot-c, var(--text-subtle));
}
.tl-item.done::before { background: var(--dot-c); }
.tl-item.current::before { box-shadow: 0 0 0 3px color-mix(in oklab, var(--dot-c) 28%, transparent); }
.tl-date { font-size: 11.5px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.tl-title { font-size: 12.5px; font-weight: 500; margin-top: 2px; }
.tl-body { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; z-index: 80;
  background: var(--scrim);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  display: grid; place-items: start center; padding-top: 10vh;
}
.modal {
  width: min(640px, 92vw); background: var(--surface); border-radius: var(--r-lg);
  box-shadow: 0 24px 64px rgba(15,17,20,.24), 0 0 0 .5px rgba(15,17,20,.1);
  overflow: hidden;
}
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; background: var(--surface-2); }
.modal-foot .spacer { flex: 1; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11.5px; color: var(--text-subtle); margin-bottom: 4px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 32px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px;
  outline: none; font-size: 13px; color: var(--text);
}
.textarea { height: auto; padding: 8px 10px; min-height: 72px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── Toast ──────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; }
.toast {
  min-width: 220px; max-width: 360px;
  background: var(--toast-bg); color: var(--toast-fg);
  padding: 9px 14px; border-radius: var(--r-md); font-size: 12.5px;
  display: flex; align-items: center; gap: 8px;
  animation: toast-in .22s cubic-bezier(.25,.1,.25,1);
  box-shadow: 0 8px 24px rgba(0,0,0,.24);
}
.toast.success { background: #0e7c50; color: #eaf6ee; }
.toast.error   { background: #c0392b; color: #ffecea; }
.toast.info    { background: var(--toast-bg); }
.toast .close { margin-left: auto; background: transparent; border: 0; color: rgba(255,255,255,.6); cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.3; } }

/* ── Chart ──────────────────────────────────────────────────── */
.chart { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding: 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-stack { width: 100%; max-width: 52px; position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.bar { background: var(--accent); border-radius: 4px 4px 0 0; position: relative; }
.bar.bar-closed { background: color-mix(in oklab, var(--accent) 50%, var(--surface)); border-radius: 0; }
.bar.bar-top { border-radius: 4px 4px 0 0; }
.bar-label { font-size: 11px; color: var(--text-muted); }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 16px; gap: 2px; background: var(--surface); position: sticky; top: 0; z-index: 4; }
.tab {
  padding: 10px 14px; font-size: 13px; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: transparent; border-top: 0; border-left: 0; border-right: 0;
  display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }
.tab .count { font-size: 10.5px; font-weight: 500; padding: 1px 6px; border-radius: 999px; background: var(--surface-sunken); color: var(--text-muted); }
.tab.active .count { background: var(--accent-soft); color: var(--accent-text); }

/* ── Empty ──────────────────────────────────────────────────── */
.empty { padding: 60px 20px; text-align: center; color: var(--text-subtle); font-size: 13px; }

/* ── Cowork view ────────────────────────────────────────────── */
.cowork { padding: 20px 24px; display: grid; grid-template-columns: 1fr 380px; gap: 16px; }
.chat-msg { margin-bottom: 10px; }
.chat-user { background: var(--accent-soft); color: var(--accent-text); padding: 8px 12px; border-radius: 12px 12px 2px 12px; max-width: 80%; margin-left: auto; font-size: 13px; }
.chat-ai { background: var(--surface-sunken); padding: 10px 14px; border-radius: 12px 12px 12px 2px; max-width: 90%; font-size: 13px; }
.chat-api { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); background: var(--bg); padding: 8px 10px; border-radius: 6px; margin-top: 6px; border: 1px solid var(--border); white-space: pre-wrap; }

/* misc */
.sticky-peek-overlap { padding-right: var(--peek-w); }
.rel { position: relative; }
.stage { position: relative; }

/* Kbd */
kbd.kbd {
  font-family: var(--font-ui); font-size: 10.5px; padding: 1px 5px; border-radius: 3px;
  background: var(--surface-sunken); color: var(--text-muted); border: 1px solid var(--border);
}

.hint { font-size: 11.5px; color: var(--text-subtle); }

/* input-like editable in peek */
.inline-edit {
  border: 1px solid transparent; border-radius: 5px; padding: 2px 6px;
  margin: -2px -6px; min-height: 20px; cursor: text; color: var(--text);
  font-size: 12.5px;
}
.inline-edit:hover { border-color: var(--border); background: var(--surface); }
.inline-edit:focus { border-color: var(--accent); background: var(--surface); outline: none; }

/* ── focus-visible 통합 링 ──────────────────────────────────── */
.chip:focus-visible,
.nav-item:focus-visible,
.hd-btn:focus-visible,
.view-tab:focus-visible,
.tab:focus-visible,
.icon-btn:focus-visible,
.dropdown-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ring);
  border-radius: var(--r-sm);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

/* ── 커스텀 스크롤바 ─────────────────────────────────────────── */
.content, .peek-body, .sidebar-nav, .dropdown {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.content::-webkit-scrollbar,
.peek-body::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar,
.dropdown::-webkit-scrollbar { width: 10px; height: 10px; }
.content::-webkit-scrollbar-track,
.peek-body::-webkit-scrollbar-track,
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb,
.peek-body::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--text) 14%, transparent);
  border-radius: 999px;
  border: 2.5px solid var(--surface);
}
.content::-webkit-scrollbar-thumb:hover,
.peek-body::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: color-mix(in oklab, var(--text) 26%, transparent);
}

/* ── 메트릭 카드 톤 바 ──────────────────────────────────────── */
.metric::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--tone, var(--accent)), transparent);
}

/* ── 모션 접근성 ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
