/* Tokens: every colour pair below is measured at 4.5:1 or more for text, 3:1 for edges and icons. */
:root {
  color-scheme: light dark;
  --brand: #9f1a1e; --brand-hover: #7f1418; --brand-ink: #8a1519; --on-brand: #fff;
  --gold: #f2b705;
  --bg: #f8f5f0; --surface: #fff; --surface-2: #f1ece4; --line: #e3dbcf; --line-strong: #8f8579;
  --ink: #1c1917; --ink-2: #57524d; --focus: #1d5fd1;
  --ok-bg: #e3f4e8; --ok-ink: #17652f; --warn-bg: #fdecc8; --warn-ink: #7a4a00; --err-bg: #fde5e3; --err-ink: #a0161b;
  --shadow: 0 1px 2px rgb(28 25 23 / .06), 0 4px 16px rgb(28 25 23 / .06);
  --shadow-hover: 0 2px 4px rgb(28 25 23 / .08), 0 10px 28px rgb(28 25 23 / .12);
  --r: 14px; --r-sm: 10px;
  --tone-red-bg: #fde4e1; --tone-red-ink: #9f1a1e;
  --tone-amber-bg: #fdeccb; --tone-amber-ink: #7a4a00;
  --tone-teal-bg: #d6f1ee; --tone-teal-ink: #0d5c57;
  --tone-green-bg: #dff1dc; --tone-green-ink: #23602a;
  --tone-blue-bg: #dde8fb; --tone-blue-ink: #1d4a9e;
  --tone-purple-bg: #ece2fa; --tone-purple-ink: #5b2f99;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-size: 100%; line-height: 1.55; color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #b3262a; --brand-hover: #c83a3e; --brand-ink: #ff9d93; --on-brand: #fff;
    --bg: #141211; --surface: #1d1a18; --surface-2: #26221f; --line: #38322d; --line-strong: #8a8178;
    --ink: #f3eee8; --ink-2: #b9b0a6; --focus: #8ab4ff;
    --ok-bg: #173822; --ok-ink: #8fdca6; --warn-bg: #3d2c08; --warn-ink: #f6c766; --err-bg: #3f1514; --err-ink: #ffaaa3;
    --shadow: 0 1px 2px rgb(0 0 0 / .4); --shadow-hover: 0 8px 24px rgb(0 0 0 / .5);
    --tone-red-bg: #3d1716; --tone-red-ink: #ffa49b;
    --tone-amber-bg: #3a2a0b; --tone-amber-ink: #f6c766;
    --tone-teal-bg: #0f302d; --tone-teal-ink: #7fd8cf;
    --tone-green-bg: #17301a; --tone-green-ink: #9bd89f;
    --tone-blue-bg: #172640; --tone-blue-ink: #a9c4ff;
    --tone-purple-bg: #2a1d3f; --tone-purple-ink: #cdb2f7;
  }
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
img { max-width: 100%; }
a { color: var(--brand-ink); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem); margin: .2rem 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 0 0 .9rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-2); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; }
[hidden] { display: none !important; }

/* Focus: visible ring on keyboard focus only; the page container itself never shows one. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
main:focus, main:focus-visible { outline: none; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--surface); color: var(--ink); padding: .75rem 1rem; border-radius: var(--r-sm); }
.skip:focus { top: .5rem; }

/* Header and footer */
.site-header { background: var(--brand); color: var(--on-brand); border-bottom: 3px solid var(--gold); }
.bar { max-width: 1160px; margin: 0 auto; padding: 0 1rem; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--on-brand); text-decoration: none; font-size: 1.1rem; min-height: 44px; white-space: nowrap; }
.brand-mark { border-radius: 9px; box-shadow: 0 0 0 2px rgb(255 255 255 / .25); }
.top-nav { display: flex; gap: .25rem; }
.top-nav a { color: var(--on-brand); text-decoration: none; font-weight: 600; padding: 0 .9rem; min-height: 44px; display: inline-flex; align-items: center; border-radius: 999px; white-space: nowrap; }
.top-nav a:hover { background: rgb(255 255 255 / .14); }
.top-nav a[aria-current="page"] { background: rgb(255 255 255 / .2); }
.top-nav a:focus-visible, .brand:focus-visible { outline-color: #fff; }
main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.site-footer { border-top: 1px solid var(--line); color: var(--ink-2); font-size: .9rem; text-align: center; padding: 1.5rem 1rem 2rem; }
.site-footer p { max-width: 720px; margin: 0 auto .4rem; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .55rem 1.05rem;
  font: inherit; font-weight: 600; line-height: 1.2; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer;
  text-decoration: none; transition: background-color .15s, border-color .15s, box-shadow .15s; }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--err-ink); }
