:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1d212a;
  --line: #2a2f3a;
  --text: #e7e9ee;
  --muted: #9aa3b2;
  --faint: #6b7385;
  --accent: #f5b300;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 14px;
  --c: #9aa3b2; /* model color, set per element */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: #8ab4ff; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 80px; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: rgba(15,17,21,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted); padding: 6px 12px; border-radius: 999px; white-space: nowrap; font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--panel2); text-decoration: none; }
.nav a.active { color: #111; background: var(--accent); }
.me { color: var(--muted); font-size: 13px; white-space: nowrap; }
.me a { color: var(--faint); margin-left: 8px; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; }
  .me { margin-left: auto; }
}

/* cards */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.card.accent { border-left: 4px solid var(--accent); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.lead { font-size: 1.15rem; font-weight: 600; color: #fff; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; color: var(--faint); }
ul.clean { margin: 0; padding-left: 1.2em; }
ul.clean li { margin: 4px 0; }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
}
.cookie { background: linear-gradient(135deg, #2a2110, #171a21 60%); border-color: #4a3a12; }
.example-banner {
  background: #7f1d1d; border: 1px solid #ef4444; color: #fff; font-weight: 700;
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; text-align: center;
}
.notice { background: var(--panel2); border: 1px dashed var(--line); padding: 10px 14px; border-radius: 10px; color: var(--muted); margin-bottom: 16px; }

/* model tabs */
.model-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.model-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 600;
}
.model-tab:hover { text-decoration: none; border-color: var(--c); }
.model-tab.active { background: var(--c); color: #111; border-color: var(--c); }
.model-tab .who { font-weight: 400; font-size: 12px; color: var(--muted); }
.model-tab.active .who { color: #222; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; flex: none; }
.model-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.model-head h1 { color: var(--c); margin: 0; }

/* branding card */
.branding { border-top: 4px solid var(--c); padding: 0; overflow: hidden; }
.branding > .bhead {
  padding: 14px 18px; display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 18%, transparent), transparent);
}
.branding > .bhead h2 { margin: 0; }
.branding .section { padding: 14px 18px; border-top: 1px solid var(--line); }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.section-title h3 { margin: 0; letter-spacing: .04em; font-size: 13px; text-transform: uppercase; }
.section-title .grow { flex: 1; }
.helper { color: var(--faint); font-size: 12.5px; margin: 0 0 10px; }
.section.tests { background: #14171d; }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.item .row { display: flex; gap: 10px; align-items: flex-start; }
.item .txt { flex: 1; font-weight: 600; white-space: pre-wrap; word-break: break-word; }
.item .links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.item .links a {
  font-size: 12.5px; padding: 2px 10px; border-radius: 999px; background: #22324d; color: #bcd4ff;
}
.item .meta-line { margin-top: 4px; }
.item .result { margin-top: 6px; font-size: 13.5px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.item .result b { color: var(--muted); font-weight: 600; }
.item .actions { display: flex; gap: 4px; flex: none; }
.empty { color: var(--faint); font-style: italic; font-size: 13.5px; padding: 4px 0; }

/* buttons */
button, .btn {
  font: inherit; cursor: pointer; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); padding: 7px 12px; font-weight: 600; font-size: 13.5px;
}
button:hover { border-color: #3d4452; }
button:disabled { opacity: .5; cursor: default; }
.btn-add {
  width: 30px; height: 30px; padding: 0; border-radius: 50%; font-size: 18px; line-height: 1;
  background: var(--c); color: #111; border: none;
}
.btn-icon { padding: 4px 8px; font-size: 13px; background: transparent; border-color: transparent; color: var(--muted); }
.btn-icon:hover { background: var(--panel); border-color: var(--line); color: var(--text); }
.btn-primary { background: var(--accent); color: #111; border-color: var(--accent); }
.btn-green { background: #14361f; border-color: #1f6b3a; color: #b6f3c9; }
.btn-red { background: #3a1414; border-color: #6b1f1f; color: #ffc2c2; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* forms */
form.inline {
  background: var(--panel2); border: 1px solid #3d4452; border-radius: 10px; padding: 12px; margin-bottom: 8px;
  display: grid; gap: 8px;
}
label { font-size: 12.5px; color: var(--muted); display: grid; gap: 4px; }
input, textarea, select {
  font: inherit; width: 100%; background: #0f1218; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 16px; /* 16px avoids iOS zoom */
}
textarea { min-height: 70px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--c); outline-offset: -1px; }
.links-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 640px) { .links-grid { grid-template-columns: 1fr; } }

/* notes */
.note { border-left: 3px solid var(--c); }
.note .week { font-weight: 700; color: var(--c); font-size: 13px; }

/* tables (stats/admin) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: var(--panel2); color: var(--muted); font-weight: 600; font-size: 12px; white-space: pre-line; vertical-align: bottom; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.pos { color: #4ade80; font-weight: 600; }
td.neg { color: #f87171; font-weight: 600; }
td.ok { color: #4ade80; font-weight: 700; }
tr.group-start td { border-top: 2px solid #3a404d; }
@media (max-width: 640px) {
  table { font-size: 12.5px; }
  th, td { padding: 6px 7px; }
  th { min-width: 64px; }
  .table-wrap td:first-child, .table-wrap th:first-child {
    position: sticky; left: 0; z-index: 1; background: var(--panel2);
    box-shadow: 1px 0 0 var(--line);
  }
}
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kv .box { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kv .k { color: var(--muted); font-size: 12px; }
.kv .v { font-size: 1.25rem; font-weight: 700; }
.subtitle { color: var(--muted); font-size: 13px; margin: -4px 0 12px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50;
  background: #222835; color: #fff; border: 1px solid #3d4452; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 90vw;
}
.toast.error { background: #3a1414; border-color: #6b1f1f; }

/* admin */
.admin-row { display: grid; grid-template-columns: 1.3fr 1fr .8fr 1.3fr auto; gap: 8px; align-items: center; }
@media (max-width: 760px) { .admin-row { grid-template-columns: 1fr 1fr; } }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: #0f1218; padding: 8px; border-radius: 8px; word-break: break-all; border: 1px solid var(--line); }
