:root{
  --bg:#fff6ee; --card:#ffffff; --ink:#2a2730; --muted:#93897f; --line:#f0e5d9;
  --brand:#f97316; --brand-dark:#e85d04; --ok:#12b886; --warn:#f59f00; --bad:#fa5252;
  --green:#12b886; --blue:#4c6ef5; --purple:#7c4dff; --red:#fa5252; --amber:#f59f00; --teal:#0ca678;
  --give:#12b886; --swap:#7c4dff; --sell:#4c6ef5; --radius:18px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:-apple-system,"Segoe UI",Rubik,Arial,sans-serif;
  background:var(--bg); color:var(--ink); line-height:1.55;
  -webkit-font-smoothing:antialiased; padding-bottom:82px; overflow-x:hidden;
}
a{color:var(--brand); text-decoration:none}

.topbar{
  position:sticky; top:0; z-index:20; display:flex; align-items:center;
  justify-content:space-between; background:var(--bg); color:var(--ink);
  padding:14px 18px 10px;
}
.brand{color:var(--brand); font-weight:800; font-size:19px; letter-spacing:-.2px}
/* admin support mode: "acting as rep for school X" banner */
.act-banner{position:sticky; top:0; z-index:19; display:flex; align-items:center; justify-content:space-between;
  gap:10px; background:#3b2f6b; color:#fff; padding:8px 16px; font-size:13.5px; flex-wrap:wrap}
.act-banner b{font-weight:800}
.act-banner a{color:#fff; font-weight:700; text-decoration:underline; white-space:nowrap}
.who{display:flex; align-items:center; gap:10px; font-size:14px}
.who .logout{color:var(--muted); font-size:13px}

.wrap{max-width:560px; margin:0 auto; padding:8px 16px 16px}

.card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:16px; margin-bottom:14px; box-shadow:0 6px 18px rgba(191,145,100,.10)}
.card h2{margin:0 0 4px; font-size:17px}
.card h3{margin:0 0 8px; font-size:15px}
.card .sub{color:var(--muted); font-size:13px; margin-bottom:12px}

h1{font-size:22px; margin:6px 0 14px}
.lead{color:var(--muted); margin:0 0 18px}

.btn{display:inline-block; background:var(--brand); color:#fff; border:0; border-radius:12px;
  padding:12px 16px; font-size:15px; font-weight:700; cursor:pointer; text-align:center; width:100%;
  box-shadow:0 4px 12px rgba(249,115,22,.25)}
.btn:hover{background:var(--brand-dark)}
.btn.sec{background:#fbeee2; color:var(--brand-dark); box-shadow:none}
.btn.ghost{background:transparent; border:1px solid var(--line); color:var(--ink)}
.btn.danger{background:#fbeaea; color:var(--bad)}
.btn.sm{width:auto; padding:7px 12px; font-size:13px}
.row-btns{display:flex; gap:8px; flex-wrap:wrap}

label{display:block; font-size:13px; color:var(--muted); margin:10px 0 4px}
/* text-like fields only — must NOT hit radio/checkbox (the hidden segmented-control
   radios are position:absolute; width:100% would blow them to viewport width and
   overflow the RTL layout — the "my books displaced on Chrome" bug). */
input:not([type=checkbox]):not([type=radio]),select,textarea{
  width:100%; padding:11px 12px; border:1px solid var(--line);
  border-radius:10px; font-size:15px; font-family:inherit; background:#fff}
textarea{min-height:150px; resize:vertical}
.inline{display:flex; gap:8px; align-items:end}
.inline>*{flex:1}

/* upload area — obvious tappable file button + clear labels/separator */
.fld-label{display:block; font-size:14px; font-weight:700; color:var(--ink); margin:2px 0 6px}
.file-btn{display:flex; align-items:center; gap:12px; cursor:pointer; margin:0;
  border:2px dashed var(--line); border-radius:12px; padding:12px 14px; background:#faf6f0}
.file-btn:hover{border-color:var(--brand); background:#fbeee2}
.file-btn.has-file{border-style:solid; border-color:var(--give); background:#eef9f2}
.file-btn input[type=file]{display:none}
.fb-cta{flex:0 0 auto; background:var(--brand); color:#fff; font-weight:700; font-size:14px;
  padding:9px 14px; border-radius:10px; box-shadow:0 3px 10px rgba(249,115,22,.25)}
.fb-name{color:var(--muted); font-size:13px; overflow-wrap:anywhere; min-width:0}
.file-btn.has-file .fb-name{color:var(--give); font-weight:600}
.or-sep{display:flex; align-items:center; gap:10px; color:var(--muted); font-size:12px; margin:12px 0}
.or-sep::before,.or-sep::after{content:''; flex:1; height:1px; background:var(--line)}
.btn.lg{padding:15px 16px; font-size:16px}

.flash{padding:11px 14px; border-radius:10px; margin-bottom:12px; font-size:14px}
.flash-success{background:#e7f6ee; color:#127a4f; border:1px solid #bfe6d1}
.flash-error{background:#fdeaea; color:#b02a2a; border:1px solid #f3c9c9}
.flash-otp,.flash-link{background:#fff6df; color:#7a5b12; border:1px solid #f0dfae; word-break:break-all}

.tabbar{position:fixed; bottom:0; left:0; right:0; width:100%; background:#fff; border-top:1px solid var(--line);
  display:flex; justify-content:space-around; padding:8px 4px 10px; z-index:20;
  box-shadow:0 -4px 18px rgba(191,145,100,.10)}
.tabbar a{flex:1 1 0; min-width:0; display:flex; flex-direction:column; align-items:center; gap:3px;
  color:var(--muted); padding:4px 2px}
.tabbar a .ti{width:38px; height:38px; border-radius:12px; display:flex; align-items:center;
  justify-content:center; font-size:19px; background:transparent; flex:0 0 auto}
.tabbar a.on{color:var(--brand); font-weight:700}
.tabbar a.on .ti{background:var(--brand); color:#fff; box-shadow:0 4px 12px rgba(249,115,22,.35)}
.tabbar a > span:last-child{font-size:10px; max-width:100%; white-space:nowrap; overflow:hidden;
  text-overflow:ellipsis; text-align:center}

.pill{display:inline-block; padding:3px 9px; border-radius:999px; font-size:12px; font-weight:600}
.pill.give{background:#e6f6ee; color:var(--give)}
.pill.swap{background:#efe9fb; color:var(--swap)}
.pill.sell{background:#e7f0fe; color:var(--sell)}
.pill.have{background:#e9edf2; color:#516072}
.pill.avail{background:#e6f6ee; color:var(--give)}
.pill.unavail{background:#f3e6e6; color:var(--bad)}
.pill.consum{background:#fdf0df; color:var(--warn)}
.pill.committed{background:#efe9fb; color:var(--swap)}
.pill.surplus{background:#fff4df; color:var(--warn)}
.pill.new{background:#eef2f8; color:#516072}

.list-item{display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:11px 0; border-bottom:1px solid var(--line)}
.list-item:last-child{border-bottom:0}
.list-item[hidden]{display:none}   /* author display:flex would otherwise defeat [hidden] */
.li-main{min-width:0}
.li-title{font-weight:600; font-size:14px; overflow-wrap:anywhere}
.li-meta{color:var(--muted); font-size:12px; margin-top:2px; overflow-wrap:anywhere}
.li-side{text-align:end; white-space:nowrap; flex:0 0 auto}
/* flow variant: rows with several action buttons — the button group wraps below
   the content when there isn't room, instead of crushing the title to one glyph
   per line. On wide screens they still sit side by side. */
.list-item.flow{flex-wrap:wrap}
.list-item.flow .li-main{flex:1 1 240px; min-width:0}
.list-item.flow .li-side{flex:0 1 auto; white-space:normal; text-align:start}
.list-item.flow .row-btns{justify-content:flex-start}
/* cross-edition alternates: group each book's alt copies under its title */
.alt-group{padding:8px 0; border-bottom:1px solid var(--line)}
.alt-group:last-of-type{border-bottom:0}
.alt-group > .li-title{margin-bottom:2px}
.alt-group .list-item{padding:7px 0 7px 4px; border-bottom:0}
/* tappable list row (links into an action) */
a.list-item.tap{color:var(--ink); text-decoration:none; border-radius:10px; margin:0 -6px;
  padding-inline:6px; transition:background .12s}
a.list-item.tap:hover,a.list-item.tap:active{background:#faf4ec}
a.list-item.tap .li-side{display:flex; align-items:center; gap:6px}
.tap-chev{color:var(--muted); font-weight:700; font-size:18px}

.stat-row{display:flex; gap:10px; margin-bottom:14px}
.stat{flex:1; background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:12px; text-align:center}
.stat .n{font-size:22px; font-weight:700}
.stat .l{font-size:12px; color:var(--muted)}

.price{font-weight:700}
.free{color:var(--give); font-weight:700}
.muted{color:var(--muted)}
.tiny{font-size:12px; color:var(--muted)}
.divider{height:1px; background:var(--line); margin:14px 0}
.note{background:#f7f9fc; border:1px dashed var(--line); border-radius:10px; padding:10px 12px;
  font-size:13px; color:var(--muted); margin:10px 0}
.center{text-align:center}
.mt{margin-top:12px}
.chain{font-size:12px; color:var(--muted); background:#eef2f8; border-radius:10px; padding:8px 12px}

/* ---- parent home: vibrant, kid-centric ---- */
.greet-row{display:flex; justify-content:space-between; align-items:flex-start; margin:4px 2px 14px}
.hello{font-size:22px; font-weight:800; letter-spacing:-.3px}
.wave{display:inline-block}
.year-badge{display:inline-block; margin-top:8px; background:#fde9c8; color:#b06f0d;
  font-size:12px; font-weight:700; padding:5px 11px; border-radius:999px}
.bell{position:relative; width:44px; height:44px; border-radius:14px; background:#fff;
  display:flex; align-items:center; justify-content:center; font-size:19px;
  box-shadow:0 4px 12px rgba(191,145,100,.14)}
.bell i{position:absolute; top:-4px; inset-inline-start:-4px; background:var(--red); color:#fff;
  font-style:normal; font-size:11px; font-weight:700; min-width:19px; height:19px; border-radius:999px;
  display:flex; align-items:center; justify-content:center; padding:0 4px}

.sec-head{display:flex; justify-content:space-between; align-items:center; margin:6px 2px 10px}
.sec-head h2{font-size:17px; margin:0}
.addkid{margin:-4px 2px 12px}
.addkid>summary{display:inline-block; list-style:none; cursor:pointer; color:var(--brand);
  font-weight:700; font-size:14px}
.addkid>summary::-webkit-details-marker{display:none}

.kid-row{display:flex; gap:12px; overflow-x:auto; padding:2px 2px 8px; margin-bottom:6px;
  scroll-snap-type:x mandatory}
.kid-card{flex:0 0 78%; max-width:300px; scroll-snap-align:start; border-radius:var(--radius); padding:16px;
  color:#fff; text-decoration:none; box-shadow:0 10px 24px rgba(191,145,100,.18)}
.kid-card.orange{--kc:#f97316} .kid-card.green{--kc:#12b886} .kid-card.purple{--kc:#7c4dff}
.kid-card.blue{--kc:#4c6ef5} .kid-card.teal{--kc:#0ca678}
.kid-card{background:linear-gradient(150deg, var(--kc), color-mix(in srgb, var(--kc) 78%, #000))}
.kc-emoji{font-size:26px}
.kc-name{font-size:20px; font-weight:800; margin-top:6px}
.kc-class{font-size:12px; opacity:.9; margin-top:2px}
.kc-bottom{display:flex; align-items:center; gap:16px; margin-top:16px}
.ring{position:relative; width:66px; height:66px; border-radius:50%; flex:0 0 auto;
  background:conic-gradient(#fff calc(var(--pct)*1%), rgba(255,255,255,.32) 0)}
.ring::after{content:''; position:absolute; inset:7px; border-radius:50%; background:var(--kc)}
.ring span{position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  z-index:1; font-weight:800; font-size:15px}
.kc-stats{display:flex; gap:18px}
.kc-stats b{font-size:20px; font-weight:800; display:block}
.kc-stats small{font-size:11px; opacity:.9}

.match-banner,.surplus-card{display:flex; align-items:center; justify-content:space-between; gap:10px;
  border-radius:18px; padding:14px 16px; margin-bottom:12px; text-decoration:none}
.match-banner{background:linear-gradient(135deg,#12b886,#0ca678); color:#fff;
  box-shadow:0 8px 20px rgba(18,184,134,.28)}
.match-banner .mb-tx b{font-size:15px; display:block}
.match-banner .mb-tx small,.surplus-card .mb-tx small{font-size:12px; opacity:.92}
.mb-cta{background:rgba(255,255,255,.22); color:#fff; font-weight:700; font-size:13px;
  padding:8px 14px; border-radius:12px; white-space:nowrap}
/* gentle give-away nudge (soft, non-pushy) */
.give-nudge{display:flex; gap:12px; align-items:flex-start; background:#eaf8f0;
  border:1px solid #c7ecd8; border-radius:16px; padding:14px 16px; margin-bottom:12px}
.gn-emoji{font-size:24px; line-height:1; flex:0 0 auto}
.gn-body b{font-size:15px; color:#0b7a4b}
.gn-body p{margin:4px 0 10px; font-size:13px; color:#3f6b56; line-height:1.5}
.gn-body .btn{width:auto}
.surplus-card{background:#ffe6d2; color:#a4511b}
.surplus-card .mb-tx b{font-size:15px; display:block}
.sc-cta{background:#fff; color:var(--brand-dark); font-weight:700; font-size:13px;
  padding:8px 14px; border-radius:12px; white-space:nowrap; box-shadow:0 3px 8px rgba(164,81,27,.15)}

/* action-first buttons */
.actions{display:flex; flex-direction:column; gap:10px; margin-bottom:16px}
.action{display:flex; align-items:center; gap:14px; background:var(--card); border:1px solid var(--line);
  border-radius:var(--radius); padding:14px 16px; box-shadow:0 1px 2px rgba(20,30,50,.04)}
.action .ic{font-size:26px; line-height:1}
.action .tx{display:flex; flex-direction:column}
.action .tx b{font-size:15px}
.action .tx small{color:var(--muted); font-size:12px}
.action.primary{background:var(--brand); border-color:var(--brand)}
.action.primary .tx b,.action.primary .ic{color:#fff}
.action.primary .tx small{color:#dbe6ff}

/* section labels */
.section-label{font-size:13px; color:var(--muted); font-weight:600; margin:6px 2px 8px}

/* quests / gamification */
.quest-card{border:1px solid var(--line)}
.quest-head{display:flex; justify-content:space-between; align-items:flex-start; gap:10px}
.quest-head h2{margin:0}
.quest-ring{flex:0 0 auto; background:#eef2f8; color:var(--brand); font-weight:700; font-size:14px;
  border-radius:999px; padding:6px 12px}
.next-quest{display:flex; align-items:center; gap:12px; background:#eef4ff; border:1px solid #cfe0ff;
  border-radius:12px; padding:12px 14px; margin:12px 0}
.next-quest .ic{font-size:22px}
.next-quest .tx{display:flex; flex-direction:column; flex:1}
.next-quest .tx small{color:var(--muted); font-size:12px}
.next-quest .tx b{font-size:15px; color:var(--ink)}
.next-quest .go{font-size:20px; color:var(--brand)}
.all-done{background:#e7f6ee; color:#127a4f; border:1px solid #bfe6d1; border-radius:12px;
  padding:12px; text-align:center; font-weight:600; margin:12px 0}
.quests{display:flex; flex-direction:column; gap:2px}
.quest{display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); font-size:14px}
.quest:last-child{border-bottom:0}
.quest .check{width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background:#eef2f8; color:var(--muted); font-size:13px; flex:0 0 auto}
.quest.done .check{background:var(--ok); color:#fff}
.quest.done .q-title{color:var(--muted)}
.quest .q-title{flex:1}
.quest .q-detail{color:var(--muted); font-size:12px}

.progress{height:8px; background:#eef2f8; border-radius:999px; overflow:hidden; margin-top:6px}
.progress .bar{height:100%; background:var(--ok); border-radius:999px}

/* scanner */
.scanner{position:relative; background:#0e141c; border-radius:12px; overflow:hidden; aspect-ratio:4/3; margin-bottom:8px}
.scanner video{width:100% !important; height:100% !important; object-fit:cover; display:block}
#reader{width:100%}
#reader img{max-width:100%}   /* html5-qrcode injects a shaded scan-region overlay */
.scan-status{text-align:center; color:var(--muted); font-size:13px; margin:0 0 12px}

/* iOS 'Add to Home Screen' hint (Safari has no auto prompt) */
.ios-a2hs{position:fixed; inset-inline:12px; bottom:12px; z-index:40; display:flex; gap:10px;
  align-items:center; background:#2a2730; color:#fff; border-radius:14px; padding:12px 14px;
  box-shadow:0 8px 24px rgba(0,0,0,.28); font-size:13px; line-height:1.4}
.ios-a2hs.with-tab{bottom:92px}
.ios-a2hs[hidden]{display:none}
.ios-a2hs b{color:#ffd9a8}
.ios-a2hs button{flex:0 0 auto; background:rgba(255,255,255,.15); color:#fff; border:0; width:28px;
  height:28px; border-radius:8px; font-size:14px; cursor:pointer}

/* admin */
.admin-tabs{display:flex; gap:6px; margin-bottom:14px; overflow-x:auto}
.admin-tabs a{flex:0 0 auto; padding:8px 14px; border-radius:999px; background:#eef2f8; color:var(--ink); font-size:14px}
.admin-tabs a.on{background:var(--brand); color:#fff}
.metrics{display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:14px}
.metric{background:var(--card); border:1px solid var(--line); border-radius:12px; padding:14px 10px; text-align:center}
.metric .mv{font-size:22px; font-weight:700}
.metric .ml{font-size:11px; color:var(--muted); margin-top:2px}

/* segmented control (global trade policy) */
.seg{display:flex; gap:6px; background:#eef2f8; padding:4px; border-radius:12px}
.seg-opt{flex:1; margin:0}
.seg-opt input{position:absolute; opacity:0; pointer-events:none}
.seg-opt span{display:block; text-align:center; padding:10px 0; border-radius:9px; font-weight:600;
  font-size:14px; color:var(--muted); cursor:pointer}
.seg-opt input:checked + span{background:#fff; color:var(--brand); box-shadow:0 1px 3px rgba(20,30,50,.12)}

.sell-box{margin-top:14px}
.sell-box input[type=range]{width:100%; accent-color:var(--brand)}
.price-preview{font-size:16px; margin-top:6px}
.price-preview b{font-size:22px; color:var(--brand)}
.check-row{display:flex; align-items:center; gap:8px; margin-top:14px}
.check-row input{width:auto}
details.add-manual summary{cursor:pointer; color:var(--brand); font-size:14px; padding:4px 0}

/* who-needs-what chips */
.parent-row{border-bottom:1px solid var(--line); padding-bottom:10px; margin-bottom:6px}
.parent-row:last-child{border-bottom:0}
.missing-chips{display:flex; flex-wrap:wrap; gap:6px; padding:2px 0 2px}
.chip{font-size:12px; padding:4px 9px; border-radius:999px; background:#f3e6e6; color:var(--bad)}
.chip.ok{background:#e6f6ee; color:var(--give)}
.chip.no{background:#f3e6e6; color:var(--bad)}
.chip.done{background:#e9edf2; color:#516072}

/* catalog search results */
.cat-results{display:flex; flex-direction:column; gap:6px; margin-top:8px; max-height:280px; overflow-y:auto}
.cat-item{display:block; width:100%; text-align:start; background:#faf4ec; border:1px solid var(--line);
  border-radius:12px; padding:10px 12px; cursor:pointer}
.cat-item:hover{background:#f3e8db}
.cat-item b{display:block; font-size:14px}
.cat-item small{color:var(--muted); font-size:12px}
.picked{background:#e7f6ee; color:#127a4f; border-radius:10px; padding:8px 12px; font-size:13px; margin-top:8px}

/* rep board — books list (titles + per-title expand + version pager) */
.bl-topbar{display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:6px}
.bl-ver{font-size:13px; color:var(--muted); font-weight:600; white-space:nowrap; display:flex; align-items:center; gap:6px}
.vnav{display:inline-flex; width:28px; height:28px; align-items:center; justify-content:center;
  border-radius:8px; background:#eef2f8; color:var(--brand); font-size:17px; text-decoration:none}
.vnav.off{background:transparent; color:var(--line); cursor:default}
/* three distinct heading levels: card title › section label › (workbook rows) */
.bl-title{margin:0; font-size:18px; font-weight:800}
.bl-group{display:inline-block; font-size:11px; font-weight:800; letter-spacing:.04em;
  padding:3px 10px; border-radius:999px; margin:16px 0 6px}
.bl-group.books{background:#eef2f8; color:var(--brand)}
.bl-group.works{background:#fdf0e3; color:#a5680f}
.bk{border-top:1px solid var(--line)}
.bk>summary{list-style:none; cursor:pointer; display:flex; justify-content:space-between;
  align-items:center; gap:10px; padding:11px 2px; font-size:14px}
.bk>summary::-webkit-details-marker{display:none}
.bk>summary::after{content:'▾'; color:var(--muted); font-size:12px; order:-1}
.bk[open]>summary::after{content:'▴'}
.bk-name{font-weight:700; overflow-wrap:anywhere; flex:1 1 auto}
.bk-count{flex:0 0 auto; white-space:nowrap; font-size:12px; font-weight:600; color:var(--muted);
  background:#f3f5f8; border:1px solid var(--line); border-radius:8px; padding:2px 9px}
.bk-count.muted{background:transparent; border-color:transparent}
.bk-plain{border-top:1px solid var(--line); padding:11px 2px; font-size:14px; font-weight:600}
/* who-needs-what expansion */
.miss-body{padding:2px 2px 12px; display:flex; flex-wrap:wrap; gap:6px}
.miss-head{flex:0 0 100%; font-size:12px; font-weight:700; color:var(--bad); margin-bottom:2px}
.miss-head.done{color:var(--give)}
.have-grid{display:grid; grid-template-columns:1fr 1fr; gap:8px; padding:0 2px 12px}
.have-col{border-radius:10px; padding:8px 10px}
.have-col.yes{background:#e9f7ef}
.have-col.no{background:#fdeef0}
.hc-head{font-size:12px; font-weight:700; margin-bottom:5px}
.have-col.yes .hc-head{color:var(--give)}
.have-col.no .hc-head{color:var(--bad)}
.hc-name{display:inline-block; background:#fff; border:1px solid var(--line); border-radius:999px;
  padding:2px 9px; font-size:12px; margin:0 0 4px 4px}

/* admin upload analysis: stat row */
.review-summary{display:flex; gap:10px; margin-bottom:12px}
.review-summary>div{flex:1; background:var(--card); border:1px solid var(--line); border-radius:12px;
  padding:10px; text-align:center}
.review-summary b{font-size:20px; display:block}
.review-summary small{font-size:11px; color:var(--muted)}
.review-summary .ok b{color:var(--give)}
.review-summary .warn b{color:var(--warn)}
/* list review screen — one document-order list, decisions only where needed */
.rev-summary{display:flex; align-items:center; gap:14px; background:var(--card); border:1px solid var(--line);
  border-radius:14px; padding:12px 16px; margin-bottom:14px; box-shadow:0 1px 2px rgba(20,30,50,.04)}
.rev-score{flex:0 0 auto; line-height:1}
.rev-score b{font-size:30px; color:var(--give)}
.rev-score span{font-size:18px; color:var(--muted)}
.rev-score-txt{flex:1 1 auto; min-width:0}
.rev-score-txt>div:first-child{font-weight:700; font-size:14px}
.match-bar{height:7px; border-radius:999px; background:#e9edf2; margin:6px 0 5px; overflow:hidden}
.match-bar i{display:block; height:100%; background:var(--give); border-radius:999px}
.rev-list{display:flex; flex-direction:column; gap:9px}
.rev-card{background:var(--card); border:1px solid var(--line); border-radius:13px;
  padding:12px 13px; box-shadow:0 1px 2px rgba(20,30,50,.04)}
.rev-card.set{border-color:#d9c9f2}
.rev-card.is-cons{border-color:#f0d49a; background:#fffaf1}
.rev-card.off{opacity:.5}
.rev-head{display:flex; justify-content:space-between; align-items:flex-start; gap:10px}
.rev-inc{display:flex; align-items:flex-start; gap:9px; cursor:pointer; flex:1 1 auto; min-width:0}
.rev-inc input{margin-top:3px; width:18px; height:18px; flex:0 0 auto; accent-color:var(--give)}
.rev-title{font-weight:600; font-size:14.5px; overflow-wrap:anywhere; line-height:1.35}
.rev-badges{display:flex; gap:5px; flex-wrap:wrap; align-items:center; flex:0 0 auto; justify-content:flex-end}
.rev-remark{font-size:11px; color:var(--muted); margin:5px 0 0 27px; overflow-wrap:anywhere}
.rev-foot{display:flex; align-items:center; justify-content:space-between; gap:10px; margin:7px 0 0 27px}
.rev-foot:empty{display:none}
.rev-part{display:flex; justify-content:space-between; align-items:center; gap:8px;
  border-top:1px dashed var(--line); padding:8px 2px 4px; margin-top:7px}
.rev-part:first-of-type{margin-top:9px}
.rev-part-title{font-size:13px; overflow-wrap:anywhere; color:#3a4453}
.rev-missing{color:var(--warn); font-size:12px; font-weight:600; margin-top:8px}
.tag-cons{font-size:11.5px; font-weight:700; color:#8a5a10; background:#fbe7c2; border-radius:999px; padding:2px 9px}
.cons-btn{border:1px solid var(--line); background:#eef2f8; color:var(--ink); border-radius:999px;
  font-size:12px; font-weight:700; padding:5px 11px; cursor:pointer}
.cons-btn.on{background:#fbe7c2; border-color:#f0d49a; color:#8a5a10}
/* unresolved row: no catalog match yet — needs the picker before it can be included */
.rev-card.unresolved{border-color:#e7b7b7; background:#fdf6f6}
.pick-btn{border:1px solid var(--line); background:#eef2f8; color:var(--ink); border-radius:999px;
  font-size:12px; font-weight:700; padding:5px 11px; cursor:pointer}
.rev-card.unresolved .pick-btn{background:#fbe3e3; border-color:#e7b7b7; color:#a23c3c}
.rev-pick{margin:9px 0 2px}
.rev-pick[hidden]{display:none}
.pick-q{width:100%; border:1px solid var(--line); border-radius:10px; padding:9px 11px; font-size:14px}
.pick-results{max-height:230px; overflow:auto; margin-top:6px}
.pick-item{display:flex; flex-direction:column; align-items:flex-end; gap:1px; width:100%; text-align:right;
  background:var(--card); border:1px solid var(--line); border-radius:10px; padding:8px 10px; margin-top:6px; cursor:pointer}
.pick-item:hover{border-color:var(--brand); background:#fbeee2}
.pi-title{font-weight:600; font-size:13.5px; overflow-wrap:anywhere}
.pick-hint{color:var(--muted); font-size:12.5px; padding:8px 2px}
.rev-gap{font-size:12.5px; color:#a23c3c; background:#fdecec; border-radius:9px; padding:7px 10px; margin:8px 0 2px}
.pick-suggest-label{font-size:12px; font-weight:700; color:var(--muted); margin:2px 0 4px}
.pick-item.pick-sugg{border-style:dashed}
.add-book{margin-top:10px}
.sp-remove,.sa-remove{padding:3px 9px; font-size:12px; line-height:1}
/* sticky action bar */
.publish-bar{position:sticky; bottom:0; z-index:20; display:flex; align-items:center; gap:12px;
  background:linear-gradient(to top, var(--bg) 62%, transparent); padding:14px 2px 10px; margin-top:16px}
.pb-go{flex:1 1 auto; text-align:center}
.pb-cancel{flex:0 0 auto; color:var(--muted); font-size:14px; padding:8px}
.pb-n{opacity:.85; font-weight:600}
.btn.block{display:block; width:100%; text-align:center}
/* blocking wait overlay while a list is parsed */
.busy-overlay{position:fixed; inset:0; z-index:1000; background:rgba(20,24,33,.55);
  display:flex; align-items:center; justify-content:center; padding:24px; backdrop-filter:blur(2px)}
.busy-overlay[hidden]{display:none}
.busy-box{background:var(--card); border-radius:16px; padding:26px 22px; max-width:340px; text-align:center;
  box-shadow:0 18px 50px rgba(0,0,0,.25)}
.busy-spin{width:38px; height:38px; margin:0 auto 14px; border-radius:50%;
  border:3px solid var(--line); border-top-color:var(--brand); animation:busy-rot .8s linear infinite}
@keyframes busy-rot{to{transform:rotate(360deg)}}
.busy-title{font-weight:800; font-size:16px}
.busy-sub{font-size:13px; color:var(--muted); margin-top:6px; line-height:1.5}
.rr-meta{white-space:nowrap; flex:0 0 auto; text-align:end}
.rr-field{display:block; font-size:12px; color:var(--muted); margin:8px 0 0}
.rr-action{margin-top:4px}
.rr-move{background:#eef2f8; color:var(--ink); border:0; border-radius:9px; font-size:12px;
  font-weight:600; padding:6px 12px; margin-top:8px; cursor:pointer}
.rr-move:hover{background:#e2e8f0}

/* scan result banner (clear, distinct green) */
.scan-hit{display:flex; align-items:center; gap:14px; background:linear-gradient(135deg,#12b886,#0ca678);
  color:#fff; border-radius:16px; padding:14px 16px; margin-bottom:14px;
  box-shadow:0 8px 20px rgba(18,184,134,.30)}
.scan-hit .ic{width:38px; height:38px; border-radius:50%; background:rgba(255,255,255,.25);
  display:flex; align-items:center; justify-content:center; font-size:20px; font-weight:800; flex:0 0 auto}
.scan-hit .tx{display:flex; flex-direction:column; min-width:0}
.scan-hit .tx small{font-size:12px; opacity:.9}
.scan-hit .tx b{font-size:16px; overflow-wrap:anywhere}

/* prominent "not found" alert — bold, red, big icon; pushes the scanner down */
.scan-miss{display:flex; align-items:center; gap:14px; background:#fdecec;
  border:2px solid var(--bad); border-radius:16px; padding:16px 18px; margin-bottom:16px;
  box-shadow:0 8px 22px rgba(250,82,82,.20)}
.scan-miss .ic{width:46px; height:46px; border-radius:50%; background:var(--bad); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:26px; font-weight:800; flex:0 0 auto}
.scan-miss .tx{display:flex; flex-direction:column; min-width:0}
.scan-miss .tx b{font-size:18px; color:var(--bad)}
.scan-miss .tx small{font-size:13px; color:#9b3b3b; margin-top:2px; line-height:1.45; overflow-wrap:anywhere}

/* scan duplicate prompt */
.dup-card{background:#fff4df; border:1px solid #f0dfae; border-radius:16px; padding:16px; margin-bottom:14px}
.dup-q b{font-size:15px}
.dup-q div{font-size:13px; color:#7a5b12; margin-top:4px}
.dup-actions{display:flex; gap:10px; margin-top:14px}
.dup-actions form{flex:1}

/* old-edition (master-list) confirmation card + badge (docs/arch/0006) */
.oldedition-card{background:#fbf1e4; border:2px solid #d9a441; border-radius:16px; padding:16px; margin-bottom:14px}
.oe-badge{display:inline-block; background:#8a5a10; color:#fff; font-weight:800; font-size:13px;
  padding:4px 12px; border-radius:999px; letter-spacing:.02em}
.oe-title{font-weight:700; font-size:16px; margin-top:10px; overflow-wrap:anywhere}
.oe-meta{font-size:12px; color:#8a6a2e; margin-top:2px}
.oe-match{font-size:14px; margin-top:10px; background:#fff; border-radius:10px; padding:10px 12px}
.oe-warn{font-size:13px; color:#a5680f; font-weight:600; margin-top:6px}
.pill.old{background:#8a5a10; color:#fff; font-weight:800}

/* admin destructive-delete confirmation (docs/arch/0007) */
.danger-card{border:2px solid var(--bad)}
.dc-head{font-weight:800; font-size:16px; color:var(--bad); margin-bottom:6px}
.dc-list{margin:8px 0; padding-inline-start:20px; font-size:14px; line-height:1.7}
.dc-note{background:#fdecec; border-radius:10px; padding:10px 12px; font-size:13px; color:#9b3b3b; margin-top:8px; overflow-wrap:anywhere}
.dc-note.keep{background:#eef7f1; color:#2b6b48}
.btn.danger{background:#fbeaea; color:var(--bad)}
.btn.danger.lg{background:var(--bad); color:#fff; box-shadow:0 6px 16px rgba(250,82,82,.3)}

/* admin Users sub-tabs (docs/arch/0008) */
.subtabs{display:flex; gap:6px; background:#eef2f8; padding:4px; border-radius:12px; margin-bottom:12px}
.subtabs a{flex:1; text-align:center; padding:9px 0; border-radius:9px; font-weight:700; font-size:14px; color:var(--muted)}
.subtabs a.on{background:#fff; color:var(--brand); box-shadow:0 1px 3px rgba(20,30,50,.12)}

/* mini table */
.tbl{display:flex; flex-direction:column; font-size:14px}
.tbl .tr{display:grid; grid-template-columns:2fr .8fr .8fr .8fr .9fr; gap:6px; padding:9px 0;
  border-bottom:1px solid var(--line); align-items:center; text-align:center}
.tbl .tr span:first-child{text-align:start}
.tbl .tr:last-child{border-bottom:0}
.tbl .th{color:var(--muted); font-size:12px; font-weight:600}
.tbl .name{font-weight:600}
/* per-school accordion in the overview */
.school-row{cursor:pointer}
.school-row:hover{background:#faf4ec}
.school-row .chev{display:inline-block; transition:transform .15s; color:var(--muted); font-size:11px}
.school-row.open .chev{transform:rotate(90deg)}
.school-detail{background:#faf7f2; border-bottom:1px solid var(--line); padding:2px 12px 8px}
.cd-row{display:grid; grid-template-columns:2fr .8fr .8fr .8fr; gap:6px; padding:6px 2px}
.cd-row span:first-child{text-align:start; font-weight:600}
.cd-row.cd-head{color:var(--muted); font-size:11px; font-weight:600}
.cd-row.cd-head span:first-child{font-weight:600}
/* move-child drawer under a parent row (admin people tab) */
.parent-toggle .chev{display:inline-block; transition:transform .15s; color:var(--muted); font-size:11px}
.parent-toggle.open .chev{transform:rotate(90deg)}
.parent-detail{background:#faf7f2; border-bottom:1px solid var(--line); padding:6px 12px 10px}
/* "all lists completed — you need no books" banner on the swap screen */
.done-msg{background:#eaf7ee; border:1px solid #b7e0c4; color:#1c6b39; border-radius:10px;
  padding:14px 16px; text-align:center; font-size:16px}
/* little info glyph next to an "not eligible" tag — native title tooltip explains why */
.info{display:inline-block; margin-inline-start:4px; color:var(--muted); cursor:help; font-size:12px}

/* ===== Landing page (redesigned) ===== */
.hero{ text-align:center; padding:26px 6px 10px }
.hero-badge{
  display:inline-block; background:#fff; border:1px solid var(--line);
  color:var(--brand-dark); font-size:13px; font-weight:700;
  padding:6px 14px; border-radius:999px; margin-bottom:18px;
  box-shadow:0 2px 8px rgba(232,93,4,.06);
}
.hero-title{
  font-size:30px; line-height:1.25; font-weight:800; letter-spacing:-.5px;
  margin:0 0 14px; color:var(--ink);
}
.hero-title .hl{ color:var(--brand); }
.hero-lead{ color:var(--muted); font-size:15.5px; line-height:1.6; margin:0 auto 22px; max-width:30em; }

.cta-card{
  background:linear-gradient(180deg,#fff 0%,#fffaf4 100%);
  border:1px solid var(--line); border-radius:var(--radius);
  padding:18px; margin-bottom:12px;
  box-shadow:0 8px 24px rgba(232,93,4,.10);
}
.cta-head{ display:flex; gap:12px; align-items:flex-start; margin-bottom:14px; }
.cta-emoji{ font-size:26px; line-height:1.2; flex:0 0 auto; }
.cta-title{ font-size:18px; font-weight:800; color:var(--ink); }
.cta-sub{ font-size:13px; color:var(--muted); margin-top:2px; line-height:1.5; }

.secondary-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:transparent; border:1px solid var(--line); border-radius:14px;
  padding:13px 16px; margin-bottom:26px; color:var(--ink);
}
.secondary-row:hover{ background:#fff; border-color:#f0d9c2; }
.sr-title{ font-size:14.5px; font-weight:700; }
.sr-sub{ font-size:12.5px; color:var(--muted); margin-top:1px; }
.sr-arrow{ color:var(--brand); font-size:22px; font-weight:700; flex:0 0 auto; }

.how{ padding:0 4px 8px; }
.how-title{
  font-size:12px; font-weight:800; letter-spacing:.14em; color:var(--muted);
  text-align:center; margin-bottom:14px; text-transform:none;
}
.how-steps{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px; }
.how-steps li{
  display:flex; align-items:center; gap:12px;
  background:#fff; border:1px solid var(--line); border-radius:14px;
  padding:12px 14px; font-size:14.5px; color:var(--ink); font-weight:600;
}
.how-steps .hs-emoji{ font-size:20px; flex:0 0 auto; }
.how-steps li{ counter-increment:hs; position:relative; }
.how-steps li::after{
  content:counter(hs); margin-inline-start:auto;
  font-size:13px; font-weight:800; color:#e7c9a8;
}
.how-steps{ counter-reset:hs; }
