:root {
  --ink: #16302b;
  --ink-2: #1e443c;
  --brass: #b9882f;
  --brass-dark: #97701f;
  --paper: #f6f2ea;
  --card: #fffdf7;
  --text: #24332e;
  --muted: #6b7a73;
  --danger: #b3402f;
  --warn: #9a6a0f;
  --ok: #2e7d4f;
  --info: #2f6f77;
  --border: #e4ddcd;
  --shadow-sm: 0 1px 2px rgba(22, 48, 43, .06), 0 2px 8px rgba(22, 48, 43, .05);
  --shadow-md: 0 2px 4px rgba(22, 48, 43, .07), 0 10px 28px rgba(22, 48, 43, .09);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--paper); color: var(--text); line-height: 1.6; }

::selection { background: rgba(185, 136, 47, .25); }
a { color: var(--info); }
a:hover { color: var(--ink); }

/* ---------- Header ---------- */
header.site-header {
  background: linear-gradient(120deg, var(--ink) 0%, var(--ink-2) 60%, #27544a 100%);
  color: #fff; padding: 0 24px;
  border-bottom: 3px solid var(--brass);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(22, 48, 43, .25);
}
.nav-wrap { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 28px; min-height: 64px; }
.brand { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: .01em; color: #fff; text-decoration: none; }
.brand span { color: var(--brass); font-style: italic; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 22px; margin-right: 10px;
  background: linear-gradient(180deg, var(--brass), var(--brass-dark)); border-radius: 2px; vertical-align: -4px; }
nav.main-nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }
nav.main-nav a { color: #cfe0d8; text-decoration: none; padding: 7px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  transition: background .18s ease, color .18s ease; }
nav.main-nav a:hover { background: rgba(255, 255, 255, .14); color: #fff; }
nav.main-nav a.active { background: var(--brass); color: var(--ink); font-weight: 600; }

/* ---------- Layout & type ---------- */
main { max-width: 1120px; margin: 40px auto; padding: 0 24px; }
h1 { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 6px; color: var(--ink); }
h2 { font-family: var(--font-display); font-size: 21px; font-weight: 600; margin: 34px 0 14px; color: var(--ink);
  display: flex; align-items: center; gap: 10px; }
h2::before { content: ""; width: 14px; height: 3px; background: var(--brass); border-radius: 2px; }
.subtitle { color: var(--muted); margin-bottom: 24px; max-width: 72ch; }

.hero { position: relative; overflow: hidden; color: #fff; border-radius: 18px; padding: 56px 48px; margin-bottom: 32px;
  background:
    radial-gradient(circle at 85% 20%, rgba(185, 136, 47, .28), transparent 55%),
    linear-gradient(125deg, var(--ink) 20%, var(--ink-2) 70%, #2a5a4f 100%);
  box-shadow: var(--shadow-md); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px); background-size: 22px 22px; }
.hero h1 { color: #fff; font-size: 40px; line-height: 1.15; margin-bottom: 12px; }
.hero p { max-width: 620px; color: #d7e4dc; margin-bottom: 26px; position: relative; z-index: 1; }
.hero .btn { position: relative; z-index: 1; }

/* ---------- Cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px;
  margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid .card { transition: transform .18s ease, box-shadow .18s ease; }
.grid .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* ---------- Buttons ---------- */
.btn { display: inline-block; background: var(--ink); color: #fff; border: 1px solid var(--ink);
  padding: 10px 22px; border-radius: 10px; font-size: 14px; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; text-decoration: none; letter-spacing: .01em;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease; }
.btn:hover { background: var(--ink-2); box-shadow: 0 4px 14px rgba(22, 48, 43, .25); transform: translateY(-1px); color: #fff; }
.btn:active { transform: translateY(0); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--brass); outline-offset: 2px; }
.btn.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.secondary:hover { background: var(--ink); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #93342a; }
.btn.small { padding: 6px 13px; font-size: 13px; border-radius: 8px; }
.btn:disabled { background: #b9b2a1; border-color: #b9b2a1; color: #f3efe4; cursor: not-allowed;
  box-shadow: none; transform: none; }

/* ---------- Forms ---------- */
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select {
  padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 9px; font-size: 14px; width: 100%;
  background: #fff; color: var(--text); font-family: var(--font-body);
  transition: border-color .15s ease, box-shadow .15s ease; }
input:focus, select:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(185, 136, 47, .18); outline: none; }
form.inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
form.inline .field { flex: 1; min-width: 180px; }
label { font-size: 12.5px; font-weight: 600; display: block; margin-bottom: 5px; color: var(--ink);
  text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; background: transparent; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: rgba(22, 48, 43, .045); font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: rgba(185, 136, 47, .07); }
tr:last-child td { border-bottom: none; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.badge.ok { background: #ddefe3; color: var(--ok); }
.badge.warn { background: #f7ead0; color: var(--warn); }
.badge.danger { background: #f6ded8; color: var(--danger); }
.badge.info { background: #d9eaea; color: var(--info); }
.badge.muted { background: #e6e1d3; color: var(--muted); }

/* ---------- Stats ---------- */
.stat { background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--brass);
  border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat .num { font-family: var(--font-display); font-size: 32px; font-weight: 600; color: var(--ink); line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* ---------- Books ---------- */
.book-cover { width: 46px; height: 62px; border-radius: 4px 8px 8px 4px; color: #f3e6c8;
  background: linear-gradient(135deg, var(--ink-2), var(--ink)); border-left: 4px solid var(--brass);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display);
  font-size: 21px; font-weight: 600; box-shadow: var(--shadow-sm); }
.book-title { font-weight: 600; color: var(--ink); }
.book-meta { color: var(--muted); font-size: 13px; }

/* ---------- Notices ---------- */
.notice { background: #faf3d9; border: 1px solid #e8d488; border-left-width: 4px; border-radius: 10px;
  padding: 13px 17px; margin-bottom: 16px; font-size: 14px; }
.notice.ok { background: #e2f1e7; border-color: #9fcdb2; }
.notice a { font-weight: 600; }

footer.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 36px 0; }
footer.site-footer::before { content: ""; display: block; width: 60px; height: 2px; background: var(--brass);
  margin: 0 auto 14px; border-radius: 2px; opacity: .6; }

/* Responsive layout for small screens */
@media (max-width: 860px) {
  .nav-wrap { min-height: 0; flex-wrap: wrap; padding: 12px 16px; gap: 8px; }
  nav.main-nav { margin-left: 0; gap: 4px 8px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .hero { padding: 34px 24px; }
  .hero h1 { font-size: 28px; }
  h1 { font-size: 25px; }
  th, td { padding: 9px 10px; font-size: 13px; }
  form.inline .field { min-width: 140px; }
  main { padding: 0 14px; margin: 24px auto; }
}

/* Hero button contrast on the dark banner */
.hero .btn { background: var(--brass); border-color: var(--brass); color: var(--ink); }
.hero .btn:hover { background: var(--brass-dark); border-color: var(--brass-dark); color: #fff; }
.hero .btn.secondary { background: transparent; border-color: rgba(255, 255, 255, .65); color: #fff; }
.hero .btn.secondary:hover { background: rgba(255, 255, 255, .14); color: #fff; }

/* ---------- Accessibility & polish pass ---------- */
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 100; background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 0 0 10px 10px; font-size: 14px; font-weight: 600; text-decoration: none;
  transition: top .15s ease; }
.skip-link:focus { top: 0; color: #fff; }
main:focus { outline: none; }
#main { scroll-margin-top: 80px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
  .grid .card:hover { transform: none; }
}

td, .stat .num { font-variant-numeric: tabular-nums; }
::placeholder { color: #9aa79f; opacity: 1; }
::marker { color: var(--brass); }

.btn:active { transform: translateY(0) scale(.97); }
.btn.small:active { transform: scale(.96); }

.main-nav a { position: relative; }
.main-nav a.active { box-shadow: 0 2px 8px rgba(185, 136, 47, .35); }

.book-cover { transition: transform .18s ease, box-shadow .18s ease; }
tbody tr:hover .book-cover { transform: scale(1.06) rotate(-2deg); box-shadow: var(--shadow-md); }

.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid .card h2, .grid .card h3 { color: var(--ink); }
.grid .card p { color: var(--text); }

tbody td .btn.small { white-space: nowrap; }


/* =========================================================
   Third pass: refinements suggested by Claude review
   ========================================================= */

/* =========================================================
   1. TOKENS: AA-safe colours, easing, fluid type
   (verify the ratios with your checker; these are my estimates)
   ========================================================= */
:root {
  --ease: cubic-bezier(.2, .7, .2, 1);
  --muted: #5b6a63;                 /* was ~4.1:1 on paper, now ≥4.5:1 */
  --ok: #24663f; --info: #27616a; --warn: #8a5d0a; --danger: #a63a2a;
  --fs-h1: clamp(1.6rem, 1.15rem + 1.7vw, 2.1rem);
}
html { scrollbar-gutter: stable; }
body {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: radial-gradient(1100px 420px at 50% -180px, rgba(185,136,47,.12), transparent 70%), var(--paper);
}
main { flex: 1; width: 100%; }
h1, h2, .hero h1 { font-optical-sizing: auto; text-wrap: balance; }
p, .subtitle, li { text-wrap: pretty; }
h1 { font-size: var(--fs-h1); }
.subtitle { font-size: 1.0625rem; line-height: 1.55; }
[hidden] { display: none !important; }
::placeholder { color: #75827b; }

/* =========================================================
   2. FOCUS: visible on light AND dark surfaces (≥3:1)
   ========================================================= */
.btn:focus-visible, a:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(185,136,47,.45);
}
.site-header :focus-visible, .hero :focus-visible { outline-color: #fff; }

input:focus, select:focus { border-color: var(--ink-2); box-shadow: 0 0 0 4px rgba(185,136,47,.3); }

/* =========================================================
   3. HEADER / NAV: aria-current support, hover polish,
      single-row scrollable nav on mobile
   ========================================================= */
nav.main-nav a[aria-current="page"] { background: var(--brass); color: var(--ink); font-weight: 600;
  box-shadow: 0 2px 8px rgba(185,136,47,.35); }
nav.main-nav a:not(.active):not([aria-current]):hover { transform: translateY(-1px); }
.brand::before { transition: transform .25s var(--ease); }
.brand:hover::before { transform: translateY(-2px) rotate(-8deg); }
@media (max-width: 860px) {
  nav.main-nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
  nav.main-nav::-webkit-scrollbar { display: none; }
  nav.main-nav a { white-space: nowrap; }
}

/* =========================================================
   4. HERO: book-spine motif (pure CSS), content above overlays
   ========================================================= */
.hero > * { position: relative; z-index: 1; }
.hero::before { content: ""; position: absolute; right: 48px; bottom: 0; width: 150px; height: 200px; pointer-events: none;
  background:
    linear-gradient(180deg, #d8a84a, var(--brass-dark)) 0 100% / 28px 120px no-repeat,
    linear-gradient(180deg, #3a7767, #24493f)           36px 100% / 32px 170px no-repeat,
    linear-gradient(180deg, #f0e4c6, #cdbd94)           76px 100% / 24px 140px no-repeat,
    linear-gradient(180deg, #2c5f53, #1b3c35)          108px 100% / 34px 190px no-repeat;
  opacity: .85; }
@media (max-width: 860px) { .hero::before { display: none; } }

/* =========================================================

   5. CARDS: calm by default, only *interactive* cards lift
   ========================================================= */
.grid .card:hover { transform: none; box-shadow: var(--shadow-sm); }
.card { position: relative; }
.grid .card:has(a[href], .btn)::before {
  content: ""; position: absolute; inset: -1px -1px auto; height: 3px; border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg, var(--brass), transparent);
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.grid .card:has(a[href], .btn):hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.grid .card:has(a[href], .btn):hover::before { transform: scaleX(1); }

/* =========================================================
   6. STATS: stronger numeric hierarchy
   ========================================================= */
.stat { background: linear-gradient(180deg, #fff, var(--card)); }
.stat .num { font-size: clamp(28px, 2.4vw + 12px, 40px); letter-spacing: -.02em; }
.stat .lbl { margin-top: 6px; }

/* =========================================================
   7. TABLES: row marker, no-wrap headers, stacked on phones
      (needs the 10-line JS below for data-label)
   ========================================================= */
th { white-space: nowrap; }
tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--brass); }
@media (max-width: 640px) {
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 6px 14px; margin-bottom: 12px; }
  td { display: flex; justify-content: space-between; align-items: center; gap: 16px; text-align: right;
       border: 0; border-bottom: 1px dashed var(--border); padding: 9px 0; }
  tr td:last-child { border-bottom: 0; }
  td::before { content: attr(data-label); text-align: left; font-size: 11px; font-weight: 700;

    text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
  td[data-label=""]::before, td:not([data-label])::before { display: none; }
}

/* =========================================================
   8. EMPTY STATES: automatic + explicit class
   ========================================================= */
.empty-state, .grid:empty::before, tbody:empty::before {
  display: block; grid-column: 1 / -1; text-align: center; padding: 44px 20px; color: var(--muted);
  border: 1.5px dashed var(--border); border-radius: 14px;
  background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(185,136,47,.05) 10px 11px); }
.empty-state strong { display: block; font: 600 18px var(--font-display); color: var(--ink); margin-bottom: 4px; }
.grid:empty::before { content: "Nothing to show yet."; }
tbody:empty { display: block; }
tbody:empty::before { content: "No records to display."; }

/* =========================================================
   9. FORMS: touch size, search icon, select chevron,
      validation, required marker
   ========================================================= */
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select { min-height: 44px; }
input[placeholder*="search" i], input[type=search] { padding-left: 40px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236b7a73' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='9' r='6'/%3E%3Cpath d='m14 14 4 4'/%3E%3C/svg%3E") no-repeat 13px center / 17px; }
select { appearance: none; padding-right: 38px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2316302b' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 13px center / 12px; }
input:user-invalid, select:user-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(166,58,42,.15); }
input:disabled, select:disabled { background: #f1ede2; color: var(--muted); cursor: not-allowed; }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); }
label:has(+ :required)::after { content: " *"; color: var(--danger); }   /* drop if labels already have * */

/* =========================================================
   10. BUTTONS & BADGES: depth, loading state, status dots

   ========================================================= */
.btn { background-image: linear-gradient(180deg, rgba(255,255,255,.1), transparent); position: relative; }
.btn[aria-busy="true"] { color: transparent; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.badge { display: inline-flex; align-items: center; gap: 6px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.muted { color: #52605a; }

/* =========================================================
   11. NOTICES: icon without breaking inline flow
   ========================================================= */
.notice { position: relative; padding-left: 50px; }
.notice::before { content: "!"; position: absolute; left: 16px; top: 13px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--warn); color: #fff; font: 700 13px/22px var(--font-body); text-align: center; }
.notice.ok::before { content: "✓"; background: var(--ok); }

/* =========================================================
   12. MOTION: cross-page view transitions + page entrance
       (progressive enhancement; reduced-motion safe)
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
  main > * { animation: rise .45s var(--ease) backwards; }   /* top-level only: live-search re-renders won't re-animate */
  main > *:nth-child(2) { animation-delay: .06s; }
  main > *:nth-child(3) { animation-delay: .12s; }
  main > *:nth-child(n+4) { animation-delay: .18s; }
}


/* Touch targets + print */
@media (pointer: coarse) { .btn.small { min-height: 40px; } nav.main-nav a { padding: 10px 14px; } }
@media print { header.site-header, footer.site-footer, .btn, .skip-link { display: none; } body { background: #fff; } }

/* Small phones: search gets its own row in inline filter forms */
@media (max-width: 560px) {
  form.inline .field { min-width: 0; flex: 1 1 calc(50% - 6px); }
  form.inline .field:first-child { flex: 1 1 100%; }
}

/* =========================================================
   Liveliness pass: motion and micro-interactions
   Everything motion-related is gated on no-preference;
   JS enhancements bail out under reduced motion too.
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {

  /* Hero: slow gradient drift + bobbing book spines + load shine */
  .hero::before { animation: spineBob 6s ease-in-out infinite; }
  @keyframes spineBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

  /* Nav links: underline slides in on hover */
  nav.main-nav a { position: relative; }
  nav.main-nav a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 7px; height: 2px;
    border-radius: 2px; background: var(--brass); transform: scaleX(0); transform-origin: left;
    transition: transform .28s var(--ease); }
  nav.main-nav a:hover::after { transform: scaleX(1); }

  /* Buttons: shine sweep + lift on hover */
  .btn { position: relative; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s var(--ease),
    background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease); }
  .btn::after { content: ""; position: absolute; top: -10%; bottom: -10%; left: -90%; width: 55%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .38), transparent);
    transform: skewX(-20deg); transition: left .55s var(--ease); pointer-events: none; }
  .btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
  .btn:hover::after { left: 140%; }
  .btn:active { transform: translateY(0) scale(.97); }

  /* Cards lift; book covers get springier */
  .grid .card, main > .card { transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease); }
  .grid .card:hover, main > .card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
  .book-cover { transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s var(--ease); }
  tbody tr:hover .book-cover { transform: scale(1.12) rotate(-4deg) translateY(-2px); box-shadow: var(--shadow-md); }

  /* Stat cards pop in (they are injected after load, so this plays on insert) */
  .stat { animation: statPop .5s var(--ease) backwards; }
  .stat:nth-child(2) { animation-delay: .07s; }
  .stat:nth-child(3) { animation-delay: .14s; }
  .stat:nth-child(4) { animation-delay: .21s; }
  @keyframes statPop { from { opacity: 0; transform: translateY(10px) scale(.96); } }

  /* Available badges: the status dot pulses */
  .badge.ok::before { animation: dotPulse 2.4s ease-out infinite; }
  @keyframes dotPulse {
    0% { box-shadow: 0 0 0 0 rgba(38, 122, 82, .45); }
    70% { box-shadow: 0 0 0 6px rgba(38, 122, 82, 0); }
    100% { box-shadow: 0 0 0 0 rgba(38, 122, 82, 0); }
  }

  /* Table rows stagger in on first render (JS adds the class + delay) */
  tbody tr.row-in { animation: rowIn .38s var(--ease) backwards; }
  @keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } }

  /* Scroll reveal (JS adds .rv, then .in when visible) */
  .rv { opacity: 0; transform: translateY(16px); transition: opacity .55s var(--ease), transform .55s var(--ease); }
  .rv.in { opacity: 1; transform: none; }

  /* Inputs: subtle grow on focus */
  input, select, textarea { transition: border-color .18s ease, box-shadow .18s ease, transform .18s var(--ease); }
  input:focus, select:focus, textarea:focus { transform: translateY(-1px); }
}


/* =========================================================
   Fourth pass: Claude color + motion round
   ========================================================= */

:root {
  --brass-hi: #e6bf66;  --brass-lo: #8a6419;
  --verdigris: #3d8f7b; --leaf: #5a8f46; --oxblood: #8e3b32;
  --paper: #f7f1e4;     --card: #fffcf4;   --border: #e6dcc4;
  --foil: linear-gradient(in oklab 135deg, var(--brass-lo), var(--brass) 30%, var(--brass-hi) 50%, var(--brass) 70%, var(--brass-lo));
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}
@supports (transition-timing-function: linear(0, 1)) {
  :root { --spring: linear(0, .22 6%, .62 13%, .96 21%, 1.09 28%, 1.12 33%, 1.08 40%, 1.02 50%, .99 62%, 1 78%, 1); }
}

/* paper grain: static, composited once, no repaint */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .045; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* oklab interpolation = no muddy grey mid-tones in the green gradient */
header.site-header { background: linear-gradient(in oklab 120deg, #12281f 0%, var(--ink-2) 55%, #2d6153 100%); }

/* brass hairline + top highlight on dark surfaces */
.hero { box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.14), inset 0 0 0 1px rgba(230,191,102,.2); }

nav.main-nav a.active, nav.main-nav a[aria-current="page"],
.hero .btn:not(.secondary), .hero .btn:not(.secondary):hover {
  background: var(--foil); border-color: var(--brass-lo); color: #1a2a22;
}
h2::before, .brand::before { background: var(--foil); }
h2::before { width: 22px; }

.stat { --tone: var(--brass); position: relative; border-top-color: var(--tone);
  background:
    radial-gradient(120% 90% at 100% 0, color-mix(in oklab, var(--tone) 16%, transparent), transparent 60%),
    linear-gradient(180deg, #fff, var(--card)); }
.grid > .stat:nth-child(4n+2) { --tone: var(--verdigris); }
.grid > .stat:nth-child(4n+3) { --tone: var(--leaf); }
.grid > .stat:nth-child(4n+4) { --tone: var(--oxblood); }  /* reorder so oxblood lands on "overdue" */
.stat .lbl::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px;
  border-radius: 50%; background: var(--tone); vertical-align: 1px; }

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .grid .card, .stat { position: relative; isolation: isolate; overflow: hidden; }
  .grid .card::after, .stat::after {
    content: ""; position: absolute; left: 0; top: 0; width: 340px; height: 340px; margin: -170px 0 0 -170px;
    border-radius: 50%; z-index: -1; pointer-events: none; opacity: 0; will-change: transform, opacity;
    background: radial-gradient(closest-side, rgba(230,191,102,.30), transparent);
    transform: translate3d(var(--mx, 0px), var(--my, 0px), 0);
    transition: opacity .3s var(--ease);
  }
  .grid .card:hover::after, .stat:hover::after { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    body::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
      background: var(--foil); transform-origin: 0 50%; transform: scaleX(0);
      animation: read-progress linear both; animation-timeline: scroll(root block); }
    @keyframes read-progress { to { transform: scaleX(1); } }

    header.site-header::after { content: ""; position: absolute; inset: auto 0 -16px; height: 16px; pointer-events: none;
      background: linear-gradient(rgba(22,48,43,.25), transparent); opacity: 0;
      animation: header-elevate linear both; animation-timeline: scroll(root block); animation-range: 0 120px; }
    @keyframes header-elevate { to { opacity: 1; } }

    .hero::after { inset: -60px 0; animation: hero-drift linear both;
      animation-timeline: view(); animation-range: cover 0% cover 100%; }
    @keyframes hero-drift { from { transform: translateY(-28px); } to { transform: translateY(28px); } }
  }
}

@media (prefers-reduced-motion: no-preference) {
  header.site-header { view-transition-name: site-header; }
  main { view-transition-name: page; }
  nav.main-nav a.active, nav.main-nav a[aria-current="page"] { view-transition-name: nav-pill; }

  ::view-transition-group(site-header) { animation-duration: 0s; }
  ::view-transition-group(nav-pill) { animation-duration: .45s; animation-timing-function: var(--spring); }
  ::view-transition-old(page) { animation: vt-out .14s ease-in both; }
  ::view-transition-new(page) { animation: vt-in .3s var(--ease) .04s both; }
  @keyframes vt-out { to { opacity: 0; } }
  @keyframes vt-in  { from { opacity: 0; } }
}

@media (prefers-reduced-motion: no-preference) {
  .notice { animation: notice-in .5s var(--ease) backwards; }
  .notice::before { animation: pop .6s var(--spring) .15s backwards; }
  @keyframes notice-in { from { opacity: 0; transform: translateY(-8px); } }
  @keyframes pop { from { transform: scale(0); } }

  .swap-in { animation: swap-in .38s var(--ease) backwards; animation-delay: calc(min(var(--i, 0), 8) * 40ms); }
  @keyframes swap-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
}


/* =========================================================
   Fifth pass: Claude clean redesign (Ink & Indigo, feature rows,
   stat strip, Geist type)
   ========================================================= */

/* =========================================================
   A. PALETTE "INK & INDIGO": tokens
   ========================================================= */
:root {
  --ink: #0b1020;        --ink-2: #151b30;
  --paper: #f8f9fb;      --card: #ffffff;     --border: #e4e7ef;
  --text: #1c2030;       --muted: #5a6275;

  /* accent (token names kept so every old rule re-themes) */
  --brass: #4f46e5;      --brass-dark: #4338ca;
  --brass-hi: #a5b4fc;   --brass-lo: #3730a3;

  --ok: #0b6b44;  --warn: #8a5a00;  --danger: #b42318;  --info: #175cd3;

  /* stat-tile accents (decorative, used as borders/dots/washes) */
  --verdigris: #0891b2;  --leaf: #059669;  --oxblood: #e11d48;

  --foil: linear-gradient(180deg, #6366f1, #4f46e5);
  --shadow-sm: 0 1px 2px rgba(11,16,32,.05), 0 2px 8px rgba(11,16,32,.04);
  --shadow-md: 0 2px 4px rgba(11,16,32,.06), 0 12px 32px rgba(11,16,32,.09);
}

/* =========================================================
   A. PALETTE: surfaces, type, header, hero
   ========================================================= */
body { background: radial-gradient(900px 360px at 50% -160px, rgba(99,102,241,.08), transparent 70%), var(--paper); }
body::after { display: none; }                         /* drop paper grain */
::selection { background: rgba(79,70,229,.18); }
::placeholder { color: #6f778b; }
h1, h2, .hero h1 { font-weight: 500; letter-spacing: -.02em; }

header.site-header { background: linear-gradient(in oklab 120deg, #0b1020, #151b30 60%, #1d2444);

  border-bottom: 1px solid rgba(255,255,255,.08); box-shadow: none; }
.brand span { color: var(--brass-hi); }
.brand::before { background: linear-gradient(180deg, #818cf8, #4f46e5); }
nav.main-nav a { color: #b4bbd0; }
nav.main-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
nav.main-nav a.active, nav.main-nav a[aria-current="page"] {
  background: rgba(255,255,255,.1); color: #fff; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); border-color: transparent; }

.hero { background:
    radial-gradient(60% 90% at 88% 0, rgba(99,102,241,.5), transparent 62%),
    radial-gradient(45% 70% at 5% 115%, rgba(34,211,238,.16), transparent 60%),
    linear-gradient(in oklab 160deg, #0b1020, #151b30);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.1), inset 0 0 0 1px rgba(255,255,255,.06); }
.hero p { color: #c3c9dd; }
.hero::before { opacity: 1; background:
  linear-gradient(180deg, rgba(165,180,252,.55), rgba(165,180,252,.08)) 0 100% / 28px 120px no-repeat,
  linear-gradient(180deg, rgba(255,255,255,.30), rgba(255,255,255,.05)) 36px 100% / 32px 170px no-repeat,
  linear-gradient(180deg, rgba(34,211,238,.35), rgba(34,211,238,.05)) 76px 100% / 24px 140px no-repeat,
  linear-gradient(180deg, rgba(129,140,248,.5), rgba(129,140,248,.06)) 108px 100% / 34px 190px no-repeat; }

/* buttons: indigo primary, white-on-dark inside hero */
.btn { background-color: var(--brass); border-color: var(--brass); }
.btn:hover { background-color: var(--brass-dark); box-shadow: 0 6px 18px rgba(79,70,229,.28); }
.btn.secondary { color: var(--ink); border-color: #c9cee0; }
.btn.secondary:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn:disabled { background: #d5d9e6; border-color: #d5d9e6; color: #6b7389; }
.hero .btn:not(.secondary), .hero .btn:not(.secondary):hover { background: #fff; border-color: #fff; color: var(--ink); }
.hero .btn:not(.secondary):hover { background: #eef0ff; }

/* links, focus, forms */
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {

  outline: 2px solid var(--brass); outline-offset: 2px; box-shadow: 0 0 0 5px rgba(79,70,229,.18); }
.site-header :focus-visible, .hero :focus-visible { outline-color: #fff; box-shadow: none; }
input:focus, select:focus { border-color: var(--brass); box-shadow: 0 0 0 4px rgba(79,70,229,.15); }
input:user-invalid, select:user-invalid { box-shadow: 0 0 0 3px rgba(180,35,24,.14); }
input:disabled, select:disabled { background: #f0f2f7; }
th { background: rgba(11,16,32,.035); }
tbody tr:hover { background: rgba(79,70,229,.04); }
tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--brass); }
h2::before { background: var(--brass); }

/* status */
.badge.ok { background: #dcf5e8; }  .badge.warn { background: #fdf0d0; }
.badge.danger { background: #fde4e1; }  .badge.info { background: #e0ecff; }
.badge.muted { background: #eceef4; color: #4b5366; }
.notice { background: #fff8e6; border-color: #f0d28a; }
.notice.ok { background: #e6f6ee; border-color: #9bd7b8; }

/* stats, spotlight, book covers */
.stat { background: radial-gradient(120% 90% at 100% 0, color-mix(in oklab, var(--tone) 10%, transparent), transparent 60%), #fff; }
.grid .card::after, .stat::after { background: radial-gradient(closest-side, rgba(99,102,241,.14), transparent); }
.book-cover { color: #e0e4f5; border-left-color: var(--brass-hi); }
footer.site-footer::before { background: var(--brass); }

/* =========================================================
   C1. RHYTHM + HIERARCHY + GLASS HEADER
   ========================================================= */
main { margin-top: clamp(28px, 4vw, 56px); }
h1 { margin-bottom: 10px; }
.subtitle { font-size: 1.0625rem; margin-bottom: 32px; }
h2 { font-size: 1.25rem; margin: 56px 0 16px; }
h2::before { display: none; }
.card { border-radius: 16px; padding: clamp(18px, 2.4vw, 28px); }
.stat { border-top-width: 2px; border-radius: 14px; }
@media (min-width: 861px) {
  header.site-header { background: rgba(11,16,32,.82); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); }
}

kbd { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 3px 6px; color: var(--muted);
  background: #fff; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; }
.kbd-hint { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
@media (pointer: coarse) { .kbd-hint { display: none; } }

/* =========================================================
   C3. QUIET ROW ACTIONS + MOBILE FORM ERGONOMICS
   ========================================================= */
tbody .btn.small:not(:disabled):not(.danger):not(.secondary) {
  background: rgba(79,70,229,.08); color: var(--brass-dark); border-color: transparent; box-shadow: none; }
tbody .btn.small:not(:disabled):not(.danger):not(.secondary):hover {
  background: var(--brass); color: #fff; }
form.inline .btn { min-height: 44px; }
@media (max-width: 560px) {
  form.inline .field, form.inline .btn { flex: 1 1 100%; width: 100%; }
}

/* =========================================================
   D. FEATURE ROWS: hairline-divided, numbered, no cards
   ========================================================= */
.feat-list { list-style: none; counter-reset: feat; margin-top: 8px; border-top: 1px solid var(--border); }
.feat-row { counter-increment: feat; position: relative; display: grid; align-items: start;
  grid-template-columns: 190px minmax(0, 1fr) minmax(0, 250px); gap: 8px 40px; padding: 28px 0;
  border-bottom: 1px solid var(--border); }
.feat-meta { display: flex; align-items: baseline; gap: 14px; }
.feat-meta::before { content: counter(feat, decimal-leading-zero); font: 500 12px/1 var(--font-mono, ui-monospace, Menlo, monospace);
  color: var(--brass); letter-spacing: .04em; }
.feat-role { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.feat-body h3 { font: 600 1.25rem/1.25 var(--font-display); letter-spacing: -.02em; color: var(--ink); margin-bottom: 6px; text-wrap: balance; }
.feat-body p { color: var(--muted); font-size: .9375rem; max-width: 56ch; }
.fr { margin-left: 4px; font: 500 11px/1 var(--font-mono, ui-monospace, Menlo, monospace); color: #7b8296; white-space: nowrap; }

/* the one mini-UI: a search field with a blinking caret */
.feat-aside { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px;
  border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 1px var(--border); font-size: 12.5px; color: var(--muted); }
.feat-aside span::after { content: ""; display: inline-block; width: 1.5px; height: 13px; margin-left: 3px;
  vertical-align: -2px; background: var(--brass); }

/* hover: a brass hairline sweeps under the row */
.feat-row::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: var(--brass); transform: scaleX(0); transform-origin: left; }
@media (prefers-reduced-motion: no-preference) {
  .feat-row::after { transition: transform .5s var(--ease); }
  .feat-meta::before { transition: opacity .3s; opacity: .6; }
  .feat-row:hover::after { transform: scaleX(1); }
  .feat-row:hover .feat-meta::before { opacity: 1; }
  .feat-aside span::after { animation: caret 1.1s steps(1) infinite; }
  @keyframes caret { 50% { opacity: 0; } }
  @supports (animation-timeline: view()) {

    .feat-row { animation: row-in linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
    @keyframes row-in { from { opacity: 0; transform: translateY(14px); } }
  }
}
@media (max-width: 860px) { .feat-row { grid-template-columns: 150px minmax(0, 1fr); gap: 8px 24px; } .feat-aside { display: none; } }
@media (max-width: 560px) { .feat-row { grid-template-columns: 1fr; padding: 22px 0; } .feat-meta { margin-bottom: 2px; } }

/* =========================================================
   E. STATS: single hairline strip, no tiles
   ========================================================= */
#stats.grid { grid-template-columns: repeat(4, 1fr); gap: 0; border-block: 1px solid var(--border); }
#stats .stat { background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible;
  padding: 26px clamp(14px, 2.4vw, 32px); border-left: 1px solid var(--border); }
#stats .stat:first-child { border-left: 0; padding-left: 0; }
#stats .stat::after { display: none; }                       /* no cursor spotlight on the strip */
#stats .stat .num { font-size: clamp(2rem, 1.2rem + 2.6vw, 3rem); font-weight: 500; letter-spacing: -.04em; line-height: 1; }
#stats .stat .lbl { margin-top: 10px; font-size: 12px; letter-spacing: .06em; }
#stats .stat .lbl::before { width: 6px; height: 6px; margin-right: 8px; }
@media (max-width: 860px) {
  #stats.grid { grid-template-columns: repeat(2, 1fr); }
  #stats .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  #stats .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* =========================================================
   F. TYPE: Geist
   ========================================================= */
:root {
  --font-display: "Inter", "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body:    "Inter", "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
body { -webkit-font-smoothing: antialiased; letter-spacing: 0; }
h1 { font-weight: 600; letter-spacing: -.035em; line-height: 1.1; }
.hero h1 { font-weight: 600; letter-spacing: -.045em; line-height: 1.06; }
h2 { font-weight: 600; letter-spacing: -.025em; }
.feat-body h3 { font-weight: 600; letter-spacing: -.02em; }
.brand { font-weight: 600; letter-spacing: -.02em; }
.brand span { font-style: normal; font-weight: 500; }
.book-title { font-weight: 600; letter-spacing: -.01em; }
.stat .num, td { font-variant-numeric: tabular-nums; }
.btn { letter-spacing: 0; }
label, th, .lbl, .feat-role { letter-spacing: .06em; }       /* slightly tighter than Inter's .07-.08 */
kbd, .fr { font-family: var(--font-mono); }

/* =========================================================
   Sixth pass: mobile layout fixes + Vercel/GitHub-inspired
   touch ergonomics (sticky header, list-card book rows)
   ========================================================= */

/* Sticky glass header at EVERY width (was desktop-only blur,
   and un-stuck under 860px which made content clip under it) */
@media (max-width: 860px) {
  header.site-header {
    position: sticky; top: 0;
    background: rgba(11,16,32,.9);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
  }
  .nav-wrap { gap: 6px 16px; padding: 10px 16px; }
  main { margin-top: 22px; }
}

/* Mobile book rows -> compact list cards (GitHub list pattern):
   small cover pinned left, title block above the meta rows */
@media (max-width: 640px) {
  tbody:has(.book-cover) tr { position: relative; padding: 12px 14px 6px 72px; }
  tbody td:has(.book-cover) {
    position: absolute; left: 14px; top: 14px;
    display: block; padding: 0; border: 0;
  }
  td:has(.book-cover) .book-cover { width: 42px; height: 56px; font-size: 17px; }
  tbody td:has(.book-title) {
    display: block; text-align: left; gap: 0;
    padding: 1px 0 9px; border-bottom: 1px dashed var(--border);
  }
  td:has(.book-title)::before { display: none; }  /* primary line: no visible label */
  td:has(.book-title) .book-meta { margin-top: 2px; }
  tbody td:has(.btn) { justify-content: flex-end; }
  .hero { padding: 30px 22px; border-radius: 14px; margin-bottom: 26px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 14.5px; margin-bottom: 20px; }
}

/* Touch ergonomics (Vercel web interface guidelines) */
a, .btn, button, summary { touch-action: manipulation; }
body { -webkit-tap-highlight-color: transparent; }
@media (max-width: 640px) {
  /* >=16px inputs stop iOS auto-zoom on focus */
  input[type=text], input[type=email], input[type=password],
  input[type=date], input[type=number], select { font-size: 16px; }
}

/* Login and registration */
.auth-wrap { max-width: 420px; margin: 24px auto 0; }
.auth-wrap .card:hover { transform: none; }
.google-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted, #6b7280); font-size: .85rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-switch { margin: 18px 0 0; text-align: center; font-size: .95rem; }
[hidden] { display: none !important; }

/* Soft green page background with a slow, subtle drift (not white) */
body { background-color: #d9e6dd; position: relative; }
body::before { content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 35% at 20% 25%, rgba(185, 136, 47, .20), transparent 70%),
    radial-gradient(45% 40% at 80% 20%, rgba(47, 111, 119, .20), transparent 70%),
    radial-gradient(50% 45% at 55% 85%, rgba(46, 125, 79, .18), transparent 70%);
  animation: bg-drift 28s ease-in-out infinite alternate; }
@keyframes bg-drift { from { transform: translate3d(-3%, -2%, 0) scale(1); } to { transform: translate3d(3%, 3%, 0) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }
