:root {
  --navy: oklch(0.24 0.06 262);
  --teal: oklch(0.52 0.11 170);
  --teal-soft: oklch(0.95 0.035 175);
  --amber: oklch(0.62 0.15 60);
  --amber-soft: oklch(0.95 0.06 80);
  --red: oklch(0.55 0.18 25);
  --red-soft: oklch(0.95 0.04 25);
  --bg: oklch(0.985 0.004 250);
  --card: oklch(1 0 0);
  --muted: oklch(0.965 0.008 250);
  --muted-fg: oklch(0.48 0.03 260);
  --border: oklch(0.91 0.01 250);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--navy);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
h3 { margin: 24px 0 8px; font-size: 15px; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 12px 16px; background: var(--navy); color: white; }
.brand { font-weight: 800; font-size: 18px; }
.brand span { color: oklch(0.8 0.1 175); }
.brand small { font-weight: 500; opacity: .7; margin-left: 6px; }
.clock { font-variant-numeric: tabular-nums; opacity: .9; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.auto { font-size: 12px; opacity: .85; }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.tabs button { border: 0; background: none; padding: 8px 12px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted-fg); cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--teal-soft); color: var(--teal); }
.tab { display: none; }
.tab.active { display: block; }

.btn { border: 0; background: var(--teal); color: white; font: inherit; font-weight: 700; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: inherit; border: 1px solid currentColor; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.warn { background: var(--amber); }
.btn.danger { background: var(--red); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.topbar .btn.ghost { color: white; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.card h4 { margin: 0 0 4px; }
.card p { margin: 0 0 8px; color: var(--muted-fg); }
.hint { color: var(--muted-fg); font-size: 13px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted-fg); }
td.mono, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; word-break: break-all; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--muted); color: var(--muted-fg); }
.badge.ok { background: var(--teal-soft); color: var(--teal); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.bad { background: var(--red-soft); color: var(--red); }

.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.stack-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; align-items: end; margin-top: 8px; }
.stack-form strong { grid-column: 1 / -1; }
.stack-form label { display: grid; gap: 2px; font-size: 12px; color: var(--muted-fg); }
input, select { font: inherit; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: white; color: var(--navy); }

.kit { margin-top: 16px; display: grid; gap: 12px; }
.kit .codes { display: flex; flex-wrap: wrap; gap: 12px; }
.kit .code-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px; width: 300px; }
.kit .code-card img { width: 100%; image-rendering: pixelated; background: white; }
.kit ol { margin: 0; padding-left: 20px; }
pre.code { background: var(--navy); color: oklch(0.95 0.01 250); padding: 12px; border-radius: 10px; overflow: auto; font-size: 12px; max-height: 480px; }
details pre { white-space: pre-wrap; }

#toast { position: fixed; bottom: 16px; right: 16px; background: var(--navy); color: white; padding: 10px 14px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 420px; }
#toast.show { opacity: 1; }
#toast.error { background: var(--red); }

@media (max-width: 640px) {
  main { padding: 12px; }
  .top-actions { margin-left: 0; }
  .kit .code-card { width: 100%; }
}
