/* Super Splash — colours taken from the logo: sky, sea, sun, grass */
:root {
  --sky: #2fa6de;
  --sky-50: #eaf6fd;
  --sea: #0b5d8f;
  --navy: #0a2e4a;
  --sun: #f6c33b;
  --sun-50: #fff7dc;
  --grass: #3f9d44;
  --grass-50: #e6f5e6;
  --coral: #e5484d;
  --coral-50: #fdecec;
  --orange: #ef8a17;
  --orange-50: #fff1e0;
  --violet: #7c5cd6;
  --ink: #12263a;
  --muted: #5e7387;
  --line: #d7e6f0;
  --bg: #f2f8fc;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(10, 46, 74, .06), 0 4px 16px rgba(10, 46, 74, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sky-50: #10324a; --sun-50: #3a3112; --grass-50: #133419; --coral-50: #3d1a1c; --orange-50: #3b2810;
    --ink: #e6f0f7; --muted: #9db2c4; --line: #24405a; --bg: #0a1a28; --card: #102639;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --sky-50: #10324a; --sun-50: #3a3112; --grass-50: #133419; --coral-50: #3d1a1c; --orange-50: #3b2810;
  --ink: #e6f0f7; --muted: #9db2c4; --line: #24405a; --bg: #0a1a28; --card: #102639; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
a { color: var(--sea); }
@media (prefers-color-scheme: dark) { a { color: var(--sky); } }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; font-weight: 750; }
h3 { font-size: 1rem; }
code { background: var(--sky-50); padding: .1em .35em; border-radius: 4px; font-size: .9em; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mt { margin-top: 1.4rem; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.danger-text { color: var(--coral); font-weight: 600; }
[hidden] { display: none !important; }

.boot { display: grid; place-items: center; min-height: 100vh; }
.boot img { width: 120px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; transform: scale(.96); } }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 42px; padding: .5em 1em; border-radius: 10px;
  border: 1px solid transparent; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; background: var(--sky-50); color: var(--sea);
  transition: transform .05s, filter .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--sea); color: #fff; }
