/* Layout: a quiet working rail on the left (librarian), a tab bar for students; content in one scrolling column.
   Signature detail: due dates appear as rubber-stamp marks in date-due-slip ink. */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --sunk: #e9edf1;
  --ink: #18212e;
  --muted: #5a6575;
  --line: #d9dfe6;
  --accent: #4a34b8;       /* date-due stamp ink */
  --accent-soft: #ebe7fb;
  --accent-ink: #ffffff;
  --ok: #17734a; --ok-soft: #e1f3ea;
  --warn: #9a5a00; --warn-soft: #fbf0dc;
  --bad: #b3202a; --bad-soft: #fbe6e7;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .06);
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 10px;
  --rail: 232px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151b; --surface: #191f27; --sunk: #222a34; --ink: #e8ecf1; --muted: #9ba6b4; --line: #2c3541;
    --accent: #a896ff; --accent-soft: #2a2550; --accent-ink: #14112b;
    --ok: #5fd39b; --ok-soft: #173327; --warn: #f0b155; --warn-soft: #3a2b12; --bad: #ff8a8f; --bad-soft: #3d1d20;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151b; --surface: #191f27; --sunk: #222a34; --ink: #e8ecf1; --muted: #9ba6b4; --line: #2c3541;
  --accent: #a896ff; --accent-soft: #2a2550; --accent-ink: #14112b;
  --ok: #5fd39b; --ok-soft: #173327; --warn: #f0b155; --warn-soft: #3a2b12; --bad: #ff8a8f; --bad-soft: #3d1d20;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100%; }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; line-height: 1.1; }
.brand-sub { font-size: .72rem; color: var(--muted); }
.nav-group { margin-top: 12px; padding: 0 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .93rem; }
.nav a:hover { background: var(--sunk); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; }
.rail-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.main { min-width: 0; padding-block: 28px 80px; padding-inline: clamp(16px, 4vw, 40px); }
.page { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }

.topbar { display: none; }
.tabbar { display: none; }

