/* ============================================================
   Limit — documentation site
   Palette matched to the machine dashboard (127.0.0.1:8080):
   warm paper background, white cards, ink text, steel-blue accent.
   Self-contained: no external fonts, no CDNs, works offline.
   ============================================================ */
:root {
  --bg:      #faf9f7;
  --card:    #ffffff;
  --ink:     #1a1a1a;
  --dim:     #777777;
  --line:    #e6e2dc;
  --acc:     #2563a8;
  --ok:      #1a7f37;
  --warn:    #b45309;
  --bad:     #b91c1c;
  --bg-soft: #f4f2ef;
  --bg-code: #f6f5f3;
  --acc-soft:#eef3fa;
  --mono: ui-monospace, Menlo, Consolas, "Cascadia Code", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;
  --nav-h: 56px;
  --max-w: 1080px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #d7e3f4; }

nav.top {
  position: sticky; top: 0; z-index: 50;
  min-height: var(--nav-h);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 20px;
  background: rgba(250,249,247,.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: .12em; font-size: 14px;
  color: var(--ink); text-decoration: none; margin-right: 14px;
}
.brand .mark {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--acc);
  display: grid; place-items: center;
  color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 0;
}
nav.top a.link {
  color: var(--dim); text-decoration: none; font-size: 13.5px;
  padding: 6px 11px; border-radius: 8px; letter-spacing: .02em;
  transition: color .15s, background .15s;
}
nav.top a.link:hover { color: var(--ink); background: var(--bg-soft); }
nav.top a.link.active { color: var(--acc); background: var(--acc-soft); font-weight: 600; }
nav.top .spacer { flex: 1; }
nav.top .status {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  display: flex; align-items: center; gap: 7px;
}
nav.top .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.pill {
  display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--dim);
  font-family: var(--mono);
}
.pill.ok { color: var(--ok); border-color: #bfe3c8; background: #eef8f1; }
.pill.bad { color: var(--bad); border-color: #f1b3b3; background: #fdecec; }
.pill.warn { color: var(--warn); border-color: #f5c99a; background: #fff7ed; }
.pill.acc { color: var(--acc); border-color: #c4d5ec; background: var(--acc-soft); }

.hero { position: relative; width: 100%; height: clamp(480px, 68vh, 780px); overflow: hidden;
  background: #dfe2e4; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.hero canvas:active { cursor: grabbing; }
.hero .scrim {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(250,249,247,.18) 0%, rgba(250,249,247,0) 30%, rgba(250,249,247,.85) 96%, var(--bg) 100%),
    radial-gradient(55% 40% at 50% 80%, rgba(0,0,0,.06), transparent 70%);
}
.hero .titleblock { position: absolute; left: clamp(20px, 5vw, 56px); bottom: clamp(20px, 5vh, 40px); pointer-events: none; }
.hero .kicker {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--acc); margin-bottom: 8px;
}
.hero h1 { font-size: clamp(28px, 4.4vw, 42px); font-weight: 700; letter-spacing: -.015em; line-height: 1.08; color: var(--ink); }
.hero p.sub { margin-top: 10px; max-width: 560px; color: #4a4a4a; font-size: 15px; }
.hero .hint {
  position: absolute; right: clamp(16px, 4vw, 44px); bottom: clamp(18px, 4.5vh, 36px);
  font-family: var(--mono); font-size: 10.5px; color: #8b8f94; letter-spacing: .08em;
  display: flex; align-items: center; gap: 8px; pointer-events: none;
}
.hero .hint::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #b8bdc2; }
/* status badge for drive.html (mirrors .stage .stagebadge, hero-scale) */
.hero .stagebadge { position: absolute; right: clamp(16px, 4vw, 44px); top: clamp(14px, 3vh, 22px); pointer-events: none; }
.hero .loader {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; color: var(--dim); letter-spacing: .12em;
  background: #dfe2e4; z-index: 5;
}
.hero .loader .bar { margin-top: 12px; width: 120px; height: 2px; background: #d5d9dc; overflow: hidden; border-radius: 2px; }
.hero .loader .bar i { display: block; height: 100%; width: 40%; background: var(--acc); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%);} 100% { transform: translateX(280%);} }

main { max-width: var(--max-w); margin: 0 auto; padding: 44px 24px 80px; }
section { margin-bottom: 52px; }
section > h2 {
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
  font-weight: 600;
}
section > h2 .pill { text-transform: none; letter-spacing: 0; }
section > h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
h3 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; margin: 24px 0 10px; }
p { color: #444; margin-bottom: 12px; }
p.lead { font-size: 16.5px; color: #2c2c2c; }
ul, ol { color: #444; margin: 0 0 14px 22px; }
li { margin-bottom: 6px; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--mono); font-size: 12.5px; color: #233246;
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 5px; white-space: nowrap;
}
pre {
  background: var(--bg-code); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; overflow-x: auto; margin: 14px 0 18px;
}
pre code { background: none; border: none; padding: 0; white-space: pre; font-size: 12.5px; line-height: 1.6; color: #333; }
pre .c { color: #8a8a8a; }
pre .k { color: var(--acc); }

.codeblock {
  background: #10151d; border: 1px solid #222c39; border-radius: 12px;
  margin: 14px 0 18px; overflow: hidden;
  box-shadow: 0 12px 32px -20px rgba(16, 21, 29, .6);
}
.codeblock-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 13px; background: #171f2a; border-bottom: 1px solid #222c39;
}
.cb-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em;
  text-transform: uppercase; color: #8fa3ba; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.cb-dots i {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-left: 6px; background: #2c3947; flex: none;
}
.cb-dots i:nth-child(1) { background: #e0654f; }
.cb-dots i:nth-child(2) { background: #e0a83f; }
.cb-dots i:nth-child(3) { background: #59a86b; }
pre.cb {
  background: none; border: none; border-radius: 0; margin: 0;
  padding: 14px 16px 16px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
  color: #c9d5e3; white-space: pre;
}
pre.cb::-webkit-scrollbar { height: 8px; }
pre.cb::-webkit-scrollbar-thumb { background: #2c3947; border-radius: 4px; }
pre.cb::-webkit-scrollbar-track { background: transparent; }
.t-cmd  { color: #7ec8ff; font-weight: 600; }
.t-flag { color: #b39ddb; }
.t-cmt  { color: #5d6b7c; font-style: italic; }
.t-key  { color: #7ee0c3; }
.t-str  { color: #ffd28a; }
.t-num  { color: #f2a0c4; }
.t-bool { color: #f2a0c4; }
.t-null { color: #6b7a8c; font-style: italic; }
strong { color: var(--ink); font-weight: 600; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  transition: border-color .18s, box-shadow .18s;
}
.card:hover { border-color: #cfd6de; box-shadow: 0 1px 4px rgba(20,30,40,.05); }
.card .tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--acc); margin-bottom: 7px; display: block;
}
.card h3 { margin: 0 0 7px; font-size: 15.5px; }
.card p { margin: 0; font-size: 13.5px; color: var(--dim); }
.card .meta { margin-top: 11px; font-family: var(--mono); font-size: 11.5px; color: #9a9a9a; }

.tablewrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 14px 0 20px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--dim); padding: 7px 8px 7px 16px; border-bottom: 1px solid var(--line);
  background: var(--bg-soft); font-weight: 600;
}
td { padding: 8px 16px 8px 16px; border-bottom: 1px solid var(--line); vertical-align: top; color: #444; }
tr:last-child td { border-bottom: none; }
td.k { font-family: var(--mono); font-size: 12.5px; color: #555; white-space: nowrap; }
td .pill { white-space: nowrap; }

.note {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-left: 3px solid var(--acc);
  background: var(--card); border-radius: var(--radius); padding: 13px 15px; margin: 16px 0;
  font-size: 14px; color: #444;
}
.note.amber { border-left-color: var(--warn); background: #fffdf9; }
.note .ico { font-family: var(--mono); color: var(--acc); font-size: 12px; margin-top: 1px; }
.note.amber .ico { color: var(--warn); }

.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin: 18px 0; }
.flow .step {
  flex: 1 1 150px; min-width: 150px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px 11px; position: relative;
}
.flow .step .n { font-family: var(--mono); font-size: 10.5px; color: #9a9a9a; letter-spacing: .12em; }
.flow .step .t { font-weight: 650; font-size: 14px; margin-top: 4px; }
.flow .step .d { font-size: 12.5px; color: var(--dim); margin-top: 4px; }
.flow .arrow { align-self: center; color: #b8b3ab; font-size: 16px; flex: 0 0 auto; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.chip {
  font-family: var(--mono); font-size: 11.5px; color: #555;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
  background: var(--card);
}
.chip b { color: var(--acc); font-weight: 600; }

footer {
  border-top: 1px solid var(--line);
  padding: 24px 24px 32px; text-align: center;
  color: var(--dim); font-size: 12.5px; font-family: var(--mono); letter-spacing: .03em;
}
footer .dot { color: var(--acc); }

.drive {
  max-width: none; margin: 0 auto;
  padding: 18px 0 40px;
}
.stage {
  position: relative; background: #dfe2e4;
  width: 100%; overflow: hidden;
  height: clamp(480px, 68vh, 780px);
  cursor: grab; touch-action: none;
}
.stage:active { cursor: grabbing; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .stagehint {
  position: absolute; left: 12px; bottom: 10px;
  font-family: var(--mono); font-size: 11px; color: #6a6f75;
  background: rgba(255,255,255,.75); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 9px; pointer-events: none;
}
.stage .stagebadge {
  position: absolute; right: 12px; top: 10px; pointer-events: none;
}
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px 8px;
  margin: 20px auto 0; max-width: var(--max-w);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  column-gap: 26px; align-items: start;
}
.panel > h2, .panel > .psub, .panel > .pfoot { grid-column: 1 / -1; }
.panel h2 {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--dim); font-weight: 600; margin: 0 0 4px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.panel .psub { font-size: 12px; color: #9a9a9a; margin-bottom: 10px; }
.pgroup { padding-top: 2px; margin-top: 4px; }
.pgroup + .pgroup { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 12px; }
.pgroup h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--acc);
  font-weight: 700; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline;
}
.pgroup h3 .sql { font-family: var(--mono); font-size: 10.5px; color: #9a9a9a; text-transform: none; letter-spacing: 0; font-weight: 500; }
.frow {
  display: grid; grid-template-columns: 78px 1fr 106px; gap: 8px; align-items: center;
  padding: 3.5px 0; border-bottom: 1px dashed var(--line);
}
.frow:last-child { border-bottom: none; }
.frow label { font-size: 12.5px; color: #555; }
.frow input[type="text"], .frow input[type="number"], .frow select {
  width: 100%; font-family: var(--mono); font-size: 12px;
  border: 1px solid var(--line); border-radius: 6px; padding: 3.5px 7px;
  background: var(--bg); color: var(--ink);
}
.frow input:focus, .frow select:focus { outline: none; border-color: var(--acc); }
.frow .map { font-family: var(--mono); font-size: 10px; color: #a3a3a3; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow input[type="checkbox"] { accent-color: var(--acc); width: 15px; height: 15px; justify-self: start; }
.frow.check { grid-template-columns: 1fr 130px; }
.jointgrid .frow { grid-template-columns: 70px 1fr 104px; }
.pfoot { border-top: 1px solid var(--line); margin-top: 12px; padding: 9px 0 4px; font-size: 11.5px; color: #9a9a9a; }
.pfoot code { font-size: 10.5px; }

.embedwrap {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--card); margin: 14px 0 20px;
}
.embedbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--bg-soft);
  font-family: var(--mono); font-size: 11.5px; color: var(--dim);
}
.embedbar .url { color: var(--acc); }
.embedbar a.open {
  margin-left: auto; font-size: 12px; padding: 3px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--acc); font-family: var(--sans);
}
.embedbar a.open:hover { background: var(--acc-soft); text-decoration: none; }
.embedwrap iframe { width: 100%; height: 720px; border: 0; display: block; background: #faf9f7; }

@media (max-width: 900px) {
  .stage { height: 60vh; }
  .panel { max-height: none; }
}
@media (max-width: 640px) {
  nav.top { padding: 6px 10px; }
  .brand { margin-right: 6px; }
  nav.top .status { display: none; }
  .hero { height: 380px; }
  .hero .hint { display: none; }
  .frow { grid-template-columns: 74px 1fr 92px; }
  .panel { grid-template-columns: 1fr; }
}

.mut { color: var(--mut, #7a7f85); }
.btn {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--acc); background: var(--acc); color: #fff;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--acc); }
.note select, .note input {
  font: inherit; font-size: 13px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.note select:focus, .note input:focus { outline: none; border-color: var(--acc); }
.live-ack { font-size: 12.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-ack .btn { padding: 4px 12px; font-size: 12px; }