.btn-danger { background: var(--coral); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost.danger { color: var(--coral); }
.btn-in { background: var(--grass); color: #fff; }
.btn-out { background: var(--orange); color: #fff; }
.btn-meal { background: var(--sun); color: var(--navy); }
.btn-light { background: #fff; color: var(--navy); }
.btn-ghost-light { background: rgba(255, 255, 255, .18); color: #fff; border-color: rgba(255, 255, 255, .4); }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: .6em 1.3em; }
.btn-sm { min-height: 32px; padding: .25em .7em; font-size: .85rem; }
.icon-btn { background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: var(--muted); width: 40px; height: 40px; border-radius: 8px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .55em .75em; min-height: 42px; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--sky) 45%, transparent); outline-offset: 1px; border-color: var(--sky); }
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--sea); }
textarea { resize: vertical; }

/* ---------- Shell ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; padding-top: max(.5rem, env(safe-area-inset-top));
  background: linear-gradient(100deg, var(--sea), var(--sky)); color: #fff; box-shadow: 0 2px 10px rgba(10, 46, 74, .2); }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; min-width: 0; }
.brand img { width: 46px; height: 40px; object-fit: contain; background: #fff; border-radius: 10px; padding: 2px; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand strong { font-size: 1.1rem; font-weight: 800; white-space: nowrap; }
.brand small { opacity: .85; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: flex; gap: .2rem; margin-left: 1rem; flex: 1; overflow-x: auto; }
.topnav a { color: #fff; text-decoration: none; padding: .45rem .8rem; border-radius: 999px; font-weight: 600; font-size: .95rem; white-space: nowrap; opacity: .9; }
.topnav a:hover { background: rgba(255, 255, 255, .15); opacity: 1; }
.topnav a.active { background: #fff; color: var(--sea); opacity: 1; }
.me { margin-left: auto; display: flex; align-items: center; gap: .45rem; color: #fff; text-decoration: none; font-weight: 600; font-size: .9rem;
  background: rgba(255, 255, 255, .15); padding: .35rem .75rem; border-radius: 999px; }
.role-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); vertical-align: middle; }
.role-admin { background: var(--coral); } .role-leader { background: var(--grass); } .role-caterer { background: var(--sun); } .role-medical { background: var(--violet); }
.view { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 6rem; }
.bottomnav { display: none; }
.offline-bar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--orange); color: #fff; text-align: center; padding: .5rem; font-weight: 600; font-size: .9rem; }
body.offline .offline-bar { display: block; }

@media (max-width: 820px) {
  .topnav { display: none; }
  .me-name { display: none; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(10, 46, 74, .08); }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .45rem 0 .5rem; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
  .bottomnav a .ico { font-size: 1.3rem; line-height: 1; filter: grayscale(.7); }
  .bottomnav a.active { color: var(--sea); }
  .bottomnav a.active .ico { filter: none; }
  body.offline .offline-bar { bottom: calc(58px + env(safe-area-inset-bottom)); }
  .view { padding: 1rem 1rem 7rem; }
  h1 { font-size: 1.35rem; }
}

/* ---------- Common blocks ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1rem; border: 1px solid var(--line); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1, .page-head h2 { margin: 0; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + section { margin-top: 1rem; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }
.back { display: inline-block; margin-bottom: .75rem; text-decoration: none; font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.search { max-width: 420px; flex: 1 1 260px; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: .35rem .9rem; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; min-height: 36px; }
.chip.on { background: var(--sea); color: #fff; border-color: var(--sea); }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15em .55em; border-radius: 6px; background: var(--sky-50); color: var(--sea); margin-left: .25rem; vertical-align: middle; white-space: nowrap; }
.b-youth { background: var(--sky); color: #fff; }
.b-adult { background: var(--sun); color: var(--navy); }
.b-danger { background: var(--coral); color: #fff; }
.b-warn { background: var(--orange-50); color: #a04f00; }
.b-info { background: var(--grass-50); color: var(--grass); }
.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: .25em .7em; border-radius: 999px; white-space: nowrap; }
.pill-on { background: var(--grass-50); color: var(--grass); }
.pill-off { background: var(--line); color: var(--muted); }

.alert { padding: .55rem .8rem; border-radius: 10px; font-weight: 600; margin: .35rem 0; border-left: 5px solid; }
.alert-danger { background: var(--coral-50); color: var(--coral); border-color: var(--coral); }
.alert-warn { background: var(--orange-50); color: #b25a00; border-color: var(--orange); }
.alert-info { background: var(--grass-50); color: var(--grass); border-color: var(--grass); }
@media (prefers-color-scheme: dark) { .alert-warn { color: #ffb35c; } .b-warn { color: #ffb35c; } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat-n { font-size: 2.1rem; font-weight: 800; line-height: 1; color: var(--sea); font-variant-numeric: tabular-nums; }
.stat-l { font-weight: 700; margin-top: .3rem; }
.stat-s { color: var(--muted); font-size: .85rem; }
.stat-main { background: linear-gradient(135deg, var(--sea), var(--sky)); color: #fff; border: 0; }
.stat-main .stat-n, .stat-main .stat-s { color: #fff; }
.stat-muted .stat-n { color: var(--muted); }
@media (prefers-color-scheme: dark) { .stat-n { color: var(--sky); } }

.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.bars a { text-decoration: none; color: inherit; display: block; }
.bar-label { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: .2rem; }
.bar { height: 10px; background: var(--sky-50); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--sky); border-radius: 99px; transition: width .4s; }
.bar.full i { background: var(--coral); }
.bar.meal i { background: var(--sun); }

.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .7rem; padding: .5rem 0 .5rem .7rem; border-bottom: 1px solid var(--line); border-left: 4px solid var(--line); font-size: .92rem; }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.feed small { color: var(--muted); }
.feed em { color: var(--muted); }
.f-event_in, .f-activity_in { border-left-color: var(--grass) !important; }
.f-event_out, .f-activity_out { border-left-color: var(--orange) !important; }
.f-meal { border-left-color: var(--sun) !important; }
.f-medical { border-left-color: var(--violet) !important; }
@media (max-width: 560px) { .feed li { grid-template-columns: auto 1fr; } .feed small { grid-column: 2; } }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: .5rem; border-bottom: 2px solid var(--line); }
.table td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.wrap { word-break: break-word; max-width: 360px; }
.table tr.inactive td { opacity: .55; }
.table tr.warn-row td { background: var(--coral-50); }
.row-actions { white-space: nowrap; text-align: right; }

/* ---------- People ---------- */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .5rem; }
.person { display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; }
.person:hover { border-color: var(--sky); }
.person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person-main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-tags { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.person-tags > .badge + .badge { margin-top: 0; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--sky); }
.avatar.adult { background: var(--sun); color: var(--navy); }
.avatar.xl { width: 72px; height: 72px; font-size: 1.8rem; }

