/* fancysauce.css — dashboard look-alike tokens and mock UI parts for demos.
 *
 * Token values copy FancysauceAI/fancysauce packages/theme/src/base.css
 * (HSL triplets, shadcn style). Update them here when the dashboard theme changes.
 * Fonts: link Outfit, Manrope, and JetBrains Mono from Google Fonts in each demo.
 */

:root {
  --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Outfit", "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --background: 0 0% 100%;
  --card: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --border: 214.3 31.8% 91.4%;
  --primary: 24.6 95% 49%;
  --primary-strong: 24.6 95% 36%;
  --primary-foreground: 222.2 84% 4.9%;
  --primary-soft: 24.6 100% 95%;
  --sidebar: 24.6 95% 49%;
  --sidebar-accent: 24.6 95% 42%;
  --sidebar-border: 24.6 90% 42%;
  --sidebar-primary-foreground: 24.6 95% 36%;
  --ring: 24.6 95% 49%;
  --stage: 214 30% 94.5%;
  --shadow: 222 47% 11%;

  --claude: 26 90% 37%;
  --codex: 176 86% 30%;
  --good-fg: 161 94% 24%;
  --good-bg: 152 76% 94%;
  --bad-fg: 0 74% 42%;
  --warn-fg: 23 83% 31%;
  --warn-bg: 38 92% 92%;
  --info-fg: 224 76% 40%;
  --info-bg: 222 90% 95%;
  --indigo: 239 84% 67%;
  --emerald: 160 84% 39%;

  --term-bg: 222 47% 7%;
  --term-fg: 210 40% 92%;
  --term-dim: 215 20% 58%;
  --radius: 0.5rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: 222.2 84% 4.9%;
    --card: 222.2 47.4% 11%;
    --foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --border: 217.2 32.6% 22%;
    --primary: 24.6 90% 58%;
    --primary-strong: 24.6 90% 62%;
    --primary-soft: 24.6 60% 16%;
    --sidebar: 24.6 88% 42%;
    --sidebar-accent: 24.6 85% 35%;
    --sidebar-border: 24.6 80% 36%;
    --sidebar-primary-foreground: 24.6 95% 36%;
    --ring: 24.6 90% 58%;
    --stage: 224 60% 3%;
    --shadow: 0 0% 0%;
    --claude: 30 90% 58%;
    --codex: 174 70% 48%;
    --good-fg: 158 64% 52%;
    --good-bg: 160 60% 12%;
    --bad-fg: 0 84% 70%;
    --warn-fg: 35 92% 62%;
    --warn-bg: 30 60% 13%;
    --info-fg: 217 91% 72%;
    --info-bg: 224 50% 16%;
    --term-bg: 224 60% 2%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --background: 222.2 84% 4.9%;
  --card: 222.2 47.4% 11%;
  --foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --border: 217.2 32.6% 22%;
  --primary: 24.6 90% 58%;
  --primary-strong: 24.6 90% 62%;
  --primary-soft: 24.6 60% 16%;
  --sidebar: 24.6 88% 42%;
  --sidebar-accent: 24.6 85% 35%;
  --sidebar-border: 24.6 80% 36%;
  --sidebar-primary-foreground: 24.6 95% 36%;
  --ring: 24.6 90% 58%;
  --stage: 224 60% 3%;
  --shadow: 0 0% 0%;
  --claude: 30 90% 58%;
  --codex: 174 70% 48%;
  --good-fg: 158 64% 52%;
  --good-bg: 160 60% 12%;
  --bad-fg: 0 84% 70%;
  --warn-fg: 35 92% 62%;
  --warn-bg: 30 60% 13%;
  --info-fg: 217 91% 72%;
  --info-bg: 224 50% 16%;
  --term-bg: 224 60% 2%;
  color-scheme: dark;
}

