@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #5d6270;
  --line: #e3e1dc;
  --accent: #b4441b;
  --accent-ink: #ffffff;
  --ok: #1f7a4d;
  --warn: #9a6400;
  --bad: #b42318;
  --code-bg: #f0eee9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 4px 16px rgba(20, 20, 30, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #181b21;
    --ink: #eceef2;
    --muted: #9aa0ad;
    --line: #2a2e37;
    --accent: #ee7a4c;
    --accent-ink: #1a0d06;
    --ok: #4cc38a;
    --warn: #e0a83a;
    --bad: #f27166;
    --code-bg: #1f232b;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 'Libre Franklin', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); font-weight: 700; }
h2 { font-size: 1.6rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 1em; }
code, pre, .mono { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: .88em; }
code { background: var(--code-bg); padding: .1em .4em; border-radius: 5px; }
pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; overflow-x: auto; margin: 0 0 1em; line-height: 1.5;
}
pre code { background: none; padding: 0; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }

/* header */
.top { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; color: var(--accent); flex: none; }
.brand small { font-weight: 500; color: var(--muted); }
nav { display: flex; gap: 20px; align-items: center; }
nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
nav a:hover, nav a[aria-current] { color: var(--ink); }
@media (max-width: 640px) { .brand small { display: none; } nav { gap: 14px; } nav .hide-sm { display: none; } }

/* buttons + forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .95rem;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.small { padding: 6px 11px; font-size: .85rem; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 6px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
input:focus, textarea:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; }

/* sections */
.hero { padding: 72px 0 56px; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--accent); margin-bottom: 14px; }
section { padding: 48px 0; border-top: 1px solid var(--line); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 860px) { .grid3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card p:last-child { margin-bottom: 0; }
.step { font-family: 'JetBrains Mono', monospace; color: var(--accent); font-weight: 500; font-size: .85rem; margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.clean li:last-child { border-bottom: 0; }
.flow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.flow .arrow { align-self: center; color: var(--muted); font-size: 1.4rem; }
@media (max-width: 760px) { .flow { grid-template-columns: 1fr; } .flow .arrow { transform: rotate(90deg); justify-self: center; } }

/* docs */
.docs h2 { margin-top: 2em; padding-top: .4em; }
.docs h2:first-of-type { margin-top: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { font: inherit; font-size: .88rem; font-weight: 600; background: none; border: 1px solid var(--line); color: var(--muted); padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }
[hidden] { display: none !important; }
.copy { position: relative; }
.copy button { position: absolute; top: 8px; right: 8px; }
.note { border-left: 3px solid var(--accent); padding: 10px 14px; background: var(--surface); border-radius: 0 8px 8px 0; margin: 0 0 1em; }

/* status */
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; border: 1px solid currentColor; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.mute { color: var(--muted); }
.msg { padding: 10px 14px; border-radius: 8px; margin: 12px 0; font-size: .93rem; border: 1px solid var(--line); background: var(--surface); }
.msg.bad { color: var(--bad); border-color: currentColor; }
.msg.ok { color: var(--ok); border-color: currentColor; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; font-weight: 600; }

/* admin */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stats .card { padding: 16px 18px; }
.stats b { display: block; font-size: 1.7rem; line-height: 1.1; }
.stats span { color: var(--muted); font-size: .85rem; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td .btn + .btn { margin-left: 6px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 30px 0 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 1.25rem; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 24px; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 10, 15, .45); }
.secret { word-break: break-all; padding: 12px; background: var(--code-bg); border-radius: 8px; font-family: 'JetBrains Mono', monospace; font-size: .9rem; }

footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .88rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
footer a { color: var(--muted); }
.msg { white-space: pre-line; }
