:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #171a1f;
  --muted: #6a6f78;
  --line: #e2e0d8;
  --accent: #3d5a00;
  --accent-bg: #c6f45d;
  --danger: #b3261e;
  --warn: #8a5a00;
  --ok: #1f7a3f;
  --code-bg: #14161a;
  --code-ink: #e8e6df;
  --radius: 10px;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215;
    --panel: #181b20;
    --ink: #ecebe6;
    --muted: #9a9fa8;
    --line: #2a2e35;
    --accent: #c6f45d;
    --danger: #ff8a80;
    --warn: #f0c060;
    --ok: #7fdc9c;
    --code-bg: #0b0c0e;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
p { margin: 0; }
code, pre, .mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: grid; gap: 1rem; }
.grow { flex: 1; min-width: 0; }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 1.1rem 0.8rem; display: flex; flex-direction: column; gap: 0.2rem; position: sticky; top: 0; height: 100vh; }
.brand { font: 700 1.25rem var(--mono); letter-spacing: -0.04em; padding: 0.2rem 0.6rem 1rem; text-decoration: none; display: block; }
.brand span { background: var(--accent-bg); color: #171a1f; padding: 0 0.3em; border-radius: 5px; }
.side a.nav { text-decoration: none; padding: 0.45rem 0.6rem; border-radius: 7px; color: var(--muted); font-weight: 500; }
.side a.nav:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.side a.nav.on { color: var(--ink); background: color-mix(in srgb, var(--ink) 9%, transparent); }
.side .foot { margin-top: auto; padding: 0.6rem; border-top: 1px solid var(--line); font-size: 0.85rem; }
.main { padding: 1.6rem 2rem 4rem; max-width: 1060px; width: 100%; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .foot { margin: 0 0 0 auto; border: 0; }
  .brand { padding-bottom: 0.2rem; }
  .main { padding: 1.2rem 1rem 3rem; }
}

/* components */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card.flush { padding: 0; overflow: hidden; }
button, .btn { font: 500 0.9rem var(--sans); padding: 0.45rem 0.85rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; }
button:hover, .btn:hover { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
button.danger { color: var(--danger); }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.65rem; width: 100%; }
textarea { font-family: var(--mono); font-size: 0.85rem; min-height: 16rem; resize: vertical; }
label { display: grid; gap: 0.3rem; font-size: 0.85rem; font-weight: 500; }
form.stack { gap: 0.8rem; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
th, td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.tablewrap { overflow-x: auto; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 0.4rem; font: 500 0.78rem var(--mono); padding: 0.15rem 0.55rem; border-radius: 99px; border: 1px solid var(--line); }
.pill::before { content: ''; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--muted); }
.pill.running::before { background: var(--ok); }
.pill.suspended::before { background: var(--warn); }
.pill.error::before, .pill.failed::before { background: var(--danger); }
.pill.busy::before { background: var(--accent); animation: pulse 1s infinite; }
.pill.ready::before { background: var(--ok); }
@keyframes pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .pill.busy::before { animation: none; } }

.tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 0.55rem 0.8rem; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--ink); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.kv div span { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.kv div b { font: 600 1rem var(--mono); }

pre.term { background: var(--code-bg); color: var(--code-ink); border-radius: var(--radius); padding: 1rem; margin: 0; overflow: auto; max-height: 26rem; min-height: 9rem; white-space: pre-wrap; word-break: break-word; font-size: 0.82rem; }
pre.term .cmd { color: #c6f45d; }
pre.term .err { color: #ff9d94; }
pre.term .dim { color: #8b9099; }
pre.snip { background: var(--code-bg); color: var(--code-ink); border-radius: 8px; padding: 0.8rem 1rem; margin: 0; overflow-x: auto; font-size: 0.82rem; }
.secret { background: color-mix(in srgb, var(--accent-bg) 30%, var(--panel)); border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem 0.9rem; font-family: var(--mono); font-size: 0.85rem; word-break: break-all; }

.meter { height: 8px; background: color-mix(in srgb, var(--ink) 10%, transparent); border-radius: 9px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: 9px; }

#toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: 0.5rem; z-index: 50; max-width: min(26rem, 90vw); }
.toast { background: var(--ink); color: var(--bg); padding: 0.65rem 0.9rem; border-radius: 9px; font-size: 0.9rem; box-shadow: 0 6px 24px rgb(0 0 0 / 0.2); }
.toast.bad { background: var(--danger); color: #fff; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); padding: 1.4rem; width: min(30rem, 92vw); }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }

/* landing + auth */
.land { max-width: 980px; margin: 0 auto; padding: 1.4rem 1.2rem 5rem; }
.land header { display: flex; justify-content: space-between; align-items: center; }
.hero { padding: 5rem 0 3rem; display: grid; gap: 1.3rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); letter-spacing: -0.045em; max-width: 14ch; text-wrap: balance; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 52ch; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-top: 2.5rem; }
.features h3 { font: 600 0.95rem var(--mono); margin-bottom: 0.35rem; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.plans .card b.price { font: 700 1.6rem var(--mono); display: block; margin: 0.3rem 0 0.6rem; }
.plans ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.9rem; }
.auth { max-width: 24rem; margin: 12vh auto; padding: 0 1rem; display: grid; gap: 1.2rem; }
.notice { border-left: 3px solid var(--warn); padding: 0.5rem 0.8rem; background: color-mix(in srgb, var(--warn) 9%, transparent); font-size: 0.88rem; border-radius: 0 8px 8px 0; }
.desk-screen { height: min(72vh, 820px); min-height: 360px; background: #14161a; border-radius: var(--radius); overflow: hidden; outline-offset: 2px; }
.desk-screen canvas { cursor: default; }
.crumb { color: var(--muted); text-decoration: none; font-size: 0.88rem; }
.files-path { font-family: var(--mono); font-size: 0.85rem; }
