/* ============================================================================
   InSitu Design System — single source of truth (no runtime dependencies)
   ----------------------------------------------------------------------------
   Tokens are ported from the shadcn "new-york" theme used by the @efferd
   dashboard-3 / app-shell-3 blocks (radius .65rem, neutral palette, sidebar
   tokens) and expressed as plain CSS so desktop, console and landing share one
   look without Tailwind/shadcn/React deps.

   Copy this file verbatim with scripts/sync-design.sh. Do not edit copies.
   ============================================================================ */

/* ---------- Font (Pretendard Variable, OFL) — path is relative to the copy ---------- */
@font-face {
  font-family: "Pretendard Variable";
  src: url("./fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --radius: 0.65rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-full: 9999px;

  --background: #fafafa;
  --foreground: #060606;
  --card: #ffffff;
  --card-foreground: #060606;
  --popover: #ffffff;
  --popover-foreground: #060606;
  --primary: #171717;
  --primary-foreground: #fafafa;
  --secondary: #eeeeee;
  --secondary-foreground: #171717;
  --muted: #eeeeee;
  --muted-foreground: #737373;
  --accent: #eeeeee;
  --accent-foreground: #171717;
  --destructive: #e40014;
  --destructive-foreground: #ffffff;
  --success: #009588;
  --success-soft: #e3f4f2;
  --warning: #f99c00;
  --warning-soft: #fff3df;
  --info: #1447e6;
  --info-soft: #e5ebfd;
  --border: #dedede;
  --input: #e4e4e4;
  --ring: #bebebe;
  --chart-1: #f05100;
  --chart-2: #009588;
  --chart-3: #104e64;
  --chart-4: #fcbb00;
  --chart-5: #f99c00;
  --sidebar: #fafafa;
  --sidebar-foreground: #060606;
  --sidebar-primary: #171717;
  --sidebar-primary-foreground: #fafafa;
  --sidebar-accent: #eeeeee;
  --sidebar-accent-foreground: #171717;
  --sidebar-border: #e5e5e5;
  --sidebar-ring: #bebebe;
  --brand: #1447e6; /* single accent used sparingly (links, focus, hero) */
  --brand-soft: #e5ebfd;

  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Segoe UI Variable", "Segoe UI", "Malgun Gothic", "Noto Sans KR", Roboto, sans-serif;
  --font-mono: "Geist Mono", "SF Mono", "Cascadia Code", "D2Coding", Menlo, Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.25rem;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);

  --rail-width: 48px;
  --panel-width: 272px;
  --header-height: 48px;
  --sidebar-width: 256px;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --duration: 150ms;

  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #030303;
  --foreground: #fcfcfc;
  --card: #0d0d0d;
  --card-foreground: #fcfcfc;
  --popover: #0d0d0d;
  --popover-foreground: #fcfcfc;
  --primary: #fcfcfc;
  --primary-foreground: #0d0d0d;
  --secondary: #222222;
  --secondary-foreground: #fcfcfc;
  --muted: #222222;
  --muted-foreground: #a1a1a1;
  --accent: #222222;
  --accent-foreground: #fcfcfc;
  --destructive: #ff6568;
  --destructive-foreground: #0d0d0d;
  --success: #00bb7f;
  --success-soft: rgba(0, 187, 127, 0.14);
  --warning: #f99c00;
  --warning-soft: rgba(249, 156, 0, 0.16);
  --info: #5b8bff;
  --info-soft: rgba(20, 71, 230, 0.22);
  --border: rgba(255, 255, 255, 0.11);
  --input: rgba(255, 255, 255, 0.15);
  --ring: #737373;
  --chart-1: #1447e6;
  --chart-2: #00bb7f;
  --chart-3: #f99c00;
  --chart-4: #ac4bff;
  --chart-5: #ff2357;
  --sidebar: #171717;
  --sidebar-foreground: #fcfcfc;
  --sidebar-primary: #1447e6;
  --sidebar-primary-foreground: #fcfcfc;
  --sidebar-accent: #262626;
  --sidebar-accent-foreground: #fcfcfc;
  --sidebar-border: rgba(255, 255, 255, 0.1);
  --sidebar-ring: #737373;
  --brand: #5b8bff;
  --brand-soft: rgba(20, 71, 230, 0.22);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #030303;
    --foreground: #fcfcfc;
    --card: #0d0d0d;
    --card-foreground: #fcfcfc;
    --popover: #0d0d0d;
    --popover-foreground: #fcfcfc;
    --primary: #fcfcfc;
    --primary-foreground: #0d0d0d;
    --secondary: #222222;
    --secondary-foreground: #fcfcfc;
    --muted: #222222;
    --muted-foreground: #a1a1a1;
    --accent: #222222;
    --accent-foreground: #fcfcfc;
    --destructive: #ff6568;
    --destructive-foreground: #0d0d0d;
    --success: #00bb7f;
    --success-soft: rgba(0, 187, 127, 0.14);
    --warning: #f99c00;
    --warning-soft: rgba(249, 156, 0, 0.16);
    --info: #5b8bff;
    --info-soft: rgba(20, 71, 230, 0.22);
    --border: rgba(255, 255, 255, 0.11);
    --input: rgba(255, 255, 255, 0.15);
    --ring: #737373;
    --chart-1: #1447e6;
    --chart-2: #00bb7f;
    --chart-3: #f99c00;
    --chart-4: #ac4bff;
    --chart-5: #ff2357;
    --sidebar: #171717;
    --sidebar-foreground: #fcfcfc;
    --sidebar-primary: #1447e6;
    --sidebar-primary-foreground: #fcfcfc;
    --sidebar-accent: #262626;
    --sidebar-accent-foreground: #fcfcfc;
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --sidebar-ring: #737373;
    --brand: #5b8bff;
    --brand-soft: rgba(20, 71, 230, 0.22);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.6);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  font-feature-settings: "ss01", "cv11";
  /* Korean: break between words (어절), never inside one. Long tokens (paths, URLs) still wrap. */
  word-break: keep-all;
  overflow-wrap: anywhere;
}
code, pre, kbd, .mono, .break-all { word-break: break-all; }
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a.link { color: var(--brand); }
a.link:hover { text-decoration: underline; }
code, pre, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; }
pre { margin: 0; overflow: auto; }
hr, .separator { border: 0; border-top: 1px solid var(--border); margin: 0; }
.separator-v { width: 1px; align-self: stretch; background: var(--border); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
::selection { background: var(--brand-soft); }
img, svg { display: block; max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted-foreground); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row { display: flex; align-items: center; gap: var(--space-2); }
.col { display: flex; flex-direction: column; gap: var(--space-2); }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); } .gap-4 { gap: var(--space-4); } .gap-6 { gap: var(--space-6); }
.mt-2 { margin-top: var(--space-2); } .mt-4 { margin-top: var(--space-4); } .mt-6 { margin-top: var(--space-6); } .mb-2 { margin-bottom: var(--space-2); } .mb-4 { margin-bottom: var(--space-4); }
.scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--ring) transparent; }
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--ring); border-radius: var(--radius-full); border: 2px solid transparent; background-clip: content-box; }