.btn.icon-only { width: 44px; padding: 0; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }
.link-btn { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--brand-ink); cursor: pointer; text-decoration: none; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.25rem; }
.chip { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: 0 1rem; border-radius: 999px; font: inherit; font-weight: 600;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); cursor: pointer; text-decoration: none; }
.chip:hover { border-color: var(--line-strong); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.warn:not([aria-pressed="true"]) { border-color: var(--warn-ink); color: var(--warn-ink); }
.chip-count { font-size: .8rem; min-width: 1.6rem; padding: .05rem .4rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); text-align: center; }
.chip[aria-pressed="true"] .chip-count { background: rgb(127 127 127 / .35); color: inherit; }

/* Search */
.search { display: flex; align-items: center; gap: .6rem; background: var(--surface); color: var(--ink-2); border: 2px solid var(--line);
  border-radius: 999px; padding: 0 1.1rem; min-height: 56px; box-shadow: var(--shadow); }
.search:focus-within { border-color: var(--focus); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1.05rem; padding: .8rem 0; outline: none; }
.search.small { min-height: 48px; box-shadow: none; flex: 1 1 280px; }
.search.small input { font-size: 1rem; }

/* Home */
.hero { position: relative; overflow: hidden; padding: clamp(1.5rem, 4vw, 3rem); margin-bottom: 2rem; border-radius: calc(var(--r) + 6px);
  background: linear-gradient(135deg, var(--tone-red-bg), var(--surface) 60%, var(--tone-amber-bg)); border: 1px solid var(--line); }
.hero h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.2rem); }
.hero-lead { font-size: 1.1rem; color: var(--ink-2); max-width: 46ch; margin-bottom: 1.4rem; }
.hero .search { max-width: 680px; }
.hero-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: 1rem; color: var(--ink-2); }
.block { margin: 0 0 2.5rem; }
.count { color: var(--ink-2); font-weight: 400; }
.results { margin-bottom: 2.5rem; }

.tile { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; flex: none; }
.tone-red { background: var(--tone-red-bg); color: var(--tone-red-ink); }
.tone-amber { background: var(--tone-amber-bg); color: var(--tone-amber-ink); }
.tone-teal { background: var(--tone-teal-bg); color: var(--tone-teal-ink); }
.tone-green { background: var(--tone-green-bg); color: var(--tone-green-ink); }
.tone-blue { background: var(--tone-blue-bg); color: var(--tone-blue-ink); }
.tone-purple { background: var(--tone-purple-bg); color: var(--tone-purple-ink); }

.folder-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.folder-card { display: flex; align-items: center; gap: .9rem; height: 100%; min-height: 84px; padding: .9rem 1rem; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); transition: box-shadow .15s, border-color .15s; }
.folder-card:hover { box-shadow: var(--shadow-hover); border-color: var(--line-strong); }
.folder-text { display: flex; flex-direction: column; gap: .1rem; }
.folder-text .muted { font-size: .9rem; }

/* Item cards */
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.item-link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s; }
.item-link:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.cover { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.kind-chip { position: absolute; left: .6rem; bottom: .6rem; display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem;
  border-radius: 999px; font-size: .78rem; font-weight: 600; background: rgb(20 18 17 / .82); color: #fff; }
.kind-chip.solid { position: static; background: var(--surface-2); color: var(--ink); margin-bottom: .4rem; }
.item-text { display: flex; flex-direction: column; gap: .2rem; padding: .85rem 1rem 1rem; }
.item-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-author, .item-folder { font-size: .9rem; color: var(--ink-2); }
.item-folder { color: var(--brand-ink); }

/* Page header (folder, print, admin) */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; column-gap: .5rem; color: var(--ink-2); font-size: .95rem; margin-bottom: .5rem; }
.crumb { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; }
.crumb + .crumb::before { content: "/"; color: var(--ink-2); }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; margin-bottom: 1.5rem; }
.page-head > div:not(.page-actions) { flex: 1 1 320px; }
.page-head h1 { margin: 0; }
.page-head p { margin: .2rem 0 0; }
.page-head .tile { width: 64px; height: 64px; border-radius: 16px; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Empty, alerts, skeleton */
.empty { text-align: center; padding: 2.5rem 1rem; border: 1.5px dashed var(--line); border-radius: var(--r); color: var(--ink-2); background: var(--surface); }
.empty.small { padding: 1.5rem; list-style: none; }
.empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); margin-bottom: .6rem; }
.empty-title { font-weight: 700; color: var(--ink); font-size: 1.1rem; margin-bottom: .3rem; }
.alert { display: flex; align-items: center; gap: .5rem; padding: .8rem 1rem; border-radius: var(--r-sm); font-weight: 500; }
.alert.success { background: var(--ok-bg); color: var(--ok-ink); }
.alert.error { background: var(--err-bg); color: var(--err-ink); }
.hint { display: flex; align-items: center; gap: .4rem; color: var(--ink-2); font-size: .92rem; }
.skeleton { padding-top: .5rem; }
.sk { background: var(--surface-2); border-radius: var(--r-sm); animation: pulse 1.2s ease-in-out infinite; }
.sk-title { height: 2.4rem; width: 55%; margin-bottom: .8rem; }
.sk-line { height: 1rem; width: 35%; margin-bottom: 2rem; }
.sk-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.sk-card { height: 230px; border-radius: var(--r); }
@keyframes pulse { 50% { opacity: .55; } }

