:root {
  --bg: #f3efe7;
  --bg-2: #ebe4d8;
  --panel: #fffdf9;
  --panel-2: #f8f3eb;
  --ink: #211d18;
  --ink-2: #3d372f;
  --muted: #72695d;
  --line: #ddd2c2;
  --line-strong: #c9bba7;
  --accent: #9a4a2f;
  --accent-2: #2e4f5c;
  --accent-soft: #f0ddcf;
  --auto: #8a6a2f;
  --auto-soft: #f5ecd7;
  --danger: #a33a2b;
  --danger-soft: #f6e2de;
  --ok: #3e6b4f;
  --ok-soft: #dfe9df;
  --warn: #9a6a1f;
  --warn-soft: #f6ead0;
  --shadow: 0 10px 30px rgba(45, 35, 20, 0.08);
  --shadow-strong: 0 18px 50px rgba(45, 35, 20, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --font-serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130f;
    --bg-2: #1d1a15;
    --panel: #211e19;
    --panel-2: #28241d;
    --ink: #f1ece2;
    --ink-2: #d6cec1;
    --muted: #a99f90;
    --line: #3a342b;
    --line-strong: #4b4338;
    --accent: #e0a084;
    --accent-2: #9dc0c8;
    --accent-soft: #3a2620;
    --auto: #e2c47a;
    --auto-soft: #38301d;
    --danger: #e79a8c;
    --danger-soft: #3a211d;
    --ok: #a7cba9;
    --ok-soft: #20301f;
    --warn: #e3bd72;
    --warn-soft: #372d19;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-strong: 0 18px 50px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(154, 74, 47, 0.07), transparent 60%),
    radial-gradient(900px 400px at 0% 0%, rgba(46, 79, 92, 0.06), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.78rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 0 1 auto; }
.row > .field, .row > select, .row > input { flex: 1 1 180px; }
.full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.8rem clamp(1rem, 3vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.7rem; color: var(--ink); flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 1.3rem; flex: 0 0 auto;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font-serif); font-size: 1.2rem; }
.brand-text small { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.02em; }
.search-inline { flex: 1 1 auto; max-width: 620px; }
.search-inline input {
  width: 100%; padding: 0.62rem 0.95rem; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--panel); outline: none;
}
.search-inline input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mainnav { display: flex; align-items: center; gap: 1rem; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.mainnav > a:not(.btn) { color: var(--ink-2); font-size: 0.94rem; }
.mainnav > a:not(.btn):hover { color: var(--accent); text-decoration: none; }
.who { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--muted); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.85rem;
}
.linklike { background: none; border: 0; color: var(--muted); padding: 0; font-size: inherit; }
.linklike:hover { color: var(--accent); }
.mainnav form { margin: 0; }
.page { max-width: 1320px; margin: 0 auto; padding: 2rem clamp(1rem, 3vw, 2rem) 4rem; }
.centered-login { display: grid; place-items: center; min-height: 70vh; }
.footer {
  max-width: 1320px; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 3rem;
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  color: var(--muted); font-size: 0.82rem; border-top: 1px solid var(--line);
}
.footer a { color: var(--muted); }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  padding: 0.55rem 0.95rem; border-radius: 999px; font-size: 0.9rem; font-weight: 600;
  text-decoration: none; white-space: nowrap; transition: 0.15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--ink-2); transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.small { padding: 0.38rem 0.7rem; font-size: 0.82rem; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: wait; transform: none; }
.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field > span, .field > label { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea, input[type="text"], input[type="search"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; padding: 0.62rem 0.8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--panel); outline: none;
}
textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus,
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.card-form { padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); margin-top: 0.75rem; }
.alert { padding: 0.8rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-2); margin: 0.75rem 0; }
.alert.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); color: var(--danger); }
.alert.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); color: var(--ok); }
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.12rem 0.5rem; font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.tag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2);
  border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.76rem; line-height: 1.5;
}
.tag.auto { background: var(--auto-soft); border-color: color-mix(in srgb, var(--auto) 35%, var(--line)); color: var(--auto); }
.tag.story-tag { background: color-mix(in srgb, var(--accent-2) 12%, var(--panel)); border-color: color-mix(in srgb, var(--accent-2) 30%, var(--line)); color: var(--accent-2); }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag-x { border: 0; background: none; color: inherit; opacity: 0.6; padding: 0 0.1rem; font-size: 0.95rem; line-height: 1; }
.tag-x:hover { opacity: 1; color: var(--danger); }
.linklike { color: var(--accent); }
.linklike:hover { text-decoration: underline; }

