@import url('../fonts/pretendard.css');

/* ============================================================
   VirtualOmics Design System — app.css
   Light workspace chrome (Asana-like) + deep dark data canvas.
   No build tools, no external references. Fully offline.
   ============================================================ */

/* ---------- 1. TOKENS ---------- */
:root {
  /* base palette */
  --bg: #ffffff;
  --bg-2: #f7f8f9;
  --text: #2e3c54;
  --text-muted: #646f79;
  --text-subtle: #8a939c;
  --text-invert: #ffffff;
  --border: #e8e8e9;
  --border-strong: #d3d6d9;

  /* accent */
  --accent: #82f384;
  --accent-600: #16a34a;
  --accent-700: #12813b;
  --accent-800: #0d602c;
  --accent-soft: #eafdea;
  --accent-soft-2: #d3fad4;
  --accent-glow: rgba(130, 243, 132, 0.45);
  --accent-contrast: #0b2415;

  /* state — success */
  --success: #22c55e;
  --success-soft: #e7f9ee;
  --success-text: #15803d;
  /* state — warning */
  --warning: #f59e0b;
  --warning-soft: #fef3d7;
  --warning-text: #a15c07;
  /* state — danger */
  --danger: #ef4444;
  --danger-soft: #fdeaea;
  --danger-text: #b91c1c;
  /* state — info */
  --info: #3b82f6;
  --info-soft: #e8f0fe;
  --info-text: #1d4ed8;
  /* state — neutral */
  --neutral: #94a3b8;
  --neutral-soft: #f1f3f5;
  --neutral-text: #4b5563;

  /* surfaces */
  --surface: #ffffff;
  --surface-2: #f5f6f7;
  --surface-3: #eceef0;
  --surface-hover: #f0f6f1;
  --surface-active: #e4f5e5;
  --overlay: rgba(20, 28, 24, 0.44);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(255, 255, 255, 0.75);

  /* dark data canvas */
  --canvas-bg: #06110c;
  --canvas-bg-2: #0b1c14;
  --canvas-bg-3: #112a1e;
  --canvas-grid: rgba(130, 243, 132, 0.10);
  --canvas-border: rgba(130, 243, 132, 0.18);
  --canvas-text: #e6f7ea;
  --canvas-muted: #8fae9b;
  --canvas-accent: #82f384;
  --canvas-accent-2: #4ee0c1;
  --canvas-accent-3: #7bb0ff;

  /* radius */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-full: 999px;

  /* spacing (4px scale) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --sp-9: 40px;
  --sp-10: 48px;
  --sp-11: 64px;
  --sp-12: 80px;

  /* typography */
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --fs-4xl: 38px;
  --fs-5xl: 48px;
  --lh-tight: 1.2;
  --lh-base: 1.55;
  --lh-loose: 1.75;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-black: 800;
  --tracking-tight: -0.01em;
  --tracking-wide: 0.04em;

  /* shadows */
  --shadow-sm: 0 1px 2px rgba(24, 39, 30, 0.06), 0 1px 3px rgba(24, 39, 30, 0.05);
  --shadow-md: 0 2px 6px rgba(24, 39, 30, 0.07), 0 8px 20px rgba(24, 39, 30, 0.07);
  --shadow-lg: 0 8px 20px rgba(24, 39, 30, 0.10), 0 24px 48px rgba(24, 39, 30, 0.12);
  --shadow-glow: 0 0 0 1px var(--accent-glow), 0 6px 24px var(--accent-glow);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --ring: 0 0 0 3px rgba(22, 163, 74, 0.28);
  --ring-danger: 0 0 0 3px rgba(239, 68, 68, 0.28);

  /* z-index scale */
  --z-base: 0;
  --z-raised: 10;
  --z-sticky: 100;
  --z-drawer: 300;
  --z-scrim: 400;
  --z-modal: 500;
  --z-pill: 600;
  --z-toast: 700;
  --z-tooltip: 800;

  /* motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms;
  --dur-base: 220ms;
  --dur-slow: 420ms;
  --dur-slower: 900ms;

  /* layout metrics */
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
  --content-max: 100%;     /* 본문은 창 너비를 그대로 채운다 */
  --tap-min: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* 모듈 간격 — 네이버식 넓은 여백 리듬 */
  --grid-gap: 20px;
  --section-gap: 28px;
  --card-pad: 22px;
}

/* ---------- 2. DARK THEME ---------- */
[data-theme='dark'] {
  --bg: #0c1310;
  --bg-2: #0f1a15;
  --text: #e4ece6;
  --text-muted: #9db0a5;
  --text-subtle: #7a8c82;
  --text-invert: #08120c;
  --border: #1e2b24;
  --border-strong: #2c3d33;

  --accent-600: #57e06a;
  --accent-700: #82f384;
  --accent-800: #a7f7a8;
  --accent-soft: #12271a;
  --accent-soft-2: #17351f;
  --accent-contrast: #06110c;

  --success-soft: #10281a;
  --success-text: #6ee7a0;
  --warning-soft: #2c2210;
  --warning-text: #fbbf5c;
  --danger-soft: #2e1616;
  --danger-text: #fca5a5;
  --info-soft: #14203a;
  --info-text: #93b8fd;
  --neutral-soft: #182119;
  --neutral-text: #b3c1b8;

  --surface: #101c16;
  --surface-2: #14231c;
  --surface-3: #1a2c23;
  --surface-hover: #172c20;
  --surface-active: #1c3826;
  --overlay: rgba(2, 8, 5, 0.62);
  --glass: rgba(16, 28, 22, 0.62);
  --glass-border: rgba(130, 243, 132, 0.14);

  --canvas-bg: #040d09;
  --canvas-bg-2: #081711;
  --canvas-bg-3: #0e2418;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.45), 0 8px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.5), 0 24px 48px rgba(0, 0, 0, 0.5);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --ring: 0 0 0 3px rgba(130, 243, 132, 0.32);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  [data-theme='auto'] {
    --bg: #0c1310;
    --bg-2: #0f1a15;
    --text: #e4ece6;
    --text-muted: #9db0a5;
    --text-subtle: #7a8c82;
    --text-invert: #08120c;
    --border: #1e2b24;
    --border-strong: #2c3d33;

    --accent-600: #57e06a;
    --accent-700: #82f384;
    --accent-800: #a7f7a8;
    --accent-soft: #12271a;
    --accent-soft-2: #17351f;
    --accent-contrast: #06110c;

    --success-soft: #10281a;
    --success-text: #6ee7a0;
    --warning-soft: #2c2210;
    --warning-text: #fbbf5c;
    --danger-soft: #2e1616;
    --danger-text: #fca5a5;
    --info-soft: #14203a;
    --info-text: #93b8fd;
    --neutral-soft: #182119;
    --neutral-text: #b3c1b8;

    --surface: #101c16;
    --surface-2: #14231c;
    --surface-3: #1a2c23;
    --surface-hover: #172c20;
    --surface-active: #1c3826;
    --overlay: rgba(2, 8, 5, 0.62);
    --glass: rgba(16, 28, 22, 0.62);
    --glass-border: rgba(130, 243, 132, 0.14);

    --canvas-bg: #040d09;
    --canvas-bg-2: #081711;
    --canvas-bg-3: #0e2418;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.45), 0 8px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.5), 0 24px 48px rgba(0, 0, 0, 0.5);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --ring: 0 0 0 3px rgba(130, 243, 132, 0.32);
    color-scheme: dark;
  }
}

