:root {
  color-scheme: dark;
  --background: #111312;
  --surface: #1b1e1b;
  --raised: #232723;
  --line: #373d35;
  --foreground: #f5f6f1;
  --silver: #b7beb5;
  --accent: #aeca42;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--foreground); }
body:not(.admin-page) main { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
.shell { max-width: 880px; padding-inline: clamp(14px, 4vw, 36px); margin-inline: auto; }
.masthead { background: #171a17; border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.brand { display: flex; align-items: center; gap: .8rem; height: 66px; font-size: .94rem; font-weight: 780; letter-spacing: .035em; }
.brand img { width: 60px; height: 30px; object-fit: contain; border-radius: 6px; }
.brand b { color: var(--accent); margin-left: .3em; }
main { padding-block: 1.25rem 3rem; }
h1, h2, h3, p { margin: 0 0 .75rem; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.7rem, 5vw, 2.45rem); letter-spacing: -.035em; line-height: 1.12; }
h2 { font-size: 1.26rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; }
section + section { margin-top: 1.65rem; }
.muted, small { color: var(--silver); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; min-width: 0; }
button, .button { border: 1px solid var(--line); background: var(--raised); border-radius: 10px; min-height: 43px; padding: .5rem .85rem; cursor: pointer; font-weight: 650; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
.primary { color: #14190c; background: var(--accent); border-color: var(--accent); }
.subtle { background: transparent; }
input, select, textarea { width: 100%; background: #151815; border: 1px solid var(--line); padding: .55rem .65rem; border-radius: 9px; }
input, select { min-height: 43px; }
textarea { min-height: 72px; resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
label { display: grid; align-content: start; gap: .28rem; font-size: .92rem; color: var(--silver); }
.heading, .row, .actions, .search { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.heading, .row { justify-content: space-between; }
.heading { margin-bottom: 1rem; }
.heading h1, .heading h2, .row p, .row h3 { margin-bottom: 0; }
.search { margin-bottom: .85rem; flex-wrap: nowrap; }
.search input { flex: 1; }
.Card, .metric, .line, .hero { border: 1px solid var(--line); border-radius: 13px; padding: .85rem; background: var(--surface); min-width: 0; }
.Card + .Card, .line + .line { margin-top: .55rem; }
.Card p { margin-bottom: .28rem; }
.Card > .actions { margin-top: .65rem; }
.clickable { display: block; width: 100%; text-align: left; }
.hero { background: linear-gradient(115deg,#222b1b,var(--surface) 72%); padding: 1.05rem; }
.hero strong { font-size: clamp(1.55rem, 6vw, 2.2rem); color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%, 220px),1fr)); gap: .75rem; }
.line-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .45rem; }
.line .row { margin-top: .55rem; }
.stack { display: grid; gap: .85rem; }
.pager { justify-content: flex-end; margin-top: .7rem; }
.tabs { z-index: 1; position: fixed; inset: auto 0 0; display: flex; justify-content: center; padding: .25rem max(.25rem, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(.25rem, env(safe-area-inset-left)); background: #171a17; border-top: 1px solid var(--line); }
.tabs button { flex: 1 1 0; max-width: 156px; padding: .3rem .1rem; border: 0; background: transparent; font-size: clamp(.65rem, 2.75vw, .84rem); color: var(--silver); }
.tabs span { display: block; font-size: 1.16rem; line-height: 1.2; margin-bottom: .1rem; }
.tabs [aria-current=page] { color: var(--accent); }
#notice { border-left: 3px solid var(--accent); padding: .65rem; background: var(--surface); overflow-wrap: anywhere; }
#notice.error { border-color: #ef8479; }
dialog { padding: 1rem; background: var(--surface); color: var(--foreground); width: min(94vw, 580px); max-height: 85dvh; border: 1px solid var(--line); border-radius: 14px; }
dialog::backdrop { background: #000a; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%, 155px),1fr)); gap: .6rem; }
#metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
@media (max-width: 520px) { #metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } }
.metric strong { display: block; color: var(--accent); font-size: 1.35rem; margin-top: .2rem; }
.data-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; background: var(--surface); text-align: left; }
th, td { padding: .65rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { color: var(--silver); }
