/* Stillhand website styles: design tokens, layout, header/footer, home, stats, suggestion board, dialogs and legal pages (.doc). */

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #101815;
  --surface: #1b2620;
  --surface-2: #223029;
  --line: rgba(238, 240, 232, 0.09);
  --line-strong: rgba(238, 240, 232, 0.18);
  --text: #eef0e8;
  --muted: #a3ada6;
  --faint: #7d8a82;
  --accent: #c4e79a;
  --accent-ink: #14200f;
  --accent-soft: rgba(196, 231, 154, 0.12);
  --warn: #d59280;
  --warn-soft: rgba(213, 146, 128, 0.12);
  --gold: #c9a86a;
  --card: #f3efe4;
  --radius: 14px;
  --radius-sm: 8px;
  --max: 1080px;
  --gutter: 20px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --focus: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
main { flex: 1 0 auto; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: 6px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
#site-header {
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 24, 21, 0.92);
  position: sticky; top: 0; z-index: 20;
}
@supports (backdrop-filter: blur(8px)) {
  #site-header { background: rgba(16, 24, 21, 0.78); backdrop-filter: blur(8px); }
}
.site-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; font-size: 17px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  color: var(--muted); text-decoration: none; font-size: 15px;
  padding: 8px 12px; border-radius: 999px;
}
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.noscript-nav { display: flex; gap: 16px; flex-wrap: wrap; padding: 20px var(--gutter); }

/* ---------- Footer ---------- */
#site-footer { border-top: 1px solid var(--line); margin-top: 72px; min-height: 160px; }
.site-foot { padding-top: 32px; padding-bottom: 40px; display: grid; gap: 16px; color: var(--muted); font-size: 14px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--text); }
.foot-note { margin: 0; max-width: 60ch; }
.foot-copy { margin: 0; color: var(--faint); }
.lang-switch select {
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 6px 8px; font: inherit;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px;
  font: 600 15px/1.2 var(--font); text-decoration: none; cursor: pointer;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #d2efae; }
.btn-quiet { border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--text); border-color: transparent; background: var(--surface); }
.btn-danger { color: var(--warn); border-color: rgba(213, 146, 128, 0.45); }
.btn-danger:hover { border-color: var(--warn); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* Store buttons: plain spans until the store URLs exist, then links. */
.store { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; list-style: none; }
.store-btn {
  display: inline-flex; align-items: center; gap: 12px;
  min-width: 190px; min-height: 56px; padding: 8px 18px 8px 14px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--text); text-decoration: none;
}
.store-btn svg { flex: none; width: 26px; height: 26px; color: var(--accent); }
.store-btn .store-text { display: grid; line-height: 1.2; }
.store-btn .store-small { font-size: 12px; color: var(--muted); }
.store-btn .store-name { font-size: 17px; font-weight: 650; }
a.store-btn:hover { border-color: var(--accent); }
.store-btn.is-soon { cursor: default; }

/* ---------- Home ---------- */
.hero { padding: 56px 0 40px; }
.hero-grid { display: grid; gap: 40px; align-items: center; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 14px; }
.hero h1 { font-size: clamp(36px, 8vw, 58px); margin-bottom: 16px; }
.hero .lede { font-size: clamp(18px, 2.4vw, 21px); color: var(--muted); max-width: 34ch; margin-bottom: 28px; }
.hero-links { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 15px; }
.hero-art { display: flex; justify-content: center; }
.hero-art svg { width: min(300px, 78vw); height: auto; }
.art-caption { text-align: center; color: var(--faint); font-size: 12px; margin-top: 8px; }

.section { padding: 48px 0 8px; }
.section-head { max-width: 56ch; margin-bottom: 28px; }
.section-head h2 { font-size: clamp(26px, 4.5vw, 34px); }
.section-head p { color: var(--muted); }

.features { display: grid; gap: 16px; }
.feature {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: grid; gap: 14px; align-content: start;
}
.feature-art { height: 120px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.feature-art svg { width: 100%; height: 100%; }
.feature h3 { font-size: 19px; margin: 0; }
.feature p { color: var(--muted); margin: 0; }

.fair {
  display: grid; gap: 12px; padding: 24px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface);
}
.fair h2 { font-size: 22px; margin: 0; }
.fair p { margin: 0; color: var(--muted); max-width: 70ch; }
.age { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--warn); color: var(--warn); font-weight: 700; font-size: 14px; }
.fair-head { display: flex; align-items: center; gap: 14px; }