/* ---------- 3. RESET / BASE ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  letter-spacing: var(--tracking-tight);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--text);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5 { font-size: var(--fs-md); }
h6 { font-size: var(--fs-base); }

p { margin: 0 0 var(--sp-3); }
img, svg, video, canvas { max-width: 100%; }
svg { display: inline-block; vertical-align: middle; flex: none; }

a {
  color: var(--accent-600);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--accent-700); text-decoration: underline; }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-5) 0; }

code, pre, kbd, samp { font-family: var(--font-mono); font-size: 0.92em; }

::selection { background: var(--accent-soft-2); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent-600);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); background-clip: content-box; }

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- 4. APP SHELL / LAYOUT ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: 100vh;
  min-height: 100vh;
  background: var(--bg-2);
  transition: grid-template-columns var(--dur-base) var(--ease-out);
}
.app-shell:has(.sidebar.collapsed) { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* sidebar */
.sidebar {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: var(--sidebar-w);
  height: 100vh;
  padding: var(--sp-4) var(--sp-3);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: 0;
  z-index: var(--z-drawer);
  transition: width var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), padding var(--dur-base) var(--ease-out);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-brand .brand-mark {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  flex: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-600) 100%);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-sm);
}
.sidebar-section-label {
  padding: var(--sp-4) var(--sp-3) var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 40px;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  width: 100%;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.sidebar-item:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.sidebar-item:focus-visible { outline: 2px solid var(--accent-600); outline-offset: -2px; }
.sidebar-item > svg { flex: none; color: currentColor; }
.sidebar-item .sidebar-label { overflow: hidden; text-overflow: ellipsis; }
.sidebar-item .sidebar-badge {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--accent-600);
  background: var(--accent-soft);
  border-radius: var(--radius-full);
  padding: 1px var(--sp-2);
}
.sidebar-item.active {
  background: var(--accent-soft);
  color: var(--accent-700);
  font-weight: var(--fw-semibold);
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  width: 3px; height: 20px;
  transform: translateY(-50%);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  background: var(--accent-600);
}
.sidebar-footer { margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--border); }

/* collapsed sidebar */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); padding-left: var(--sp-2); padding-right: var(--sp-2); }
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-badge,
.sidebar.collapsed .sidebar-brand span:not(.brand-mark) { display: none; }
.sidebar.collapsed .sidebar-item { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }

/* collapsed tooltip */
.sidebar.collapsed .sidebar-item[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.sidebar.collapsed .sidebar-item[data-tip]:hover::after,
.sidebar.collapsed .sidebar-item[data-tip]:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* main column */
.main-col { grid-column: 2; display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(8px);
}
.topbar .topbar-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.topbar .topbar-spacer { margin-left: auto; }

.content {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  background: var(--bg-2);
}
.page-header {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-6) var(--sp-6) var(--sp-4);
  max-width: var(--content-max);
  margin: 0 auto;
}
.page-header .page-title { font-size: var(--fs-2xl); font-weight: var(--fw-bold); }
.page-header .page-desc { margin: var(--sp-1) 0 0; color: var(--text-muted); font-size: var(--fs-base); }
.page-header .page-actions { margin-left: auto; display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.page-body {
  padding: 0 var(--sp-6) var(--sp-10);
  max-width: var(--content-max);
  margin: 0 auto;
  min-width: 0;
}

.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.hamburger:hover { background: var(--surface-hover); }

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-scrim);
  background: var(--overlay);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease-out), visibility var(--dur-base) var(--ease-out);
}
.drawer-scrim.open { opacity: 1; visibility: visible; }

/* ---------- 5. CARDS ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text); }
.card-subtitle { font-size: var(--fs-sm); color: var(--text-muted); }
.card-header .card-actions { margin-left: auto; display: flex; gap: var(--sp-2); }
.card-body { padding: var(--sp-5); }
.card-footer {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.card.interactive { cursor: pointer; }
.card.interactive:hover {
  transform: translateY(-2px);
  border-color: var(--accent-600);
  box-shadow: var(--shadow-md);
}
.card.interactive:focus-visible { outline: 2px solid var(--accent-600); outline-offset: 2px; }
.card.flush .card-body { padding: 0; }

.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.stat-card .stat-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.stat-card .stat-value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-card .stat-unit { font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--text-muted); margin-left: 2px; }
.stat-card .stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}
.stat-card .stat-delta.up { color: var(--success-text); }
.stat-card .stat-delta.down { color: var(--danger-text); }
.stat-card .stat-delta.flat { color: var(--text-muted); }

.glass-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  padding: var(--sp-5);
}

/* ---------- 6. WORKFLOW / FLOW ---------- */
.flow {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: var(--sp-2) 0;
}
.flow-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  flex: 0 0 auto;
  min-width: 120px;
  padding: var(--sp-2);
  text-align: center;
}
.flow-step .flow-dot {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  transition: all var(--dur-base) var(--ease-spring);
}
.flow-step .flow-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted); }
.flow-step .flow-meta { font-size: var(--fs-xs); color: var(--text-subtle); font-variant-numeric: tabular-nums; }

.flow-step.done .flow-dot { border-color: var(--accent-600); background: var(--accent-600); color: #ffffff; }
.flow-step.done .flow-label { color: var(--text); }
.flow-step.active .flow-dot {
  border-color: var(--accent-600);
  background: var(--accent-soft);
  color: var(--accent-700);
  box-shadow: 0 0 0 6px var(--accent-glow);
  animation: flow-pulse 1.8s var(--ease-in-out) infinite;
}
.flow-step.active .flow-label { color: var(--accent-700); font-weight: var(--fw-semibold); }
.flow-step.pending .flow-dot { border-style: dashed; background: var(--surface-2); color: var(--text-subtle); }
.flow-step.failed .flow-dot { border-color: var(--danger); background: var(--danger-soft); color: var(--danger-text); }

.flow-connector {
  position: relative;
  flex: 1 1 auto;
  min-width: 32px;
  height: 3px;
  align-self: flex-start;
  margin-top: 20px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  overflow: hidden;
}
.flow-connector.done { background: var(--accent-600); }
.flow-connector.active {
  background-image: linear-gradient(
    90deg,
    var(--accent-600) 0%,
    var(--accent) 25%,
    var(--accent-600) 50%,
    var(--accent) 75%,
    var(--accent-600) 100%
  );
  background-size: 200% 100%;
  background-color: var(--accent-soft-2);
  animation: flow-dash 1.4s linear infinite;
}
.flow-connector.pending {
  background: repeating-linear-gradient(90deg, var(--border-strong) 0 6px, transparent 6px 12px);
}

.flow.vertical { flex-direction: column; align-items: flex-start; overflow-x: visible; }
.flow.vertical .flow-step { flex-direction: row; align-items: center; text-align: left; min-width: 0; width: 100%; gap: var(--sp-3); }
.flow.vertical .flow-step .flow-text { display: flex; flex-direction: column; }
.flow.vertical .flow-connector {
  width: 3px;
  height: 28px;
  min-width: 0;
  flex: none;
  margin: 0 0 0 28px;
  align-self: flex-start;
}
.flow.vertical .flow-connector.active {
  background-image: linear-gradient(
    180deg,
    var(--accent-600) 0%,
    var(--accent) 25%,
    var(--accent-600) 50%,
    var(--accent) 75%,
    var(--accent-600) 100%
  );
  background-size: 100% 200%;
  animation: flow-dash-v 1.4s linear infinite;
}
.flow.vertical .flow-connector.pending {
  background: repeating-linear-gradient(180deg, var(--border-strong) 0 6px, transparent 6px 12px);
}

@keyframes flow-dash { from { background-position: 200% 0; } to { background-position: 0 0; } }
@keyframes flow-dash-v { from { background-position: 0 200%; } to { background-position: 0 0; } }
@keyframes flow-pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--accent-glow); }
  50% { box-shadow: 0 0 0 10px rgba(130, 243, 132, 0.12); }
}

