/* =========================================================
   Spark Pixel Dashboard — Design Tokens
   Light: cool white / teal   ·   Dark: warm charcoal / orange
   ========================================================= */
:root {
  --font-sans: "Inter", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;

  /* ---------- Light ---------- */
  --bg: #f3f4f6;
  --bg-elev: #ffffff;
  --bg-sunken: #f7f8fa;
  --bg-hover: #f2f3f5;
  --bg-active: #eceef1;
  --line: #e7e9ec;
  --line-strong: #d5d9de;
  --text: #17191c;
  --text-2: #4b5563;
  --text-3: #8a919b;
  --text-4: #b3b9c2;

  --accent: #0f9d8a;
  --accent-soft: #9edbd1;
  --accent-tint: #e6f6f3;
  --accent-text: #0b7f70;

  --teal: #0f9d8a; --teal-tint: #e6f6f3;
  --blue: #2f7ff5; --blue-tint: #e8f0fe;
  --purple: #8b5cf6; --purple-tint: #f0ebff;
  --orange: #f28c28; --orange-tint: #fff1e4;
  --green: #16a34a; --green-tint: #e6f7ec;
  --red: #e5484d; --red-tint: #fdecec;
  --yellow: #d99b1a; --yellow-tint: #fff5dd;

  --grid-cell: #e6e8eb;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.14), 0 2px 6px rgba(16,24,40,.08);
  --tooltip-bg: #17191c;
  --tooltip-text: #ffffff;
  --btn-dark-bg: #17191c;
  --btn-dark-text: #ffffff;
  --seat-fill: var(--accent);
}

html[data-theme="dark"] {
  --bg: #14120f;
  --bg-elev: #1e1b18;
  --bg-sunken: #191714;
  --bg-hover: #26221e;
  --bg-active: #2b2722;
  --line: #2a2622;
  --line-strong: #3a352f;
  --text: #ede8e0;
  --text-2: #b8b1a6;
  --text-3: #837c72;
  --text-4: #5d574f;

  --accent: #f4831f;
  --accent-soft: #7a4a22;
  --accent-tint: #2c2117;
  --accent-text: #ffa04d;

  --teal: #2bb5a0; --teal-tint: #14302b;
  --blue: #5b9cff; --blue-tint: #1a2740;
  --purple: #a78bfa; --purple-tint: #2a2340;
  --orange: #f4831f; --orange-tint: #2c2117;
  --green: #35c46a; --green-tint: #15301f;
  --red: #f0605f; --red-tint: #3a1f1f;
  --yellow: #e9b949; --yellow-tint: #332a14;

  --grid-cell: #2a2622;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.35);
  --shadow-lg: 0 14px 40px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);
  --tooltip-bg: #2a2622;
  --tooltip-text: #f5f1ea;
  --btn-dark-bg: #f4831f;
  --btn-dark-text: #1a120a;
  --seat-fill: var(--accent);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
kbd {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3);
  border: 1px solid var(--line); background: var(--bg-elev); border-radius: 5px; padding: 1px 5px; line-height: 1.4;
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.hide-mobile { }

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  padding: 10px 10px 12px;
  overflow-y: auto; overflow-x: hidden;
  transition: width .22s ease, transform .25s ease, background-color .25s;
  z-index: 40;
  scrollbar-width: thin;
}
.ws {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .15s;
}
.ws:hover { background: var(--bg-hover); }
.ws-logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: var(--btn-dark-bg); color: var(--btn-dark-text);
  display: grid; place-items: center;
}
.ws-logo svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.ws-meta { min-width: 0; flex: 1; }
.ws-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-sub { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.ws-sub svg { width: 12px; height: 12px; }
.ws-chev { color: var(--text-3); width: 14px; height: 14px; }

.nav { margin-top: 8px; display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 10px 6px;
}
.nav-label-row { display: flex; align-items: center; justify-content: space-between; padding-right: 4px; }
.nav-label-row span { display: inline-flex; align-items: center; gap: 4px; }
.lbl-chev { width: 12px; height: 12px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 13px;
  width: 100%; text-align: left; white-space: nowrap;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item svg { width: 16px; height: 16px; color: var(--text-3); }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-active); color: var(--text); font-weight: 600; }
