:root {
  color-scheme: light dark;
  --fg: #1c1b19; --muted: #6a675f; --line: #e4e1d8; --bg: #f8f6f1; --panel: #fffdf9;
  --accent: #c0392b; --accent-soft: #fbe9e6;
}
@media (prefers-color-scheme: dark) {
  :root { --fg: #ecebe7; --muted: #9c9a93; --line: #2e2d2a; --bg: #151514; --panel: #1d1d1b;
          --accent: #ea6e5f; --accent-soft: #3a2320; }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
       font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }

.shell { display: grid; grid-template-columns: 15rem 1fr; min-height: 100vh; }

.sidebar { display: flex; flex-direction: column; gap: 1.5rem; padding: 1.25rem 1rem;
           background: var(--panel); border-right: 1px solid var(--line); }
.sidebar .brand { font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; color: inherit; text-decoration: none; padding: 0 .6rem; }
.sidebar .brand small { color: var(--muted); font-weight: 500; margin-left: .35rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.sidebar nav a { display: block; padding: .5rem .6rem; border-radius: .5rem; color: inherit;
                                          text-decoration: none; font-size: .95rem; }
.sidebar nav a:hover { background: var(--accent-soft); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar nav a.soon { color: var(--muted); opacity: .6; pointer-events: none; }
.sidebar nav a.soon em { font-style: normal; font-size: .72rem; margin-left: .4rem; border: 1px solid var(--line); border-radius: 1rem; padding: 0 .4rem; }
.sidebar .who { font-size: .82rem; color: var(--muted); padding: 0 .6rem; word-break: break-all; }
.sidebar .who a, .sidebar .who button { color: inherit; font: inherit; background: none; border: none; padding: 0;
                                         text-decoration: underline; cursor: pointer; }
.sidebar .who a:hover, .sidebar .who button:hover { color: var(--accent); }
.sidebar .who div { margin-top: .35rem; display: flex; gap: .8rem; }

.content { padding: 2rem 2.25rem 4rem; min-width: 0; }
.content h1 { font-size: clamp(1.4rem, 3vw, 1.8rem); margin: 0 0 .4rem; letter-spacing: -.01em; }
.note { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.state { padding: 3rem 1rem; text-align: center; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.card { padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--panel); }
.card h2 { margin: 0 0 .25rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: .88rem; }
.card.soon { opacity: .6; }

/* Lists and forms, shared by every admin page. */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.bar h1 { margin: 0; }
.tools { display: flex; align-items: center; gap: 1rem; }
.toggle { font-size: .88rem; color: var(--muted); cursor: pointer; }
button.primary, button.secondary, button.danger, a.btn { display: inline-block; padding: .5rem 1rem; border-radius: .5rem; font: inherit;
                                                        font-size: .92rem; cursor: pointer; text-decoration: none; }
button.primary, a.btn.primary { border: none; background: var(--accent); color: #fff; font-weight: 600; }
button.secondary, a.btn.secondary { border: 1px solid var(--line); background: var(--panel); color: inherit; }
button.danger { border: 1px solid var(--line); background: var(--panel); color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
.form { max-width: 40rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--panel); padding: 1.1rem 1.25rem 1.25rem; }
.form .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form .wide { grid-column: 1 / -1; }
.form label { display: block; font-size: .82rem; color: var(--muted); margin: .8rem 0 .25rem; }
.form input, .form textarea, .form select { width: 100%; padding: .55rem .7rem; border-radius: .5rem; border: 1px solid var(--line);
                                            background: var(--bg); color: inherit; font: inherit; }
.form input:focus, .form textarea:focus, .form select:focus { outline: none; border-color: var(--accent); }
.form .actions { display: flex; gap: .6rem; margin-top: 1.1rem; }
.err { color: var(--accent); font-size: .9rem; margin: .8rem 0 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
td .thumb { width: 2.6rem; height: 2.6rem; border-radius: .4rem; overflow: hidden; background: var(--accent-soft); }
td .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
td.actions { white-space: nowrap; text-align: right; }
td.actions button, td.actions a.btn { margin-left: .35rem; padding: .3rem .7rem; font-size: .85rem; }
tr.archived td { opacity: .55; }
tr.archived td.actions { opacity: 1; }
.badge { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
         border: 1px solid var(--line); border-radius: 1rem; padding: .05rem .5rem; margin-left: .3rem; }
.low { color: var(--accent); font-weight: 600; }
.back { display: inline-block; margin-bottom: 1rem; color: var(--muted); font-size: .9rem; text-decoration: none; }
.back:hover { color: var(--accent); }

@media (max-width: 48rem) {
  .form .grid { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: column; gap: .75rem; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .content { padding: 1.25rem 1rem 3rem; }
}

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1.5rem 0 0; color: var(--muted); font-size: .9rem; }