.more-grid { display: grid; gap: 16px; }
.more-card {
  display: grid; gap: 6px; padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.more-card:hover { border-color: var(--accent); }
.more-card strong { font-size: 18px; }
.more-card span { color: var(--muted); }
.more-card .go { color: var(--accent); font-weight: 600; }

/* ---------- Page heads ---------- */
.page-head { padding: 40px 0 20px; }
.page-head h1 { font-size: clamp(30px, 6vw, 42px); }
.page-head p { color: var(--muted); max-width: 60ch; margin: 0; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; min-height: 92px; display: grid; align-content: start; gap: 4px; min-width: 0;
}
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: clamp(24px, 6vw, 32px); font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.stat.is-live .stat-label::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-right: 6px; vertical-align: 1px;
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.panel h2 { font-size: 18px; margin-bottom: 14px; }
.stats-cols { display: grid; gap: 16px; margin-top: 16px; }
.stats-meta { color: var(--faint); font-size: 13px; margin: 14px 0 0; min-height: 1.6em; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.bar-name { font-weight: 600; }
.bar-name small { display: block; color: var(--faint); font-weight: 400; font-size: 12px; }
.bar-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.5s ease; }
.bar-val { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 4ch; text-align: right; }

.season-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 12px; }
.season-line strong { font-size: 20px; }
.season-ends { color: var(--accent); font-size: 14px; }

.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.board-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.board-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 0 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.board-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); height: 43px; }
.board-table tr:last-child td { border-bottom: 0; }
.board-table .r { text-align: right; }
.board-table .rank { width: 2.5em; color: var(--muted); }
.board-table tr.top3 .rank { color: var(--accent); font-weight: 650; }
.board-table .name { max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.board-table .tier { color: var(--muted); white-space: nowrap; }
.pos { color: var(--accent); }
.neg { color: var(--warn); }

.skel {
  display: inline-block; height: 0.9em; width: 5ch; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 0%, #2a3a32 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; vertical-align: middle;
}
.skel-wide { width: 70%; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.state {
  text-align: center; padding: 32px 16px; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.state strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.state .btn { margin-top: 14px; }

/* ---------- Suggestion board ---------- */
.wrap.narrow { max-width: 860px; }
.board-tools { display: grid; gap: 14px; margin: 8px 0 18px; }
.board-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  font: 600 14px/1 var(--font); color: var(--muted); background: transparent; border: 0;
  padding: 10px 16px; border-radius: 999px; cursor: pointer; min-height: 38px;
}
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: thin; }
.chip {
  flex: none; font: 500 13px/1 var(--font); color: var(--muted); background: transparent;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 9px 14px; cursor: pointer; min-height: 36px;
}
.chip[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.auth-line { font-size: 13px; color: var(--faint); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; min-height: 24px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.notice { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: 14px; }
.notice.is-error { background: var(--warn-soft); }

.sugg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.sugg {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px 12px;
}
.like {
  align-self: start;
  display: grid; justify-items: center; align-content: start; gap: 2px;
  width: 56px; min-height: 60px; padding: 8px 0 6px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--muted);
  cursor: pointer; font: 650 15px/1.1 var(--font); font-variant-numeric: tabular-nums;
}
.like svg { width: 18px; height: 18px; }
.like:hover { border-color: var(--accent); color: var(--text); }
.like[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sugg-main { min-width: 0; }
.sugg-title { font-size: 17px; margin: 2px 0 6px; overflow-wrap: anywhere; }
.sugg-body { color: var(--muted); margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.sugg-body.is-clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.sugg-more { margin-top: 4px; font-size: 14px; }
.sugg-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--faint); }
.sugg-author { color: var(--muted); max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg-actions { margin-left: auto; display: flex; gap: 12px; }
.sugg-actions .linkish { color: var(--faint); font-size: 13px; }
.sugg-actions .linkish:hover { color: var(--text); }
.badge {
  display: inline-block; font-size: 11px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap;
}
.badge-planned { border-color: rgba(196, 231, 154, 0.5); color: var(--accent); }
.badge-progress { background: var(--accent-soft); border-color: rgba(196, 231, 154, 0.5); color: var(--accent); }
.badge-done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.badge-declined { border-color: rgba(213, 146, 128, 0.5); color: var(--warn); }
.reply { margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.reply-head { font-size: 12px; font-weight: 650; color: var(--accent); margin-bottom: 4px; }
.reply-head span { color: var(--faint); font-weight: 400; }
.reply p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 15px; }
.sugg.is-skel { min-height: 132px; }
.load-more { display: flex; justify-content: center; margin-top: 18px; min-height: 44px; }

/* ---------- Dialogs ---------- */
dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  padding: 0; border: 1px solid var(--line-strong); border-radius: 18px;
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(5, 9, 7, 0.72); }
.dlg { padding: 22px; display: grid; gap: 14px; }
.dlg h2 { font-size: 20px; margin: 0; }
.dlg p { margin: 0; color: var(--muted); }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.field input, .field textarea {
  width: 100%; font: 16px/1.5 var(--font); color: var(--text); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px;
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); border-radius: 10px; }
.field-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--faint); }
.field-err { color: var(--warn); }
.counter.is-over { color: var(--warn); }
.dlg .form-err { color: var(--warn); font-size: 14px; margin: 0; min-height: 0; }