/* ---------- 7. BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 38px;
  padding: 0 var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-spring);
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled,
.btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn > svg { flex: none; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-soft-2); border-color: var(--accent-600); box-shadow: 0 2px 10px var(--accent-glow); }
.btn-primary:active:not(:disabled) { background: var(--accent); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--accent-600); color: var(--accent-700); }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }

.btn-danger { background: var(--danger); color: #ffffff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-text); border-color: var(--danger-text); }
.btn-danger:focus-visible { box-shadow: var(--ring-danger); }

.btn-sm { min-height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-sm); gap: var(--sp-1); }
.btn-lg { min-height: var(--tap-min); padding: 0 var(--sp-6); font-size: var(--fs-md); border-radius: var(--radius); }
.btn-icon { width: 38px; min-width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 30px; min-width: 30px; }
.btn-icon.btn-lg { width: var(--tap-min); min-width: var(--tap-min); }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------- 8. FORMS ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); min-width: 0; }
.field-row { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}
.label .req { color: var(--danger); }

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-base);
  line-height: 1.4;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.input::placeholder,
.textarea::placeholder { color: var(--text-subtle); }
.input:hover:not(:disabled),
.select:hover:not(:disabled),
.textarea:hover:not(:disabled) { border-color: var(--text-subtle); }
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent-600);
  box-shadow: var(--ring);
}
.input:disabled,
.select:disabled,
.textarea:disabled { background: var(--surface-2); color: var(--text-subtle); cursor: not-allowed; }
.textarea { min-height: 96px; resize: vertical; }

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--sp-8);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.input.invalid,
.select.invalid,
.textarea.invalid { border-color: var(--danger); }
.input.invalid:focus,
.select.invalid:focus,
.textarea.invalid:focus { box-shadow: var(--ring-danger); }

.help-text { font-size: var(--fs-sm); color: var(--text-muted); }
.error-text { font-size: var(--fs-sm); color: var(--danger-text); font-weight: var(--fw-medium); display: flex; align-items: center; gap: var(--sp-1); }

.input-group { display: flex; align-items: stretch; width: 100%; min-width: 0; }
.input-group > .input,
.input-group > .select { border-radius: 0; flex: 1 1 auto; min-width: 0; }
.input-group > :first-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
.input-group > :last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.input-group > * + * { margin-left: -1px; }
.input-group > .input:focus,
.input-group > .select:focus { position: relative; z-index: var(--z-raised); }
.input-group .input-addon {
  display: flex;
  align-items: center;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: var(--fs-base);
  color: var(--text);
  min-height: 24px;
  user-select: none;
}
.checkbox input[type='checkbox'],
.radio input[type='radio'] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  flex: none;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.checkbox input[type='checkbox'] { border-radius: 5px; }
.radio input[type='radio'] { border-radius: var(--radius-full); }
.checkbox input[type='checkbox']:checked,
.radio input[type='radio']:checked { background: var(--accent-600); border-color: var(--accent-600); }
.checkbox input[type='checkbox']:checked {
  background-image: linear-gradient(45deg, transparent 46%, #ffffff 46%, #ffffff 56%, transparent 56%),
    linear-gradient(-45deg, transparent 62%, #ffffff 62%, #ffffff 72%, transparent 72%);
  background-position: 2px 4px, 0 0;
  background-size: 12px 12px, 18px 18px;
  background-repeat: no-repeat;
}
.radio input[type='radio']:checked { box-shadow: inset 0 0 0 3px var(--surface); }
.checkbox input:focus-visible,
.radio input:focus-visible { outline: none; box-shadow: var(--ring); }
.checkbox input:disabled,
.radio input:disabled { opacity: 0.5; cursor: not-allowed; }

.switch { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; user-select: none; min-height: 24px; }
.switch input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 40px; height: 22px;
  flex: none;
  margin: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out);
}
.switch input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: var(--radius-full);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-spring);
}
.switch input[type='checkbox']:checked { background: var(--accent-600); }
.switch input[type='checkbox']:checked::after { transform: translateX(18px); }
.switch input[type='checkbox']:focus-visible { outline: none; box-shadow: var(--ring); }
.switch input[type='checkbox']:disabled { opacity: 0.5; cursor: not-allowed; }

.slider {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
}
.slider::-moz-range-track { height: 6px; border-radius: var(--radius-full); background: var(--surface-3); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  margin-top: -6px;
  border-radius: var(--radius-full);
  background: var(--accent-600);
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease-out);
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: var(--radius-full);
  background: var(--accent-600);
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
.slider:hover::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 0 0 6px var(--accent-glow); }
.slider:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring); }
.slider:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 9. TABLES ---------- */
.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-base);
  font-variant-numeric: tabular-nums;
}
.table th,
.table td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: var(--z-raised);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-strong);
}
.table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.selected { background: var(--accent-soft); }
.table td.num,
.table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.wrap { white-space: normal; }

.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  margin-left: var(--sp-2);
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid var(--text-subtle);
  opacity: 0.35;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.table th.sortable:hover::after { opacity: 0.8; }
.table th.sortable[aria-sort='ascending']::after { opacity: 1; border-bottom-color: var(--accent-600); }
.table th.sortable[aria-sort='descending']::after { opacity: 1; border-bottom-color: var(--accent-600); transform: rotate(180deg); }
.table th.sortable:focus-visible { outline: 2px solid var(--accent-600); outline-offset: -2px; }

.table-compact th,
.table-compact td { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }

/* ---------- 10. BADGES / CHIPS ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  background: var(--neutral-soft);
  color: var(--neutral-text);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge > svg { width: 12px; height: 12px; }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-info { background: var(--info-soft); color: var(--info-text); }
.badge-neutral { background: var(--neutral-soft); color: var(--neutral-text); }
.badge-accent { background: var(--accent-soft); color: var(--accent-700); }
.badge-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
  flex: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 28px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.chip:hover { background: var(--surface-hover); }
.chip.selected { background: var(--accent-soft); border-color: var(--accent-600); color: var(--accent-700); }
.chip.removable { padding-right: var(--sp-1); }
.chip.removable .chip-x {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.chip.removable .chip-x:hover { background: var(--danger-soft); color: var(--danger-text); }
.chip.removable .chip-x:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- 11. PROGRESS ---------- */
.progress {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  overflow: hidden;
}
.progress.lg { height: 14px; }
.progress.sm { height: 5px; }
.progress-bar {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: var(--radius-full);
  background-image: linear-gradient(90deg, var(--accent-600) 0%, var(--accent) 50%, var(--accent-600) 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width var(--dur-slow) var(--ease-out);
  animation: progress-slide 2.4s linear infinite;
  overflow: hidden;
}
.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.55) 45%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(255, 255, 255, 0.55) 55%,
    transparent 80%
  );
  background-size: 220% 100%;
  animation: progress-shimmer 1.6s linear infinite;
}
.progress-bar.danger { background-image: linear-gradient(90deg, var(--danger) 0%, #ff8f8f 50%, var(--danger) 100%); box-shadow: none; }
.progress-bar.warning { background-image: linear-gradient(90deg, var(--warning) 0%, #ffd48a 50%, var(--warning) 100%); box-shadow: none; }
.progress-bar.done { animation: none; }
.progress-bar.done::after { display: none; }

.progress-indeterminate { position: relative; overflow: hidden; }
.progress-indeterminate::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 38%;
  border-radius: var(--radius-full);
  background-image: linear-gradient(90deg, transparent 0%, var(--accent-600) 30%, var(--accent) 60%, transparent 100%);
  animation: progress-indeterminate 1.25s var(--ease-in-out) infinite;
}

@keyframes progress-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes progress-slide { from { background-position: 0 0; } to { background-position: 200% 0; } }
@keyframes progress-indeterminate {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* circular progress (SVG) */
.progress-ring { display: inline-block; transform: rotate(-90deg); flex: none; }
.progress-ring circle {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--dur-slow) var(--ease-out), stroke var(--dur-base) var(--ease-out);
}
.progress-ring circle.track { stroke: var(--surface-3); }
.progress-ring circle.bar { stroke: var(--accent-600); filter: drop-shadow(0 0 4px var(--accent-glow)); }
.progress-ring.spin { animation: ring-spin 1.4s linear infinite; }
@keyframes ring-spin { to { transform: rotate(270deg); } }

/* stepped progress dots */
.progress-steps { display: flex; align-items: center; gap: 0; width: 100%; min-width: 0; }
.progress-steps .step-dot {
  position: relative;
  flex: none;
  width: 12px; height: 12px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  border: 2px solid var(--border-strong);
  transition: all var(--dur-base) var(--ease-spring);
}
.progress-steps .step-dot.done { background: var(--accent-600); border-color: var(--accent-600); }
.progress-steps .step-dot.current {
  background: var(--accent);
  border-color: var(--accent-600);
  transform: scale(1.25);
  animation: step-pulse 1.6s var(--ease-in-out) infinite;
}
.progress-steps .step-line { flex: 1 1 auto; height: 2px; background: var(--border-strong); min-width: 12px; }
.progress-steps .step-line.done { background: var(--accent-600); }
.progress-steps .step-line.active {
  background-image: linear-gradient(90deg, var(--accent-600), var(--accent), var(--accent-600));
  background-size: 200% 100%;
  animation: flow-dash 1.4s linear infinite;
}
@keyframes step-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 7px rgba(130, 243, 132, 0.08); }
}

/* ---------- 12. JOB PILL (bottom-fixed) ---------- */
.job-pill-stack {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sp-5) + var(--safe-b));
  transform: translateX(-50%);
  z-index: var(--z-pill);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: var(--sp-2);
  pointer-events: none;
  max-width: calc(100vw - var(--sp-8));
}
.job-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: 100%;
  min-height: var(--tap-min);
  padding: var(--sp-2) var(--sp-5) var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  animation: pill-in var(--dur-slow) var(--ease-spring) both;
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.job-pill:hover { transform: translateY(-2px); border-color: var(--accent-600); }
.job-pill:active { transform: scale(0.98); }
.job-pill:focus-visible { outline: none; box-shadow: var(--shadow-lg), var(--ring); }
.job-pill .job-pill-title {
  font-weight: var(--fw-semibold);
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-pill .job-pill-sub { font-size: var(--fs-sm); color: var(--text-muted); }
.job-pill .job-pill-pct {
  margin-left: var(--sp-1);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-bold);
  color: var(--accent-700);
}
.job-pill .job-pill-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.job-pill.done { border-color: var(--accent-600); background: var(--accent-soft); }
.job-pill.failed { border-color: var(--danger); background: var(--danger-soft); }
.job-pill.leaving { animation: pill-out var(--dur-base) var(--ease-out) both; }

