/* Kerver — production SaaS UI (calm dark, Linear/Vercel posture) */
:root {
  color-scheme: dark;
  --bg: #08090a;
  --bg-elevated: #0f1011;
  --surface: #141516;
  --surface-2: #191a1b;
  --surface-hover: #1e1f21;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #f7f8f8;
  --text-2: #d0d6e0;
  --muted: #8a8f98;
  --muted-2: #62666d;
  --brand: #5e6ad2;
  --brand-hover: #7170ff;
  --brand-soft: rgba(94, 106, 210, 0.14);
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.12);
  --warn: #f59e0b;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --max: 1080px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-feature-settings: "cv01", "ss03";
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}
a { color: var(--brand-hover); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.container { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px) saturate(1.2);
  background: rgba(8, 9, 10, 0.78);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none !important;
}
.brand:hover { text-decoration: none !important; }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex: 0 0 auto;
  overflow: hidden;
  background: var(--brand);
  display: grid;
  place-items: center;
}
.brand-mark img,
.brand-mark svg {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 7px;
}
.brand-text { min-width: 0; line-height: 1.15; }
.brand-name {
  font-weight: 590;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}
.brand-tag {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  margin-top: 1px;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Pills / badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 510;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
}
.pill.ok {
  border-color: rgba(16, 185, 129, 0.28);
  background: var(--ok-soft);
  color: #6ee7b7;
}
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.badge {
  font-size: 0.72rem;
  font-weight: 510;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-weight: 510;
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: none !important;
  color: #fff;
  background: var(--brand);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-hover); text-decoration: none !important; }
.btn.secondary,
.btn.ghost {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text-2);
  box-shadow: none;
}
.btn.secondary:hover,
.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-strong);
  color: var(--text);
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}
.btn.danger:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Hero / marketing */
.hero { padding: 56px 0 28px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 32px;
  align-items: start;
}
h1, .page-title {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4.2vw, 2.75rem);
  font-weight: 510;
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: var(--text);
  text-wrap: balance;
}
.page-title {
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  margin: 0;
}
.lead {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0 0 22px;
  max-width: 48ch;
  font-weight: 400;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.feature {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.feature b {
  display: block;
  margin-bottom: 4px;
  font-weight: 590;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}
.feature span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

/* Cards / panels */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: 18px;
}
.card h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 590;
  letter-spacing: -0.02em;
}
.card .sub {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 14px;
  line-height: 1.45;
}

/* Tabs / forms */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-weight: 510;
  font-size: 0.85rem;
  transition: background 0.12s ease, color 0.12s ease;
}
.tab.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 12px 0 6px;
  font-weight: 510;
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  outline: none;
  font-size: 0.9rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(113, 112, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.18);
}
input::placeholder { color: var(--muted-2); }
.msg { min-height: 1.2em; margin-top: 10px; font-size: 0.875rem; }
.ok { color: var(--ok); }
.err { color: #f87171; }
.muted { color: var(--muted); }

/* Sections */
.section { padding: 12px 0 48px; }
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}
.section-title h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 590;
  letter-spacing: -0.02em;
}
pre, code { font-family: var(--mono); }
pre {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  overflow: auto;
  background: #050506;
  border: 1px solid var(--line);
  color: #dbe1ea;
  font-size: 0.8rem;
  line-height: 1.55;
}
code.inline {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.8rem;
  color: var(--text-2);
}
.footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: 0.8rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* Dashboard */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 0 14px;
}
.topbar .muted { font-size: 0.875rem; margin-top: 4px; }
.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}
.grid-main { display: grid; gap: 14px; }
.usage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 14px 0 8px;
}
.usage-head:first-of-type { margin-top: 2px; }
.usage-title { font-weight: 510; font-size: 0.875rem; }
.usage-meta {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}
.bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 0;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--brand);
  transition: width 0.35s ease, background 0.2s ease;
  border-radius: 999px;
}
.bar.warn > i { background: var(--warn); }
.bar.danger > i { background: var(--danger); }
.bar-pct {
  position: absolute;
  inset: auto 0 -18px 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 0.7rem;
  font-weight: 510;
  color: var(--muted);
  pointer-events: none;
  text-shadow: none;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 22px;
}
.stat {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.stat .label {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 4px;
  font-weight: 510;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat .value {
  font-size: 1.05rem;
  font-weight: 590;
  letter-spacing: -0.02em;
  color: var(--text);
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.row input { flex: 1; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}
th {
  color: var(--muted);
  font-weight: 510;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.key-once {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--ok-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  word-break: break-all;
}
.empty { color: var(--muted); padding: 8px 0; font-size: 0.875rem; }
.deposit-box {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}
.panel-active {
  padding: 14px !important;
  background: var(--brand-soft) !important;
  border: 1px solid rgba(94, 106, 210, 0.28) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
}

@media (max-width: 900px) {
  .hero { padding-top: 36px; }
  .hero-grid, .grid-2 { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .usage-meta { font-size: 0.75rem; white-space: normal; }
  .nav-actions .pill { display: none; }
  .container { width: min(var(--max), calc(100% - 28px)); }
}