/* ---------- Legal and other documents ---------- */
.doc { width: 100%; max-width: calc(70ch + 2 * var(--gutter)); margin: 0 auto; padding: 40px var(--gutter) 0; font-size: 17px; line-height: 1.7; }
.doc h1 { font-size: clamp(30px, 6vw, 40px); margin-bottom: 8px; }
.doc h2 { font-size: 23px; margin: 2em 0 0.6em; padding-top: 0.2em; }
.doc h3 { font-size: 18px; margin: 1.6em 0 0.5em; }
.doc p, .doc li { color: #d8ddd5; }
.doc p.doc-updated { color: var(--faint); font-size: 14px; margin-bottom: 2em; }
.doc ul, .doc ol { padding-left: 1.4em; margin: 0 0 1em; }
.doc li { margin-bottom: 0.4em; }
.doc li::marker { color: var(--faint); }
.doc strong { color: var(--text); }
.doc a { overflow-wrap: anywhere; }
.doc code { font-family: var(--mono); font-size: 0.88em; background: var(--surface); border: 1px solid var(--line); padding: 0.1em 0.35em; border-radius: 5px; overflow-wrap: anywhere; }
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; font-size: 15px; display: block; overflow-x: auto; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.doc th { color: var(--muted); font-weight: 600; font-size: 13px; border-bottom-color: var(--line-strong); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.doc blockquote { margin: 0 0 1em; padding: 4px 16px; border-left: 3px solid var(--line-strong); color: var(--muted); }

/* ---------- Wider screens ---------- */
@media (min-width: 560px) {
  :root { --gutter: 28px; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sugg { grid-template-columns: 64px minmax(0, 1fr); padding: 18px 20px 16px 16px; }
  .like { width: 64px; }
}
@media (min-width: 760px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fair { grid-template-columns: auto 1fr; align-items: start; gap: 8px 20px; }
  .fair .age { grid-row: span 2; }
  .stats-cols { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; }
}
@media (min-width: 900px) {
  .hero { padding: 80px 0 56px; }
  .hero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
}
@media (max-width: 479px) {
  .board-table .tier { display: none; }
  .board-table .name { max-width: 9em; }
  .board-table td, .board-table th { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 359px) {
  :root { --gutter: 16px; }
  .brand span { display: none; }
  .store-btn { min-width: 0; flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, .chip, .like, .store-btn { border: 1px solid ButtonText; }
}

/* ---------- admin (operators only; /admin is not linked anywhere) ---------- */
.adm-gate { max-width: 420px; display: grid; gap: 14px; }
.adm-gate .form-err { color: var(--warn); font-size: 14px; margin: 0; min-height: 1.4em; }
.adm-top { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.adm-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.adm-stats .stat { min-height: 68px; padding: 10px 12px; }
.adm-stats .stat-value { font-size: clamp(22px, 5vw, 28px); }
.adm-stats .stat.is-alert .stat-value { color: var(--warn); }
.adm .board-tools .seg { display: flex; }
.adm .board-tools .seg button { flex: 1 1 0; padding: 10px 6px; }
.adm-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.adm-filters input[type="search"], .adm-sel select, .adm-status-sel, .adm-merge input {
  width: 100%; min-height: 44px; font: 16px/1.3 var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px;
}
.adm-filters input[type="search"] { grid-column: 1 / -1; background: var(--bg); }
.adm-sel { display: block; min-width: 0; }
.adm-filters .btn { grid-column: 1 / -1; }
.adm-list { gap: 12px; }
.adm-item { grid-template-columns: minmax(0, 1fr); padding: 14px 14px 14px; }
.adm-item.is-hidden { border-style: dashed; border-color: rgba(213, 146, 128, 0.45); }
.adm-item.is-deleted { opacity: 0.65; }
.adm-item.is-busy { opacity: 0.6; }
.adm-badges { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.adm-id { font: 650 14px/1 var(--mono); color: var(--muted); margin-right: 2px; }
.badge-warn { border-color: rgba(213, 146, 128, 0.5); color: var(--warn); }
.adm-item .sugg-title { margin: 8px 0 6px; }
.adm-item .sugg-meta { gap: 4px 12px; }
.adm-pid { font: 12px/1.3 var(--mono); color: var(--faint); max-width: 100%; overflow-wrap: anywhere; }
.adm-counts { display: inline-flex; gap: 12px; }
.adm-reports.is-hot { color: var(--warn); font-weight: 650; }
.adm-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.adm-controls .adm-status-sel { grid-column: 1 / -1; }
.adm-btn { min-height: 44px; padding: 8px 14px; }
.adm-panel { margin-top: 12px; }
.adm-reply-form { display: grid; gap: 8px; }
.adm-reply-form textarea {
  width: 100%; min-height: 110px; font: 16px/1.5 var(--font); color: var(--text); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; resize: vertical;
}
.adm-row { display: flex; flex-wrap: wrap; gap: 8px; }
.adm-merge input { flex: 1 1 120px; width: auto; background: var(--bg); }
@media (min-width: 560px) {
  .adm-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .adm-filters { grid-template-columns: 1fr 1fr 2fr auto; }
  .adm-filters input[type="search"], .adm-filters .btn { grid-column: auto; }
  .adm-controls { display: flex; flex-wrap: wrap; }
  .adm-controls .adm-status-sel { width: auto; min-width: 150px; }
  .adm-item { padding: 16px 18px; }
}

/* admin: tabs, notices, stats */
.adm-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.adm-tabs { flex: 1 1 auto; display: flex; min-width: 0; }
.adm-tabs button { flex: 1 1 0; padding: 10px 8px; }
.seg button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.adm-notice { position: sticky; top: 72px; z-index: 10; border: 1px solid var(--line-strong); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); background: var(--surface-2); }
.adm-notice.is-error { background: #3a2a25; }
.adm-top { display: none; }
.wrap.narrow.adm { max-width: 980px; }
.adm-head { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.nt-new { margin-bottom: 20px; }
.nt-new h2, .nt-flagcard h2 { font-size: 18px; margin-bottom: 14px; }
.nt-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 8px; }
.nt-head h2 { font-size: 18px; margin: 0; }
.nt-form { display: grid; gap: 14px; }
.nt-langs { display: grid; gap: 18px; }
.nt-lang { display: grid; gap: 12px; align-content: start; }
.nt-lang h3 { font-size: 14px; color: var(--accent); margin: 0; letter-spacing: 0.04em; text-transform: uppercase; }
.nt-form .field input[type="text"], .nt-form .field textarea, .nt-form select, .nt-form input[type="datetime-local"],
.nt-flag input[type="datetime-local"], .nt-flag input[type="text"], .nt-flag input[type="url"], .nt-confirm input {
  width: 100%; min-height: 44px; font: 16px/1.4 var(--font); color: var(--text); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px;
}
.nt-form .field textarea { min-height: 110px; }
.nt-form select { background: var(--surface); }
.nt-times { display: grid; gap: 14px; }
.nt-times .field { gap: 8px; }
.nt-hint { font-size: 13px; color: var(--faint); margin: 0; }
.nt-form .form-err { color: var(--warn); font-size: 14px; margin: 0; min-height: 0; }
.nt-item .nt-text { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.nt-item .nt-text:first-of-type { border-top: 0; }
.nt-lang-tag { font: 650 11px/1 var(--mono); color: var(--faint); letter-spacing: 0.06em; }
.nt-title { font-size: 16px; margin: 4px 0 4px; overflow-wrap: anywhere; }
.nt-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nt-flags { display: grid; gap: 22px; }
.nt-flag { display: grid; gap: 10px; align-content: start; padding-top: 18px; border-top: 1px solid var(--line); }
.nt-flag:first-child { padding-top: 0; border-top: 0; }
.nt-flag h3 { font-size: 16px; margin: 0; }
.nt-state { margin: 0; color: var(--muted); font-size: 14px; }
.nt-state.is-hot { color: var(--warn); font-weight: 600; }
.nt-at input { flex: 1 1 180px; width: auto; }
.nt-confirm { display: grid; gap: 8px; padding: 14px; border: 1px solid rgba(213, 146, 128, 0.45); border-radius: var(--radius-sm); background: var(--warn-soft); }
.nt-warn { margin: 0; color: var(--text); font-size: 14px; }
.nt-confirm input { flex: 1 1 140px; width: auto; text-transform: uppercase; }

.adm-statbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.adm-statsbody { display: grid; gap: 16px; }
.adm-sec { font-size: 18px; margin: 8px 0 -4px; }
.adm-aipanel h2, .adm-tables h2 { font-size: 18px; margin-bottom: 14px; }
.adm-meters { display: grid; gap: 16px; }
.adm-meter { display: grid; gap: 6px; font-size: 14px; }
.adm-meter-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; }
.bar-fill.is-hot { background: var(--warn); }
.adm-charts { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.adm-chart { padding: 14px; display: grid; gap: 6px; }
.adm-chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.adm-chart-head h3 { font-size: 15px; margin: 0; }
.adm-readout { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.adm-chart-sum { margin: 0; font-size: 13px; color: var(--muted); }
.adm-chart-sum strong { color: var(--accent); font-size: 20px; font-weight: 650; margin-right: 2px; }
.adm-chart-sum strong.neg { color: var(--warn); }
.adm-chart-svg { display: block; width: 100%; height: 84px; border-radius: 6px; touch-action: pan-y; cursor: crosshair; }
.adm-bar { fill: var(--accent); }
.adm-chart-svg.is-warn .adm-bar { fill: var(--warn); }
.adm-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.adm-area { fill: var(--accent-soft); stroke: none; }
.adm-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.adm-base { stroke: var(--line-strong); stroke-width: 1; }
.adm-hl { fill: rgba(238, 240, 232, 0.1); }
.adm-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.adm-tables { display: grid; gap: 16px; }
.adm-kv { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.adm-kv li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 16px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.adm-kv li:last-child { border-bottom: 0; }
.adm-kv .r { text-align: right; }
.adm-kv-name { overflow-wrap: anywhere; }
.adm-kv-head { color: var(--muted); font-size: 12px; }
@media (min-width: 560px) {
  .adm-head { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 760px) {
  .nt-langs { grid-template-columns: 1fr 1fr; }
  .nt-times { grid-template-columns: 1fr 1fr; }
  .adm-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-tables { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nt-flags { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
  .nt-flag { padding-top: 0; border-top: 0; }
  .nt-controls { display: flex; }
}
@media (min-width: 900px) {
  .adm-charts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.adm .seg button { white-space: nowrap; }
.adm-head .stat-value { white-space: nowrap; overflow-wrap: normal; font-size: clamp(20px, 5.6vw, 28px); }
.adm-statbar .seg button { padding: 10px 12px; }
.nt-flagcard { margin-top: 18px; }
@media (max-width: 479px) { .adm-head .stat-value { font-size: clamp(18px, 4.9vw, 24px); } }