/* ---------- Hero / index ---------- */
.hero {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 2rem; align-items: center;
  padding: 2.5rem 0 1.5rem;
}
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.74rem; font-weight: 700; color: var(--accent); margin: 0 0 0.5rem; }
.hero h1 { margin-bottom: 0.6rem; }
.hero em { color: var(--accent); font-style: italic; }
.hero .muted { max-width: 52ch; }
.search-panel { display: flex; gap: 0.6rem; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.45rem; box-shadow: var(--shadow); }
.search-panel input { border: 0; background: transparent; box-shadow: none !important; padding: 0.7rem 1rem; }
.search-panel .btn { border-radius: 999px; }
.filters {
  display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap;
  padding: 0.9rem; background: color-mix(in srgb, var(--panel) 70%, transparent);
  border: 1px solid var(--line); border-radius: var(--radius); margin: 0.5rem 0 1rem;
  backdrop-filter: blur(8px);
}
.filter { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.filter select { padding: 0.42rem 0.6rem; font-size: 0.85rem; min-width: 150px; }
.filter.sort select { min-width: 140px; }
.filter-link { margin-left: auto; font-size: 0.82rem; color: var(--muted); }
.results-bar { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: 0.9rem; margin: 0 0 0.9rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.1rem; }
.card {
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: var(--ink); box-shadow: 0 2px 10px rgba(45, 35, 20, 0.04);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-strong); border-color: var(--line-strong); }
.thumb { position: relative; aspect-ratio: 4 / 3; background: var(--bg-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 2.5rem; color: var(--muted); background: var(--panel-2); }
.kind-badge {
  position: absolute; left: 0.5rem; bottom: 0.5rem; background: rgba(20, 17, 14, 0.72); color: #fff;
  border-radius: 999px; padding: 0.1rem 0.45rem; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.todo-mark {
  position: absolute; top: 0.45rem; right: 0.45rem; width: 22px; height: 22px; border-radius: 50%;
  background: var(--warn); color: #fff; display: grid; place-items: center; font-size: 0.75rem; font-weight: 800;
}
.card-body { padding: 0.8rem 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.card-title { font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { color: var(--muted); font-size: 0.78rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: auto; padding-top: 0.4rem; }
.loading { color: var(--muted); padding: 2rem; text-align: center; grid-column: 1 / -1; }
.empty {
  text-align: center; padding: 4rem 1.5rem; border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 50%, transparent);
}
.empty-mark { font-size: 3rem; color: var(--line-strong); margin-bottom: 0.5rem; }
.empty h2 { margin-bottom: 0.3rem; }
.more-wrap { display: flex; justify-content: center; padding: 2rem 0; }

/* ---------- Detail ---------- */
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.2rem 0 1rem; }
.backlink { color: var(--muted); font-size: 0.9rem; }
.detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr); gap: 2rem; align-items: start; }
.detail-media { position: sticky; top: 90px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.media-frame { background: #111; min-height: 320px; display: grid; place-items: center; }
.media-frame img, .media-frame video, .media-frame iframe { width: 100%; height: auto; max-height: 78vh; object-fit: contain; background: #111; }
.media-frame iframe { height: 78vh; border: 0; }
.media-frame audio, .media-frame video { width: 100%; max-height: 340px; background: #111; }
.media-placeholder { color: var(--muted); text-align: center; padding: 3rem 1.5rem; }
.media-big { font-size: 4rem; margin-bottom: 0.5rem; }
.media-caption { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0.7rem 0.9rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; background: var(--panel-2); }
.detail-side { display: flex; flex-direction: column; gap: 1rem; }
.detail-title-row { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.detail-title-row h1 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.6rem); }
.meta-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.detail-block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: 0 2px 8px rgba(45, 35, 20, 0.03); }
.detail-block h2 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.detail-block p { margin: 0; white-space: normal; }
.detail-block.purpose { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: linear-gradient(180deg, var(--accent-soft), var(--panel) 55%); }
.detail-block.purpose h2 { color: var(--accent); }
.detail-block summary { cursor: pointer; font-weight: 600; }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0.5rem 0 0; font-size: 0.85rem; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; }
.inline-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.3rem 0; border-bottom: 1px dashed var(--line); }
.inline-row:last-child { border-bottom: 0; }
.comments { display: flex; flex-direction: column; gap: 0.7rem; max-height: 360px; overflow: auto; padding-right: 0.25rem; }
.comment { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; background: var(--panel-2); }
.comment-head { display: flex; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.2rem; }
.comment-body { white-space: pre-wrap; }
.suggestions { border-color: color-mix(in srgb, var(--auto) 45%, var(--line)); background: linear-gradient(180deg, var(--auto-soft), var(--panel) 60%); }
.edit-panel { margin-top: 1rem; border-color: var(--accent); }
.detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; padding-top: 0.5rem; }
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 0.7rem 1.1rem; border-radius: 999px;
  box-shadow: var(--shadow-strong); z-index: 100; font-size: 0.9rem; max-width: 90vw;
}
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ---------- Stories ---------- */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
.story-card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); box-shadow: var(--shadow); transition: transform 0.16s ease, box-shadow 0.16s ease; }
.story-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-strong); }
.story-cover { aspect-ratio: 16 / 9; background: var(--bg-2); overflow: hidden; }
.story-cover img { width: 100%; height: 100%; object-fit: cover; }
.story-cover span { display: grid; place-items: center; width: 100%; height: 100%; font-size: 3rem; color: var(--muted); }
.story-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.35rem; }
.story-title { font-family: var(--font-serif); font-size: 1.35rem; }
.story-summary { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; padding: 2rem 0 1.2rem; }
.page-head h1 { margin-bottom: 0.2rem; }
.inline-form { display: inline-block; }
.inline-form summary { list-style: none; cursor: pointer; }
.inline-form summary::-webkit-details-marker { display: none; }
.inline-form[open] summary { margin-bottom: 0.5rem; }
.inline-form.right summary { margin-left: auto; }
.story-hero { padding: 1.5rem 0 1rem; max-width: 900px; }
.story-hero h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.lead { font-size: 1.15rem; color: var(--ink-2); }
.meta-row { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: 0.9rem; }
.add-items { margin: 1rem 0 2rem; }