/* ---------- Icons (inline SVG helper) ---------- */
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 36px; padding: 0 var(--space-4);
  border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: var(--text-base); font-weight: 500; white-space: nowrap; user-select: none;
  background: var(--primary); color: var(--primary-foreground);
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), color var(--duration) var(--ease), box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.btn:hover { background: color-mix(in srgb, var(--primary) 90%, transparent); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn-outline { background: var(--card); color: var(--foreground); border-color: var(--border); box-shadow: var(--shadow-xs); }
.btn-outline:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { background: color-mix(in srgb, var(--secondary) 80%, var(--foreground) 6%); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-destructive { background: var(--destructive); color: var(--destructive-foreground); }
.btn-destructive:hover { background: color-mix(in srgb, var(--destructive) 90%, black); }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: color-mix(in srgb, var(--brand) 88%, black); }
.btn-link { background: transparent; color: var(--brand); padding: 0; height: auto; }
.btn-link:hover { text-decoration: underline; background: transparent; }
.btn-sm { height: 30px; padding: 0 var(--space-3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-xs { height: 26px; padding: 0 var(--space-2); font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg { height: 42px; padding: 0 var(--space-6); font-size: var(--text-md); }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon.btn-xs { width: 26px; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 var(--space-3);
  border: 1px solid var(--input); border-radius: var(--radius-md);
  background: var(--card); color: var(--foreground); box-shadow: var(--shadow-xs);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.input:disabled, .select:disabled, .textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--destructive); }
.input-sm, .select-sm { height: 30px; font-size: var(--text-sm); padding: 0 var(--space-2); }
.textarea { height: auto; min-height: 88px; padding: var(--space-2) var(--space-3); resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: var(--text-sm); font-weight: 500; color: var(--foreground); }
.hint { font-size: var(--text-xs); color: var(--muted-foreground); }
.error-text { font-size: var(--text-xs); color: var(--destructive); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .icon { position: absolute; left: 10px; color: var(--muted-foreground); pointer-events: none; }
.input-group .input { padding-left: 32px; }
.checkbox, .radio { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.check { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); cursor: pointer; }

/* Switch */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: var(--radius-full); background: var(--input); transition: background var(--duration) var(--ease); }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow-sm); transition: transform var(--duration) var(--ease); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- Card ---------- */
.card { background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: var(--radius-xl); display: flex; flex-direction: column; }
.card-header { padding: var(--space-5) var(--space-5) 0; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-size: var(--text-md); font-weight: 600; }
.card-description { font-size: var(--text-sm); color: var(--muted-foreground); }
.card-content { padding: var(--space-5); }
.card-footer { padding: 0 var(--space-5) var(--space-5); display: flex; align-items: center; gap: var(--space-2); }
.card-sm .card-header { padding: var(--space-4) var(--space-4) 0; }
.card-sm .card-content { padding: var(--space-4); }
.card-hover { transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease); cursor: pointer; }
.card-hover:hover { border-color: var(--ring); box-shadow: var(--shadow-sm); }

/* Stat (dashboard-3 stats.tsx) */
.stat .stat-label { font-size: var(--text-xs); color: var(--muted-foreground); font-weight: 400; }
.stat .stat-value { font-size: var(--text-2xl); font-weight: 600; font-variant-numeric: tabular-nums; margin-top: var(--space-2); }
.stat .stat-foot { font-size: var(--text-xs); color: var(--muted-foreground); display: flex; gap: 4px; align-items: center; margin-top: var(--space-2); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.delta-up { color: #059669; } .delta-down { color: #e11d48; }

/* ---------- Badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-full); border: 1px solid transparent; font-size: var(--text-xs); font-weight: 500; white-space: nowrap; background: var(--primary); color: var(--primary-foreground); }
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge-outline { background: transparent; border-color: var(--border); color: var(--foreground); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: #b45309; }
.badge-destructive { background: color-mix(in srgb, var(--destructive) 12%, transparent); color: var(--destructive); }
.badge-info { background: var(--info-soft); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Avatar ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--secondary); color: var(--secondary-foreground); display: inline-flex; align-items: center; justify-content: center; font-size: var(--text-sm); font-weight: 600; flex: none; overflow: hidden; }
.avatar-sm { width: 24px; height: 24px; font-size: var(--text-xs); }
.avatar-lg { width: 40px; height: 40px; font-size: var(--text-md); }

/* ---------- Table ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; font-weight: 500; color: var(--muted-foreground); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: color-mix(in srgb, var(--muted) 50%, var(--card)); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.table tr.selected td { background: var(--accent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Tabs ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--muted); border-radius: var(--radius-md); }
.tab { height: 28px; padding: 0 12px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted-foreground); font-size: var(--text-sm); font-weight: 500; }
.tab:hover { color: var(--foreground); }
.tab[aria-selected="true"], .tab.active { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-xs); }
.tabs-line { display: flex; gap: var(--space-4); border-bottom: 1px solid var(--border); padding: 0 var(--space-2); }
.tabs-line .tab { height: 36px; padding: 0 2px; border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-line .tab[aria-selected="true"], .tabs-line .tab.active { background: transparent; box-shadow: none; border-bottom-color: var(--foreground); }

/* ---------- Alert / callout ---------- */
.alert { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); font-size: var(--text-sm); }
.alert-title { font-weight: 600; }
.alert-info { border-color: color-mix(in srgb, var(--info) 30%, transparent); background: var(--info-soft); }
.alert-warning { border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-soft); }
.alert-destructive { border-color: color-mix(in srgb, var(--destructive) 30%, transparent); background: color-mix(in srgb, var(--destructive) 8%, transparent); color: var(--destructive); }
.alert-success { border-color: color-mix(in srgb, var(--success) 30%, transparent); background: var(--success-soft); }

/* ---------- Kbd / Tooltip ---------- */
.kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--radius-sm); background: var(--muted); font-size: 11px; color: var(--muted-foreground); }
[data-tooltip] { position: relative; }
[data-tooltip]::after { content: attr(data-tooltip); position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%); padding: 4px 8px; border-radius: var(--radius-sm); background: var(--foreground); color: var(--background); font-size: var(--text-xs); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--duration) var(--ease); z-index: 60; }
[data-tooltip]:hover::after { opacity: 1; }
[data-tooltip][data-tooltip-side="right"]::after { left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }

/* ---------- Dropdown / menu ---------- */
.menu { min-width: 200px; padding: 4px; background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.menu-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: 7px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; font-size: var(--text-sm); text-align: left; color: inherit; }
.menu-item:hover { background: var(--accent); color: var(--accent-foreground); }
.menu-item.destructive { color: var(--destructive); }
.menu-label { padding: 6px 10px; font-size: var(--text-xs); color: var(--muted-foreground); }
.menu-separator { height: 1px; margin: 4px -4px; background: var(--border); }

/* ---------- Dialog ---------- */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: var(--space-6); animation: fade-in 120ms var(--ease); }
.dialog { width: 100%; max-width: 480px; max-height: calc(100vh - 48px); overflow: auto; background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); animation: pop-in 160ms var(--ease); }
.dialog-lg { max-width: 760px; }
.dialog-xl { max-width: 960px; }
.dialog-header { padding: var(--space-5) var(--space-6) 0; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.dialog-title { font-size: var(--text-lg); font-weight: 600; }
.dialog-description { font-size: var(--text-sm); color: var(--muted-foreground); margin-top: 4px; }
.dialog-body { padding: var(--space-5) var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.dialog-footer { padding: 0 var(--space-6) var(--space-5); display: flex; justify-content: flex-end; gap: var(--space-2); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Settings dialog (Loom-style: left section nav + content) */
.settings { display: grid; grid-template-columns: 200px 1fr; min-height: 520px; }
.settings-nav { padding: var(--space-4) var(--space-3); border-right: 1px solid var(--border); background: var(--sidebar); border-radius: var(--radius-xl) 0 0 var(--radius-xl); }
.settings-nav .nav-group-label { padding: 12px 10px 4px; font-size: var(--text-xs); color: var(--muted-foreground); }
.settings-content { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-6); overflow: auto; }
.settings-section { display: flex; flex-direction: column; gap: var(--space-3); }
.settings-section-title { font-size: var(--text-sm); font-weight: 600; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: 0; }
.settings-row .label { font-weight: 500; }
.settings-row .hint { margin-top: 2px; }

/* ---------- Toast ---------- */
.toast-region { position: fixed; right: var(--space-4); bottom: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); z-index: 70; }
.toast { min-width: 280px; max-width: 420px; padding: var(--space-3) var(--space-4); background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); font-size: var(--text-sm); animation: pop-in 160ms var(--ease); }
.toast-destructive { border-color: var(--destructive); color: var(--destructive); }