.profile-head { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.profile-head > div:nth-child(2) { flex: 1; min-width: 200px; }
.profile-head h1 { margin-bottom: .1rem; }
.profile-head p { margin: .1rem 0; }
.tags { margin-top: .4rem; display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.tags .badge { margin-left: 0; }
.alerts { margin-top: .8rem; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-top: 1rem; }
.qa { background: var(--bg); border-radius: 12px; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.qa h3 { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.qa .row { display: flex; gap: .4rem; flex-wrap: wrap; }
.qa .row .btn { flex: 1; }
.infos { display: grid; gap: .5rem; margin: 0; }
.info { display: grid; grid-template-columns: 150px 1fr; gap: .5rem; }
.info dt { color: var(--muted); font-size: .88rem; }
.info dd { margin: 0; white-space: pre-wrap; }
.info.danger dd { color: var(--coral); font-weight: 700; }
.info.warn dd { font-weight: 600; }
@media (max-width: 560px) { .info { grid-template-columns: 1fr; gap: 0; } }
.med-form { display: grid; grid-template-columns: 180px 1fr auto; gap: .5rem; margin-bottom: 1rem; align-items: start; }
@media (max-width: 640px) { .med-form { grid-template-columns: 1fr; } }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tile > a { padding: 1rem; text-decoration: none; color: inherit; flex: 1; }
.tile h3 { margin: 0; font-size: 1.1rem; }
.tile p { margin: .2rem 0 .6rem; }
.tile-n { font-size: 2.2rem; font-weight: 800; color: var(--sea); line-height: 1; }
.tile-n small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.tile.closed { opacity: .6; }
.tile-actions { display: flex; gap: .4rem; padding: .5rem 1rem .8rem; border-top: 1px solid var(--line); }

/* ---------- Meals ---------- */
.diet-list { display: grid; gap: .6rem; }
.diet { border: 1px solid var(--line); border-left: 5px solid var(--grass); border-radius: 10px; padding: .6rem .8rem; }
.diet.allergy { border-left-color: var(--coral); }
.diet-head { display: flex; justify-content: space-between; gap: 1rem; }
.diet-head span { color: var(--muted); white-space: nowrap; }
.diet-people { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.diet-people span { font-size: .85rem; background: var(--bg); border-radius: 6px; padding: .1rem .45rem; }
.diet-people span.done { text-decoration: line-through; opacity: .55; }

/* ---------- Scan station ---------- */
.scan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .scan-layout { grid-template-columns: 1fr; } }
.scan-controls { display: grid; gap: .6rem; margin-bottom: .8rem; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; gap: 4px; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 700; padding: .6rem .4rem; border-radius: 9px; cursor: pointer; color: var(--muted); min-height: 44px; }
.seg button.on { background: var(--card); color: var(--sea); box-shadow: var(--shadow); }
.big-select { font-size: 1.05rem; font-weight: 600; min-height: 48px; }
.mode-banner { text-align: center; font-weight: 800; font-size: 1.15rem; padding: .7rem; border-radius: 12px; color: #fff; letter-spacing: .01em; }
.b-in { background: var(--grass); }
.b-out { background: var(--orange); }
.b-auto { background: var(--sea); }
.b-meal { background: var(--sun); color: var(--navy); }
.camera-box { position: relative; background: #0a1a28; border-radius: 14px; overflow: hidden; min-height: 300px; display: grid; }
.camera-box #camera { width: 100%; }
.camera-box #camera:empty::before { content: "Camera off — tap Start camera, or use the box below"; color: #9db2c4; display: grid; place-items: center; min-height: 240px; text-align: center; padding: 1rem; }
.camera-box video { width: 100% !important; display: block; }
.cam-buttons { display: flex; gap: .5rem; align-items: center; margin: .7rem 0; flex-wrap: wrap; }
.cam-buttons .check { margin-left: auto; display: flex; align-items: center; gap: .3rem; }
.manual { position: relative; }
.scan-input { font-size: 1.1rem; min-height: 52px; }
.suggest { list-style: none; padding: 0; margin: .3rem 0 0; display: grid; gap: .3rem; }
.suggest button { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: .6rem .8rem; border-radius: 10px; font: inherit; cursor: pointer; }
.suggest button:hover { border-color: var(--sky); }
.suggest span { color: var(--muted); }

.result-host:empty { display: none; }
.result-host { position: absolute; inset: 0; z-index: 5; }
.result { position: absolute; inset: 0; padding: 1.2rem; color: #fff; display: flex; flex-direction: column; justify-content: center; gap: .4rem; animation: pop .18s ease-out; overflow-y: auto; }
@keyframes pop { from { transform: scale(.96); opacity: .4; } }
.result-ok { background: #2f8f34; }
.result-ok.dir-out { background: #d6780c; }
.result-warn { background: #d6780c; }
.result-error { background: #c8282e; }
.result-queued { background: #0b5d8f; }
.result-title { font-size: 1.7rem; font-weight: 850; line-height: 1.15; }
.result-who { font-size: 1.05rem; opacity: .95; }
.result-who .badge { background: #fff; color: var(--sea); }
.result-msg { font-size: 1.05rem; }
.result .alert { background: #fff; font-size: 1.1rem; }
.result .alert-danger { font-size: 1.35rem; }
.result-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.recent-list { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.recent-list li { display: flex; gap: .5rem; padding: .4rem 0 .4rem .6rem; border-bottom: 1px solid var(--line); border-left: 4px solid var(--grass); }
.recent-list li.r-warn, .recent-list li.r-queued { border-left-color: var(--orange); }
.recent-list li.r-error { border-left-color: var(--coral); }
.recent-list li.undone { opacity: .5; text-decoration: line-through; }
.recent-list time { color: var(--muted); font-variant-numeric: tabular-nums; }
.recent-list em { margin-left: auto; color: var(--muted); }

/* ---------- Roll call ---------- */
.rollcall-summary { font-size: 1.2rem; padding: .9rem 1.1rem; background: var(--coral-50); color: var(--coral); border-radius: var(--radius); margin-bottom: 1rem; border: 2px solid var(--coral); }
.rollcall-summary.all { background: var(--grass-50); color: var(--grass); border-color: var(--grass); }
.rollcall-summary .muted { font-size: .9rem; }
.rc-list { list-style: none; padding: 0; margin: 0; columns: 2 260px; column-gap: 1.2rem; }
.rc-list li { break-inside: avoid; border-bottom: 1px solid var(--line); }
.rc-list label { display: flex; align-items: center; gap: .5rem; padding: .45rem .2rem; cursor: pointer; }
.rc-list li.ok .rc-name { text-decoration: line-through; opacity: .6; }
.rc-call { margin-left: auto; text-decoration: none; }

/* ---------- Medical ---------- */
.med-list { display: grid; gap: .6rem; }
.med-item { display: block; padding: .7rem .8rem; border: 1px solid var(--line); border-left: 5px solid var(--violet); border-radius: 10px; text-decoration: none; color: inherit; font-size: .92rem; }
.med-item:hover { border-color: var(--violet); }
.med-head { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-bottom: .2rem; }
.med-head small { color: var(--muted); flex: 1; }

/* ---------- Forms & modals ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
.form-grid .full, .form-section { grid-column: 1 / -1; }
.form-section { margin: .6rem 0 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.field { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; }
.field small { color: var(--muted); font-weight: 400; }
.field.check { flex-direction: row; align-items: center; gap: .5rem; grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.form-error { color: var(--coral); font-weight: 600; min-height: 1.2em; margin: .3rem 0; }
.form-error:empty { display: none; }
.modal { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { width: min(820px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(10, 26, 40, .55); }
.modal > header { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal > header h2 { margin: 0; }
.modal-body { padding: 1rem 1.1rem; }
.modal > footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); }
.errors { max-height: 240px; overflow: auto; color: var(--coral); font-size: .9rem; }
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.link-list li { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.link-list .btn { min-width: 210px; justify-content: flex-start; }

#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 100; display: grid; gap: .4rem; width: min(480px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: .7rem 1rem; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); transition: opacity .4s, transform .4s; }
.toast-ok { background: var(--grass); }
.toast-warn { background: var(--orange); }
.toast-error { background: var(--coral); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Login & public pages ---------- */
.login-wrap, body.public { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(circle at 20% 0%, var(--sun) 0, transparent 35%), linear-gradient(170deg, var(--sky) 0%, var(--sea) 60%, var(--navy) 100%); }
.login-card, .public-card { background: var(--card); width: min(420px, 100%); border-radius: 22px; padding: 2rem 1.6rem; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); text-align: center; }
.login-logo, .public-logo { width: 130px; height: auto; margin-bottom: .5rem; }
.login-card h1 { margin: 0; font-size: 1.9rem; color: var(--sea); }
.login-form { display: grid; gap: .8rem; margin-top: 1.2rem; text-align: left; }
.login-form .btn { width: 100%; }
.member-no { font-size: 1.4rem; font-weight: 800; color: var(--sea); margin: .2rem 0 .8rem; }
.public-card .btn { margin-top: 1rem; }

@media print {
  .topbar, .bottomnav, .offline-bar, .head-actions, .chips, .toolbar, #toasts, .back { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .view { padding: 0; }
}