.nav-item.active svg { color: var(--text); }
.nav-item span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item kbd { margin-left: auto; }
.nav-badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  background: var(--red); color: #fff; border-radius: 999px; padding: 1px 6px; flex: none !important;
}
.nav-star { width: 13px !important; height: 13px !important; color: var(--text-4) !important; opacity: 0; transition: opacity .15s; }
.nav-item:hover .nav-star { opacity: 1; }
.nav-star.on { opacity: 1; fill: var(--orange); stroke: var(--orange); color: var(--orange) !important; }
.dash-dot { width: 14px; height: 14px; border-radius: 4px; background: var(--c); flex: none; display: inline-block; margin: 0 1px; }

.sidebar-bottom { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 1px; }
.plan {
  margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; background: var(--bg-sunken);
}
.plan-head { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.plan-head svg { width: 14px; height: 14px; color: var(--text-3); }
.plan-row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: 10px; }
.plan-row b { color: var(--text); font-weight: 500; }
.seat-bar {
  margin: 8px 0 12px; height: 8px; border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--seat-fill) 0 6px, transparent 6px 8px);
  position: relative;
}
.seat-bar::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: calc(100% * 4 / 25);
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 8px);
  background-position: right;
}

/* collapsed sidebar (desktop) */
.app.collapsed .sidebar { width: var(--sidebar-w-collapsed); padding-left: 8px; padding-right: 8px; }
.app.collapsed .ws-meta, .app.collapsed .ws-chev, .app.collapsed .nav-label, .app.collapsed .nav-item span,
.app.collapsed .nav-item kbd, .app.collapsed .nav-badge, .app.collapsed .nav-star, .app.collapsed .plan,
.app.collapsed .ws-logo + * { display: none; }
.app.collapsed .ws { justify-content: center; padding: 8px 0; }
.app.collapsed .nav-item { justify-content: center; padding: 9px 0; }
.app.collapsed .nav-item .dash-dot { margin: 0; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; background: var(--bg-elev); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
  transition: background-color .25s;
}
#menuBtn { display: none; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-sunken); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 10px 0 12px; height: 34px; width: 100%; max-width: 440px; color: var(--text-3);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; font-size: 12.5px; color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search svg { width: 14px; height: 14px; }
.search.sm { height: 30px; max-width: 220px; border-radius: 8px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  color: var(--text-2); position: relative; transition: background .15s, color .15s;
  border: 1px solid transparent;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.xs { width: 24px; height: 24px; border-radius: 6px; }
.icon-btn.xs svg { width: 14px; height: 14px; }
.icon-btn.has-dot::after {
  content: ""; position: absolute; top: 7px; right: 7px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--red); border: 1.5px solid var(--bg-elev);
}
.ic-moon { display: none; }
html[data-theme="dark"] .ic-moon { display: block; }
html[data-theme="dark"] .ic-sun { display: none; }
#themeToggle svg { transition: transform .35s ease; }
#themeToggle:active svg { transform: rotate(40deg) scale(.9); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden; border: 2px solid var(--line);
  background: var(--bg-hover); transition: border-color .15s;
}
.avatar:hover { border-color: var(--accent); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* page head */
.pagehead {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px 0;
}
.crumb { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; }
.crumb b { color: var(--text); font-weight: 600; }
.crumb a:hover { color: var(--text); }
.pagehead-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.edited { color: var(--text-3); font-size: 12px; }
.edited b { color: var(--text-2); font-weight: 500; }
.edited a { color: var(--accent-text); font-weight: 500; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px;
  border: 1px solid var(--line); background: var(--bg-elev); border-radius: 8px;
  font-weight: 500; font-size: 12.5px; color: var(--text); white-space: nowrap;
  box-shadow: var(--shadow); transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; color: var(--text-2); }
.btn .chev { width: 12px; height: 12px; color: var(--text-3); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; box-shadow: none; }
.btn-block { width: 100%; justify-content: center; }
.btn-dark { background: var(--btn-dark-bg); color: var(--btn-dark-text); border-color: transparent; }
.btn-dark svg { color: inherit; }
.btn-dark:hover { background: var(--btn-dark-bg); filter: brightness(1.12); border-color: transparent; }
.btn-soft { background: var(--bg-sunken); box-shadow: none; }
.btn-ghost { border-color: transparent; box-shadow: none; color: var(--text-2); background: transparent; margin-top: 6px; }
.btn-ghost:hover { background: var(--bg-hover); border-color: transparent; }

/* dropdown */
.dropdown { position: relative; }
.dropdown.open > .btn { border-color: var(--line-strong); background: var(--bg-hover); }
.dropdown.open > .btn .chev { transform: rotate(180deg); }
.menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 170px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 5px; z-index: 50;
  opacity: 0; transform: translateY(-4px) scale(.98); pointer-events: none;
  transition: opacity .15s, transform .15s;
}
.dropdown.open .menu { opacity: 1; transform: none; pointer-events: auto; }
.menu li {
  padding: 7px 10px; border-radius: 6px; font-size: 12.5px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; color: var(--text-2);
}
.menu li:hover { background: var(--bg-hover); color: var(--text); }
.menu li[aria-selected="true"] { color: var(--text); font-weight: 600; }
.menu li[aria-selected="true"]::after { content: "✓"; color: var(--accent); font-size: 11px; }

