/* Fonts are self-hosted (public/fonts): Bagel Fat One for the logo and big numbers,
   Fredoka for headings, Nunito for everything else. */
@font-face { font-family: "Bagel Fat One"; src: url(fonts/bagel-fat-one.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Fredoka"; src: url(fonts/fredoka.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(fonts/nunito.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --bg: #fffdf8;
  --panel: #f7f2e8;
  --line: #e3dac7;
  --text: #251f33;
  --muted: #6b647a;
  --accent: #5b3df5;
  --accent-text: #ffffff;
  --accent-soft: #ece8ff;
  --sun: #ffc93c;
  --good: #14804a;
  --bad: #c2362b;
  --warn-bg: #fff3cf;
  --card: #ffffff;
  --shadow: 0 1px 0 rgba(37,31,51,.04), 0 6px 18px -10px rgba(37,31,51,.18);
  --r: 14px;
  --head: "Fredoka", "Nunito", system-ui, sans-serif;
  --logo: "Bagel Fat One", "Fredoka", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17141f; --panel: #201c2b; --line: #373048; --text: #f1eefa; --muted: #a59fb8;
    --accent: #8f7bff; --accent-text: #14101f; --accent-soft: #2a2447; --sun: #ffd25e;
    --good: #4ade80; --bad: #ff7b6e; --warn-bg: #3a3118; --card: #1d1a28;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 8px 20px -12px rgba(0,0,0,.6);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: .005em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.tight { gap: .4rem; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.hide { display: none !important; }

/* top bar + logo */
.top { border-bottom: 2px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top .inner { max-width: 1120px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1rem; justify-content: space-between; }
.brand { font-family: var(--logo); font-size: 1.6rem; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: .45rem; line-height: 1; font-weight: 400; }
.brand i { width: 28px; height: 28px; border-radius: 50%; background: var(--sun); display: inline-block; position: relative; flex: none; }
.brand i::after { content: ""; position: absolute; left: 6px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); }
.userbtn { display: inline-flex; align-items: center; gap: .45rem; padding-left: .3rem; border-radius: 99px; }
.userbtn .av { margin: -.1rem 0; }
a.btn.on { border-color: var(--accent); color: var(--accent); }
.sitenotice { background: var(--sun); color: #251f33; text-align: center; font-weight: 700; padding: .45rem 1rem; font-size: .92rem; }

/* page shell: sidebar + content */
main { max-width: 1120px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 1.75rem; align-items: start; }
.shell > * { min-width: 0; }
.side { position: sticky; top: 4.6rem; max-height: calc(100vh - 5.5rem); overflow: auto; padding-bottom: 1rem; scrollbar-width: thin; }
.side h2 { font-size: 1.25rem; margin: 0 0 .2rem; }
.sidesub { margin-bottom: 1rem; }
.walletcard { margin: .6rem 0 1rem; padding: .7rem .9rem; }
.crumbs { margin: 0 0 .75rem; }
.offgrp .navlink { color: var(--muted); font-weight: 600; }
.offgrp .navlink .ni { filter: grayscale(1); opacity: .6; }
.offgrp .navlink.on { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.offgrp > b::before { content: "🙈 "; }
.navgrp { margin-bottom: 1rem; }
.navgrp > b { display: block; font: 600 .72rem var(--head); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0 0 .25rem .6rem; }
.navlink { display: flex; align-items: center; gap: .55rem; padding: .42rem .65rem; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.navlink:hover { background: var(--panel); }
.navlink.on { background: var(--accent); color: var(--accent-text); box-shadow: 0 6px 14px -8px var(--accent); }
.navlink .ni { width: 1.3rem; text-align: center; }
.navlink .pill { margin-left: auto; }
.navlink.on .pill { color: var(--accent-text); border-color: var(--accent-text); }
.page-head { margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .15rem 0 0; color: var(--muted); }
@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .side { position: static; max-height: none; overflow: visible; padding-bottom: 0; }
  .sidesub, .walletcard { display: none; }
  .side h2, .navgrp > b { display: none; }
  .side nav { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .4rem; border-bottom: 2px solid var(--line); }
  .navgrp { display: contents; }
  .navlink { white-space: nowrap; border: 2px solid var(--line); }
  .navlink.on { border-color: var(--accent); }
  .navlink .ni { width: auto; }
}

/* surfaces */
.card { border: 2px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; background: var(--card); box-shadow: var(--shadow); }
.card.link { cursor: pointer; text-decoration: none; color: inherit; display: block; font-weight: 400; transition: transform .12s, border-color .12s; }
.card.link:hover { border-color: var(--accent); transform: translateY(-2px); }
.card.mine { border-color: var(--accent); }
.card.dim, tr.dim { opacity: .6; }
.panel { background: var(--panel); border: 2px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; }
.card h3 { margin-bottom: .6rem; }
.stat b { display: block; font: 600 1.75rem var(--head); line-height: 1.15; }
.stat.sun { background: var(--sun); border-color: var(--sun); color: #251f33; }
.stat.sun .muted { color: #4a4152; }
.notice { background: var(--warn-bg); border: 2px solid var(--line); border-radius: var(--r); padding: .75rem 1rem; }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: .05rem .55rem; border: 2px solid var(--line); border-radius: 99px; color: var(--muted); white-space: nowrap; }
.pill.good { color: var(--good); border-color: var(--good); } .pill.bad { color: var(--bad); border-color: var(--bad); }
.pill.accent { color: var(--accent); border-color: var(--accent); }
.tile { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.45rem; flex: none; }
.tile.sm { width: 30px; height: 30px; font-size: 1.05rem; border-radius: 9px; }
.av { display: inline-block; vertical-align: middle; flex: none; border-radius: 50%; }
.who { display: inline-flex; align-items: center; gap: .5rem; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--accent-soft); font-size: .95em; flex: none; vertical-align: middle; }
.big { font: 600 2rem var(--head); }
.bignum { font-family: var(--logo); }
.code { font: 400 1.9rem var(--logo); letter-spacing: .12em; color: var(--accent); }
.bar { height: 12px; background: var(--panel); border: 2px solid var(--line); border-radius: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.sun > span { background: var(--sun); }
.bar.warn > span { background: var(--bad); }
.bar > span { transition: width .3s; }

/* controls */
button, .btn { transition: border-color .12s, filter .12s, background .12s; font: 700 .95rem "Nunito", sans-serif; padding: .5rem 1rem; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); }
button.danger-bg { background: var(--bad); border-color: var(--bad); color: #fff; }
button.small { padding: .22rem .65rem; font-size: .85rem; border-radius: 8px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.linkish { border: 0; background: none; color: var(--accent); padding: 0; }
input, select, textarea { font: inherit; width: 100%; padding: .5rem .65rem; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }
input[type=checkbox], input[type=radio] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); flex: none; }
textarea { min-height: 84px; resize: vertical; }
select { width: auto; max-width: 100%; }
label.f select, form select.full { width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
label.f { display: block; margin-bottom: .8rem; font-weight: 700; font-size: .9rem; }
label.f > input, label.f > select, label.f > textarea { margin-top: .25rem; font-weight: 400; }
label.check { display: flex; gap: .55rem; align-items: center; margin-bottom: .55rem; cursor: pointer; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.fieldset { border: 2px dashed var(--line); border-radius: var(--r); padding: .8rem .9rem .3rem; margin: 0 0 .9rem; }
.fieldset > legend, .fieldset > .lg { font: 600 .95rem var(--head); padding: 0 .35rem; }
.icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: .35rem; margin-top: .25rem; max-height: 170px; overflow: auto; }
.ico { position: relative; display: block; }
.ico input { position: absolute; opacity: 0; }
.ico span { display: flex; align-items: center; justify-content: center; height: 42px; border: 2px solid var(--line); border-radius: 10px; font-size: 1.3rem; cursor: pointer; }
.ico input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.ico input:focus-visible + span { outline: 3px solid var(--accent); }
.picklist { max-height: 260px; overflow: auto; border: 2px solid var(--line); border-radius: 10px; padding: .55rem .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border-radius: 99px; padding: .25rem .8rem; }

/* tables + lists */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 2px solid var(--line); vertical-align: middle; }
th { font: 600 .8rem var(--head); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; }
.item { display: flex; gap: .75rem; align-items: center; padding: .7rem 0; border-bottom: 2px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item.block { display: block; }
.item .title { font-weight: 800; }
.empty { text-align: center; padding: 1.6rem 1rem; background: var(--panel); border: 2px dashed var(--line); border-radius: var(--r); }
.empty .em { font-size: 2.2rem; display: block; }

/* getting-started checklist */
.checklist li { display: flex; gap: .6rem; align-items: center; padding: .3rem 0; list-style: none; }
.checklist { margin: 0; padding: 0; }
.checklist .dot { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; flex: none; }
.checklist .done .dot { background: var(--good); border-color: var(--good); color: #fff; }
.checklist .done { color: var(--muted); text-decoration: line-through; }

/* charts */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 96px; }
.bars > div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bars span { display: block; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .axis { display: block; text-align: center; font-size: .65rem; color: var(--muted); margin-top: 3px; }
.spark { width: 96px; height: 30px; flex: none; }
.spark polyline { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.up { color: var(--good); } .down { color: var(--bad); }

/* modal + toast */
#modal { position: fixed; inset: 0; background: rgba(20,14,40,.5); display: flex; align-items: flex-start; justify-content: center; padding: 3vh 1rem; overflow: auto; z-index: 10; }
#modal[hidden], #toast[hidden] { display: none; }
.dialog { background: var(--bg); border: 2px solid var(--line); border-radius: 16px; padding: 1.25rem; width: 100%; max-width: 500px; }
.dialog.wide { max-width: 740px; }
#toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .6rem 1.1rem; border-radius: 12px; z-index: 20; max-width: 90vw; font-weight: 700; }
#toast.err { background: var(--bad); color: #fff; }

/* landing + auth */
.hero { max-width: 1000px; margin: 0 auto; padding: 2.5rem 1rem 1rem; display: grid; grid-template-columns: 1.1fr .9fr; gap: 2.5rem; align-items: center; }
.hero h1 { font: 400 clamp(2.4rem, 6vw, 3.6rem)/1.05 var(--logo); color: var(--accent); margin-bottom: 1rem; }
.hero .lead { font-size: 1.15rem; color: var(--muted); }
.hero .brand { font-size: 2rem; margin-bottom: 1.25rem; }
.seg { display: flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 1rem; }
.seg button { flex: 1; border: 0; border-radius: 0; padding: .6rem .4rem; }
.seg button.on { background: var(--accent); color: var(--accent-text); }
.seg.inline { display: inline-flex; flex-wrap: wrap; margin: 0; background: var(--card); }
.seg.inline button { flex: none; padding: .45rem .9rem; }
.subtabs { max-width: 100%; overflow-x: auto; flex-wrap: nowrap !important; }
input.search { width: min(260px, 100%); border-radius: 99px; padding-left: 1rem; }
.features { max-width: 1000px; margin: 1.5rem auto 4rem; padding: 0 1rem; }
.features .grid { grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }
.features h3 { margin-top: .4rem; }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1.5rem; } }

form[data-type=law] .f-spend, form[data-type=law] .f-tax, form[data-type=tax] .f-spend, form[data-type=spend] .f-tax { display: none; }
footer.admin-foot { margin-top: 3rem; color: var(--muted); font-size: .85rem; }
@media print { .top, .side, button, #toast { display: none !important; } .shell { display: block; } #modal { position: static; background: none; } }

/* coins + per-page settings */
.coin { display: inline-block; vertical-align: -0.22em; margin-right: .22em; flex: none; }
.amt { white-space: nowrap; }
.coinpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: .4rem; margin-top: .3rem; }
.coinpick .ico span { height: 56px; }
details.modset { margin-bottom: 1rem; padding: .6rem 1rem; background: var(--panel); }
details.modset > summary { cursor: pointer; font: 600 .95rem var(--head); color: var(--muted); list-style: none; }
details.modset > summary::-webkit-details-marker { display: none; }
details.modset[open] > summary { color: var(--text); margin-bottom: .6rem; }
details.modset .modset-body { padding-bottom: .3rem; }

/* Task answer keys */
.keyfields { display: none; margin: .2rem 0 1rem; padding: .85rem; border: 2px dashed var(--line); border-radius: 12px; }
form[data-key="1"] .keyfields { display: block; }
form[data-ktype="text"] .k-choice, form[data-ktype="choice"] .k-text { display: none; }
form.answer { flex-basis: 100%; margin: .25rem 0 0; }
form.answer .picklist { margin-bottom: .5rem; }
.item:has(> form.answer) { flex-wrap: wrap; }

/* ---------- dashboard ---------- */
.dashsec { margin-bottom: 1.6rem; }
.dashsec h2 { font-size: 1.1rem; color: var(--muted); margin-bottom: .7rem; }
.classcard { display: flex !important; gap: .9rem; align-items: flex-start; }
.classcard h3 { margin: 0 0 .15rem; }
.cc-coin { flex: none; line-height: 0; }
.cc-coin .coin { margin: 0; }

/* ---------- hidden sections, safety, settings ---------- */
.hiddenbar { border-color: var(--accent); background: var(--accent-soft); margin-bottom: 1rem; }
.modlist .item .btn, .modlist .item button { flex: none; }
hr.sep { border: 0; border-top: 2px solid var(--line); margin: 1.25rem 0; }
details.mergebox > summary { cursor: pointer; list-style: none; }
details.mergebox > summary::-webkit-details-marker { display: none; }
.nowrap-cell { white-space: nowrap; }
.nowrap-text { white-space: nowrap; }

/* ---------- avatars + badges ---------- */
.avpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: .4rem; margin-top: .3rem; max-height: 250px; overflow: auto; padding: 2px; }
.avpick .ico span { height: 58px; border-radius: 50%; border-color: transparent; }
.avpick .ico input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.medalart { flex: none; line-height: 0; position: relative; }
.badgecard.locked .medalart { filter: grayscale(1); opacity: .45; }
.badgecard.locked b { color: var(--muted); }
.badgecard.earned { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.badgewall { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .6rem; }
.bw { display: flex; flex-direction: column; align-items: center; gap: .25rem; text-align: center; }
.bw small { font-size: .72rem; font-weight: 700; line-height: 1.15; }

/* ---------- stock market ---------- */
.marketbar .nextmove { margin-top: .75rem; }
.nextmove { display: flex; gap: .8rem; align-items: center; }
.nextmove .nm-ico { font-size: 1.8rem; }
.nextmove .bignum { font-size: 1.6rem; color: var(--accent); line-height: 1.15; display: block; }
.countdown { font-variant-numeric: tabular-nums; }

/* ---------- government ---------- */
.election .cands { margin-top: .6rem; }
.cand { display: flex; gap: .6rem; align-items: center; padding: .5rem .6rem; border-radius: 10px; background: var(--panel); margin-bottom: .4rem; flex-wrap: wrap; }
.cand.picked { box-shadow: inset 0 0 0 2px var(--accent); }
.election.voting { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.holder { margin: 0 .3rem .3rem 0; }
details.past > summary { cursor: pointer; }
.elist { max-height: 340px; }
.erow { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .45rem 0; border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.erow:last-child { border-bottom: 0; }
.erow.dim { opacity: .55; }
.erow select { font-size: .85rem; padding: .25rem .4rem; }

/* ---------- admin ---------- */
details.menu { position: relative; display: inline-block; text-align: left; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] { display: block; }
td details.menu { vertical-align: middle; }
td details.menu[open] .menu-body { text-align: left; }
details.menu .menu-body { margin-top: .4rem; background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: .4rem; display: flex; flex-direction: column; gap: .25rem; min-width: 220px; }
details.menu .menu-body button { text-align: left; border-color: transparent; }
details.menu .menu-body button:hover { border-color: var(--accent); }

/* ---------- reading ---------- */
.doc.done { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.upbar { margin: 0 0 1rem; }
#reader { position: fixed; inset: 0; z-index: 9; background: var(--panel); display: flex; flex-direction: column; }
#reader[hidden] { display: none; }
body.reading { overflow: hidden; }
.rd-top { display: flex; gap: .8rem; align-items: center; padding: .6rem 1rem; background: var(--bg); border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.rd-top .grow b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-progress { height: 8px; margin-top: .3rem; max-width: 420px; }
.rd-progress span { background: var(--good) !important; }
.rd-status { gap: .6rem; }
.rd-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 1rem .75rem 3rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; outline: none; }
.rd-page { position: relative; background: #fff; box-shadow: var(--shadow); border-radius: 4px; max-width: 100%; }
.rd-page canvas { display: block; border-radius: 4px; }
.rd-page.img { padding: 0; background: none; box-shadow: none; }
.rd-page.img img { max-width: min(100%, 1000px); display: block; border-radius: 6px; }
.rd-page.end { background: none; box-shadow: none; color: var(--muted); padding: 1rem; }
.rd-num { position: absolute; right: .5rem; top: .4rem; font-size: .72rem; font-weight: 700; color: #6b647a; background: rgba(37,31,51,.07); padding: 0 .45rem; border-radius: 6px; z-index: 1; }
.rd-text { max-width: 720px; width: 100%; background: var(--bg); padding: 1.5rem 1.6rem; border-radius: 12px; border: 2px solid var(--line); white-space: pre-wrap; font-size: 1.08rem; line-height: 1.7; }
@media (max-width: 800px) { .rd-top { padding: .5rem .75rem; } }

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  h1 { font-size: 1.55rem; }
  .top .inner { gap: .5rem; }
  .userbtn .uname { display: none; }
  .brand { font-size: 1.35rem; }
  .page-head { gap: .6rem; }
  .card { padding: .85rem .9rem; }
}

/* ---------- class code + QR ---------- */
.joinpanel { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.qrbox { line-height: 0; background: #fff; padding: 6px; border-radius: 10px; border: 2px solid var(--line); }
.qr { display: block; }
.bigjoin .qrbig { display: inline-block; background: #fff; padding: 10px; border-radius: 16px; line-height: 0; }
.bigjoin .qrbig .qr { width: min(320px, 70vw); height: auto; }

/* ---------- people tools ---------- */
.peopletools { margin: -.4rem 0 1rem; }
.dupcard { border-color: var(--sun); margin-bottom: 1rem; }
.chip.pos { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.chip.neg { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }

/* ---------- seating plan (room canvas) ---------- */
.seatbar { position: sticky; top: 4.4rem; z-index: 3; }
.seatbar .chip.small { padding: .15rem .55rem; font-size: .8rem; }
.selbar { margin-top: .6rem; padding-top: .6rem; border-top: 2px dashed var(--line); }
.roomwrap { overflow-x: auto; border-radius: var(--r); }
.roomcanvas { position: relative; aspect-ratio: 3 / 2; min-width: 560px; container-type: inline-size; background: #f3ead9; border: 3px solid #cdbb98; border-radius: var(--r); user-select: none; touch-action: none; }
/* The snap grid (20 units = 1/60 of the width) only shows while arranging. */
.roomcanvas.editing { background-color: #f6efe1; background-image: linear-gradient(rgba(120,95,60,.13) 1px, transparent 1px), linear-gradient(90deg, rgba(120,95,60,.13) 1px, transparent 1px);
  background-size: calc(100% / 60) calc(100% / 40); }
.ritem { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1cqw; overflow: hidden; border-radius: .7cqw; color: #251f33; }
.roomcanvas.editing .ritem { cursor: grab; }
.ritem.dragging { cursor: grabbing; opacity: .85; z-index: 5; box-shadow: 0 1cqw 2cqw rgba(0,0,0,.25); }
.ritem.sel { outline: .35cqw solid var(--accent); outline-offset: .2cqw; z-index: 4; }
.ritem.desk { background: #fffdf8; border: .25cqw solid #b89c6d; box-shadow: 0 .3cqw 0 #a68a5b; font-size: 1.15cqw; padding: .3cqw; }
.ritem.desk.empty { background: #fbf6ec; border-style: dashed; }
.ritem.desk.empty .muted { color: #9c8a6b; font-size: .95cqw; }
.ritem.desk.drop { border-color: var(--accent); background: #ece8ff; }
.ritem.desk.picked { background: #ece8ff; border-color: #5b3df5; box-shadow: 0 0 0 .35cqw #5b3df5; }
.roomcanvas:not(.editing) .ritem.desk.taken { cursor: pointer; }
.ritem.desk .av { width: 3.2cqw !important; height: 3.2cqw !important; }
.ritem .sname { font-weight: 800; line-height: 1.1; text-align: center; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ritem .sname small { font-weight: 600; }
.ritem .sbal { font-size: .9cqw; color: #6b647a; }
.ritem .sbal .coin { width: 1cqw; height: 1cqw; }
.ritem .sbeh { position: absolute; top: .3cqw; right: .5cqw; display: flex; gap: .3cqw; font-size: .9cqw; font-weight: 800; }
.ritem .sbeh i { font-style: normal; }
.ritem .sbeh .up { color: #14804a; } .ritem .sbeh .down { color: #c2362b; }
/* Decorations */
.ritem.deco { font-size: 2.2cqw; }
.ritem .dl { font: 600 1.05cqw var(--head); letter-spacing: .02em; text-align: center; padding: 0 .4cqw; }
.k-teacher { background: #b97a46; border: .25cqw solid #8c5a30; box-shadow: 0 .3cqw 0 #74491f; color: #fff8ec; flex-direction: row !important; gap: .6cqw !important; }
.k-teacher .dl { font-size: 1.3cqw; }
.k-board { background: #fdfdfd; border: .3cqw solid #8b93a7; border-radius: .3cqw; }
.k-door { background: #c98a52; border-radius: .3cqw; box-shadow: inset 0 0 0 .25cqw #a2683a; }
.k-window { background: linear-gradient(90deg, #bfe3ff 0 48%, #8ec9f2 48% 52%, #bfe3ff 52%); border: .25cqw solid #fff; border-radius: .2cqw; }
.k-shelf { background: #9b6a43; border: .25cqw solid #74491f; }
.k-computer { background: #e0e4ec; border: .25cqw solid #8b93a7; }
.k-plant, .k-bin { background: transparent; }
.k-sink { background: #dff1f7; border: .25cqw solid #9cc7d6; border-radius: 1.2cqw; }
.k-rug { background: repeating-linear-gradient(45deg, #d9cff9 0 1.2cqw, #e8e2fc 1.2cqw 2.4cqw); border: .35cqw solid #b6a6f0; border-radius: 1.6cqw; }
.k-label { background: #fff3cf; border: .2cqw dashed #e0b84a; }
.k-label .dl { font-size: 1.15cqw; }
@media (prefers-color-scheme: dark) {
  .roomcanvas { background-color: #2a2533; border-color: #4a4058; }
  .roomcanvas.editing { background-color: #2c2736; background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); }
  .ritem.desk.empty { background: #3a3446; border-color: #6d6080; } .ritem.desk.empty .muted { color: #b7aac9; }
}
.chip.on { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- businesses ---------- */
.biz .listing { padding: .5rem 0; }
.card.mine .biz { box-shadow: none; border-style: dashed; }

/* ---------- garden ---------- */
.gardenbed { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 45%), 1fr)); gap: .6rem; background: #7a5233; border-radius: var(--r); padding: .7rem; border: 2px solid #5e3d24; }
.plot { background: #9b6a43; border-radius: 12px; min-height: 160px; padding: .5rem; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .15rem; color: #fff8ec; text-align: center; box-shadow: inset 0 -6px 0 rgba(0,0,0,.12); }
.plot.empty { justify-content: center; background: repeating-linear-gradient(0deg, #9b6a43 0 10px, #8f6140 10px 20px); }
.plot.empty .muted { color: #e9d3bc; }
.plot.mine { box-shadow: inset 0 -6px 0 rgba(0,0,0,.12), 0 0 0 3px var(--sun); }
.plot.thirsty { background: #b88a5c; }
.plot.ready { background: #6f8f3a; }
.plot.dead { background: #6b5a4c; }
.pl-art { font-size: 2.8rem; line-height: 1; margin-bottom: auto; padding-top: .3rem; }
.pl-art.g1 { font-size: 2rem; padding-top: 1rem; }
.plot.ready .pl-art { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { .plot.ready .pl-art { animation: none; } }
.pl-name { font-weight: 800; font-size: .85rem; }
.pl-owner { font-size: .72rem; opacity: .85; }
.pl-bar { width: 100%; height: 8px; border-color: rgba(0,0,0,.2); background: rgba(0,0,0,.2); }
.pl-bar > span { background: #8fe388; }
.pl-info { font-size: .72rem; }
.pl-info .down { color: #ffd2cc; }
.pl-info .up { color: #e8ffd0; }
.pl-act { min-height: 1.8rem; display: flex; gap: .3rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.pl-act button { background: #fffdf8; color: #251f33; border-color: transparent; }
.pl-act button.primary { background: var(--sun); color: #251f33; }
.pl-act .muted { color: #f0dcc6; }
.seedlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: .5rem; }
.seed { display: flex; gap: .6rem; align-items: center; }
.se { font-size: 1.8rem; }
.seedpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.seedbtn { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .7rem .4rem; }
@media print { .seatbar, .peopletools, .dupcard { display: none !important; } }
.av.photo { object-fit: cover; background: var(--accent-soft); }
.photorow { margin-bottom: .8rem; }
.photorow label.btn { cursor: pointer; }

/* ---------- admin extras ---------- */
.bars.tall { height: 140px; }
.bars > div { position: relative; }
.bars .newdot { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: .62rem; font-weight: 800; color: var(--accent-text); background: var(--accent); border-radius: 99px; padding: 0 .25rem; line-height: 1.3; }
.modtext { max-width: 360px; word-break: break-word; }
.impbar { background: #251f33; color: #fff8ec; padding: .5rem 1rem; text-align: center; font-weight: 700; font-size: .92rem; line-height: 2; border-bottom: 3px solid var(--sun); }
.impbar button { margin-left: .6rem; background: var(--sun); color: #251f33; border-color: var(--sun); }
