@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/InterVariable.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #070b14;
  --elev: #0f1724;
  --elev-2: #152033;
  --line: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --faint: #64748b;
  --blue: #3b82f6;
  --blue-deep: #1d4ed8;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --violet: #c084fc;
  --sans: Inter, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 420px at 8% -12%, rgba(59, 130, 246, 0.18), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.55;
}
body.app-body { background: var(--bg); }
a { color: var(--blue); }
img { max-width: 100%; }

.wrap { width: min(1080px, calc(100% - 2.5rem)); margin: 0 auto; }
.narrow { width: min(460px, calc(100% - 2.5rem)); margin: 0 auto; }

.site-header, .site-footer {
  width: min(1080px, calc(100% - 2.5rem));
  margin: 0 auto;
}
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 0;
  flex-wrap: wrap;
}
body:not(.app-body) .site-header {
  border-bottom: 1px solid transparent;
}
.nav, .subnav { display: flex; gap: 0.9rem 1.1rem; align-items: center; flex-wrap: wrap; }
.nav a, .subnav a { color: #d4d4d4; text-decoration: none; font-weight: 500; }
.nav a:hover, .subnav a:hover, .nav a[aria-current="page"], .subnav a[aria-current="page"] { color: #fff; }
.subnav { margin: 0.25rem 0 1.25rem; }

.brand-word {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
  font-size: 1.65rem;
}
.brand-word .accent { color: #3b82f6; }
.brand-word-hero { font-size: clamp(2.8rem, 8vw, 4.4rem); }
.brand-word-footer { font-size: 1.15rem; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 2.5rem 0 3rem;
  color: var(--faint);
  border-top: 1px solid #161616;
  margin-top: 3rem;
}
.site-footer nav { display: flex; gap: 1rem; }
.site-footer a { color: var(--muted); text-decoration: none; }

.hero { padding: 3.5rem 0 2rem; }
.lede { font-size: 1.2rem; max-width: 40rem; color: #d4d4d4; margin: 1rem 0 0; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; margin: 2.2rem 0 0; }
.metric, .card, .panel {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.05rem;
}
.metric strong { display: block; font-size: 1.15rem; letter-spacing: -0.025em; }
.metric span, .muted, .hint { color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
h1, h2, h3 { letter-spacing: -0.03em; font-weight: 600; line-height: 1.15; }
h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin: 0 0 0.6rem; }
h2 { font-size: 1.4rem; margin: 0 0 0.7rem; }
h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
p { margin: 0.4rem 0 0.8rem; }
section { padding: 1.6rem 0; }

.btn, button.btn {
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 7px;
  padding: 0.65rem 0.95rem;
  font: 600 0.95rem/1 var(--sans);
  letter-spacing: -0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn:hover { background: var(--blue-deep); }
.btn-ghost { background: transparent; color: #fff; border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--elev-2); }
.btn-small { padding: 0.45rem 0.7rem; font-size: 0.88rem; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #3f1d1d; }
.btn-danger:hover { background: #1a0a0a; }

label { display: block; font-size: 0.92rem; margin: 0.85rem 0 0.35rem; }
input, textarea, select {
  width: 100%;
  background: #070707;
  color: #fff;
  border: 1px solid #2a2a2a;
  border-radius: 7px;
  padding: 0.7rem 0.75rem;
  font: inherit;
}
textarea { min-height: 8rem; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue); border-color: transparent; }
.form-error { color: var(--danger); min-height: 1.2rem; }
.file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; margin: 0.2rem 0; }
.file-actions .form-error { min-height: 0; flex-basis: 100%; margin: 0; }
.form-ok { color: var(--ok); }

pre, code { font-family: var(--mono); }
pre {
  background: #070707;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.05rem;
  overflow: auto;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #e7e7e7;
}
code { font-size: 0.92em; }
:not(pre) > code { color: #dbe7ff; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 1px solid #1c1c1c; vertical-align: top; }
th { color: var(--muted); font-weight: 500; background: #070707; }
tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.18rem 0.62rem 0.18rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  background: var(--elev-2);
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.st-completed, .st-ok { color: var(--ok); }
.st-in_progress { color: #93c5fd; }
.st-validating, .st-finalizing { color: var(--violet); }
.st-failed, .st-expired { color: var(--danger); }
.st-cancelling, .st-cancelled { color: var(--warn); }
.pill.st-completed, .pill.st-ok { background: rgba(74, 222, 128, 0.12); }
.pill.st-in_progress { background: rgba(59, 130, 246, 0.16); color: #93c5fd; }
.pill.st-validating, .pill.st-finalizing { background: rgba(192, 132, 252, 0.16); }
.pill.st-failed, .pill.st-expired { background: rgba(248, 113, 113, 0.14); }
.pill.st-cancelling, .pill.st-cancelled { background: rgba(251, 191, 36, 0.14); }

.callout {
  border: 1px solid #1e3a8a;
  background: #070d1c;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  color: #dbeafe;
}
.callout strong { color: #fff; }

.stack { display: grid; gap: 0.9rem; }
.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1rem; }
.docs h2 { margin-top: 2rem; }
.docs h3 { margin-top: 1.2rem; }
.toc { display: flex; gap: 0.8rem 1rem; flex-wrap: wrap; margin: 0.5rem 0 0.2rem; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: #fff; }
.key-reveal input { font-family: var(--mono); }
.balance { font-size: 1.8rem; letter-spacing: -0.03em; margin: 0.2rem 0; }
.packs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.6rem 0 1rem; }
.packs .btn[aria-pressed="true"] { border-color: var(--blue); color: #fff; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-top {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #0b1220;
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-top .brand-word { font-size: 1.35rem; }
.app-top-spacer { flex: 1; }
.app-top-links { display: flex; align-items: center; gap: 0.35rem; }
.app-top-links a, .side-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
}
.app-top-links a { padding: 0.4rem 0.65rem; }
.app-top-links a:hover, .side-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.app-top-links svg, .side-nav svg, .icon-btn svg, .btn svg { width: 1rem; height: 1rem; flex: none; }
.nav-toggle {
  display: none;
  background: transparent;
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  cursor: pointer;
}
.avatar-wrap { position: relative; }
.avatar {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  border: 0;
  background: var(--blue);
  color: #fff;
  font: 700 0.78rem/1 var(--sans);
  cursor: pointer;
}
.avatar-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  min-width: 12rem;
  background: #0f1724;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  z-index: 30;
}
.avatar-menu a, .menu a, .menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  text-decoration: none;
  font: 500 0.92rem/1.2 var(--sans);
  padding: 0.5rem 0.6rem;
  border-radius: 7px;
  cursor: pointer;
}
.avatar-menu a:hover, .menu a:hover, .menu button:hover { background: var(--elev-2); }
.avatar-email { margin: 0.2rem 0.6rem 0.45rem; color: var(--muted); font-size: 0.82rem; word-break: break-all; }
.app-frame { display: flex; flex: 1; min-height: 0; }
.app-side {
  width: 272px;
  flex: none;
  background: #0b1220;
  border-right: 1px solid var(--line);
  padding: 1rem 0.85rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.new-batch { width: 100%; padding: 0.72rem 0.9rem; }
.side-nav { display: flex; flex-direction: column; gap: 0.15rem; }
.side-nav a { padding: 0.55rem 0.7rem; }
.side-nav a[aria-current="page"] { background: #172554; color: #fff; }
.usage-card {
  margin-top: auto;
  background: #0c1424;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 0.85rem 0.8rem;
}
.usage-card h2 { font-size: 0.95rem; margin: 0; display: flex; justify-content: space-between; gap: 0.5rem; }
.usage-card h2 span, .usage-kicker, .usage-of, .usage-meter-note, .usage-held { color: var(--muted); font-size: 0.78rem; font-weight: 500; }
.usage-kicker { margin: 0.85rem 0 0.15rem; }
.usage-figure { margin: 0; font-size: 1.35rem; letter-spacing: -0.03em; font-weight: 650; }
.usage-of { margin: 0.1rem 0 0.55rem; }
.meter { height: 6px; border-radius: 999px; background: #1e293b; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--blue); border-radius: inherit; }
.usage-meter-note { margin: 0.4rem 0 0.7rem; }
.usage-paid { display: flex; justify-content: space-between; gap: 0.5rem; margin: 0 0 0.35rem; font-size: 0.88rem; }
.usage-held { margin: 0 0 0.6rem; }
.usage-stats { margin: 0.35rem 0 0.8rem; display: grid; gap: 0.35rem; }
.usage-stats div { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.86rem; }
.usage-stats dt { color: var(--muted); }
.usage-stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.usage-link { width: 100%; }
.app-scrim { display: none; }
.app-main { flex: 1; min-width: 0; padding: 1.6rem 1.5rem 2rem; }
.app-main h1 { font-size: 1.7rem; margin-bottom: 0.25rem; }
.page-sub { color: var(--muted); margin: 0 0 1.1rem; }
.job-card { background: #0c1222; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.job-card table { font-size: 0.9rem; }
.job-card th {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
  color: var(--faint);
  background: transparent;
  border-bottom: 1px solid var(--line);
}
.job-card td { border-bottom: 1px solid rgba(30, 41, 59, 0.85); vertical-align: middle; }
.job-card tr:last-child td { border-bottom: 0; }
.job-id { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--mono); font-size: 0.82rem; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: #fff; background: var(--elev-2); }
.progress-cell { min-width: 7.5rem; }
.progress-label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.25rem; }
.progress {
  height: 6px;
  border-radius: 999px;
  background: #1e293b;
  overflow: hidden;
}
.progress span { display: block; height: 100%; border-radius: inherit; }
.when { display: block; }
.when small { display: block; color: var(--muted); }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.35rem; position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  min-width: 11rem;
  background: #0f1724;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.3rem;
  z-index: 5;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.job-detail td { background: #0a101c; }
.detail-grid { display: grid; gap: 0.7rem; padding: 0.35rem 0.2rem 0.5rem; }
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}
.pager-pages { display: flex; gap: 0.25rem; align-items: center; }
.pager-pages button {
  min-width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: 600 0.86rem/1 var(--sans);
  cursor: pointer;
}
.pager-pages button[aria-current="page"] { border-color: var(--blue); color: #fff; }
.pager-pages button:disabled { opacity: 0.4; cursor: default; }
.empty-jobs { padding: 2.2rem 1rem; text-align: center; color: var(--muted); }
.batch-dialog {
  width: min(560px, calc(100% - 2rem));
  background: #0f1724;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.15rem 1.2rem;
}
.batch-dialog::backdrop { background: rgba(2, 6, 16, 0.72); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.dialog-head h2 { margin: 0; }

@media (max-width: 800px) {
  .metrics, .steps, .split { grid-template-columns: 1fr; }
  .hero { padding-top: 2rem; }
}
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .app-top-links { display: none; }
  .app-side {
    position: fixed;
    z-index: 25;
    top: 64px;
    bottom: 0;
    left: 0;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    overflow: auto;
  }
  .app-side.is-open { transform: none; }
  .app-scrim {
    display: block;
    position: fixed;
    inset: 64px 0 0 0;
    background: rgba(2, 6, 16, 0.55);
    z-index: 24;
  }
  .app-main { padding: 1.1rem 0.9rem 1.6rem; }
  .pager { flex-wrap: wrap; }
}