/* Item page */
.item-head { max-width: 900px; margin-bottom: 1.2rem; }
.item-head .muted { font-size: 1.05rem; }
.item-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; margin-bottom: 2.5rem; }
.item-main > * + * { margin-top: 1.25rem; }
.item-side { position: sticky; top: 1rem; }
.player { position: relative; width: 100%; background: #000; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ratio-16x9 { aspect-ratio: 16 / 9; }
.ratio-doc { aspect-ratio: 4 / 5; max-height: 80vh; background: var(--surface-2); }
.player-media { display: block; width: 100%; border-radius: var(--r); }
audio { width: 100%; }
.source-row { margin: .9rem 0 0; }
.description { font-size: 1.1rem; white-space: pre-line; }
.details, .cite, .qr-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; }
.side-title { display: flex; align-items: center; gap: .45rem; font-size: 1rem; margin-bottom: .75rem; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.2rem; margin: 0; }
.meta dt { color: var(--ink-2); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.cite-text { background: var(--surface-2); padding: .8rem 1rem; border-radius: var(--r-sm); overflow-wrap: anywhere; font-style: italic; }
.cite-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }

/* QR */
.qr-card { text-align: center; }
.qr-card canvas, .qr-dialog canvas { display: block; margin: 0 auto; width: 100%; max-width: 220px; height: auto; image-rendering: pixelated; border-radius: 8px; }
.qr-url { font-size: .8rem; color: var(--ink-2); overflow-wrap: anywhere; margin: .5rem 0 .75rem; }
.qr-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.qr-card .qr-actions .btn { flex: 1 1 100%; }
.qr-status { font-size: .9rem; color: var(--ok-ink); margin: .5rem 0 0; min-height: 1.2em; }
dialog { border: 0; padding: 0; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgb(12 10 9 / .6); }
.qr-dialog { width: min(420px, calc(100vw - 2rem)); border-radius: calc(var(--r) + 4px); padding: 1.2rem 1.4rem 1.4rem; text-align: center; box-shadow: var(--shadow-hover); }
.qr-dialog canvas { max-width: 280px; }
.qr-dialog-head { display: flex; align-items: center; justify-content: space-between; }
.qr-dialog-head h2 { margin: 0; }
.qr-dialog-label { font-weight: 600; text-align: left; }
.present { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; background: #fff; color: #111; }
.present-body { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 2rem; }
.present canvas { width: min(72vh, 86vw); height: auto; image-rendering: pixelated; }
.present-title { font-size: clamp(1.4rem, 3vw, 2.4rem); font-weight: 700; text-align: center; margin: 0; max-width: 30ch; }
.present-url { font-size: 1.1rem; color: #444; margin: 0; }
.present-close { position: fixed; top: 1rem; right: 1rem; color: #111; }

/* Admin */
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; margin: 1.25rem 0 1rem; }
.toolbar .chips { margin: 0; }
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.admin-row { display: flex; align-items: center; gap: 1rem; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.admin-row.overdue { border-color: var(--warn-ink); box-shadow: inset 4px 0 0 var(--warn-ink); }
.admin-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.admin-row-text .muted { font-size: .9rem; }
.admin-row-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .2rem; }
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.pill.status-published { background: var(--ok-bg); color: var(--ok-ink); }
.pill.status-pending { background: var(--warn-bg); color: var(--warn-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }

.login-card { max-width: 420px; margin: 2rem auto; padding: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--r) + 4px); box-shadow: var(--shadow); text-align: center; }
.login-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--tone-red-bg); color: var(--tone-red-ink); margin-bottom: .5rem; }
.login-form { display: grid; gap: .5rem; text-align: left; margin: 1rem 0; }