/* ---------- App shell (app-shell-3 + Loom rail/panel) ---------- */
.app { display: grid; grid-template-columns: var(--rail-width) auto 1fr; grid-template-rows: 100vh; height: 100vh; overflow: hidden; background: var(--background); }
.app.panel-collapsed { grid-template-columns: var(--rail-width) minmax(0, 1fr); }
.rail { display: flex; flex-direction: column; align-items: center; padding: var(--space-2) 0; gap: 4px; background: var(--sidebar); border-right: 1px solid var(--sidebar-border); }
.rail .spacer { flex: 1; }
.rail-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--muted-foreground); }
.rail-btn:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.rail-btn.active { background: var(--sidebar-accent); color: var(--sidebar-foreground); }
.rail-btn .icon { width: 18px; height: 18px; }
.panel { width: var(--panel-width); display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--sidebar-border); overflow: hidden; }
.app.panel-collapsed .panel { display: none; }
.panel-header { height: var(--header-height); display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 0 var(--space-3) 0 var(--space-4); border-bottom: 1px solid var(--sidebar-border); }
.panel-title { font-weight: 600; font-size: var(--text-base); }
.panel-body { flex: 1; overflow: auto; padding: var(--space-2); }
.panel-footer { padding: var(--space-2); border-top: 1px solid var(--sidebar-border); }
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--background); }
.header { height: var(--header-height); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-4); border-bottom: 1px solid var(--border); background: var(--background); flex: none; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--muted-foreground); }
.breadcrumb .current { color: var(--foreground); font-weight: 500; }
.content { flex: 1; min-height: 0; display: flex; }
.split { display: grid; grid-template-columns: 1fr 380px; min-height: 0; flex: 1; }
.split.chat-collapsed { grid-template-columns: 1fr 0; }
.aside { border-left: 1px solid var(--border); background: var(--card); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.split.chat-collapsed .aside { display: none; }

/* Sidebar nav (console) */
.sidebar { width: var(--sidebar-width); background: var(--sidebar); color: var(--sidebar-foreground); border-right: 1px solid var(--sidebar-border); display: flex; flex-direction: column; padding: var(--space-2); gap: var(--space-1); }
.sidebar-header { height: var(--header-height); display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2); font-weight: 600; }
.nav-group { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2) 0; }
.nav-group-label { padding: 6px 10px 4px; font-size: var(--text-xs); font-weight: 500; color: var(--muted-foreground); }
.nav-item { display: flex; align-items: center; gap: var(--space-2); height: 32px; padding: 0 10px; border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--sidebar-foreground); border: 0; background: transparent; width: 100%; text-align: left; }
.nav-item:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.nav-item.active, .nav-item[aria-current="page"] { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); font-weight: 500; }
.nav-item .icon { color: var(--muted-foreground); }
.nav-item.active .icon { color: inherit; }
.nav-item .count { margin-left: auto; font-size: var(--text-xs); color: var(--muted-foreground); }
.sidebar-footer { margin-top: auto; padding: var(--space-2); border-top: 1px solid var(--sidebar-border); }

