/*
 * Signal Labs LLM Gateway portal.
 * Visual language matches Unsloth Studio's default palette: the token VALUES (colours, radius, flat
 * zero shadows, pill controls, type families) were read from Studio's build. This stylesheet is our
 * own code; no Studio source is copied. Fonts are OFL (Inter, Space Grotesk, Fira Code). Studio's
 * heading face, Hellix, is commercial, so we use Studio's own fallback for it, Space Grotesk.
 */

@font-face { font-family: "Inter Variable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/fonts/inter-latin-ext-wght.woff2) format("woff2-variations");
  unicode-range: U+100-2BA, U+2BD-2C5, U+2C7-2CC, U+2CE-2D7, U+2DD-2FF, U+304, U+308, U+329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter Variable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/fonts/inter-latin-wght.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk Variable"; font-style: normal; font-display: swap; font-weight: 300 700;
  src: url(/static/fonts/space-grotesk-latin-ext-wght.woff2) format("woff2-variations");
  unicode-range: U+100-2BA, U+2BD-2C5, U+2C7-2CC, U+2CE-2D7, U+2DD-2FF, U+304, U+308, U+329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk Variable"; font-style: normal; font-display: swap; font-weight: 300 700;
  src: url(/static/fonts/space-grotesk-latin-wght.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fira Code"; font-style: normal; font-display: swap; font-weight: 300 700;
  src: url(/static/fonts/fira-code-wght.ttf) format("truetype-variations"); }

/* ---------- tokens ---------- */
:root {
  --background: #fefefd;
  --foreground: oklch(26.86% 0 0);
  --card: #fff;
  --card-foreground: oklch(12.81% .0179 169.276);
  --primary: #17b88b;
  --primary-foreground: #fff;
  --secondary: oklch(95.96% .0275 167.83);
  --secondary-foreground: oklch(28.68% .0649 159.982);
  --muted: oklch(97.02% 0 0);
  --muted-foreground: oklch(54.86% 0 0);
  --accent: #ececec;
  --accent-foreground: #262626;
  --destructive: oklch(63.68% .2078 25.3313);
  --bypass: #c99d00;
  --border: oklch(92.08% .0101 164.854);
  --input: oklch(92.08% .0101 164.854);
  --ring: #262626;
  --success: #11b686;
  --sidebar: #fff;
  --sidebar-border: #f2f2f2;
  --nav-fg: #383835;
  --nav-fg-muted: #8f8f8f;
  --nav-surface-hover: #f0f0f0;
  --panel-input-surface: #f5f5f5;
  --input-surface: var(--background);
  --input-surface-focus: var(--background);
  --wash: rgb(0 0 0 / .05);

  --radius: 1.1rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-4xl: calc(var(--radius) + 16px);

  --font-sans: "Inter Variable", ui-sans-serif, sans-serif, system-ui;
  --font-heading: "Space Grotesk Variable", var(--font-sans);
  --font-mono: "Fira Code", "JetBrains Mono", ui-monospace, monospace;

  --ease-out-quart: cubic-bezier(.165, .84, .44, 1);
  color-scheme: light;
}

.dark {
  --background: #181818;
  --foreground: #dfdfdf;
  --card: #272727;
  --card-foreground: #dfdfdf;
  --primary: #17b88b;
  --primary-foreground: #fff;
  --secondary: #303030;
  --secondary-foreground: #dfdfdf;
  --muted: #303030;
  --muted-foreground: #b0b0b0;
  --accent: #3a3a3a;
  --accent-foreground: #dfdfdf;
  --bypass: #ffd60a;
  --border: #3a3a3a;
  --input: #3a3a3a;
  --ring: #dfdfdf;
  --sidebar: #272727;
  --sidebar-border: #3a3a3a;
  --nav-fg: #dfdfdf;
  --nav-fg-muted: #b0b0b0;
  --nav-surface-hover: #3a3a3a;
  --panel-input-surface: #ffffff12;
  --input-surface: rgb(255 255 255 / .06);
  --input-surface-focus: rgb(255 255 255 / .12);
  --wash: rgb(255 255 255 / .06);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border: 0 solid var(--border); }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans); font-size: .875rem; line-height: 1.5;
  background: var(--background); color: var(--foreground);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; color: var(--foreground); }
a { color: inherit; text-decoration: none; }
code, pre, kbd { font-family: var(--font-mono); }
svg { width: 16px; height: 16px; flex-shrink: 0; }
::selection { background: color-mix(in srgb, var(--primary) 30%, transparent); }