.item-form { display: grid; gap: 1.25rem; max-width: 860px; }
.section { margin: 0; padding: 1.2rem 1.3rem 1.4rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.2rem; }
.section > legend { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; padding: 0 .4rem; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-size: .9rem; }
.section > .wide, .section > .detect, .section > .choice, .section > .check { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label, .choice legend { font-weight: 600; }
.req { color: var(--err-ink); }
.field input, .field textarea, .login-form input { font: inherit; color: var(--ink); background: var(--bg); min-height: 48px; padding: .6rem .8rem;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); width: 100%; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .login-form input:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 0; }
[aria-invalid="true"] { border-color: var(--err-ink) !important; }
.hint-text { color: var(--ink-2); font-size: .88rem; }
.field-error { color: var(--err-ink); font-size: .9rem; font-weight: 600; }
.field-error:empty { display: none; }
.detect:empty { display: none; }
.detect { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.detect-row { display: flex; align-items: center; gap: .5rem; padding: .6rem .85rem; border-radius: var(--r-sm); font-weight: 500; flex: 1 1 280px; }
.detect-row.ok { background: var(--ok-bg); color: var(--ok-ink); }
.detect-row.warn { background: var(--warn-bg); color: var(--warn-ink); }
.detect-row.info { background: var(--surface-2); color: var(--ink); }
.detect-thumb { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
.choice { border: 0; margin: 0; padding: 0; min-width: 0; }
.choice legend { padding: 0; margin-bottom: .5rem; }
.choice-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.choice-status { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.choice-tile { position: relative; display: flex; align-items: center; gap: .7rem; min-height: 56px; padding: .65rem .85rem; border: 1.5px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--bg); }
.choice-tile:hover { border-color: var(--line-strong); }
.choice-tile input { position: absolute; opacity: 0; pointer-events: none; }
.choice-tile:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); background: var(--surface); }
.choice-tile:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice-tile .tile { width: 36px; height: 36px; border-radius: 9px; }
.choice-text { display: flex; flex-direction: column; gap: .1rem; }
.choice-text small { color: var(--ink-2); font-size: .85rem; }
.check { display: flex; align-items: center; gap: .65rem; min-height: 44px; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }
.form-bar { position: sticky; bottom: 0; z-index: 2; display: flex; gap: .6rem; padding: .85rem 1rem; margin: 0 -1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); }

/* Print */
.print-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; margin-top: 1rem; }
.print-card { margin: 0; padding: .7rem; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); background: #fff; color: #111; text-align: center;
  break-inside: avoid; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.print-card canvas { width: 150px; height: 150px; image-rendering: pixelated; }
.print-card figcaption { display: flex; flex-direction: column; font-size: .82rem; }
.print-card figcaption span { color: #555; }

@media (max-width: 860px) {
  .item-layout { grid-template-columns: 1fr; }
  .item-side { position: static; }
  .qr-card .qr-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 640px) {
  .bar { min-height: 56px; }
  .brand strong { font-size: 1rem; }
  .top-nav a { padding: 0 .7rem; }
  main { padding-top: 1rem; }
  .hero { padding: 1.4rem 1.1rem; border-radius: var(--r); }
  .folder-grid { grid-template-columns: 1fr; gap: .6rem; }
  .folder-card { min-height: 72px; box-shadow: none; }
  .card-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .item-text { padding: .65rem .75rem .8rem; }
  .item-title { font-size: .95rem; }
  .item-author { font-size: .82rem; }
  .meta { grid-template-columns: 1fr; gap: .15rem; }
  .meta dd { margin-bottom: .6rem; }
  .section { grid-template-columns: 1fr; padding: 1rem; }
  .admin-row { flex-wrap: wrap; }
  .admin-row-actions { width: 100%; justify-content: flex-start; }
  .page-head .tile { width: 52px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .item-link:hover { transform: none; }
}
@media print {
  .site-header, .site-footer, .no-print, .skip { display: none !important; }
  main { padding: 0; max-width: none; }
  body { background: #fff; }
  .print-grid { grid-template-columns: repeat(4, 1fr); gap: 4mm; }
}