/* tabs */
.tabs {
  display: flex; align-items: flex-end; gap: 2px; padding: 12px 20px 0;
  border-bottom: 1px solid var(--line); position: relative;
  background: var(--bg); overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 12px 10px; font-weight: 500; color: var(--text-3); font-size: 13px; white-space: nowrap;
  position: relative; transition: color .15s; border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 600; }
.tab-ink {
  position: absolute; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px;
  transition: left .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1);
}
.tab-new { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); }
.tab-new svg { width: 13px; height: 13px; }

/* ---------- Content grid ---------- */
.content { padding: 16px 20px 28px; display: flex; flex-direction: column; gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; grid-auto-flow: dense; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
[data-tabs].tab-hidden { display: none !important; }

/* card */
.card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px 16px; min-width: 0;
  display: flex; flex-direction: column;
  animation: rise .35s ease both;
  transition: background-color .25s, border-color .25s, box-shadow .2s, transform .2s;
}
.card:hover { border-color: var(--line-strong); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 24px; }
.card-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2);
}
.card-title .info { width: 13px; height: 13px; color: var(--text-4); cursor: help; }
.card-actions { display: flex; align-items: center; gap: 6px; }
.info { width: 13px; height: 13px; color: var(--text-4); cursor: help; }
.grip { color: var(--text-4); cursor: grab; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; opacity: .55; transition: opacity .15s, background .15s; }
.card:hover .grip { opacity: 1; }
.grip:hover { background: var(--bg-hover); }
.grip:active { cursor: grabbing; }
.ico {
  width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center;
  background: var(--c-tint, var(--bg-sunken)); color: var(--c, var(--text-2)); flex: none;
  border: 1px solid color-mix(in srgb, var(--c, var(--line)) 22%, transparent);
}
.ico svg { width: 12px; height: 12px; }
.ico-teal { --c: var(--teal); --c-tint: var(--teal-tint); }
.ico-blue { --c: var(--blue); --c-tint: var(--blue-tint); }
.ico-purple { --c: var(--purple); --c-tint: var(--purple-tint); }
.ico-orange { --c: var(--orange); --c-tint: var(--orange-tint); }
.ico-plain { --c: var(--text-2); --c-tint: var(--bg-sunken); border-color: var(--line); }