/* ---------- shell: sidebar + main, like Studio ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px; background: var(--primary);
  display: grid; place-items: center; color: #fff; font-family: var(--font-heading); font-weight: 600; font-size: 15px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-family: var(--font-heading); font-weight: 600; font-size: 15px; }
.brand-text span { font-size: 11px; color: var(--nav-fg-muted); }
.nav-label { font-size: 11px; color: var(--nav-fg-muted); padding: 12px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 10px;
  color: var(--nav-fg); font-size: 13.5px; transition: background-color .15s;
}
.nav-item svg { width: 16px; height: 16px; color: var(--nav-fg-muted); flex-shrink: 0; }
.nav-item:hover { background: var(--nav-surface-hover); }
.nav-item.active { background: var(--nav-surface-hover); font-weight: 500; }
.nav-item.active svg { color: var(--primary); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.who { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; }
.who img, .who .avatar { width: 26px; height: 26px; border-radius: 999px; background: var(--accent); }
.who .meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.who .meta b { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .meta span { font-size: 11px; color: var(--nav-fg-muted); }

main { padding: 40px 48px 80px; min-width: 0; }
.page { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.01em; }
.page-head p { color: var(--muted-foreground); margin-top: 4px; max-width: 60ch; }

/* ---------- card ---------- */
.card {
  background: var(--card); color: var(--card-foreground); border-radius: var(--radius-4xl);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--foreground) 10%, transparent);
  padding: 24px 0; display: flex; flex-direction: column; gap: 20px; overflow: hidden;
}
.card-head { padding: 0 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h2 { font-size: 1rem; font-weight: 600; }
.card-head p { color: var(--muted-foreground); font-size: 13px; margin-top: 2px; }
.card-body { padding: 0 24px; }

/* ---------- buttons (pill) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid transparent;
  font: 500 .875rem/1 var(--font-sans); cursor: pointer; user-select: none; transition: all .15s;
  background: var(--primary); color: var(--primary-foreground);
}
.btn:hover { background: color-mix(in srgb, var(--primary) 80%, transparent); }
.btn:focus-visible { outline: none; border-color: var(--ring); }
.btn svg { width: 16px; height: 16px; }
.btn-sm { height: 32px; padding: 0 12px; }
.btn-xs { height: 24px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 40px; padding: 0 16px; }
.btn-dark { background: var(--foreground); color: var(--background); }
.btn-dark:hover { background: color-mix(in srgb, var(--foreground) 85%, transparent); }
.btn-outline { background: var(--background); border-color: var(--border); color: var(--foreground); }
.btn-outline:hover { background: color-mix(in srgb, var(--accent) 50%, transparent); }
.dark .btn-outline { background: rgb(255 255 255 / .06); border-color: transparent; }
.dark .btn-outline:hover { background: rgb(255 255 255 / .1); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--muted); }
.btn-destructive { background: color-mix(in srgb, var(--destructive) 10%, transparent); color: var(--destructive); }
.btn-destructive:hover { background: color-mix(in srgb, var(--destructive) 20%, transparent); }
.dark .btn-destructive { background: color-mix(in srgb, var(--destructive) 20%, transparent); }

/* ---------- inputs (pill) ---------- */
.input {
  height: 36px; width: 100%; min-width: 0; border-radius: 999px; border: 1px solid var(--border);
  background: var(--input-surface); color: var(--foreground); padding: 4px 14px;
  font: 400 .875rem var(--font-sans); outline: none; transition: background-color .15s, border-color .15s;
}
.dark .input { border-color: transparent; }
.input::placeholder { color: var(--muted-foreground); }
.input:focus-visible { border-color: var(--ring); }
.dark .input:focus-visible { border-color: transparent; background: var(--input-surface-focus); }
.row-form { display: flex; gap: 8px; align-items: center; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; padding: 0 20px; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); transition: background-color .15s;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.list-row .icon-box {
  width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); background: color-mix(in srgb, var(--muted) 40%, transparent);
}
.list-row .icon-box svg { width: 15px; height: 15px; color: var(--muted-foreground); }
.list-row .main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.list-row .main b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { font-size: 11px; color: var(--muted-foreground); display: flex; flex-wrap: wrap; gap: 0 6px; }
.list-row .actions { opacity: 0; transition: opacity .15s; }
.list-row:hover .actions, .list-row:focus-within .actions { opacity: 1; }
.empty { padding: 24px; text-align: center; font-size: 12px; color: var(--muted-foreground); }
.dot { width: 6px; height: 6px; border-radius: 999px; background: #10b981; display: inline-block; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; font-size: 11px; color: var(--muted-foreground); padding: 0 24px 8px; }
.table td { padding: 11px 24px; border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); vertical-align: top; }
.table tr:hover td { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.num { text-align: right; }
.table td.model { font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; }
.table td.desc { color: var(--muted-foreground); }

/* ---------- code ---------- */
.code {
  position: relative; border-radius: var(--radius-lg); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 20%, transparent); overflow: hidden;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 14px;
  border-bottom: 1px solid var(--border); font-size: 11px; color: var(--muted-foreground);
}
.code pre { padding: 12px 14px; overflow-x: auto; font-size: 12px; line-height: 1.6; color: var(--foreground); }
.inline-code {
  font-family: var(--font-mono); font-size: 12px; padding: 1px 6px; border-radius: 6px;
  background: var(--muted); border: 1px solid var(--border);
}
.copy {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 80%, transparent); padding: 2px 7px;
  font: 400 11px var(--font-sans); color: var(--muted-foreground); cursor: pointer; transition: color .15s;
}
.copy:hover { color: var(--foreground); }
.copy svg { width: 12px; height: 12px; }