/* ---------- Timeline ---------- */
.year-nav { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0 1.5rem; }
.year-nav a { padding: 0.35rem 0.7rem; border-radius: 999px; color: var(--muted); border: 1px solid transparent; font-size: 0.9rem; }
.year-nav a:hover { text-decoration: none; border-color: var(--line); }
.year-nav a.active { background: var(--accent); color: #fff; }
.timeline { display: flex; flex-direction: column; gap: 0.6rem; }
.timeline-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 90px; gap: 1rem; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.6rem; color: var(--ink); }
.timeline-row:hover { text-decoration: none; border-color: var(--line-strong); }
.timeline-thumb { width: 140px; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 8px; background: var(--bg-2); }
.timeline-thumb img { width: 100%; height: 100%; object-fit: cover; }
.timeline-thumb span { display: grid; place-items: center; width: 100%; height: 100%; font-size: 2rem; color: var(--muted); }
.timeline-main { min-width: 0; }
.timeline-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-purpose { color: var(--muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-kind { color: var(--muted); font-size: 0.78rem; text-align: right; }

/* ---------- Upload ---------- */
.upload-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr); gap: 1.5rem; align-items: start; padding: 1rem 0 2rem; }
.upload-main { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
  border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 3rem 1.5rem; text-align: center;
  background: var(--panel-2); cursor: pointer; transition: 0.15s ease; margin-bottom: 1.2rem;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { font-size: 2.5rem; color: var(--accent); }
.file-names { color: var(--muted); font-size: 0.8rem; word-break: break-all; }
.file-preview { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.file-pick { display: flex; align-items: center; gap: 0.75rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.5rem 0.7rem; font-size: 0.85rem; }
.file-pick span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick small { color: var(--muted); }
.upload-side { display: flex; flex-direction: column; gap: 1rem; }
.upload-results { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.5rem; }
.result-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.8rem 1rem; }
.advise { margin: 0; padding-left: 1.2rem; color: var(--ink-2); }
.advise li { margin-bottom: 0.4rem; }

/* ---------- Admin ---------- */
.admin-head { align-items: flex-start; flex-direction: column; }
.admin-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; width: 100%; border-bottom: 1px solid var(--line); padding-bottom: 0.6rem; overflow-x: auto; }
.tab { border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 999px; padding: 0.45rem 0.8rem; font-size: 0.88rem; }
.tab:hover { color: var(--ink); background: var(--panel-2); }
.tab.active { background: var(--panel); border-color: var(--line-strong); color: var(--ink); font-weight: 600; }
.admin-tab { display: none; }
.admin-tab.active { display: block; }
.admin-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: 0 2px 8px rgba(45, 35, 20, 0.03); margin-bottom: 1.2rem; }
.panel h2 { margin-top: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.9rem; margin-bottom: 1.2rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: 0 2px 8px rgba(45, 35, 20, 0.03); }
.stat span { display: block; color: var(--muted); font-size: 0.8rem; }
.stat strong { display: block; font-family: var(--font-serif); font-size: 1.9rem; line-height: 1.1; margin-top: 0.2rem; }
.stat.warn strong { color: var(--warn); }
.list-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; border-bottom: 1px solid var(--line); padding: 0.55rem 0; }
.list-row:last-child { border-bottom: 0; }
.filter-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.9rem; }
.filter-row input, .filter-row select { width: auto; min-width: 150px; }
.filter-row input[type="search"] { flex: 1 1 220px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line-strong); position: sticky; top: 0; background: var(--panel); }
.admin-table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:hover td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.mini-thumb { width: 64px; height: 46px; object-fit: cover; border-radius: 6px; background: var(--bg-2); }
.bulk-bar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; margin-bottom: 0.8rem; }
.bulk-bar select { width: auto; min-width: 150px; }
.toast { position: fixed; right: 1.5rem; bottom: 1.5rem; background: var(--ink); color: var(--bg); padding: 0.75rem 1.1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-strong); z-index: 100; max-width: 360px; }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- Login ---------- */
.login-wrap { width: 100%; display: grid; place-items: center; padding: 3rem 1rem; }
.login-card { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 2.2rem; box-shadow: var(--shadow-strong); }
.login-mark { font-size: 2.5rem; color: var(--accent); margin-bottom: 0.5rem; }
.login-card h1 { font-size: 2.2rem; }
.login-card .fineprint { color: var(--muted); font-size: 0.8rem; margin-top: 1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-media { position: static; }
  .upload-layout { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .search-inline { order: 3; flex-basis: 100%; max-width: none; }
  .mainnav { width: 100%; justify-content: flex-start; }
}
@media (max-width: 680px) {
  .brand-text small { display: none; }
  .who-name { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .timeline-row { grid-template-columns: 90px minmax(0, 1fr); }
  .timeline-thumb { width: 90px; }
  .timeline-kind { display: none; }
  .page { padding-top: 1.2rem; }
  .filters { align-items: stretch; }
  .filter { flex: 1 1 140px; }
  .filter select { width: 100%; }
  .filter-link { margin-left: 0; }
  .detail-head { align-items: flex-start; }
  .detail-actions { width: 100%; }
  .detail-actions .btn { flex: 1; }
}