/* KPI */
.card.kpi { padding-bottom: 0; }
.kpi-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.kpi-value { font-size: 26px; font-weight: 500; line-height: 1; display: flex; align-items: baseline; gap: 6px; letter-spacing: -.02em; }
.kpi-value small { font-size: 12px; color: var(--text-3); font-weight: 500; }
.spark { height: 36px; width: 96px; display: flex; align-items: flex-end; gap: 2px; }
.spark i {
  flex: 1; height: var(--h); background: var(--line-strong); border-radius: 2px;
  transition: background .2s, transform .15s; transform-origin: bottom;
  animation: growY .5s cubic-bezier(.3,.7,.3,1) both; animation-delay: var(--d);
}
.spark i:hover { transform: scaleY(1.06); }
.spark i.hi { background: var(--c); }
.spark[data-color="teal"] { --c: var(--teal); }
.spark[data-color="blue"] { --c: var(--blue); }
.spark[data-color="purple"] { --c: var(--purple); }
.spark[data-color="orange"] { --c: var(--orange); }
@keyframes growY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.kpi-foot {
  margin: 14px -16px 0; padding: 9px 16px; border-top: 1px solid var(--line);
  background: var(--bg-sunken); border-radius: 0 0 var(--radius) var(--radius);
  display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--text-3);
}
.delta {
  display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 600; border-radius: 999px; padding: 2px 7px;
}
.delta.up { color: var(--green); background: var(--green-tint); }
.delta.down { color: var(--red); background: var(--red-tint); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; overflow-y: hidden; flex: none; margin: 0 -16px; padding: 0 16px; scrollbar-width: thin; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th {
  text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); padding: 8px 10px; background: var(--bg-sunken); white-space: nowrap;
  user-select: none;
}
.table th:first-child { border-radius: 8px 0 0 8px; }
.table th:last-child { border-radius: 0 8px 8px 0; }
.table th[data-sort] { cursor: pointer; }
.table th svg { width: 12px; height: 12px; vertical-align: -2px; color: var(--text-4); margin-left: 2px; }
.table th[data-sort]:hover { color: var(--text); }
.table th.sorted { color: var(--text); }
.table th.sorted svg { color: var(--accent); }
.table th.sorted.desc svg { transform: rotate(180deg); }
.table td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr.selected { background: var(--accent-tint); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .chk, .table .num { width: 34px; }
.table .num { color: var(--text-3); font-family: var(--font-mono); font-size: 11px; }
.table .right { text-align: right; }
.table .act { width: 60px; text-align: center; }
.table .amt { font-family: var(--font-mono); font-size: 12px; }
.table .date { color: var(--text-3); font-family: var(--font-mono); font-size: 11.5px; }
.table.compact td { padding: 8px 10px; font-size: 12.5px; }
.table.compact { min-width: 520px; }
.co { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.co i { width: 14px; height: 14px; border-radius: 4px; background: var(--c); display: inline-block; }
input[type="checkbox"] {
  appearance: none; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: 4px;
  background: var(--bg-elev); cursor: pointer; display: inline-grid; place-items: center; vertical-align: middle; margin: 0;
  transition: background .12s, border-color .12s;
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { content: ""; width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
input[type="checkbox"]:indeterminate { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:indeterminate::after { content: ""; width: 7px; height: 2px; background: #fff; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--t); color: var(--c);
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.active, .pill.success, .pill.scheduled { --c: var(--green); --t: var(--green-tint); }
.pill.prospect, .pill.hold, .pill.ontheway { --c: var(--orange); --t: var(--orange-tint); }
.pill.risk, .pill.failed, .pill.cancelled { --c: var(--red); --t: var(--red-tint); }
.pill.progress { --c: var(--blue); --t: var(--blue-tint); }
.row-menu { position: relative; display: inline-block; }
.row-menu .menu { min-width: 140px; }
.row-menu.open .menu { opacity: 1; transform: none; pointer-events: auto; }

/* 차트 SVG는 전역 아이콘 stroke를 상속받지 않도록 초기화 */
.donut svg, .matrix svg, .gauge svg, .linechart svg, .barchart svg { stroke: none; stroke-width: 1; }

/* ---------- Donut ---------- */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; flex: 1; }
.donut { width: 156px; height: 156px; position: relative; }
.donut svg { width: 100%; height: 100%; overflow: visible; }
.donut path { transition: transform .2s ease, opacity .2s; transform-origin: 50% 50%; cursor: pointer; stroke: var(--bg-elev); stroke-width: 2; }
.donut path.dim { opacity: .35; }
.donut path.hot { transform: scale(1.06); }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 17px; font-weight: 600; display: block; }
.donut-center span { font-size: 11px; color: var(--text-3); }
.legend { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); padding: 3px 4px; border-radius: 6px; cursor: default; transition: background .12s; }
.legend li:hover { background: var(--bg-hover); }
.legend li.off { opacity: .4; }
.legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); flex: none; }
.legend b { margin-left: auto; font-family: var(--font-mono); font-weight: 500; color: var(--text); font-size: 11.5px; }
.legend.inline { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.legend.inline li { cursor: pointer; }

/* ---------- Sales Trend / Matrix ---------- */
.trend-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 12px; background: var(--bg-sunken); border-radius: 10px; margin-bottom: 8px; }
.trend-total { color: var(--text-3); font-size: 12px; }
.trend-total b { color: var(--text); font-size: 17px; font-weight: 600; margin-left: 4px; }
.trend-legend { display: flex; gap: 12px; font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.trend-legend span { display: inline-flex; align-items: center; gap: 6px; }
.trend-legend i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.segmented { margin-left: auto; display: inline-flex; background: var(--bg-active); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--text-3); transition: background .15s, color .15s; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.matrix { position: relative; flex: 1; min-height: 240px; }
.matrix svg { width: 100%; height: 100%; display: block; overflow: visible; }
.matrix .cell { fill: var(--grid-cell); transition: fill .25s; }
.matrix .cell.a { fill: var(--accent); }
.matrix .cell.b { fill: var(--accent-soft); }
.matrix .col-hit { fill: transparent; cursor: crosshair; }
.matrix .col-hit:hover ~ .cursor { opacity: 1; }
.matrix .axis { font-family: var(--font-mono); font-size: 10px; fill: var(--text-3); }
.matrix .axis.hot { fill: var(--text); font-weight: 600; }
.matrix .cursor { stroke: var(--text-3); stroke-dasharray: 2 3; opacity: 0; transition: opacity .15s; pointer-events: none; }
.matrix .cursor-dot { fill: var(--bg-elev); stroke: var(--text); stroke-width: 1.5; }

/* ---------- Gauge ---------- */
.gauge-wrap { position: relative; width: 190px; height: 150px; margin: 4px auto 0; }
.gauge { position: absolute; inset: 0; }
.gauge svg { width: 100%; height: 100%; overflow: visible; }
.gauge line { stroke: var(--line-strong); stroke-width: 3.5; stroke-linecap: round; transition: stroke .3s; }
.gauge line.on { stroke: var(--accent); }
.gauge line.soft { stroke: var(--accent-soft); }
.gauge-center { position: absolute; left: 0; right: 0; top: 62px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.gauge-center span { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.gauge-center b { font-size: 15px; font-weight: 600; }
.gauge-legend { display: flex; justify-content: center; gap: 16px; margin-top: 2px; font-size: 12px; color: var(--text-2); }
.gauge-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gauge-legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.gauge-delta { text-align: center; font-size: 11.5px; color: var(--text-3); margin: 8px 0 14px; }
.gauge-wrap + * { margin-top: 0; }

/* ---------- Line chart ---------- */
.stats-row { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; margin-bottom: 8px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; transition: border-color .15s, background .15s; }
.stat:hover { background: var(--bg-sunken); border-color: var(--line); }
.stat span { font-size: 11px; color: var(--text-3); }
.stat b { font-size: 18px; font-weight: 500; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 8px; }
.stat em { font-style: normal; align-self: flex-start; }
.linechart { position: relative; height: 240px; }
.linechart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.linechart .gridline { stroke: var(--line); stroke-dasharray: 3 4; }
.linechart .axis { font-family: var(--font-mono); font-size: 10px; fill: var(--text-3); }
.linechart .series path.line { fill: none; stroke: var(--c); stroke-width: 1.8; stroke-linejoin: round; transition: opacity .2s; }
.linechart .series path.area { fill: var(--c); opacity: .06; transition: opacity .2s; }
.linechart .series circle { fill: var(--c); stroke: var(--bg-elev); stroke-width: 1.5; transition: r .15s; }
.linechart .series.off { opacity: 0; pointer-events: none; }
.linechart .cursor { stroke: var(--text-3); stroke-dasharray: 2 3; opacity: 0; transition: opacity .15s; pointer-events: none; }
.linechart .hit { fill: transparent; cursor: crosshair; }
.linechart .axis.hot { fill: var(--text); font-weight: 600; }
.linechart .hot-dot { r: 5; }

/* ---------- Bar chart ---------- */
.barchart { position: relative; flex: 1; min-height: 200px; }
.barchart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.barchart .gridline { stroke: var(--line); stroke-dasharray: 3 4; }
.barchart .axis { font-family: var(--font-mono); font-size: 10px; fill: var(--text-3); }
.barchart .bar { fill: var(--blue); transition: opacity .15s; cursor: pointer; transform-origin: bottom; animation: growY .6s cubic-bezier(.3,.7,.3,1) both; }
.barchart .bar.cap { fill: var(--blue); opacity: .55; }
.barchart:hover .bar { opacity: .45; }
.barchart:hover .bar:hover, .barchart:hover .bar.hot { opacity: 1; }
.barchart .bar.cap:hover { opacity: .8; }

/* ---------- Feed ---------- */
.feed { display: flex; flex-direction: column; flex: 1; }
.feed li { display: flex; gap: 10px; padding: 8px 0; position: relative; }
.feed li + li::before { content: ""; position: absolute; left: 11px; top: -16px; height: 22px; border-left: 1px dashed var(--line-strong); }
.feed .fav { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--t); color: var(--c); flex: none; margin-top: 2px; }
.feed .fav svg { width: 12px; height: 12px; }
.feed .fav.mention { --c: var(--blue); --t: var(--blue-tint); }
.feed .fav.upload { --c: var(--purple); --t: var(--purple-tint); }
.feed .fav.join { --c: var(--yellow); --t: var(--yellow-tint); }
.feed .fav.deal { --c: var(--green); --t: var(--green-tint); }
.feed .favatar { width: 22px; height: 22px; border-radius: 50%; flex: none; margin-top: 2px; }
.feed .ftext { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-2); }
.feed .ftext b { color: var(--text); font-weight: 600; }
.feed .ftext a { color: var(--accent-text); font-weight: 500; }
.feed .ftext q { display: block; quotes: none; margin-top: 5px; padding: 6px 9px; background: var(--bg-sunken); border-radius: 7px; font-size: 12px; color: var(--text-2); }
.feed .ftime { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; margin-top: 2px; }

/* ---------- Leaders ---------- */
.leaders { display: flex; flex-direction: column; flex: 1; }
.leaders li { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; transition: background .12s; }
.leaders li:hover { background: var(--bg-hover); }
.leaders .rank { width: 20px; height: 20px; display: grid; place-items: center; color: var(--text-4); }
.leaders .rank svg { width: 15px; height: 15px; }
.leaders li:nth-child(1) .rank { color: var(--yellow); }
.leaders li:nth-child(2) .rank { color: var(--text-3); }
.leaders li:nth-child(3) .rank { color: var(--orange); }
.leaders .lmeta { flex: 1; min-width: 0; }
.leaders .lname { font-weight: 600; font-size: 12.5px; }
.leaders .lamt { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }
.leaders .lbar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.leaders .lbar i { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 2px; animation: growX .7s ease both; transform-origin: left; }
@keyframes growX { from { transform: scaleX(0); } }
.leaders img { width: 28px; height: 28px; border-radius: 50%; }

/* ---------- Stack bar ---------- */
.cat-total { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.cat-total span { font-size: 11px; color: var(--text-3); }
.cat-total b { font-size: 20px; font-weight: 500; letter-spacing: -.02em; }
.stackbar { display: flex; gap: 3px; height: 12px; margin-bottom: 14px; }
.stackbar i { display: block; height: 100%; border-radius: 3px; background: var(--c); width: var(--w); transition: transform .15s, filter .15s; cursor: pointer; animation: growX .6s ease both; transform-origin: left; }
.stackbar i:hover, .stackbar i.hot { transform: scaleY(1.35); filter: brightness(1.1); }
.stackbar i:first-child { border-radius: 6px 3px 3px 6px; }
.stackbar i:last-child { border-radius: 3px 6px 6px 3px; }

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--tooltip-bg); color: var(--tooltip-text);
  border-radius: 9px; padding: 8px 10px; font-size: 11.5px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translate(-50%, -100%) translateY(-10px) scale(.96);
  transition: opacity .12s, transform .12s; min-width: 110px; border: 1px solid rgba(255,255,255,.06);
}
.tooltip.show { opacity: 1; transform: translate(-50%, -100%) translateY(-10px); }
.tooltip .tt-title { font-family: var(--font-mono); font-size: 10.5px; opacity: .7; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; white-space: nowrap; }
.tooltip .tt-row i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.tooltip .tt-row b { margin-left: auto; font-family: var(--font-mono); font-weight: 600; padding-left: 12px; }
.tooltip.plain { min-width: 0; padding: 6px 9px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 110; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--tooltip-bg); color: var(--tooltip-text); padding: 9px 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
  animation: toastIn .25s cubic-bezier(.3,.7,.3,1.2) both;
}
.toast svg { width: 14px; height: 14px; color: var(--green); }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Popover (workspace) ---------- */
.popover {
  position: fixed; z-index: 60; width: 232px; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: rise .15s ease both;
}
.popover-title { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 6px 8px; }
.popover-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px; font-weight: 500; font-size: 12.5px; text-align: left; }
.popover-item:hover { background: var(--bg-hover); }
.popover-item svg { width: 14px; height: 14px; color: var(--accent); margin-left: auto; }
.popover-item > svg:first-child { color: var(--text-3); margin-left: 0; }
.popover-sep { height: 1px; background: var(--line); margin: 5px 0; }
.ws-mini { width: 22px; height: 22px; border-radius: 6px; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }

/* ---------- Scrim ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .25s; backdrop-filter: blur(2px); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .span-3 { grid-column: span 2; }
  .stats-row { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh;
    transform: translateX(-104%); box-shadow: var(--shadow-lg);
    width: min(300px, 86vw) !important; padding-left: 10px !important; padding-right: 10px !important;
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
  /* 모바일에선 접힘 상태를 무시 */
  .app.collapsed .ws-meta, .app.collapsed .ws-chev, .app.collapsed .nav-label, .app.collapsed .nav-item span,
  .app.collapsed .nav-item kbd, .app.collapsed .nav-badge, .app.collapsed .plan { display: revert; }
  .app.collapsed .nav-item span:first-of-type { display: block; }
  .app.collapsed .plan { display: block; }
  .app.collapsed .ws { justify-content: flex-start; padding: 8px; }
  .app.collapsed .nav-item { justify-content: flex-start; padding: 7px 10px; }
  #menuBtn { display: grid; }
  #collapseBtn { display: none; }
  .topbar { padding: 10px 14px; }
  .pagehead, .tabs { padding-left: 14px; padding-right: 14px; }
  .content { padding: 14px 14px 24px; }
}

@media (max-width: 640px) {
  body { font-size: 13px; }
  .hide-mobile { display: none !important; }
  .kpis { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
  .search { max-width: none; height: 32px; }
  .search kbd { display: none; }
  .topbar-right { gap: 2px; }
  .pagehead { padding-top: 12px; }
  .pagehead-right { margin-left: 0; width: 100%; }
  .pagehead-right .dropdown { flex: 1; }
  .pagehead-right .dropdown > .btn { width: 100%; }
  .pagehead-right .dropdown > .btn [data-label] { flex: 1; text-align: left; }
  .stats-row { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
  .stat b { font-size: 16px; }
  .trend-head { gap: 8px; }
  .segmented { margin-left: 0; width: 100%; }
  .segmented button { flex: 1; text-align: center; }
  .matrix { min-height: 200px; }
  .linechart { height: 200px; }
  .kpi-value { font-size: 24px; }
  .card { padding: 12px 14px 14px; border-radius: 12px; }
  .kpi-foot { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  .tooltip { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- 언어 ---- */
.lang-btn { font-family: var(--font-sans); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
html.lang-ko .card-title { letter-spacing: .02em; }
html.lang-ko .nav-label { letter-spacing: .04em; }
