/* VerVia Digital platform — one stylesheet, no build step. */
:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --fg: #16211d;
  --muted: #5b6b64;
  --line: #dce4df;
  --accent: #1f7a6b;
  --accent-strong: #17614f;
  --accent-soft: #e2f0ec;
  --good: #2f8f4e;
  --good-soft: #e6f4ea;
  --warn: #a76a00;
  --warn-soft: #fbf1dc;
  --bad: #b8433a;
  --bad-soft: #fbe7e5;
  --neutral-soft: #eef2f0;
  --side-bg: #10211d;
  --chart-1: #0f8a74;
  --chart-grid: #e6ece8;
  --side-fg: #d7e5df;
  --side-muted: #87a198;
  --side-active: #1b3a33;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 33, 29, 0.06), 0 2px 8px rgba(16, 33, 29, 0.04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1614;
    --surface: #17211e;
    --surface-2: #1b2723;
    --fg: #e6eeea;
    --muted: #9db0a8;
    --line: #2a3833;
    --accent: #5cc2ae;
    --accent-strong: #7fd6c4;
    --accent-soft: #1b3330;
    --good: #6fcf8c;
    --good-soft: #1a3324;
    --warn: #e5b45a;
    --warn-soft: #362b17;
    --bad: #ef8a80;
    --bad-soft: #3a1f1c;
    --neutral-soft: #222e2a;
    --side-bg: #0b1210;
    --chart-1: #1fa88c;
    --chart-grid: #26332f;
    --side-active: #17302a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 0.8em; }
code, .mono { font-family: var(--mono); font-size: 0.88em; overflow-wrap: anywhere; }
small, .small { font-size: 0.85rem; }
.muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--side-bg); color: var(--side-fg);
  padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 2px 6px 6px; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand b { font-family: var(--display); font-size: 1.08rem; font-weight: 700; letter-spacing: -0.01em; display: block; }
.brand span { font-size: 0.72rem; color: var(--side-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.side label.switch-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--side-muted); padding: 0 6px; }
.side select {
  width: 100%; background: #16302a; color: #fff; border: 1px solid #27453d; border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 0.92rem;
}
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav .group { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--side-muted); padding: 12px 8px 4px; }
.nav a {
  color: var(--side-fg); padding: 7px 10px; border-radius: 7px; display: flex; align-items: center; gap: 9px;
  font-size: 0.93rem;
}
.nav a svg { width: 17px; height: 17px; flex: none; opacity: 0.8; }
.nav a:hover { background: rgba(255, 255, 255, 0.05); text-decoration: none; }
.nav a.active { background: var(--side-active); color: #fff; font-weight: 600; }
.nav a.active svg { opacity: 1; color: #5cc2ae; }
.nav .count {
  margin-left: auto; background: #5cc2ae; color: #0b1a16; font-size: 0.72rem; font-weight: 700;
  border-radius: 999px; padding: 0 7px; line-height: 1.5;
}
.side-foot { margin-top: auto; font-size: 0.85rem; color: var(--side-muted); padding: 8px 6px 0; border-top: 1px solid #23403a; }
.side-foot a { color: var(--side-fg); }
.side-foot form { display: inline; }
.side-foot button { background: none; border: 0; color: var(--side-fg); padding: 0; font: inherit; cursor: pointer; }
.side-foot button:hover { text-decoration: underline; }

.main { min-width: 0; padding: 26px 34px 60px; max-width: 1280px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar .crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.topbar h1 { margin: 0; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.menu-toggle { display: none; }

/* ---------- Cards & layout ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 18px; align-items: start; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack { min-width: 0; }
.stack > * + * { margin-top: 18px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); display: block; color: inherit;
}
a.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .label { font-size: 0.8rem; color: var(--muted); }
.tile .value { font-family: var(--display); font-size: 1.7rem; font-weight: 700; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.tile.good .value { color: var(--good); }
.tile.bad .value { color: var(--bad); }
.tile.warn .value { color: var(--warn); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sub { display: block; font-size: 0.8rem; color: var(--muted); }
tr:last-child td { border-bottom: 0; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.76rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); white-space: nowrap;
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.promo { background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--warn); }
.promo-price { color: var(--warn); font-weight: 600; }
.badge.muted { background: transparent; border: 1px solid var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* ---------- Forms ---------- */
form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .field > label { font-size: 0.85rem; font-weight: 600; }
.field .hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="search"], select, textarea {
  font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.row-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.row-form .field { flex: 1 1 140px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; white-space: nowrap;
  border-radius: 8px; padding: 8px 14px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--fg); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); padding-left: 8px; padding-right: 8px; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--line); }
.btn.danger:hover { border-color: var(--bad); }
.btn.good { background: var(--good); border-color: var(--good); }
.btn.small { padding: 4px 10px; font-size: 0.82rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Notices ---------- */
.flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface); }
.flash.success { background: var(--good-soft); border-color: transparent; color: var(--good); }
.flash.error { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.flash.info { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); }
.note { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; padding: 12px 14px; font-size: 0.9rem; color: var(--muted); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty h3 { color: var(--fg); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 0.92rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- Bars / meters ---------- */
.meter { height: 8px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.score { font-family: var(--display); font-weight: 700; font-size: 2.6rem; line-height: 1; }
.score.good { color: var(--good); } .score.warn { color: var(--warn); } .score.bad { color: var(--bad); }

.diverge { display: grid; grid-template-columns: 1fr 1fr; align-items: center; height: 14px; min-width: 120px; }
.diverge .neg, .diverge .pos { height: 10px; }
.diverge .neg { justify-self: end; background: var(--good); border-radius: 3px 0 0 3px; }
.diverge .pos { justify-self: start; background: var(--bad); border-radius: 0 3px 3px 0; }
.diverge .axis { grid-column: 1 / -1; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a.active { color: var(--fg); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--fg); }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--side-bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 14px; padding: 28px; }
.auth-card .brand { color: var(--fg); padding: 0 0 16px; }
.auth-card .brand span { color: var(--muted); }

/* ---------- Posts ---------- */
.post-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.post-card + .post-card { margin-top: 10px; }
.post-caption { white-space: pre-wrap; font-size: 0.93rem; margin: 6px 0; }
.post-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 0.82rem; color: var(--muted); }
.week-head { font-family: var(--display); font-size: 0.95rem; font-weight: 650; margin: 18px 0 8px; color: var(--muted); }

details > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details[open] > summary { margin-bottom: 10px; }

.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--neutral-soft); flex: none; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side-wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform 0.2s ease; }
  body.menu-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.4); }
  .main { padding: 16px 16px 60px; }
  .menu-toggle {
    display: inline-flex; align-items: center; gap: 6px; background: var(--side-bg); color: #fff; border: 0;
    border-radius: 8px; padding: 7px 12px; font: inherit; font-weight: 600; margin-bottom: 14px; cursor: pointer;
  }
  .grid.two, .grid.three, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .card { padding: 16px; }
}
/* ---------- Charts ---------- */
.chart-card .value { font-family: var(--display); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .pt, .chart .pt.last { r: 5; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--body); }

/* ---------- Report ---------- */
.report > .grid { margin-bottom: 18px; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 12px; }
  .side, .menu-toggle, .no-print, .flash { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; border-color: #ccd5d0; }
  .grid.two { grid-template-columns: 1fr 1fr; }
  a { color: inherit; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