@keyframes pill-in {
  from { opacity: 0; transform: translateY(24px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pill-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(16px) scale(0.94); }
}

/* ---------- 13. TOASTS ---------- */
.toast-host {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: min(380px, calc(100vw - var(--sp-8)));
  pointer-events: none;
}
.toast {
  position: relative;
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-left: 3px solid var(--neutral);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: toast-in var(--dur-base) var(--ease-spring) both;
}
.toast .toast-icon { flex: none; margin-top: 1px; color: var(--neutral); }
.toast .toast-body { min-width: 0; flex: 1; }
.toast .toast-title { font-weight: var(--fw-semibold); font-size: var(--fs-base); }
.toast .toast-msg { font-size: var(--fs-sm); color: var(--text-muted); overflow-wrap: anywhere; }
.toast .toast-close {
  flex: none;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
}
.toast .toast-close:hover { background: var(--surface-hover); color: var(--text); }
.toast .toast-close:focus-visible { outline: none; box-shadow: var(--ring); }
.toast .toast-progress {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  width: 100%;
  background: currentColor;
  opacity: 0.35;
  transform-origin: left center;
  animation: toast-timer 5s linear forwards;
}
.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon, .toast-success .toast-progress { color: var(--success-text); }
.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon, .toast-error .toast-progress { color: var(--danger-text); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon, .toast-warning .toast-progress { color: var(--warning-text); }
.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon, .toast-info .toast-progress { color: var(--info-text); }
.toast.leaving { animation: toast-out var(--dur-base) var(--ease-out) both; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(28px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); max-height: 200px; }
  to { opacity: 0; transform: translateX(28px); max-height: 0; }
}
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- 14. MODAL / SHEET ---------- */
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: var(--overlay);
  backdrop-filter: blur(3px);
  animation: fade-in var(--dur-base) var(--ease-out) both;
  overflow-y: auto;
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - var(--sp-9));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in var(--dur-base) var(--ease-spring) both;
}
.modal.wide { width: min(900px, 100%); }
.modal-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.modal-header .modal-title { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.modal-header .modal-close { margin-left: auto; }
.modal-body { padding: var(--sp-5); overflow-y: auto; min-height: 0; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.modal-footer .footer-left { margin-right: auto; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ---------- 15. SKELETON / EMPTY / SPINNER ---------- */
.skeleton {
  position: relative;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
}
[data-theme='dark'] .skeleton::after {
  background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.07) 50%, transparent 100%);
}
.skeleton-text { height: 12px; margin-bottom: var(--sp-2); border-radius: var(--radius-full); }
.skeleton-text:nth-of-type(even) { width: 78%; }
.skeleton-text:last-child { width: 55%; margin-bottom: 0; }
.skeleton-row { height: 40px; margin-bottom: var(--sp-2); border-radius: var(--radius-sm); }
.skeleton-card { height: 140px; border-radius: var(--radius); }
@keyframes skeleton-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-10) var(--sp-5);
  text-align: center;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent-600);
}
.empty-state .empty-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text); }
.empty-state .empty-desc { font-size: var(--fs-base); color: var(--text-muted); max-width: 46ch; margin: 0; }
.empty-state .empty-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); flex-wrap: wrap; justify-content: center; }

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  flex: none;
  border: 2px solid var(--surface-3);
  border-top-color: var(--accent-600);
  border-radius: var(--radius-full);
  animation: spin 0.75s linear infinite;
}
.spinner.lg { width: 32px; height: 32px; border-width: 3px; }
.spinner.sm { width: 14px; height: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 16. TABS ---------- */
.tabs {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  flex: none;
  min-height: 40px;
  padding: var(--sp-2) var(--sp-4);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  transition: color var(--dur-fast) var(--ease-out);
}
.tab::after {
  content: '';
  position: absolute;
  left: var(--sp-3); right: var(--sp-3);
  bottom: -1px;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--accent-600);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--dur-base) var(--ease-out);
}
.tab:hover { color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--accent-600); outline-offset: -2px; border-radius: var(--radius-sm); }
.tab.active { color: var(--accent-700); font-weight: var(--fw-semibold); }
.tab.active::after { transform: scaleX(1); }
.tab .tab-count {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-muted);
}
.tab.active .tab-count { background: var(--accent-soft); color: var(--accent-700); }

