:root {
  --paper: #f4efe6;
  --card: #fffcf7;
  --ink: #1b1612;
  --mute: #746b60;
  --line: #e3dacb;
  --red: #c23b22;
  --wine: #8f2a18;
  --gold: #9a7436;
  --teal: #1f6f6a;
  --serif: "Fraunces", Palatino, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; }
a { color: var(--wine); }
h1, h2 { font-family: var(--serif); font-weight: 560; letter-spacing: -.02em; margin: 0 0 8px; }
h1 { font-size: 34px; }
h2 { font-size: 22px; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
  width: 230px; flex: none; background: var(--ink); color: #f4efe6;
  padding: 18px 14px 24px; display: flex; flex-direction: column; gap: 14px;
}
.admin-side a { color: #f4efe6; text-decoration: none; }
.brand { font-family: var(--serif); font-size: 26px; }
.brand small { display: block; color: #c9bbaa; font-family: var(--sans); font-size: 12px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { padding: 7px 8px; border-radius: 8px; font-size: 14px; }
.side-nav a.is-active, .side-nav a:hover { background: rgba(255,255,255,.08); }
.pill { background: var(--red); color: white; border-radius: 99px; padding: 0 6px; font-size: 11px; }
.side-user { margin-top: auto; font-size: 13px; color: #c9bbaa; }
.admin-main { flex: 1; padding: 28px 28px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.muted, .hint { color: var(--mute); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat, .card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.stat b { display: block; font-family: var(--serif); font-size: 32px; font-weight: 560; }
.stat span { color: var(--mute); font-size: 13px; }
.delta.up { color: var(--teal); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--mute); }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.card { margin-top: 12px; }
.twocol .card { margin-top: 0; }
.statrow, .donut-legend .lg { display: flex; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.statrow .nm, .donut-legend .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statrow .ct, .donut-legend .ct { font-weight: 650; color: var(--wine); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; margin-top: 8px; }
.bars .bar { flex: 1; background: linear-gradient(180deg, #e07a62, var(--red)); min-height: 2px; border-radius: 3px 3px 0 0; position: relative; }
.bars .bar span { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: white; font-size: 11px; padding: 2px 4px; border-radius: 4px; white-space: nowrap; }
.bars .bar:hover span { display: block; }
.barx { display: flex; justify-content: space-between; color: var(--mute); font-size: 12px; }
.donut-box { display: flex; gap: 18px; align-items: center; margin-top: 8px; }
.donut-chart { width: 150px; height: 150px; position: relative; flex: none; }
.donut-ring { width: 100%; height: 100%; border-radius: 50%; }
.donut-hole {
  position: absolute; inset: 32px; background: var(--card); border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-hole b { font-family: var(--serif); font-size: 22px; }
.donut-hole span { font-size: 11px; color: var(--mute); }
.donut-legend { flex: 1; min-width: 0; }
.donut-legend .lg i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.donut-legend .pct { color: var(--mute); font-size: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); font-weight: 600; }
td.num, th.num { text-align: right; }
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; }
.form label, .grid2 label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.form input, .form textarea, .form select, .grid2 input, .grid2 textarea, .grid2 select {
  font: inherit; font-weight: 400; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: white;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 14px; }
.checks label { flex-direction: row; align-items: center; font-weight: 500; }
.form .grid2 label.checkline { flex-direction: row; align-items: center; gap: 8px; margin-top: 26px; }
.form .grid2 label.checkline input { width: auto; padding: 0; border: 0; background: transparent; }
.btn, button.btn {
  display: inline-flex; align-items: center; background: white; color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; text-decoration: none; cursor: pointer; font: inherit;
}
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.flash-ok { background: #e5f2ea; }
.flash-error { background: #f8e4de; color: var(--wine); }
.login-body { min-height: 100vh; display: grid; place-items: center; background: var(--ink); }
.login-card { width: min(420px, calc(100% - 28px)); background: var(--paper); border-radius: 20px; padding: 24px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .admin-side { width: auto; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .stats, .twocol, .grid2, .donut-box { grid-template-columns: 1fr; flex-direction: column; align-items: flex-start; }
  .stats { grid-template-columns: 1fr 1fr; }
}
