:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6a66;
  --line: #e4e2dc;
  --accent: #c4521f;
  --accent-deep: #8e3714;
  --accent-soft: #fbece4;
  --ok: #2f7d32;
  --ok-soft: #e8f4e8;
  --warn: #9a6700;
  --warn-soft: #fff6d6;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614;
    --surface: #1f1f1c;
    --text: #ecebe6;
    --muted: #9c9a93;
    --line: #34332f;
    --accent: #e0672f;
    --accent-deep: #b44a1b;
    --accent-soft: #3a2418;
    --ok: #7cc97f;
    --ok-soft: #1d2e1d;
    --warn: #e6b84a;
    --warn-soft: #33290f;
    --bad: #ff8a80;
    --bad-soft: #3a1c1c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
header {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
header .brand {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 800; font-size: 20px; letter-spacing: -0.03em;
}
header .brand .mark { width: 20px; height: 23px; fill: var(--accent); }
header .brand .mark .stud { fill: var(--accent-deep); }
header nav { display: flex; gap: 4px; flex: 1; }
header nav a {
  text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--muted);
}
header nav a.on, header nav a:hover { background: var(--accent-soft); color: var(--accent); }
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .cols-4, .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cols-4, .cols-2 { grid-template-columns: 1fr; } main { padding: 16px; } header { flex-wrap: wrap; } }
.stack > * + * { margin-top: 16px; }

.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat a { text-decoration: none; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--line); color: var(--muted); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.new { background: var(--accent-soft); color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 6px 12px; border-radius: 8px; text-decoration: none; display: inline-block;
}
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; }
button:disabled { opacity: .6; cursor: default; }
form.inline { display: inline; }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select {
  font: inherit; width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text);
}
input[type=checkbox] { width: auto; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.form-grid .wide { grid-column: span 2; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.checks { display: flex; gap: 12px; padding: 6px 0; }
.checks label { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 14px; margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters > div { min-width: 140px; }
.filters > div.grow { flex: 1; min-width: 200px; }

.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--line); display: block; }
.title-cell a { text-decoration: none; font-weight: 500; }
.title-cell a:hover { color: var(--accent); }
td.num { white-space: nowrap; }
.price-old { text-decoration: line-through; color: var(--muted); font-size: 12px; margin-right: 4px; }
.price-drop { color: var(--ok); font-weight: 600; }

.running { display: inline-flex; gap: 8px; align-items: center; color: var(--accent); font-weight: 600; }
.running::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: pulse 1s infinite alternate;
}
@keyframes pulse { from { opacity: .3; } to { opacity: 1; } }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.detail { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
.detail img { width: 100%; border-radius: var(--radius); }
@media (max-width: 700px) { .detail { grid-template-columns: 1fr; } }
dl { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }

header.admin { border-bottom: 2px solid var(--accent); }
header .brand small { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-left: 4px; }