/* ---------- 17. DARK DATA CANVAS ---------- */
.canvas {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius);
  border: 1px solid var(--canvas-border);
  background-color: var(--canvas-bg);
  background-image:
    radial-gradient(120% 90% at 15% 0%, rgba(130, 243, 132, 0.10) 0%, transparent 60%),
    radial-gradient(100% 80% at 90% 100%, rgba(78, 224, 193, 0.09) 0%, transparent 62%),
    linear-gradient(var(--canvas-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--canvas-grid) 1px, transparent 1px),
    linear-gradient(160deg, var(--canvas-bg-2) 0%, var(--canvas-bg) 55%);
  background-size: auto, auto, 28px 28px, 28px 28px, auto;
  background-position: 0 0, 0 0, -1px -1px, -1px -1px, 0 0;
  color: var(--canvas-text);
  padding: var(--sp-5);
  overflow: hidden;
  min-width: 0;
}
.canvas h1, .canvas h2, .canvas h3, .canvas h4, .canvas h5, .canvas h6 { color: var(--canvas-text); }
.canvas .canvas-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--canvas-text);
  margin-bottom: var(--sp-1);
}
.canvas .canvas-sub { font-size: var(--fs-sm); color: var(--canvas-muted); margin-bottom: var(--sp-4); }
.canvas .muted,
.canvas .canvas-muted { color: var(--canvas-muted); }
.canvas text,
.canvas .axis,
.canvas .tick { fill: var(--canvas-muted); color: var(--canvas-muted); font-size: var(--fs-sm); }
.canvas .axis-line,
.canvas .gridline { stroke: var(--canvas-grid); }
.canvas a { color: var(--canvas-accent); }
.canvas .legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--canvas-border);
  font-size: var(--fs-sm);
  color: var(--canvas-muted);
}
.canvas .legend .legend-item { display: inline-flex; align-items: center; gap: var(--sp-2); }
.canvas .legend .legend-swatch {
  width: 10px; height: 10px;
  flex: none;
  border-radius: 3px;
  background: var(--canvas-accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.canvas .canvas-figure { position: relative; z-index: 1; overflow-x: auto; min-width: 0; }
.canvas .canvas-metric {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  color: var(--canvas-accent);
  text-shadow: 0 0 22px var(--accent-glow);
  line-height: var(--lh-tight);
}

.canvas .starfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(230, 247, 234, 0.55) 50%, transparent 50%),
    radial-gradient(1px 1px at 34% 68%, rgba(130, 243, 132, 0.45) 50%, transparent 50%),
    radial-gradient(1px 1px at 58% 18%, rgba(230, 247, 234, 0.40) 50%, transparent 50%),
    radial-gradient(1.4px 1.4px at 76% 54%, rgba(78, 224, 193, 0.40) 50%, transparent 50%),
    radial-gradient(1px 1px at 88% 82%, rgba(230, 247, 234, 0.35) 50%, transparent 50%),
    radial-gradient(1px 1px at 22% 88%, rgba(130, 243, 132, 0.30) 50%, transparent 50%),
    radial-gradient(1px 1px at 66% 92%, rgba(230, 247, 234, 0.28) 50%, transparent 50%),
    radial-gradient(1.2px 1.2px at 46% 40%, rgba(123, 176, 255, 0.35) 50%, transparent 50%);
  background-size: 320px 320px;
  background-repeat: repeat;
  animation: starfield-twinkle 6s var(--ease-in-out) infinite;
}
@keyframes starfield-twinkle {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 0.72; }
}