/* Logo mark */
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.02em; }
.logo-mark { width: 24px; height: 24px; border-radius: 7px; background: var(--primary); color: var(--primary-foreground); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }

/* Workspace list item (Loom workspace panel) */
.ws-item { display: flex; align-items: center; gap: var(--space-3); padding: 8px 10px; border-radius: var(--radius-md); border: 0; background: transparent; width: 100%; text-align: left; color: inherit; }
.ws-item:hover { background: var(--sidebar-accent); }
.ws-item.active { background: var(--sidebar-accent); }
.ws-item .ws-icon { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--secondary); display: inline-flex; align-items: center; justify-content: center; color: var(--muted-foreground); flex: none; }
.ws-item .ws-name { font-size: var(--text-sm); font-weight: 500; }
.ws-item .ws-path { font-size: var(--text-xs); color: var(--muted-foreground); }

/* File tree */
.tree { font-size: var(--text-sm); }
.tree-row { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: var(--radius-sm); cursor: default; user-select: none; white-space: nowrap; }
.tree-row:hover { background: var(--accent); }
.tree-row.selected { background: var(--accent); font-weight: 500; }
.tree-row .icon { color: var(--muted-foreground); }

/* Empty state (Loom home) */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: var(--space-8); gap: var(--space-2); background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--brand) 6%, transparent), transparent 60%); }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; justify-content: center; margin-bottom: var(--space-3); color: var(--foreground); }
.empty-title { font-size: var(--text-xl); font-weight: 600; }
.empty-subtitle { font-size: var(--text-sm); color: var(--muted-foreground); max-width: 440px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); width: min(640px, 100%); margin-top: var(--space-6); }
.quick { display: flex; align-items: center; gap: var(--space-3); padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); font-size: var(--text-sm); text-align: left; cursor: pointer; transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease); }
.quick:hover { border-color: var(--ring); box-shadow: var(--shadow-sm); }
.quick .icon { color: var(--muted-foreground); }
.suggestions { display: flex; flex-direction: column; gap: var(--space-2); width: min(600px, 100%); margin-top: var(--space-5); }
.suggestion { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); font-size: var(--text-sm); text-align: left; color: var(--foreground); cursor: pointer; }
.suggestion:hover { background: var(--accent); }