/* student shell: header + content, tabs at the top on desktop */
.pshell { min-height: 100%; display: flex; flex-direction: column; }
.phead { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.phead-in { max-width: 1120px; margin: 0 auto; padding: 10px clamp(16px, 4vw, 40px); display: flex; align-items: center; gap: 18px; }
.ptabs { display: flex; gap: 2px; margin-left: 12px; }
.ptabs a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ptabs a.on { background: var(--accent-soft); color: var(--accent); }
.ptabs a svg { width: 18px; height: 18px; }
.phead .who { margin-left: auto; display: flex; align-items: center; gap: 10px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .rail.open { display: flex; position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; height: 100%; padding-top: calc(20px + env(safe-area-inset-top, 0px)); box-shadow: var(--shadow); }
  .scrim { position: fixed; inset: 0; background: rgba(10, 14, 20, .45); z-index: 55; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .main { padding-block: 18px 96px; padding-inline: 16px; }
  h1 { font-size: 1.45rem; }
  .ptabs { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; font-weight: 700; color: var(--muted); text-decoration: none; padding: 4px 0; position: relative; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--accent); }
  .tabbar .badge { position: absolute; top: 0; left: calc(50% + 6px); }
  .phead-in { padding: 10px 16px; }
}

/* ---------- building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 18px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 8px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 38px; }
.btn:hover { background: var(--sunk); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunk); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: .85rem; }
.btn svg { width: 17px; height: 17px; }
.btn[disabled] { opacity: .5; cursor: default; }
.iconbtn { border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; color: var(--ink); }
.iconbtn:hover { background: var(--sunk); }
.iconbtn svg { width: 22px; height: 22px; }

label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: .85rem; min-width: 0; }
label.field .hint { font-weight: 400; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 11px; font-weight: 400; font-size: .95rem; min-height: 40px; }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.45; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.input.big { font-size: 1.15rem; padding: 12px 14px; font-family: var(--font-mono); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search .input { padding-left: 36px; }

.seg { display: inline-flex; background: var(--sunk); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 700; font-size: .88rem; cursor: pointer; color: var(--muted); text-decoration: none; }
.seg .on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 800; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 11px; font-size: .82rem; font-weight: 700; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* date-due stamp */
.stamp { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; border: 2px solid var(--accent); color: var(--accent); border-radius: 6px; padding: 3px 9px 2px; font-family: var(--font-mono); line-height: 1.05; transform: rotate(-3deg); text-transform: uppercase; flex: none; min-width: 74px; }
.stamp b { font-size: .95rem; font-weight: 600; letter-spacing: .02em; }
.stamp small { font-size: .58rem; letter-spacing: .14em; font-weight: 600; }
.stamp.late { border-color: var(--bad); color: var(--bad); }
.stamp.soon { border-color: var(--warn); color: var(--warn); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stat { background: var(--surface); padding: 14px 16px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
a.stat:hover { background: var(--sunk); }
.stat .v { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: .8rem; color: var(--muted); font-weight: 700; }
.stat.alert .v { color: var(--bad); }
.stat.attn .v { color: var(--accent); }

/* tables */
.tablewrap { overflow-x: auto; margin: 0 -18px; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 8px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--sunk); }
table.t td.r, table.t th.r { text-align: right; }

/* lists */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t1 { display: block; font-weight: 700; overflow-wrap: anywhere; }
.li .t2 { display: block; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
a.li { color: inherit; text-decoration: none; }
a.li:hover .t1 { color: var(--accent); }

/* covers */
.cover { position: relative; aspect-ratio: 2 / 3; border-radius: 3px 6px 6px 3px; overflow: hidden; background: var(--sunk); box-shadow: inset 4px 0 0 rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.18); flex: none; max-width: 100%; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.gen { display: flex; flex-direction: column; justify-content: space-between; padding: .8em .7em .6em 1em; color: #fff; }
.cover.gen .ct { font-family: var(--font-display); font-weight: 700; line-height: 1.08; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.cover.gen .ca { font-size: .7em; opacity: .85; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cover.xs { width: 34px; font-size: 5px; }
.cover.sm { width: 48px; font-size: 7px; }
.cover.md { width: 110px; font-size: 13px; }
.cover.lg { width: 190px; font-size: 20px; }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 22px 18px; }
.book { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; min-width: 0; }
.book .cover { width: 100%; font-size: 15px; transition: transform .15s ease; }
.book:hover .cover { transform: translateY(-3px); }
.book .bt { font-weight: 700; font-size: .92rem; line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book .ba { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 500px) { .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; } .book .cover { font-size: 10px; } }

.stars { color: #d69400; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: var(--line); }
.starpick { display: flex; gap: 4px; }
.starpick button { border: 0; background: none; font-size: 1.9rem; cursor: pointer; color: var(--line); padding: 0 2px; line-height: 1; }
.starpick button.on { color: #d69400; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg { width: 36px; height: 36px; opacity: .55; }
.empty b { color: var(--ink); font-size: 1rem; }

.notice { border-radius: var(--r); padding: 12px 14px; background: var(--accent-soft); color: var(--ink); display: flex; gap: 10px; align-items: flex-start; }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); }
.notice.ok { background: var(--ok-soft); }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }

.bar { height: 10px; border-radius: 5px; background: var(--sunk); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }

/* announcements */
.update { border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; display: flex; flex-direction: column; gap: 4px; }
.update .ut { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.update .ub { white-space: pre-wrap; overflow-wrap: anywhere; }

/* messages */
.msg { padding: 12px 14px; border-radius: 10px; background: var(--sunk); display: flex; flex-direction: column; gap: 4px; }
.msg.staff { background: var(--accent-soft); }
.msg.unread { box-shadow: inset 3px 0 0 var(--accent); }
.msg .mb { white-space: pre-wrap; overflow-wrap: anywhere; }
.tmpl { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.tmpl button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 600; }
.tmpl button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* scanner result */
.result { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.result .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tx { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--sunk); }
.tx.ok { background: var(--ok-soft); }
.tx.bad { background: var(--bad-soft); }

.barcode-svg { display: block; max-width: 100%; height: auto; }
.bc-box { background: #fff; color: #000; border-radius: 6px; padding: 8px 10px 4px; display: inline-flex; flex-direction: column; align-items: center; border: 1px solid var(--line); }
.bc-box .bct { font-size: .68rem; max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #222; }

/* chart */
.chart svg { width: 100%; height: auto; display: block; }
.chart .gridl { stroke: var(--line); }
.chart .barr { fill: var(--accent); }
.chart .barr.today { fill: var(--accent); opacity: 1; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }

/* modal + toast */
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 20, .5); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(460px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 700; box-shadow: var(--shadow); pointer-events: auto; }
.toast.bad { background: var(--bad); color: #fff; }
@media (min-width: 861px) { .toasts { bottom: 24px; } }

/* auth */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-card .card { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 10px; }
.auth-brand .brand-mark svg { width: 26px; height: 26px; }
.demo-box { font-size: .88rem; }
.demo-box button { text-align: left; }

/* book detail */
.detail { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px; align-items: start; }
.detail .meta { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.detail .desc { max-width: 68ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .detail { grid-template-columns: 1fr; } .detail .cover.lg { width: 150px; } }

.review { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }
.review .rt { white-space: pre-wrap; overflow-wrap: anywhere; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 92px; }
.week .d { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.week .d i { width: 100%; max-width: 28px; background: var(--accent); border-radius: 4px 4px 2px 2px; min-height: 3px; }
.week .d i.zero { background: var(--line); }
.week .d span { font-size: .7rem; color: var(--muted); font-weight: 700; }
.week .d.today span { color: var(--accent); }

.demo-flag { background: var(--warn-soft); color: var(--warn); font-size: .8rem; font-weight: 700; padding: 6px 12px; text-align: center; }
.demo-flag button { font: inherit; background: none; border: 0; text-decoration: underline; color: inherit; cursor: pointer; padding: 0; }

.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 28px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.progress { height: 8px; background: var(--sunk); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .2s; }

video.scanner { width: 100%; max-height: 50vh; border-radius: var(--r); background: #000; }

/* ---------- printing (labels, cards) ---------- */
#print-area { display: none; }
@media print {
  @page { margin: 0.5in 0.19in; }
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; color: #000; }
  .sheet { display: grid; grid-template-columns: repeat(3, 2.625in); grid-auto-rows: 1in; column-gap: 0.125in; }
  .lbl { width: 2.625in; height: 1in; padding: 0.06in 0.12in; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; break-inside: avoid; font-family: Arial, sans-serif; }
  .lbl .lt { font-size: 7pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .lbl svg { height: 0.58in; width: auto; max-width: 100%; }
  .cards { display: grid; grid-template-columns: repeat(2, 3.375in); grid-auto-rows: 2.125in; gap: 0.2in; }
  .pcard { border: 1px solid #999; border-radius: 0.1in; padding: 0.14in; display: flex; flex-direction: column; justify-content: space-between; break-inside: avoid; font-family: Arial, sans-serif; }
  .pcard .pn { font-size: 13pt; font-weight: bold; }
  .pcard .pl { font-size: 8pt; color: #333; }
  .pcard svg { height: 0.7in; width: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
[hidden] { display: none !important; }
.google-btn { gap: 10px; min-height: 44px; font-weight: 700; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tx.hold { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
/* challenges */
.medal { flex: none; display: block; }
.medal.earned { filter: drop-shadow(0 2px 3px rgba(20, 20, 40, .18)); }
.badges { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.badges figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; text-align: center; font-size: .72rem; color: var(--muted); }
.celebrate { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; padding: 8px 0; }
.celebrate .cb { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; max-width: 160px; }
.celebrate .medal { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pop { from { transform: scale(.3) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
.chal { display: flex; flex-direction: column; gap: 14px; }
.chal-head { display: flex; gap: 16px; align-items: flex-start; }
.chal-head .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.goal { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.goal .gl { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.goal .gv { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.goal .bar, .goal .gh { grid-column: 1 / -1; }
.goal .gh { font-size: .84rem; color: var(--muted); }
.goal.done .gl svg { color: var(--ok); }
.goal.done .bar > i { background: var(--ok); }
.tick { width: 18px; height: 18px; flex: none; }
.bar.big { height: 14px; border-radius: 7px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { cursor: pointer; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches .sw { display: block; width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked + .sw { border-color: var(--surface); box-shadow: 0 0 0 2px var(--ink); }
.swatches input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.iconpick { display: flex; gap: 6px; flex-wrap: wrap; }
.iconpick label { cursor: pointer; border-radius: 50%; }
.iconpick input { position: absolute; opacity: 0; pointer-events: none; }
.iconpick input:checked + svg { outline: 3px solid var(--ink); outline-offset: 1px; border-radius: 50%; }
.goalrow { display: grid; grid-template-columns: 180px 110px minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 10px 0; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .goalrow { grid-template-columns: 1fr 1fr; } .goalrow .gx { grid-column: 1 / -1; } }
.place { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; width: 32px; text-align: center; color: var(--accent); }
.tabbar .short { display: none; }
@media (max-width: 860px) { .tabbar { grid-template-columns: repeat(6, 1fr); } .tabbar .long { display: none; } .tabbar .short { display: inline; } .tabbar a { font-size: .66rem; } }
.ptabs .short { display: none; }
.ptabs a { white-space: nowrap; padding: 8px 10px; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-family: var(--font-display); font-weight: 700; flex: none; }
.li.lb.me { background: var(--accent-soft); margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 8px; }
.lb-gap { justify-content: center; color: var(--muted); padding: 2px 0; }
.medal-dot { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: .85rem; }
.medal-dot.m1 { background: #b8860b; } .medal-dot.m2 { background: #7d8794; } .medal-dot.m3 { background: #a0522d; }
.badgerow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.badgerow .bfields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; align-items: end; }
.badgerow .bwhen { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
@media (max-width: 640px) { .badgerow { grid-template-columns: 48px minmax(0, 1fr); } .badgerow .gx { grid-column: 2; justify-self: end; } }
.sharenote { display: block; margin: 4px 0; padding: 6px 10px; background: var(--accent-soft); border-radius: 0 10px 10px 10px; font-style: italic; overflow-wrap: anywhere; }
.msg.share { background: var(--surface); border: 1px solid var(--line); }
.msg.share .li { border: 0; padding: 0; }