.canvas.aurora::before {
  content: '';
  position: absolute;
  inset: -30%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  filter: blur(38px);
  background-image:
    radial-gradient(38% 46% at 22% 30%, rgba(130, 243, 132, 0.35) 0%, transparent 70%),
    radial-gradient(34% 40% at 72% 44%, rgba(78, 224, 193, 0.30) 0%, transparent 72%),
    radial-gradient(30% 38% at 48% 78%, rgba(123, 176, 255, 0.24) 0%, transparent 72%);
  animation: aurora-drift 18s var(--ease-in-out) infinite alternate;
}
.canvas.aurora > * { position: relative; z-index: 1; }
@keyframes aurora-drift {
  0% { transform: translate3d(-4%, -2%, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(3%, 3%, 0) rotate(6deg) scale(1.12); }
  100% { transform: translate3d(6%, -3%, 0) rotate(-5deg) scale(1.05); }
}

.canvas .canvas-toolbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.canvas .btn-ghost { color: var(--canvas-muted); }
.canvas .btn-ghost:hover:not(:disabled) { background: rgba(130, 243, 132, 0.10); color: var(--canvas-text); }

/* ---------- 18. UTILITIES ---------- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; min-width: 0; }
.flex-none { flex: none; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mt-auto { margin-top: auto; }

/* 그리드 — gap 기본값을 반드시 갖는다. (없으면 카드가 서로 맞붙어 보인다) */
.grid { display: grid; gap: var(--grid-gap); }
.grid-2 { display: grid; gap: var(--grid-gap); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: var(--grid-gap); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: var(--grid-gap); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { display: grid; gap: var(--grid-gap); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.gap-0 { gap: 0; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-5); }
.mt-5 { margin-top: var(--sp-6); }
.mt-6 { margin-top: var(--sp-8); }
.mt-8 { margin-top: var(--sp-9); }
.ml-1 { margin-left: var(--sp-1); }
.ml-2 { margin-left: var(--sp-2); }
.mr-1 { margin-right: var(--sp-1); }
.mr-2 { margin-right: var(--sp-2); }
.p-0 { padding: 0; }
.p-3 { padding: var(--sp-3); }
.p-4 { padding: var(--sp-4); }
.p-5 { padding: var(--sp-5); }
.p-6 { padding: var(--sp-6); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-w-0 { min-width: 0; }
.overflow-x-auto { overflow-x: auto; max-width: 100%; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }

.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-base { font-size: var(--fs-base); }
.text-lg { font-size: var(--fs-lg); }
.text-xl { font-size: var(--fs-xl); }
.text-2xl { font-size: var(--fs-2xl); }
.text-3xl { font-size: var(--fs-3xl); }
.fw-medium { font-weight: var(--fw-medium); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-bold { font-weight: var(--fw-bold); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-accent { color: var(--accent-600); }
.text-success { color: var(--success-text); }
.text-warning { color: var(--warning-text); }
.text-danger { color: var(--danger-text); }
.text-info { color: var(--info-text); }
.uppercase { text-transform: uppercase; letter-spacing: var(--tracking-wide); }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.divider { height: 1px; background: var(--border); border: 0; margin: var(--sp-4) 0; }
.divider-v { width: 1px; align-self: stretch; background: var(--border); }
.surface { background: var(--surface); }
.rounded { border-radius: var(--radius); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.glow { box-shadow: var(--shadow-glow); }
.hide-mobile { display: initial; }
.show-mobile { display: none; }
.no-scroll { overflow: hidden; }

/* ---------- 19. RESPONSIVE ---------- */
@media (max-width: 1200px) {
  :root { --sidebar-w: 238px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app-shell,
  .app-shell:has(.sidebar.collapsed) { grid-template-columns: minmax(0, 1fr); }
  .main-col { grid-column: 1; }
  .sidebar,
  .sidebar.collapsed {
    position: fixed;
    top: 0; left: 0;
    width: min(280px, 84vw);
    height: 100dvh;
    padding: var(--sp-4) var(--sp-3);
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    transition: transform var(--dur-base) var(--ease-out);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed .sidebar-label,
  .sidebar.collapsed .sidebar-section-label,
  .sidebar.collapsed .sidebar-badge { display: initial; }
  .sidebar.collapsed .sidebar-item { justify-content: flex-start; padding-left: var(--sp-3); padding-right: var(--sp-3); }
  .sidebar.collapsed .sidebar-item[data-tip]::after { display: none; }
  .hamburger { display: inline-flex; }
  .sidebar-item { min-height: var(--tap-min); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-mobile { display: none !important; }
  .show-mobile { display: initial; }
}
@media (max-width: 720px) {
  .page-header { padding: var(--sp-5) var(--sp-4) var(--sp-3); }
  .page-body { padding: 0 var(--sp-4) var(--sp-9); }
  .topbar { padding: 0 var(--sp-4); }
  .card-body, .modal-body { padding: var(--sp-4); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .btn { min-height: var(--tap-min); }
  .btn-sm { min-height: 34px; }
  .btn-icon { width: var(--tap-min); min-width: var(--tap-min); }
  .tab { min-height: var(--tap-min); }
  .job-pill-stack { left: var(--sp-3); right: var(--sp-3); transform: none; max-width: none; align-items: stretch; }
  .job-pill { width: 100%; }
  .toast-host { top: auto; bottom: calc(var(--sp-3) + var(--safe-b)); left: var(--sp-3); right: var(--sp-3); width: auto; }

  .modal-scrim { padding: 0; place-items: end center; }
  .modal.sheet {
    width: 100%;
    max-height: 88dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 0;
    padding-bottom: var(--safe-b);
    animation: sheet-in var(--dur-base) var(--ease-out) both;
  }
  .modal.sheet .modal-header::before {
    content: '';
    position: absolute;
    top: 6px; left: 50%;
    width: 36px; height: 4px;
    transform: translateX(-50%);
    border-radius: var(--radius-full);
    background: var(--border-strong);
  }
  .modal.sheet .modal-header { position: relative; padding-top: var(--sp-5); }
}
@media (max-width: 480px) {
  :root { --fs-3xl: 26px; --fs-4xl: 32px; --fs-5xl: 38px; }
  .page-header { padding: var(--sp-4) var(--sp-3) var(--sp-3); }
  .page-body { padding: 0 var(--sp-3) var(--sp-9); }
  .page-header .page-actions { width: 100%; margin-left: 0; }
  .card-body, .card-header, .card-footer { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .canvas { padding: var(--sp-4); }
  .flow-step { min-width: 96px; }
}

/* ---------- 20. REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .progress-bar::after,
  .canvas.aurora::before,
  .canvas .starfield { display: none; }
  .card.interactive:hover { transform: none; }
}

/* ---------- 21. PRINT ---------- */
@media print {
  .sidebar, .topbar, .job-pill-stack, .toast-host, .hamburger, .drawer-scrim { display: none !important; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .card { box-shadow: none; border-color: #ccc; }
  body { background: #fff; }
}

/* ==================================================================
   22. LAYOUT REFINEMENT — 네이버식 모듈 리듬
   카드가 서로 맞붙지 않게 하고, 섹션 사이 호흡을 넓힌다.
   이 블록은 app.css 의 마지막에 두어 앞선 규칙을 정리한다.
   ================================================================== */

/* ---- 22.1 브랜드 (사이드바 로고 + 워드마크) ---- */
.sidebar-brand {
  position: relative;
  gap: var(--sp-2);
  padding: var(--sp-3) 32px var(--sp-4) 6px;
  margin-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;          /* 워드마크가 사이드바 밖으로 새지 않게 */
}
.sidebar-brand .brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  text-decoration: none;
  color: inherit;
}
/* 접기 버튼 — 브랜드 오른쪽에 또렷한 원형 버튼으로 둔다 */
.sidebar-brand .sidebar-toggle {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-subtle);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.sidebar-brand .sidebar-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.sidebar-brand .sidebar-toggle:focus-visible { outline: 2px solid var(--accent-600); outline-offset: 2px; }
.sidebar-brand .sidebar-toggle svg { display: block; transition: transform var(--dur-base) var(--ease-out); }
.sidebar-brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
}
.sidebar-brand .brand-glyph {
  width: 42px; height: 42px; display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(10, 40, 24, 0.18));
}
[data-theme='dark'] .sidebar-brand .brand-glyph {
  filter: drop-shadow(0 0 10px rgba(130, 243, 132, 0.28));
}
.sidebar-brand .brand-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand .brand-name {
  font-size: 21px;
  font-weight: var(--fw-black);
  letter-spacing: -0.04em;
  line-height: 1.14;
  color: var(--text);
  white-space: nowrap;
}
.sidebar-brand .brand-name b { font-weight: var(--fw-black); color: var(--accent-600); }
.sidebar-brand .brand-sub { display: none; }   /* 태그라인 제거 */
.sidebar-brand .sidebar-toggle { margin-left: auto; flex: none; }

.sidebar.collapsed .sidebar-brand { border-bottom-color: transparent; padding-bottom: var(--sp-3); }
.sidebar.collapsed .sidebar-brand .brand-mark { width: 40px; height: 40px; }

/* ---- 22.2 페이지 리듬 ---- */
.page-header { padding: var(--sp-8) var(--sp-8) var(--sp-5); gap: var(--sp-5); }
.page-header .page-title { font-size: 27px; letter-spacing: -0.025em; line-height: 1.25; }
.page-header .page-desc { margin-top: 6px; font-size: var(--fs-md); line-height: 1.55; }
.page-body { padding: 0 var(--sp-8) var(--sp-12); }
.page-body.narrow { max-width: 100%; }

/* 페이지 본문 안에서 연속한 블록끼리 최소 간격을 보장 */
.page-body > .grid + .grid,
.page-body > .card + .card,
.page-body > .grid + .card,
.page-body > .card + .grid,
.page-body > section + section { margin-top: var(--section-gap); }

/* ---- 22.3 카드 ---- */
.card { border-radius: 14px; }
.card-header {
  min-height: 54px;
  padding: var(--sp-4) var(--card-pad);
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.card-title { font-size: var(--fs-lg); letter-spacing: -0.015em; }
.card-body { padding: var(--card-pad); }
.card-footer { padding: var(--sp-3) var(--card-pad); }
.card.interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* 카드 안에서 첫/마지막 요소의 여백이 이중으로 붙지 않게 */
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child { margin-bottom: 0; }

/* 차트를 담는 카드 — 차트가 테두리에 닿지 않도록 */
.card-body > [id^='c-'] { margin: 2px 0; }

/* ---- 22.4 섹션 헤더 (네이버 모듈 제목) ---- */
.section-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--section-gap) 0 var(--sp-4);
  flex-wrap: wrap;
}
.section-head:first-child { margin-top: 0; }
.section-head h2,
.section-head .section-title {
  position: relative;
  padding-left: 12px;
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  color: var(--text);
}
.section-head h2::before,
.section-head .section-title::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  width: 4px; height: 17px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-600) 100%);
}
.section-head .section-desc { font-size: var(--fs-sm); color: var(--text-muted); }
.section-head .section-actions { margin-left: auto; display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---- 22.5 근거 칩(ev-row) — 줄바꿈 여유 ---- */
.ev-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.ev-row + .ev-row { margin-top: var(--sp-2); }

/* ---- 22.6 큰 지표 ---- */
.big-metric {
  font-size: 34px;
  font-weight: var(--fw-black);
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
}
.big-metric.empty { color: var(--text-subtle); }

/* ---- 22.7 표 ---- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table th { white-space: nowrap; }
.table td, .table th { padding: 11px var(--sp-4); }
.table-compact td, .table-compact th { padding: 8px var(--sp-3); }

/* ---- 22.8 목록형 본문 (방법론 등) ---- */
.bullet-list, .numbered-list { margin: 0; padding-left: 20px; display: grid; gap: var(--sp-3); }
.bullet-list li, .numbered-list li { line-height: 1.7; color: var(--text-muted); }
.bullet-list li b, .numbered-list li b { color: var(--text); }
.bullet-list.warn-list li::marker { color: var(--warning); }

/* ---- 22.9 반응형 간격 ---- */
@media (max-width: 1200px) {
  :root { --grid-gap: 18px; --section-gap: 24px; }
}
@media (max-width: 900px) {
  :root { --grid-gap: 16px; --section-gap: 22px; --card-pad: 18px; }
  .page-header { padding: var(--sp-6) var(--sp-5) var(--sp-4); }
  .page-body { padding: 0 var(--sp-5) var(--sp-10); }
}
@media (max-width: 720px) {
  :root { --grid-gap: 14px; --section-gap: 20px; --card-pad: 16px; }
  .page-header { padding: var(--sp-5) var(--sp-4) var(--sp-3); }
  .page-header .page-title { font-size: 22px; }
  .page-body { padding: 0 var(--sp-4) var(--sp-10); }
  .sidebar-brand .brand-name { font-size: 21px; }
}
@media (max-width: 480px) {
  :root { --grid-gap: 12px; --card-pad: 14px; }
  .page-body { padding: 0 var(--sp-3) var(--sp-10); }
}

/* ---- 22.10 초광폭 화면: 좌우 여백만 키우고 본문은 창을 가득 채운다 ---- */
@media (min-width: 1700px) {
  .page-header { padding-left: var(--sp-10); padding-right: var(--sp-10); }
  .page-body { padding-left: var(--sp-10); padding-right: var(--sp-10); }
  .topbar { padding-left: var(--sp-9); padding-right: var(--sp-9); }
}
@media (min-width: 2200px) {
  :root { --grid-gap: 24px; --section-gap: 32px; }
  .page-header { padding-left: var(--sp-12); padding-right: var(--sp-12); }
  .page-body { padding-left: var(--sp-12); padding-right: var(--sp-12); }
  .topbar { padding-left: var(--sp-11); padding-right: var(--sp-11); }
}

/* ==================================================================
   23. 한국어 줄바꿈 — 단어 중간에서 끊기지 않게 (word-break: keep-all)
   문장은 띄어쓰기 단위로만 넘어가고, 끊을 곳이 없는 긴 토큰
   (SMILES · 해시 · URL · 유전자 목록)만 예외로 강제 분절한다.
   ================================================================== */
html,
body {
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: normal;
}
/* 상속되지 않는 폼 요소에도 동일하게 적용 */
button, input, select, textarea, optgroup {
  word-break: keep-all;
  overflow-wrap: break-word;
}
/* 끊을 공백이 없는 값들은 어디서든 끊는다 */
.mono,
code, pre, kbd, samp,
.smiles, .seq, .hash, .token,
.ev-chip .ev-v,
.badge,
a[href^='http'],
.break-anywhere {
  word-break: normal;
  overflow-wrap: anywhere;
}
pre, code { white-space: pre-wrap; }
/* 표 셀: 숫자·식별자는 줄바꿈하지 않고, 설명 셀만 keep-all 로 흐른다 */
.table td.num, .table th.num,
.table td.mono, .table th.mono { white-space: nowrap; }

/* ==================================================================
   24. 접힌 사이드바 · 검색 입력창 정리
   ================================================================== */

/* ---- 24.1 접힌 사이드바: 로고 위, 토글 아래 (겹치지 않게) ---- */
.sidebar.collapsed .sidebar-brand {
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) 0 var(--sp-3);
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.sidebar.collapsed .sidebar-brand .brand-link { flex: none; justify-content: center; gap: 0; }
.sidebar.collapsed .sidebar-brand .brand-text { display: none; }
.sidebar.collapsed .sidebar-brand .sidebar-toggle {
  position: static;
  transform: none;
  margin: 0 auto;
}
/* 화살표 방향은 applySidebarState() 가 chevron-left/right 로 바꿔 준다 */

/* ---- 24.2 검색 입력창: 아이콘을 입력칸 안쪽에 ---- */
.input-group:has(> .input-icon) { position: relative; }
.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  pointer-events: none;
  z-index: var(--z-raised);
}
.input-icon + .input,
.input-icon ~ .input {
  padding-left: 38px;
  border-radius: var(--radius-sm);
}
/* 아이콘이 있는 그룹은 붙임(-1px) 처리를 하지 않는다 */
.input-group > .input-icon + * { margin-left: 0; }
.input-group:focus-within .input-icon { color: var(--accent-600); }

/* 지우기 버튼(있을 때) */
.input-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
}
.input-clear:hover { background: var(--surface-2); color: var(--text); }

/* ---- 24.3 툴바: 검색은 넉넉하게, 나머지는 내용만큼 ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-5);
  margin-bottom: var(--sp-2);
}
.toolbar > .input-group.flex-1 { flex: 1 1 280px; max-width: 460px; min-width: 220px; }
.toolbar > .input-group { flex: 0 1 320px; min-width: 200px; }
.toolbar > .select { flex: 0 0 auto; width: auto; min-width: 150px; max-width: 260px; }
.toolbar > .checkbox,
.toolbar > .btn,
.toolbar > .btn-group { flex: 0 0 auto; }
.toolbar .toolbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

@media (max-width: 720px) {
  .toolbar > .input-group,
  .toolbar > .input-group.flex-1 { flex: 1 1 100%; max-width: none; }
  .toolbar > .select { flex: 1 1 calc(50% - var(--sp-3)); max-width: none; }
}

/* ---- 24.4 입력 요소 마무리 ---- */
.input, .select, .textarea {
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.input:hover:not(:disabled),
.select:hover:not(:disabled),
.textarea:hover:not(:disabled) { border-color: var(--border-strong); }
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }

/* ==================================================================
   25. 진행 표시 — 하단 작업 알약 + 목록 인라인 진행바
   ================================================================== */

/* ---- 25.1 작업 알약 (job pill) ---- */
.job-pill {
  position: relative;
  overflow: hidden;
  padding: 9px 14px 9px 10px;
  gap: 11px;
  backdrop-filter: saturate(1.3) blur(10px);
}
/* 알약 아래를 따라 흐르는 진행선 */
.job-pill::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--accent-600), var(--accent));
  transition: transform var(--dur-slow) var(--ease-out);
}
.job-pill.done::after { transform: scaleX(1); }
.job-pill.failed::after { background: var(--danger); transform: scaleX(1); }

.job-pill-ring {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  flex: none;
}
.job-pill-ring svg {
  position: absolute;
  inset: 0;
  width: 34px; height: 34px;
  transform: rotate(-90deg);
}
.job-pill-ring circle { fill: none; stroke-width: 3.2; stroke-linecap: round; }
.job-pill-ring .ring-track { stroke: var(--surface-3); }
.job-pill-ring .ring-value {
  stroke: var(--accent-600);
  filter: drop-shadow(0 0 4px var(--accent-glow));
  transition: stroke-dashoffset var(--dur-slow) var(--ease-out);
}
.job-pill.done .ring-value { stroke: var(--accent-600); }
.job-pill.failed .ring-value { stroke: var(--danger); filter: none; }
/* 대기 중(진행률 미상)에는 링을 돌린다 */
.job-pill.queued .job-pill-ring svg { animation: ring-spin 1.5s linear infinite; }

.job-pill .job-pill-pct {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 11.5px;
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  color: var(--accent-700);
  line-height: 1;
}
.job-pill.failed .job-pill-pct { color: var(--danger-text); }
.job-pill .job-pill-pct svg { display: block; }

.job-pill-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: left;
  line-height: 1.35;
}
.job-pill .job-pill-title { font-size: 13.5px; max-width: 30ch; }
.job-pill .job-pill-stage {
  font-size: 11.5px;
  color: var(--text-muted);
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-pill-cancel {
  flex: none;
  width: 26px; height: 26px;
  min-width: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--text-subtle);
}
.job-pill-cancel:hover { background: var(--surface-2); color: var(--danger-text); }

@keyframes ring-spin { to { transform: rotate(270deg); } }

/* ---- 25.2 목록 행 인라인 진행바 ---- */
.row-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
}
.row-progress .progress { height: 6px; flex: 1 1 auto; min-width: 70px; }
.row-progress .row-progress-pct {
  flex: none;
  font-size: 11.5px;
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--accent-700);
  min-width: 34px;
  text-align: right;
}
.row-progress .row-progress-stage {
  flex: none;
  max-width: 18ch;
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 상태 배지 옆에서 은은하게 도는 점 */
.badge.badge-running { position: relative; padding-left: 20px; }
.badge.badge-running::before {
  content: '';
  position: absolute;
  left: 8px; top: 50%;
  width: 6px; height: 6px;
  margin-top: -3px;
  border-radius: var(--radius-full);
  background: currentColor;
  animation: badge-blink 1.3s var(--ease-in-out) infinite;
}
@keyframes badge-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

/* ---- 25.3 카드 상단에 붙는 얇은 진행선 ---- */
.card.is-running { position: relative; }
.card.is-running::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background-image: linear-gradient(90deg, transparent 0%, var(--accent-600) 30%,
                    var(--accent) 60%, transparent 100%);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  animation: card-scan 1.5s var(--ease-in-out) infinite;
  z-index: 1;
}
@keyframes card-scan {
  0% { background-position: -45% 0; }
  100% { background-position: 145% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .job-pill.queued .job-pill-ring svg,
  .badge.badge-running::before,
  .card.is-running::before { animation: none; }
}

/* 상단바 제목은 한 줄로만 — 모바일에서 본문을 밀어내지 않게 */
.topbar .topbar-title { min-width: 0; flex: 1 1 auto; }
.topbar .topbar-heading,
.topbar .topbar-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
@media (max-width: 720px) {
  .topbar .topbar-sub { display: none; }
  .topbar .topbar-heading { font-size: var(--fs-base); }
}

/* 진행 알약: 처음 등장할 때만 애니메이션. 갱신 때는 제자리에서 값만 바뀐다. */
.job-pill .job-pill-pct,
.job-pill .job-pill-stage,
.job-pill .job-pill-title { transition: none; }
.job-pill .ring-value { transition: stroke-dashoffset 420ms var(--ease-out); }
.job-pill-cancel[hidden] { display: none !important; }
/* 배지의 점 깜박임을 부드럽게 (눈이 피로하지 않게 진폭을 줄임) */
@keyframes badge-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ==================================================================
   26. 로고에 생명감 넣기 — 숨쉬는 브랜드 마크
   ------------------------------------------------------------------
   기계적으로 보이지 않게 하는 요령: 겹치는 애니메이션의 주기를 서로
   나누어떨어지지 않는 값(4.6s / 6.7s / 9.3s)으로 잡는다. 위상이 계속
   어긋나므로 같은 모습이 반복되지 않아 '살아 있는' 느낌이 난다.
   ================================================================== */
@keyframes vo-breathe {              /* 들숨·날숨 — 아주 작은 진폭 */
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.045); }
}
@keyframes vo-aura {                 /* 마크 뒤 후광. 숨과 다른 주기로 흐른다 */
  0%, 100% { opacity: .34; transform: scale(.92); }
  50%      { opacity: .72; transform: scale(1.12); }
}
@keyframes vo-ripple {               /* 맥박처럼 한 번씩 퍼져 나가는 파문 */
  0%       { opacity: 0; transform: scale(.72); }
  14%      { opacity: .5; }
  60%      { opacity: 0; transform: scale(1.5); }
  100%     { opacity: 0; transform: scale(1.5); }
}