/* Chat */
.chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-messages { flex: 1; overflow: auto; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.msg { display: flex; gap: var(--space-3); max-width: 100%; }
.msg-user { justify-content: flex-end; }
.msg-bubble { max-width: 85%; padding: 10px 14px; border-radius: var(--radius-lg); font-size: var(--text-base); line-height: 1.55; overflow-wrap: anywhere; }
.msg-user .msg-bubble { background: var(--primary); color: var(--primary-foreground); border-bottom-right-radius: 4px; }
.msg-assistant .msg-bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-bubble pre { background: var(--muted); padding: 10px 12px; border-radius: var(--radius-sm); font-size: var(--text-sm); margin: 6px 0; }
.msg-bubble code { background: var(--muted); padding: 1px 4px; border-radius: 4px; }
.msg-bubble p + p { margin-top: 8px; }
.cite { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--radius-full); border: 1px solid var(--border); background: var(--secondary); color: var(--secondary-foreground); font-size: var(--text-xs); cursor: pointer; vertical-align: middle; }
.cite:hover { border-color: var(--ring); }
.composer { padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--border); background: var(--card); }
.composer-box { border: 1px solid var(--input); border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-xs); display: flex; flex-direction: column; }
.composer-box:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 30%, transparent); }
.composer-box textarea { border: 0; background: transparent; resize: none; padding: 12px 14px 6px; min-height: 64px; max-height: 200px; outline: none; font-size: var(--text-base); line-height: 1.5; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 8px 12px; gap: var(--space-2); }
.typing { display: inline-flex; gap: 3px; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted-foreground); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* Timeline (tool calls) & plan */
.timeline { display: flex; flex-direction: column; gap: 6px; font-size: var(--text-sm); }
.tl-item { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-md); }
.tl-item:hover { background: var(--accent); }
.tl-status { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }
.tl-status.running { border: 2px solid var(--ring); border-top-color: var(--foreground); animation: spin 0.8s linear infinite; }
.tl-status.done { background: var(--success-soft); color: var(--success); }
.tl-status.denied, .tl-status.failed { background: color-mix(in srgb, var(--destructive) 12%, transparent); color: var(--destructive); }
.tl-status.pending { border: 1.5px solid var(--border); }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }
.plan { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); }
.plan-step { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
.plan-step .n { width: 18px; height: 18px; border-radius: 50%; background: var(--secondary); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; margin-top: 1px; }
.plan-step.done { color: var(--muted-foreground); text-decoration: line-through; }
.plan-step.in_progress { font-weight: 500; }
.plan-step.in_progress .n { background: color-mix(in srgb, var(--ring) 30%, var(--secondary)); }
.reasoning { margin-bottom: 8px; }
.reasoning-head { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--muted-foreground); background: none; border: 0; padding: 0; cursor: pointer; }
.reasoning-body { margin-top: 6px; font-size: var(--text-sm); color: var(--muted-foreground); white-space: pre-wrap; line-height: 1.5; }

/* Section header inside panels */
.section-title { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 4px; font-size: var(--text-xs); font-weight: 500; color: var(--muted-foreground); text-transform: none; }

/* ---------- Page / console layout ---------- */
.page { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); max-width: 1200px; width: 100%; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.page-title { font-size: var(--text-xl); font-weight: 600; }
.page-description { font-size: var(--text-sm); color: var(--muted-foreground); margin-top: 4px; }
.toolbar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
@media (max-width: 960px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Auth / centered screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--space-6); background: radial-gradient(900px 500px at 50% 0%, color-mix(in srgb, var(--brand) 8%, transparent), transparent 60%), var(--background); }
.auth-card { width: 100%; max-width: 400px; padding: var(--space-8); display: flex; flex-direction: column; gap: var(--space-5); }
.auth-card .logo { margin-bottom: var(--space-2); }
.auth-title { font-size: var(--text-xl); font-weight: 600; }
.auth-subtitle { font-size: var(--text-sm); color: var(--muted-foreground); }
.stepper { display: flex; gap: 6px; }
.stepper i { height: 4px; flex: 1; border-radius: var(--radius-full); background: var(--muted); }
.stepper i.done { background: var(--primary); }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--muted) 25%, color-mix(in srgb, var(--muted) 60%, var(--card)) 50%, var(--muted) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
