:root {
  --paper: #f6f2ea;
  --paper-2: #efe9dd;
  --card: #fffdf9;
  --ink: #1c1a17;
  --ink-2: #4a453d;
  --ink-3: #8a8175;
  --line: #e2dacb;
  --line-2: #d3c8b5;
  --accent: #0f6b5c;
  --accent-2: #14836f;
  --accent-ink: #0a4b41;
  --accent-soft: #e2efe9;
  --warn: #b4531f;
  --warn-soft: #f7e7da;
  --danger: #a8332a;
  --danger-soft: #f6e2df;
  --ok: #177a4a;
  --ok-soft: #e0efe5;
  --shadow: 0 1px 2px rgba(28, 26, 23, .05), 0 8px 24px -12px rgba(28, 26, 23, .18);
  --shadow-lg: 0 2px 4px rgba(28, 26, 23, .06), 0 24px 48px -20px rgba(28, 26, 23, .28);
  --r: 10px;
  --r-lg: 16px;
  --display: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 500; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 34px; line-height: 1.15; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }

.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- Auth ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}
.auth-hero {
  position: relative;
  overflow: hidden;
  color: #f4efe6;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* Atmosphere painted as layered background images (no pseudo-element boxes). */
  background-color: #14110e;
  background-image:
    radial-gradient(58% 52% at 88% 96%, rgba(20,131,111,.55), rgba(20,131,111,0) 100%),
    radial-gradient(46% 42% at 4% -6%, rgba(180,83,31,.34), rgba(180,83,31,0) 100%),
    linear-gradient(150deg, #17130f 0%, #100d0b 55%, #0c1211 100%);
}
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 2; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--accent-2);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand-name { font-family: var(--display); font-size: 22px; letter-spacing: -.02em; }
.auth-hero-copy { position: relative; z-index: 2; max-width: 460px; }
.auth-hero-copy h1 { font-size: 46px; line-height: 1.08; color: #fbf7ef; }
.auth-hero-copy h1 em { font-style: italic; color: #6fd2b8; }
.auth-hero-copy p { color: #b9b2a6; font-size: 16px; margin-top: 18px; }
.auth-points { position: relative; z-index: 2; display: grid; gap: 14px; margin-top: 34px; }
.auth-point { display: flex; gap: 12px; align-items: flex-start; color: #cfc8bc; font-size: 14px; }
.auth-point b { color: #f4efe6; font-weight: 600; display: block; }
.auth-point .dot { width: 7px; height: 7px; border-radius: 50%; background: #6fd2b8; margin-top: 8px; flex: none; }

.auth-form-wrap { display: grid; place-items: center; padding: 40px; background: var(--paper); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 27px; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-3); margin-bottom: 28px; font-size: 14px; }
.auth-alt { margin-top: 22px; font-size: 14px; color: var(--ink-2); text-align: center; }
.auth-demo {
  margin-top: 24px;
  padding: 12px 14px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--ink-2);
  background: var(--paper-2);
}
.auth-demo code { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .01em; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea, select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--card);
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(20, 131, 111, .14);
}
.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.header-search { width: 250px; max-width: 100%; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: var(--ink);
  color: #fbf7ef;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: transform .08s, background .15s, box-shadow .15s;
}
.btn:hover { background: #322e28; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--ink);
  color: #ded7ca;
  padding: 22px 16px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.side-brand .brand-name { color: #f4efe6; font-size: 19px; }
.side-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: #7d766a; padding: 16px 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 9px;
  color: #bab3a6; font-size: 14px; font-weight: 500;
  cursor: pointer; margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .14s, color .14s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #f4efe6; }
.nav-item.active { background: rgba(20,131,111,.22); color: #eafff7; }
.nav-item .ico { width: 17px; text-align: center; opacity: .9; }
.side-spacer { flex: 1; }
.side-gap { height: 1px; background: rgba(255,255,255,.08); margin: 12px 10px; }

/* ---------- Docs ---------- */
.main-docs { max-width: 1180px; margin: 0 auto; }
.docs-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start; }
.docs-toc { position: sticky; top: 24px; }
.docs-toc .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .13em; color: var(--ink-3); font-weight: 600; margin-bottom: 12px; }
.docs-toc a {
  display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink-2);
  font-size: 13.5px; font-weight: 500; margin-bottom: 1px; border-left: 2px solid transparent;
}
.docs-toc a:hover { background: var(--paper-2); color: var(--ink); }
.docs-toc a.active { color: var(--accent-ink); background: var(--accent-soft); border-left-color: var(--accent); }
.docs-body { max-width: 720px; min-width: 0; }
.docs-body h1 { font-size: 34px; margin-bottom: 6px; }
.docs-body > .lede { color: var(--ink-3); font-size: 16px; margin-bottom: 30px; }
.docs-body h2 { font-size: 23px; margin: 38px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.docs-body h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.docs-body h3 { font-size: 16px; margin: 22px 0 8px; }
.docs-body p { color: var(--ink-2); line-height: 1.65; margin: 10px 0; }
.docs-body ul, .docs-body ol { color: var(--ink-2); line-height: 1.7; padding-left: 20px; }
.docs-body li { margin: 5px 0; }
.docs-body li > strong, .docs-body p > strong { color: var(--ink); }
.docs-body code {
  font-family: var(--mono); font-size: 12.5px; background: var(--paper-2);
  padding: 2px 6px; border-radius: 5px; color: var(--accent-ink);
}
.docs-body pre {
  background: #14130f; color: #d9d3c6; border-radius: var(--r); padding: 34px 18px 16px;
  overflow-x: auto; margin: 14px 0; position: relative;
}
.docs-body pre::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 28px;
  background: linear-gradient(#14130f, rgba(20,19,15,.85));
  border-radius: var(--r) var(--r) 0 0; pointer-events: none;
}
.docs-body pre code { background: none; padding: 0; color: inherit; font-size: 12.5px; line-height: 1.65; }
.docs-body pre code .k { color: #7fd6bd; }
.docs-body pre code .s { color: #e0b477; }
.docs-body pre code .c { color: #6f6a5e; }
.docs-copy {
  position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.08);
  border: none; color: #d9d3c6; font-size: 11px; padding: 4px 9px; border-radius: 6px; cursor: pointer;
}
.docs-copy:hover { background: rgba(255,255,255,.16); }
.docs-note {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 16px 0; font-size: 13.5px; color: var(--accent-ink);
}
.docs-note.warn { border-color: var(--warn); background: var(--warn-soft); color: #7a3a12; }
.docs-callout { display: grid; gap: 10px; margin: 16px 0; }
.docs-callout .row {
  display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.docs-callout .row:last-child { border-bottom: none; }
.docs-callout .row .m { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); }
.docs-callout .row .d { font-size: 13.5px; color: var(--ink-2); }
.docs-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 5px; vertical-align: middle;
}
.docs-badge.post { background: #e0efe5; color: #177a4a; }
.docs-badge.get { background: #e2efe9; color: #0a4b41; }
.docs-step { display: flex; gap: 14px; margin: 16px 0; }
.docs-step .n {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.side-user { border-top: 1px solid rgba(255,255,255,.09); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-2); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none;
}
.side-user .meta { min-width: 0; }
.side-user .meta b { display: block; color: #f4efe6; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .meta span { font-size: 11.5px; color: #8d8578; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.icon-btn { background: none; border: none; color: #8d8578; cursor: pointer; padding: 5px; border-radius: 7px; }
.icon-btn:hover { color: #f4efe6; background: rgba(255,255,255,.08); }

.main { padding: 34px 40px 60px; max-width: 1320px; margin: 0 auto; min-width: 0; width: 100%; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.topbar .eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .13em; color: var(--ink-3); font-weight: 600; margin-bottom: 7px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 17px; }
.card-head .sub { font-size: 12.5px; color: var(--ink-3); }

.grid { display: grid; gap: 18px; }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
/* Cards and grid items must never be forced wider than their track. */
.card, .metric, .grid > *, .split > * { min-width: 0; }

.metric { padding: 20px 22px; }
.metric .k { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 600; }
.metric .v { font-family: var(--display); font-size: 38px; line-height: 1.05; margin-top: 10px; letter-spacing: -.02em; }
.metric .d { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.metric.accent .v { color: var(--accent-ink); }

/* ---------- Project cards ---------- */
.proj-card { padding: 20px 22px; cursor: pointer; transition: transform .12s, box-shadow .16s, border-color .16s; min-height: 200px; }
.proj-new { display: grid; place-items: center; border-style: dashed; background: transparent; box-shadow: none; }
.proj-new:hover { transform: none; box-shadow: none; border-color: var(--accent-2); background: rgba(226,239,233,.35); }
.proj-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.proj-card .row { display: flex; align-items: center; justify-content: space-between; }
.proj-glyph {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--display); font-size: 20px; font-weight: 600;
}
.proj-card h3 { margin-top: 16px; font-size: 20px; }
.proj-card .bundle { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.proj-stats { display: flex; gap: 22px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.proj-stats .s b { display: block; font-family: var(--display); font-size: 21px; }
.proj-stats .s span { font-size: 11.5px; color: var(--ink-3); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab {
  padding: 10px 15px; background: none; border: none; cursor: pointer;
  font-size: 14px; font-weight: 550; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > table { min-width: 100%; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-3); font-weight: 600; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--paper-2);
}
th:first-child { border-top-left-radius: var(--r-lg); }
th:last-child { border-top-right-radius: var(--r-lg); }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(226,218,203,.28); }
.tt { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
}
.badge.b-ok { background: var(--ok-soft); color: var(--ok); }
.badge.b-warn { background: var(--warn-soft); color: var(--warn); }
.badge.b-bad { background: var(--danger-soft); color: var(--danger); }
.badge.b-mute { background: var(--paper-2); color: var(--ink-2); }
.badge.b-prod { background: var(--accent-soft); color: var(--accent-ink); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Stats bits ---------- */
.bar-track { height: 7px; border-radius: 6px; background: var(--paper-2); overflow: hidden; display: flex; }
.bar-track i { display: block; height: 100%; }
.bar-ok { background: var(--ok); }
.bar-bad { background: var(--danger); }
.sparkline { display: flex; align-items: flex-end; gap: 5px; }
.spark-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.spark-bars { display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 86px; }
.spark-col i { display: block; border-radius: 3px; min-height: 3px; }
.spark-col > i { min-height: 3px; }
.bar-empty { background: var(--line-2); opacity: .5; }
.spark-day { font-size: 9.5px; color: var(--ink-3); text-align: center; }
.chart-legend { display: flex; gap: 18px; font-size: 12px; color: var(--ink-2); margin-top: 14px; }
.chart-legend .li { display: flex; align-items: center; gap: 7px; }
.chart-legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Phone preview ---------- */
.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 22px; align-items: start; }
.phone-stage {
  background: var(--paper-2);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  padding: 30px 20px;
  display: flex; flex-direction: column; align-items: center;
}
.phone {
  width: 286px; height: 580px; border-radius: 44px;
  background: linear-gradient(160deg, #2a2723, #12110f);
  padding: 11px; box-shadow: var(--shadow-lg), inset 0 0 0 2px rgba(255,255,255,.06);
  position: relative;
}
.phone-screen {
  width: 100%; height: 100%; border-radius: 34px; overflow: hidden;
  position: relative; display: flex; flex-direction: column;
  background:
    radial-gradient(120% 80% at 20% 8%, #2e5c66, rgba(46,92,102,0) 55%),
    radial-gradient(120% 90% at 90% 20%, #7b4a3a, rgba(123,74,58,0) 50%),
    linear-gradient(180deg, #1a2430, #0f1419 70%);
}
.lock-foot { margin-top: auto; padding-bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; z-index: 3; }
.lock-hint { font-size: 11px; color: rgba(255,255,255,.5); }
.home-bar { width: 108px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.75); }
.phone-notch {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 96px; height: 26px; border-radius: 20px; background: #0b0a09; z-index: 4;
}
.statusbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 22px 6px; color: #fff; font-size: 12.5px; font-weight: 600; z-index: 3;
}
.statusbar .sig { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; }
.lockscreen-time {
  text-align: center; color: #fff; margin-top: 26px; z-index: 3;
}
.lockscreen-time .t { font-family: var(--display); font-size: 58px; line-height: 1; letter-spacing: -.02em; }
.lockscreen-time .d { font-size: 13px; opacity: .82; margin-top: 4px; }
.push-wrap { padding: 26px 15px; z-index: 3; }
.push {
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(20px);
  border-radius: 17px; padding: 12px 14px;
  box-shadow: 0 8px 26px -10px rgba(0,0,0,.6);
  animation: pushIn .34s cubic-bezier(.2,.9,.3,1.15);
}
@keyframes pushIn { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }
.push-top { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.push-appicon {
  width: 21px; height: 21px; border-radius: 5.5px;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-family: var(--display); font-size: 12px; font-weight: 600; flex: none;
}
.push-app { font-size: 12px; font-weight: 600; color: #3a3630; text-transform: uppercase; letter-spacing: .04em; flex: 1; }
.push-now { font-size: 11px; color: #8b857b; }
.push-title { font-size: 14px; font-weight: 700; color: #17150f; line-height: 1.25; }
.push-sub { font-size: 12.5px; font-weight: 600; color: #55504a; }
.push-body { font-size: 13.5px; color: #2b2823; line-height: 1.35; margin-top: 1px; }
.push-actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.push-action {
  font-size: 11px; font-weight: 600; color: var(--accent-ink);
  background: rgba(20,131,111,.12); padding: 4px 9px; border-radius: 8px; flex: 1; text-align: center;
}

.action-row { margin-bottom: 10px; }
.action-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,.9fr) minmax(0,1.4fr) auto; gap: 8px; align-items: center; }
.action-grid input, .action-grid select { padding: 9px 11px; font-size: 13px; }
.action-grid .btn { padding: 9px 12px; }
.badge-preview {
  position: absolute; top: 11px; right: 26px; z-index: 5;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #e5484d; color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.phone-caption { margin-top: 16px; font-size: 12px; color: var(--ink-3); text-align: center; }

.public-link.is-off { opacity: .5; pointer-events: none; }
.public-code { margin-top: 12px; font-size: 12.5px; color: var(--ink-3); }
.public-code b { color: var(--ink); }

.key-row { display: flex; align-items: stretch; gap: 8px; }
.key-row input { flex: 1; min-width: 0; font-size: 11.5px; letter-spacing: -0.2px; }
.key-row .btn { flex: none; }

.curl-box {
  background: #14130f; border-radius: var(--r);
  padding: 14px 15px; overflow-x: auto; margin-top: 6px;
}
.curl-box pre { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: #d9d3c6; white-space: pre; min-width: 0; }
.curl-box .k { color: #7fd6bd; }
.curl-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Segmented ---------- */
.seg { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button {
  padding: 6px 13px; border: none; background: none; cursor: pointer;
  font-size: 13px; font-weight: 550; color: var(--ink-2); border-radius: 7px;
}
.seg button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.switch { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 44px; height: 25px; border-radius: 14px; background: var(--line-2); position: relative; transition: background .18s; flex: none; }
.switch .track::after {
  content: ''; position: absolute; top: 2.5px; left: 2.5px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(19px); }
.switch .lbl { font-size: 14px; font-weight: 550; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(28,26,23,.5);
  backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 1000;
  padding: 24px; animation: fade .16s;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--card); border-radius: var(--r-lg); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2,.9,.3,1.1);
  max-height: 90vh; overflow: auto;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 24px; }
.modal-table { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--paper-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: var(--ink); color: #fbf7ef; padding: 12px 18px; border-radius: 11px;
  font-size: 13.5px; font-weight: 550; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; animation: toastIn .2s;
  max-width: 460px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }

.empty { text-align: center; padding: 54px 20px; color: var(--ink-3); }
.empty .big { font-family: var(--display); font-size: 21px; color: var(--ink-2); margin-bottom: 6px; }

.row-flex { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.nowrap { white-space: nowrap; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }
.loading-screen { min-height: 100vh; display: grid; place-items: center; color: var(--ink-3); }
.loading-screen .spinner { border-color: var(--line-2); border-top-color: var(--accent); }

/* ---------- Responsive ---------- */

/* Tablet / small laptop: collapse the widest grids and the builder's phone column. */
@media (max-width: 1080px) {
  .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .builder-grid { grid-template-columns: minmax(0, 1fr); }
  .phone-stage { position: static; }
}

/* Narrow desktop: give the phone preview a max width so it never dominates. */
@media (max-width: 900px) {
  .docs-wrap { grid-template-columns: minmax(0, 1fr); }
  .docs-toc { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .docs-toc .eyebrow { width: 100%; }
}

/* Mobile: single column everywhere, sidebar becomes a top bar. */
@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 12px; }
  .side-label, .side-spacer, .side-gap { display: none; }
  .side-brand { padding: 4px 6px; margin-right: auto; }
  .side-user { border-top: none; padding-top: 0; margin-left: 0; }
  .nav-item { width: auto; padding: 8px 12px; }
  .nav-item .ico { display: none; }
  .main { padding: 22px 16px 50px; }
  .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.k3, .grid.k2 { grid-template-columns: minmax(0, 1fr); }
  .builder-grid { grid-template-columns: minmax(0, 1fr); }
  .phone-stage { padding: 24px 16px; }
  .phone { width: 260px; height: 528px; }
  h1 { font-size: 26px; }
  .metric .v { font-size: 32px; }
  .action-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .action-grid input[data-f="url"] { grid-column: 1 / -1; }
  .action-grid .btn { justify-self: end; }
  .header-search { width: 100%; }
  .modal { border-radius: 14px; }
  .modal-body { padding: 18px; }
}

/* Very small phones: stack the action editor and shrink type a touch. */
@media (max-width: 520px) {
  .grid.k4 { grid-template-columns: minmax(0, 1fr); }
  .side-user .meta { display: none; }
  .side-brand .brand-name { font-size: 17px; }
  .card-pad, .card-head { padding: 16px; }
  .main { padding: 18px 12px 44px; }
  .grid { gap: 14px; }
  .action-grid { grid-template-columns: minmax(0, 1fr); }
  .action-grid .btn { justify-self: stretch; }
  h1 { font-size: 23px; }
  .metric .v { font-size: 28px; }
}
