:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-strong: #eaf1ff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --line: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-strong: #1d4ed8;
  --cyan: #0e7490;
  --green: #047857;
  --amber: #b45309;
  --red: #be123c;
  --purple: #7c3aed;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 8%, rgba(37, 99, 235, 0.14), transparent 28rem),
    radial-gradient(circle at 92% 2%, rgba(124, 58, 237, 0.12), transparent 26rem),
    linear-gradient(135deg, #f8fbff 0%, #eef4ff 46%, #f7f3ff 100%);
}

a { color: var(--blue-strong); text-decoration: none; font-weight: 650; }
a:hover { color: #0f172a; text-decoration: underline; text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; }
:where(a, button, input, select, textarea):focus-visible { outline: 3px solid #0891b2; outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: 1rem; z-index: 20; padding: .7rem 1rem; border-radius: .8rem; background: #0f172a; color: #ffffff; transform: translateY(-140%); }
.skip-link:focus { transform: translateY(0); }

.shell { display: grid; grid-template-columns: 18rem minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 1.2rem; display: flex; flex-direction: column; gap: 1.4rem; border-right: 1px solid var(--line); background: rgba(255, 255, 255, .78); backdrop-filter: blur(18px); box-shadow: 10px 0 40px rgba(15, 23, 42, .06); }
.brand { display: flex; align-items: center; gap: .8rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 2.7rem; height: 2.7rem; border-radius: 1rem; background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; font-weight: 800; box-shadow: 0 16px 36px rgba(37, 99, 235, .22); }
.brand strong, .brand small { display: block; }
.brand small, .tiny, .hint, small { color: var(--muted); }
.nav { display: grid; gap: .35rem; }
.nav-link { color: #334155; padding: .78rem .9rem; border-radius: .9rem; font-weight: 750; }
.nav-link:hover, .nav-link.is-active { background: rgba(37, 99, 235, .10); color: var(--blue-strong); text-decoration: none; }
.nav-link.is-active { box-shadow: inset 3px 0 0 var(--blue); }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.link-button { border: 0; background: transparent; color: var(--blue-strong); padding: 0; cursor: pointer; font-weight: 750; }

.main-wrap { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 2rem 2rem 1rem; }
.eyebrow { margin: 0 0 .3rem; color: var(--cyan); font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 900; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.05em; }
h2 { letter-spacing: -.03em; }
.content { padding: 1rem 2rem 3rem; display: grid; gap: 1.2rem; }
.topbar-actions, .actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.6rem; padding: .65rem 1rem; border: 1px solid var(--line); border-radius: .95rem; background: rgba(255, 255, 255, .88); color: var(--blue-strong); cursor: pointer; font-weight: 850; box-shadow: var(--shadow-soft); }
.button:hover { text-decoration: none; background: #ffffff; color: #172554; }
.button.primary { border: 0; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-weight: 900; box-shadow: 0 16px 36px rgba(37, 99, 235, .24); }
.button.primary:hover { color: #fff; filter: saturate(1.08); }
.button:disabled { cursor: not-allowed; opacity: .62; box-shadow: none; }
.button.danger {
  border-color: rgba(190, 18, 60, .24);
  background: rgba(190, 18, 60, .08);
  color: #9f1239;
}
.button.danger:hover { background: rgba(190, 18, 60, .14); color: #881337; }
.button.ghost { background: transparent; box-shadow: none; }
.button.small { min-height: 2rem; padding: .35rem .65rem; border-radius: .7rem; font-size: .9rem; }
.button.full { width: 100%; }

.panel, .metric-card, .project-card, .hero-panel, .login-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.panel, .project-card, .hero-panel { padding: 1.1rem; }
.hero-panel { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; background: linear-gradient(135deg, rgba(37, 99, 235, .10), rgba(124, 58, 237, .08)), var(--panel-strong); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.metric-card { padding: 1rem; display: grid; gap: .55rem; }
.metric-card span { color: var(--muted); font-weight: 750; }
.metric-card strong { font-size: 2.2rem; letter-spacing: -.05em; }
.metric-card.danger strong { color: var(--red); }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }
.card-head, .panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.panel-header { margin-bottom: .8rem; }
.pill, .status { display: inline-flex; align-items: center; border-radius: 999px; padding: .24rem .6rem; font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; border: 1px solid transparent; }
.pill { background: rgba(37, 99, 235, .10); color: #1e40af; border-color: rgba(37, 99, 235, .18); }
.status.good { background: rgba(4, 120, 87, .10); color: #065f46; border-color: rgba(4, 120, 87, .18); }
.status.warn { background: rgba(180, 83, 9, .12); color: #92400e; border-color: rgba(180, 83, 9, .22); }
.status.bad { background: rgba(190, 18, 60, .10); color: #9f1239; border-color: rgba(190, 18, 60, .20); }
.status.muted { background: rgba(100, 116, 139, .12); color: #475569; border-color: rgba(100, 116, 139, .18); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 42rem; }
caption { position: absolute; clip-path: inset(50%); overflow: hidden; width: 1px; height: 1px; white-space: nowrap; }
th, td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #475569; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; background: rgba(248, 250, 252, .74); }
code, .code-block { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
code { color: #1e3a8a; background: rgba(37, 99, 235, .08); border-radius: .45rem; padding: .08rem .28rem; }
.code-block { max-height: 32rem; overflow: auto; padding: 1rem; border-radius: 1rem; background: #f8fafc; border: 1px solid var(--line); color: #0f172a; white-space: pre-wrap; }
.log-block { min-height: 16rem; }
.detail-list, .mini-dl { display: grid; gap: .7rem; }
.detail-list div, .mini-dl div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: .55rem; }
dt { color: var(--muted); font-weight: 750; } dd { margin: 0; text-align: right; }
.clean-list, .timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.clean-list li, .timeline li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .65rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(255, 255, 255, .68); }
.dot { width: .7rem; height: .7rem; border-radius: 999px; background: var(--muted); flex: 0 0 auto; }
.dot.good { background: var(--green); } .dot.warn { background: var(--amber); } .dot.bad { background: var(--red); }

.stack-form { display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field { display: grid; gap: .4rem; }
.field label { font-weight: 850; color: #1e293b; }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; border: 1px solid rgba(100, 116, 139, .34); border-radius: .9rem; background: rgba(255, 255, 255, .94); color: var(--text); padding: .72rem .8rem; box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04); }
.field input:not([type="checkbox"]):focus, .field select:focus, .field textarea:focus { border-color: rgba(37, 99, 235, .54); background: #ffffff; }
.field input[type="checkbox"] { width: 1.2rem; height: 1.2rem; accent-color: #2563eb; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.error, .error-message { color: #9f1239; font-weight: 750; }
.section-title { border-top: 1px solid var(--line); padding-top: 1rem; }
.callout { padding: .9rem; border: 1px solid rgba(37, 99, 235, .20); border-radius: 1rem; background: rgba(37, 99, 235, .08); color: #1e3a8a; }
.messages { display: grid; gap: .5rem; padding: 0 2rem; }
.message { border-radius: .9rem; padding: .75rem 1rem; border: 1px solid var(--line); background: rgba(255, 255, 255, .92); color: var(--text); box-shadow: var(--shadow-soft); }
.message.success { border-color: rgba(4, 120, 87, .26); } .message.warning, .message.info { border-color: rgba(180, 83, 9, .28); }

.steps { list-style: none; counter-reset: steps; padding: 0; margin: 0; display: grid; gap: .8rem; }
.step { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .9rem; align-items: center; padding: .85rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(255, 255, 255, .68); }
.step-index { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .75rem; background: rgba(37, 99, 235, .10); color: #1e40af; font-weight: 900; }
.step.good { border-color: rgba(4, 120, 87, .22); } .step.warn { border-color: rgba(180, 83, 9, .28); } .step.bad { border-color: rgba(190, 18, 60, .22); }

.login-body { display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(100%, 28rem); padding: 1.4rem; }
.login-brand { margin-bottom: 1.4rem; }

.heavy-section-deferred { content-visibility: auto; contain-intrinsic-size: auto none auto 520px; }

.wizard-shell { display: grid; grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr); gap: 1rem; align-items: start; }
.wizard-steps { position: sticky; top: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 1rem; box-shadow: var(--shadow); }
.wizard-steps ol { list-style: none; padding: 0; margin: 0; display: grid; gap: .85rem; }
.wizard-steps li { border-radius: 1rem; background: rgba(255, 255, 255, .68); border: 1px solid var(--line); overflow: hidden; }
.wizard-steps li.is-current { border-color: rgba(37, 99, 235, .42); box-shadow: inset 4px 0 0 var(--blue); }
.wizard-steps li.is-done { border-color: rgba(4, 120, 87, .22); }
.wizard-steps a { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .25rem .7rem; align-items: center; padding: .7rem; color: var(--text); }
.wizard-steps a:hover { text-decoration: none; background: rgba(37, 99, 235, .06); }
.wizard-steps li span { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: .7rem; background: linear-gradient(135deg, var(--blue), var(--purple)); color: #ffffff; font-weight: 900; }
.wizard-steps li.is-done span { background: var(--green); }
.wizard-steps li small { grid-column: 2; }
.wizard-actions { justify-content: flex-end; }
.compact-list { gap: .5rem; margin-top: .75rem; }
.launch-form fieldset { border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; display: grid; gap: 1rem; background: rgba(255, 255, 255, .34); }
.launch-form legend { padding: 0 .35rem; font-weight: 900; color: #1e3a8a; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .metric-grid, .grid.two, .grid.three, .wizard-shell { grid-template-columns: 1fr; }
  .wizard-steps { position: static; }
}
@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 1.2rem; }
  .content { padding: 1rem 1.2rem 2rem; }
  .messages { padding: 0 1.2rem; }
  .form-grid { grid-template-columns: 1fr; }
  .hero-panel { flex-direction: column; }
  .runtime-connect-form { grid-template-columns: 1fr; }
  .runtime-connect-form .button { width: 100%; }
}


.theme-swatches, .theme-summary {
  --preview-primary: #2563eb;
  --preview-accent: #22c55e;
}
.theme-swatches {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin-top: .55rem;
}
.theme-summary .theme-swatches { margin-top: 0; }
.theme-swatch-large {
  display: inline-block;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: .8rem;
  background: var(--swatch-color, var(--preview-primary));
  border: 1px solid rgba(15, 23, 42, .18);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .5), 0 10px 22px rgba(15, 23, 42, .12);
}
.theme-swatch-large[data-theme-swatch="primary"] { --swatch-color: var(--preview-primary); }
.theme-swatch-large[data-theme-swatch="accent"] { --swatch-color: var(--preview-accent); }
.field input[data-theme-color] { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; text-transform: lowercase; }
.field input[data-theme-color][aria-invalid="true"] { border-color: var(--red); }
.prewrap { white-space: pre-wrap; line-height: 1.6; color: #475569; }

.inference-hero { container-type: inline-size; }
.endpoint-card {
  display: grid;
  gap: .35rem;
  min-width: min(100%, 22rem);
  padding: 1rem;
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 1rem;
  background: rgba(255, 255, 255, .72);
  box-shadow: var(--shadow-soft);
}
.endpoint-card code { word-break: break-word; }
.runtime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
  align-items: start;
}
.runtime-card {
  container-type: inline-size;
  min-width: 0;
  align-self: start;
  align-content: start;
  display: grid;
  gap: .9rem;
  padding: 1rem;
  border: 1px solid rgba(37, 99, 235, .16);
  border-radius: 1.25rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, .86), rgba(255, 255, 255, .68));
  box-shadow: var(--shadow-soft);
}
.runtime-card .card-head,
.runtime-card .card-head > div,
.runtime-card .field,
.runtime-card dd { min-width: 0; }
.runtime-card h3,
.runtime-card code,
.runtime-card dd { overflow-wrap: anywhere; }
.runtime-card h3 { margin-bottom: .25rem; }
.connect-runtime-panel {
  border-color: rgba(124, 58, 237, .24);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, .09), rgba(124, 58, 237, .09)),
    var(--panel);
}
.account-create-form { margin-top: .95rem; }
.account-create-form .form-grid { gap: .85rem; }
.account-create-form .field input,
.account-create-form .field select {
  min-height: 2.8rem;
}
.runtime-edit-panel {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(248, 250, 252, .68);
  overflow: hidden;
}
.runtime-edit-panel summary {
  padding: .75rem .85rem;
  cursor: pointer;
  color: #1e3a8a;
  font-weight: 900;
}
.runtime-edit-body {
  display: grid;
  gap: .8rem;
  padding: .85rem;
  border-top: 1px solid var(--line);
}
.runtime-edit-form .form-grid { grid-template-columns: 1fr; gap: .75rem; }
.inline-field {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: .55rem;
}
.inline-field label { padding: 0; }
.runtime-delete-form { margin: 0; padding-top: .8rem; border-top: 1px solid rgba(190, 18, 60, .16); }
.runtime-connect-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem .7rem;
  align-items: end;
  margin-top: .9rem;
}
.runtime-connect-form.compact { margin-top: .65rem; }
.runtime-connect-form label {
  grid-column: 1 / -1;
  color: #1e293b;
  font-weight: 850;
}
.runtime-connect-form select {
  width: 100%;
  min-height: 2.8rem;
  border: 1px solid rgba(100, 116, 139, .34);
  border-radius: .95rem;
  background: rgba(255, 255, 255, .95);
  color: var(--text);
  padding: .72rem .8rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04);
}
.runtime-connect-form select:focus {
  border-color: rgba(37, 99, 235, .54);
  background: #ffffff;
}
.advanced-runtime-panel { padding: 0; overflow: hidden; }
.advanced-disclosure summary {
  display: flex;
  gap: .8rem;
  align-items: center;
  padding: 1rem 1.1rem;
  cursor: pointer;
}
.advanced-disclosure summary::marker { color: #2563eb; }
.advanced-disclosure summary span:not(.eyebrow) {
  display: grid;
  gap: .2rem;
}
.advanced-disclosure summary strong {
  color: var(--text);
  font-size: 1.15rem;
  letter-spacing: -.02em;
}
.advanced-disclosure[open] summary {
  background: rgba(37, 99, 235, .06);
  border-bottom: 1px solid var(--line);
}
.advanced-disclosure-body { padding: 1rem 1.1rem 1.1rem; }
.runtime-actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.runtime-actions form { margin: 0; }
.runtime-dl div { align-items: center; }
.runtime-error {
  max-height: 7rem;
  overflow: auto;
  padding: .65rem;
  border-radius: .9rem;
  background: rgba(190, 18, 60, .07);
}
.runtime-login-history, .device-code-box {
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(248, 250, 252, .72);
}
.device-code-box { display: grid; gap: .4rem; place-items: center; text-align: center; }
.device-code-box strong { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; font-size: clamp(1.2rem, 5vw, 2rem); letter-spacing: .06em; }
.device-code-box.compact {
  place-items: start;
  text-align: left;
}
.device-code-box.compact strong {
  font-size: clamp(1rem, 3vw, 1.35rem);
}
.connected-note {
  margin: 0;
  padding: .7rem .8rem;
  border: 1px solid rgba(4, 120, 87, .18);
  border-radius: 1rem;
  background: rgba(4, 120, 87, .08);
  color: #065f46;
  font-weight: 850;
}
.connected-detail,
.login-meta {
  display: grid;
  gap: .25rem;
}
.connected-detail span,
.connected-detail small,
.login-meta {
  color: #334155;
  font-weight: 700;
}
.login-meta {
  margin: .45rem 0 0;
}
.login-meta strong {
  color: #0f172a;
  overflow-wrap: anywhere;
}
.rate-limits-box {
  display: grid;
  gap: .65rem;
  padding: .75rem;
  border: 1px solid rgba(37, 99, 235, .16);
  border-radius: 1rem;
  background: rgba(248, 250, 252, .74);
}
.rate-limits-head,
.rate-limit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
}
.rate-limits-head strong {
  display: block;
  color: #0f172a;
  text-transform: capitalize;
}
.rate-limit-list {
  list-style: none;
  display: grid;
  gap: .55rem;
  margin: 0;
  padding: 0;
}
.rate-limit-row {
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: rgba(255, 255, 255, .72);
}
.rate-limit-row.warn {
  border-color: rgba(180, 83, 9, .22);
  background: rgba(180, 83, 9, .07);
}
.rate-limit-row.bad {
  border-color: rgba(190, 18, 60, .22);
  background: rgba(190, 18, 60, .07);
}
.rate-limit-copy {
  display: grid;
  gap: .15rem;
  min-width: 0;
}
.rate-limit-meter {
  display: grid;
  gap: .25rem;
  min-width: 7.5rem;
  text-align: right;
  color: #334155;
  font-weight: 850;
}
.rate-limit-meter progress {
  width: 100%;
  height: .62rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}
.rate-limit-meter progress::-webkit-progress-bar {
  background: #e2e8f0;
  border-radius: 999px;
}
.rate-limit-meter progress::-webkit-progress-value {
  background: linear-gradient(90deg, #2563eb, #22c55e);
  border-radius: 999px;
}
.rate-limit-meter progress::-moz-progress-bar {
  background: linear-gradient(90deg, #2563eb, #22c55e);
  border-radius: 999px;
}
.routing-list { margin: 0; padding-left: 1.2rem; display: grid; gap: .65rem; color: #475569; line-height: 1.55; }
.login-job-panel { border-color: rgba(37, 99, 235, .24); background: linear-gradient(135deg, rgba(37, 99, 235, .08), rgba(34, 197, 94, .07)), var(--panel); }
.status.good, .status.ready { background: rgba(4, 120, 87, .10); color: #065f46; border-color: rgba(4, 120, 87, .18); }
.status.login_required, .status.degraded { background: rgba(180, 83, 9, .12); color: #92400e; border-color: rgba(180, 83, 9, .22); }
.status.offline, .status.disabled { background: rgba(190, 18, 60, .10); color: #9f1239; border-color: rgba(190, 18, 60, .20); }
@container (max-width: 360px) {
  .runtime-actions { display: grid; }
  .runtime-actions .button { width: 100%; }
  .rate-limits-head,
  .rate-limit-row { align-items: flex-start; flex-direction: column; }
  .rate-limit-meter { min-width: 0; width: 100%; text-align: left; }
}
@container (max-width: 640px) {
  .inference-hero { flex-direction: column; }
  .endpoint-card { width: 100%; }
}