.sidebar-brand .brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.sidebar-brand .brand-mark::before,          /* 후광 */
.sidebar-brand .brand-mark::after {          /* 파문 */
  content: '';
  position: absolute;
  inset: -18%;
  border-radius: var(--radius-full);
  pointer-events: none;
  z-index: -1;
}
.sidebar-brand .brand-mark::before {
  background: radial-gradient(closest-side,
              var(--accent-glow, rgba(130, 243, 132, .55)), transparent 72%);
  filter: blur(5px);
  animation: vo-aura 6.7s ease-in-out infinite;
}
.sidebar-brand .brand-mark::after {
  border: 1.5px solid var(--accent-600);
  animation: vo-ripple 9.3s cubic-bezier(.2, .65, .3, 1) infinite;
}
.sidebar-brand .brand-glyph {
  animation: vo-breathe 4.6s ease-in-out infinite;
  transform-origin: 50% 55%;               /* 아래쪽을 축으로 — 부풀어 오르는 느낌 */
  will-change: transform;
}
/* 마우스를 올리면 한 번 크게 들이쉰다 */
.sidebar-brand .brand-link:hover .brand-glyph {
  animation-duration: 2.1s;
  filter: drop-shadow(0 2px 8px rgba(10, 40, 24, .26))
          drop-shadow(0 0 14px var(--accent-glow, rgba(130, 243, 132, .5)));
}
[data-theme='dark'] .sidebar-brand .brand-mark::before { filter: blur(7px); }