/* ---------- callouts ---------- */
.callout { border-radius: var(--radius-lg); padding: 12px 14px; font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.callout-success { border: 1px solid rgb(16 185 129 / .3); background: rgb(16 185 129 / .05); }
.callout-success .title { color: #059669; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.callout-success .title svg { width: 14px; height: 14px; }
.dark .callout-success .title { color: #10b981; }
.callout-error { border: 1px solid color-mix(in srgb, var(--destructive) 20%, transparent); background: color-mix(in srgb, var(--destructive) 5%, transparent); color: var(--destructive); }
.callout-warn { border: 1px solid color-mix(in srgb, var(--bypass) 35%, transparent); background: color-mix(in srgb, var(--bypass) 8%, transparent); }
.secret {
  display: flex; align-items: center; gap: 8px; border-radius: 8px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 30%, transparent); padding: 6px 6px 6px 10px;
}
.secret code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 12px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0 24px; }
.stat { border-radius: var(--radius-lg); background: var(--wash); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat span { font-size: 11px; color: var(--muted-foreground); }
.stat b { font-family: var(--font-heading); font-weight: 500; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 999px; background: var(--wash); overflow: hidden; margin: 0 24px; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.meter.hot > i { background: var(--bypass); }

/* ---------- tabs (Studio's pill toggle) ---------- */
.tabs { display: inline-flex; height: 32px; align-items: center; border-radius: 999px; padding: 3px; background: var(--wash); gap: 2px; }
.tab {
  height: 26px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center;
  font-size: 12.5px; color: var(--muted-foreground); cursor: pointer; border: 0; background: transparent; font-family: var(--font-sans);
}
.tab:hover { color: var(--foreground); }
.tab[aria-selected="true"] { background: var(--background); color: var(--foreground); box-shadow: 0 2px 8px -2px #00000029; }
.dark .tab[aria-selected="true"] { background: var(--accent); box-shadow: none; }
.tab-panel[hidden] { display: none; }

/* ---------- landing ---------- */
.landing { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.landing .card { width: 100%; max-width: 440px; padding: 36px 0 28px; text-align: center; align-items: center; gap: 18px; }
.landing h1 { font-size: 1.6rem; font-weight: 600; }
.landing p { color: var(--muted-foreground); max-width: 34ch; margin: 0 auto; }
.landing .fine { font-size: 11px; color: var(--muted-foreground); }

.muted { color: var(--muted-foreground); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); }
.spacer { flex: 1; }
.gap { height: 12px; }
.theme-toggle { justify-content: flex-start; border: 0; background: transparent; cursor: pointer; font: inherit; width: 100%; text-align: left; }
.brand-mark-lg { width: 44px; height: 44px; border-radius: 14px; font-size: 22px; }
.landing-note { text-align: left; margin: 0 24px; }
.link { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--border); }
.link:hover { text-decoration-color: var(--foreground); }
form.inline { display: inline; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar-foot { margin: 0; flex-direction: row; }
  .nav-label { display: none; }
  main { padding: 24px 16px 60px; }
  .stats { grid-template-columns: 1fr; }
  .list-row .actions { opacity: 1; }
}