/* --- app window ---------------------------------------------------------- */
.fs-app {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 50px -20px hsl(var(--shadow) / 0.35);
}
.fs-rail {
  background: hsl(var(--sidebar));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-block: 12px;
}
.fs-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #fff;
  display: grid;
  place-items: center;
}
.fs-logo img { width: 24px; height: 24px; }
.fs-rail i { width: 18px; height: 18px; border-radius: 5px; background: rgb(255 255 255 / 0.35); }
.fs-rail i.is-here { background: #fff; }
.fs-main { padding: 18px 20px 20px; display: grid; gap: 14px; min-width: 0; }
.fs-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.fs-head h3 { margin: 0; font: 600 19px/1.2 var(--font-display); }
.fs-head span { color: hsl(var(--muted-foreground)); font-size: 12.5px; }

/* --- metric tiles -------------------------------------------------------- */
.fs-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.fs-tile { border: 1px solid hsl(var(--border)); border-radius: 12px; padding: 10px 12px; background: hsl(var(--card)); }
.fs-tile b { display: block; font: 600 20px/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.fs-tile span { font-size: 11px; color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }

/* --- sessions table (mirrors MyUsageSessionList) ------------------------- */
.fs-table { border: 1px solid hsl(var(--border)); border-radius: 12px; overflow: hidden; background: hsl(var(--card)); }
.fs-tr {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) 84px 64px 76px 74px;
  align-items: center;
  column-gap: 14px;
  padding-right: 14px;
  border-top: 1px solid hsl(var(--border));
  min-height: 52px;
  transition: background 400ms ease;
}
.fs-tr:first-child { border-top: 0; }
.fs-th {
  min-height: 30px;
  background: hsl(var(--muted));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.fs-tr > .num { text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.fs-stripe { align-self: stretch; }
.fs-stripe.claude { background: hsl(var(--claude)); }
.fs-stripe.codex { background: hsl(var(--codex)); }
.fs-stripe.naming { background: repeating-linear-gradient(45deg, hsl(var(--muted-foreground) / 0.5) 0 3px, transparent 3px 6px); }
.fs-cell { min-width: 0; padding-block: 8px; display: grid; gap: 3px; }
.fs-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fs-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fs-id { font-family: var(--font-mono); font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.fs-meta { font-size: 11px; color: hsl(var(--muted-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-tr.is-flash { background: hsl(var(--primary-soft)); }
.fs-spark { width: 100%; height: 22px; display: block; }
.fs-spark path { fill: none; stroke: hsl(var(--primary)); stroke-width: 1.5; }
.fs-bar { height: 3px; border-radius: 2px; background: hsl(var(--muted)); margin-top: 4px; overflow: hidden; }
.fs-bar > span { display: block; height: 100%; }

@media (max-width: 640px) {
  .fs-tr { grid-template-columns: 6px minmax(0, 1fr) 64px 64px; }
  .fs-tr > .hide-sm { display: none; }
  .fs-app { grid-template-columns: minmax(0, 1fr); }
  .fs-rail { display: none; }
  .fs-main { padding: 14px; }
}

/* --- pills and chips ----------------------------------------------------- */
.fs-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}
.fs-pill.claude { color: hsl(var(--claude)); border-color: hsl(var(--claude) / 0.35); }
.fs-pill.codex { color: hsl(var(--codex)); border-color: hsl(var(--codex) / 0.35); }
.fs-pill.native { color: hsl(var(--good-fg)); background: hsl(var(--good-bg)); border-color: transparent; }
.fs-pill.fallback { color: hsl(var(--info-fg)); background: hsl(var(--info-bg)); border-color: transparent; }
.fs-pill.warn { color: hsl(var(--warn-fg)); background: hsl(var(--warn-bg)); border-color: transparent; }
.fs-pill.brand { color: hsl(var(--primary-strong)); background: hsl(var(--primary-soft)); border-color: transparent; }

/* --- panels -------------------------------------------------------------- */
.fs-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  padding: 14px 16px;
}
.fs-card h4 { margin: 0 0 4px; font: 600 15px/1.3 var(--font-display); }
.fs-card p { margin: 0; font-size: 13px; color: hsl(var(--muted-foreground)); }

.fs-code {
  margin: 0;
  font: 12px/1.6 var(--font-mono);
  background: hsl(var(--muted));
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  white-space: pre;
}
.fs-code .k { color: hsl(var(--info-fg)); }
.fs-code .s { color: hsl(var(--good-fg)); }
.fs-code .c { color: hsl(var(--muted-foreground)); }

/* toggle switch; purely visual, state comes from the step's data-state */
.fs-switch {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: hsl(var(--border));
  position: relative;
  transition: background 200ms ease;
  flex: none;
}
.fs-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 200ms ease;
}
.fs-switch.is-on { background: hsl(var(--primary)); }
.fs-switch.is-on::after { transform: translateX(16px); }

/* --- terminal ------------------------------------------------------------ */
.term {
  background: hsl(var(--term-bg));
  color: hsl(var(--term-fg));
  border-radius: 12px;
  overflow: hidden;
  font: 12.5px/1.65 var(--font-mono);
  box-shadow: 0 18px 50px -20px hsl(var(--shadow) / 0.45);
  border: 1px solid hsl(var(--term-dim) / 0.2);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: hsl(var(--term-dim) / 0.12);
  color: hsl(var(--term-dim));
  font-size: 11.5px;
}
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: hsl(var(--term-dim) / 0.4); }
.term-bar span { margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-body { padding: 12px 14px; overflow-x: auto; }
.term-body > div { white-space: pre-wrap; overflow-wrap: anywhere; }
.term .dim { color: hsl(var(--term-dim)); }
.term .you { color: #fdba74; }
.term .ok { color: #6ee7b7; }
.term .hl { color: #93c5fd; }
.term .warn { color: #fcd34d; }