/* 접힌 사이드바에서는 파문이 이웃 아이콘까지 번지므로 숨만 남긴다 */
.sidebar.collapsed .sidebar-brand .brand-mark::after { display: none; }

/* ==================================================================
   27. 빈 상태 일러스트 — 뒤에 옅게 깔리는 빈 페트리접시
   ================================================================== */
.empty-state { position: relative; isolation: isolate; }
.empty-state::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: min(300px, 64%);
  aspect-ratio: 1 / 1;          /* 이미지가 정사각형 · 접시 무게중심이 정중앙 */
  transform: translate(-50%, -50%);
  background: url('/static/img/empty-state.webp') center / contain no-repeat;
  opacity: .55;
  pointer-events: none;
  z-index: -1;
}
[data-theme='dark'] .empty-state::before { opacity: .3; }
.empty-state > * { position: relative; }

/* 접근성 — 움직임을 줄이도록 설정한 사용자에게는 정지 상태로 보여 준다 */
@media (prefers-reduced-motion: reduce) {
  .sidebar-brand .brand-glyph,
  .sidebar-brand .brand-mark::before,
  .sidebar-brand .brand-mark::after { animation: none; }
  .sidebar-brand .brand-mark::after { opacity: 0; }
}

/* ==================================================================
   28. 통계 카드 — 눌러서 해당 화면으로 이동하는 카드
   ================================================================== */
.stat-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
/* 카드 왼쪽 위에서 번지는 색조. 지표마다 색을 달리해 한눈에 구분된다 */
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 0% 0%,
              var(--stat-tint, transparent) 0%, transparent 58%);
  opacity: .55;
  pointer-events: none;
  z-index: -1;
  transition: opacity var(--dur-base) var(--ease-out);
}
.stat-card .stat-icon {
  position: absolute;
  top: var(--sp-4); right: var(--sp-4);
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--stat-tint, var(--surface-2));
  color: var(--stat-ink, var(--text-muted));
  transition: transform var(--dur-base) var(--ease-out);
}
.stat-card .stat-label { padding-right: 42px; }
.stat-card .stat-value { letter-spacing: -0.03em; }
.stat-card .stat-sub { font-size: var(--fs-sm); color: var(--text-muted); }

/* 색조 — 값 자체는 항상 본문 색이라 대비를 잃지 않는다 */
.stat-card.tone-mint   { --stat-tint: rgba(130, 243, 132, .20); --stat-ink: #15803d; }
.stat-card.tone-teal   { --stat-tint: rgba(45, 212, 191, .20);  --stat-ink: #0f766e; }
.stat-card.tone-sky    { --stat-tint: rgba(56, 189, 248, .18);  --stat-ink: #0369a1; }
.stat-card.tone-violet { --stat-tint: rgba(167, 139, 250, .20); --stat-ink: #6d28d9; }
.stat-card.tone-amber  { --stat-tint: rgba(251, 191, 36, .20);  --stat-ink: #b45309; }
[data-theme='dark'] .stat-card.tone-mint   { --stat-ink: #86efac; }
[data-theme='dark'] .stat-card.tone-teal   { --stat-ink: #5eead4; }
[data-theme='dark'] .stat-card.tone-sky    { --stat-ink: #7dd3fc; }
[data-theme='dark'] .stat-card.tone-violet { --stat-ink: #c4b5fd; }
[data-theme='dark'] .stat-card.tone-amber  { --stat-ink: #fcd34d; }

/* ---- 이동 가능한 카드 ---- */
a.stat-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
}
.stat-card .stat-go {
  position: absolute;
  right: var(--sp-5); bottom: var(--sp-4);
  display: inline-flex;
  color: var(--stat-ink, var(--text-muted));
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
  pointer-events: none;
}
a.stat-link:hover,
a.stat-link:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--stat-ink, var(--border-strong));
}
a.stat-link:hover::before, a.stat-link:focus-visible::before { opacity: 1; }
a.stat-link:hover .stat-go, a.stat-link:focus-visible .stat-go {
  opacity: 1; transform: translateX(0);
}
a.stat-link:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }
a.stat-link:active { transform: translateY(-1px); }
a.stat-link:focus-visible { outline: 2px solid var(--accent-600); outline-offset: 2px; }

/* 화면이 좁아지면 손가락이 닿을 만큼만 남기고 장식은 접는다 */
@media (max-width: 640px) {
  .stat-card .stat-go { display: none; }
  .stat-card .stat-icon { width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  a.stat-link, a.stat-link .stat-icon, a.stat-link .stat-go { transition: none; }
  a.stat-link:hover { transform: none; }
}
