/* Accident Tracker — sky theme */
:root {
  --sky-1: #bfe6ff; --sky-2: #e9f6ff; --sky-deep: #2a6fb0; --ink: #23405c; --ink-soft: #5b7a97;
  --sun: #ffbf2e; --sun-deep: #f29a00; --sun-soft: #fff3cf;
  --cloud: #ffffff; --cloud-edge: #d8e9f7; --rain: #6b8db5; --rain-soft: #e6eef8;
  --grass: #5cc48a; --berry: #ef6f8c; --lilac: #a48cf0;
  --card: #ffffff; --card-2: #f6fbff; --line: #dcebf7;
  --shadow: 0 6px 0 rgba(42, 111, 176, .10), 0 14px 32px rgba(42, 111, 176, .12);
  --radius: 22px; --radius-sm: 14px;
  --font-head: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, Segoe UI, sans-serif;
  --nav-h: 74px;
  color-scheme: light;
}
[data-theme="night"] {
  --sky-1: #121a3a; --sky-2: #1c2752; --sky-deep: #9ccfff; --ink: #e8f0ff; --ink-soft: #a6b7d8;
  --sun-soft: #3b3420; --cloud: #24305f; --cloud-edge: #34437c; --rain-soft: #26345f;
  --card: #1d2750; --card-2: #232f5e; --line: #33417a;
  --shadow: 0 6px 0 rgba(0, 0, 0, .25), 0 14px 32px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
[data-theme="pastel"] {
  --sky-1: #ffd9ec; --sky-2: #fff1f8; --sky-deep: #c2417f; --ink: #4a2a42; --ink-soft: #8a6680;
  --line: #f6d6e8; --card-2: #fff7fb; --cloud-edge: #f3d9e8;
  --shadow: 0 6px 0 rgba(194, 65, 127, .10), 0 14px 32px rgba(194, 65, 127, .12);
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --sky-1: #121a3a; --sky-2: #1c2752; --sky-deep: #9ccfff; --ink: #e8f0ff; --ink-soft: #a6b7d8;
    --sun-soft: #3b3420; --cloud: #24305f; --cloud-edge: #34437c; --rain-soft: #26345f;
    --card: #1d2750; --card-2: #232f5e; --line: #33417a; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--sky-2); }
body {
  margin: 0; font-family: var(--font-body); color: var(--ink); font-size: 16px; line-height: 1.5;
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 55%, var(--sky-2) 100%) fixed;
  min-height: 100vh; min-height: 100dvh;
}
[data-theme="night"] body, body[data-theme="night"] {
  background: radial-gradient(circle at 20% 10%, rgba(255,255,255,.05) 0 1px, transparent 2px) 0 0/48px 48px,
              radial-gradient(circle at 70% 60%, rgba(255,255,255,.07) 0 1px, transparent 2px) 0 0/72px 72px,
              linear-gradient(180deg, var(--sky-1), var(--sky-2)) fixed;
}
a { color: var(--sky-deep); font-weight: 700; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--ink-soft); }
.muted { font-size: .92rem; }
hr { border: 0; border-top: 2px dashed var(--line); margin: 1.4rem 0; }
code, kbd { background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: 1px 6px; font-size: .9em; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 8px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; }
.shell > div, .grid > *, .card, .main { min-width: 0; }
select { max-width: 100%; }
.main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 28px); }
.main.narrow { max-width: 560px; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--sky-1) 82%, transparent); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 800; font-size: 1.25rem; white-space: nowrap; color: var(--ink); text-decoration: none !important; }
.brand .logo { width: 38px; height: 38px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--card); box-shadow: var(--shadow); font-size: 1.25rem; border: 0; cursor: pointer; color: var(--ink); text-decoration: none !important;
}
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--berry); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; }

.sidenav { display: none; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 2px solid var(--line); box-shadow: 0 -8px 24px rgba(42,111,176,.10);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .72rem; color: var(--ink-soft); text-decoration: none !important; font-weight: 800; }
.bottomnav a .i { font-size: 1.45rem; line-height: 1; }
.bottomnav a.on { color: var(--sky-deep); }
.bottomnav a.log-fab .i {
  width: 62px; height: 62px; margin-top: -30px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem;
  background: radial-gradient(circle at 35% 30%, #fff6b8, var(--sun) 55%, var(--sun-deep)); box-shadow: 0 6px 0 #d98400, 0 10px 24px rgba(242,154,0,.45);
  animation: bob 3s ease-in-out infinite;
}
@media (min-width: 900px) {
  .shell.with-nav { grid-template-columns: 240px minmax(0, 1fr); }
  .bottomnav { display: none; }
  .main { padding-bottom: 40px; }
  .sidenav {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; padding: 18px 14px; overflow-y: auto;
    background: color-mix(in srgb, var(--card) 70%, transparent); border-right: 2px solid var(--line);
  }
  .sidenav .brand { margin: 4px 8px 16px; font-size: 1.12rem; }
  .sidenav a.nav { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; color: var(--ink); font-weight: 800; text-decoration: none !important; }
  .sidenav a.nav:hover { background: var(--card-2); }
  .sidenav a.nav.on { background: var(--sun-soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--sun); }
  .sidenav .nav .i { width: 26px; text-align: center; font-size: 1.2rem; }
  .sidenav .section { margin: 14px 12px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); font-weight: 800; }
  .sidenav .logbtn { margin: 6px 4px 12px; }
  .topbar .brand { display: none; }
}

/* ---------- Cards & grid ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; border: 2px solid var(--line); }
.card.soft { background: var(--card-2); box-shadow: none; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; align-items: start; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.page-head h1 { margin: 0; }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 999px; border: 0; cursor: pointer;
  font: 800 1rem var(--font-body); text-decoration: none !important; color: #fff; background: var(--sky-deep);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--sky-deep) 70%, #000); transition: transform .08s ease, box-shadow .08s ease; white-space: nowrap;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--sky-deep) 70%, #000); }
.btn.sun { background: var(--sun); color: #3d2a00; box-shadow: 0 4px 0 var(--sun-deep); }
.btn.rain { background: var(--rain); box-shadow: 0 4px 0 #4c6c93; }
.btn.grass { background: var(--grass); box-shadow: 0 4px 0 #3d9566; }
.btn.berry, .btn.danger { background: var(--berry); box-shadow: 0 4px 0 #c24b67; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: 0 0 0 2px var(--line) inset; }
.btn.sm { padding: 7px 13px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn.lg { padding: 15px 24px; font-size: 1.12rem; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--sky-deep); font-weight: 800; cursor: pointer; }
.linkbtn.danger { color: var(--berry); }
form.inline { display: inline; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 800; margin: 12px 0 6px; font-size: .95rem; }
.field-hint { font-size: .85rem; color: var(--ink-soft); font-weight: 600; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=date], input[type=time], input[type=month], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--card-2);
  font: 600 1rem var(--font-body); color: var(--ink); transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky-deep); background: var(--card); }
textarea { min-height: 96px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; margin: 10px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--sky-deep); flex: none; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
fieldset { border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: 6px 14px 14px; margin: 14px 0; }
legend { font-weight: 800; padding: 0 6px; }

/* Big choice tiles (role picker, log kinds) */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.tile { position: relative; }
.tile input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.tile .face {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 16px 10px; min-height: 112px;
  border-radius: var(--radius); background: var(--card-2); border: 3px solid var(--line); font-weight: 800; transition: transform .1s, border-color .1s, background .1s;
}
.tile .face .em { font-size: 2.3rem; line-height: 1; }
.tile .face small { font-weight: 700; }
.tile input:checked + .face { border-color: var(--sky-deep); background: var(--card); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile.sunny input:checked + .face { border-color: var(--sun); background: var(--sun-soft); }
.tile.rainy input:checked + .face { border-color: var(--rain); background: var(--rain-soft); }
.tile input:focus-visible + .face { outline: 3px solid var(--sun); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--card-2); font-weight: 800; }
.chip input:checked + span { border-color: var(--sky-deep); background: var(--card); color: var(--sky-deep); }
.chip.emoji span { font-size: 1.4rem; padding: 4px 10px; }

/* ---------- Flash / banners ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 800; border: 2px solid; }
.flash.ok { background: #e8f8ee; border-color: #9fdcb8; color: #1f6b43; }
.flash.warn { background: #fff4e0; border-color: #ffd28a; color: #7a4b00; }
.flash.info { background: #e8f3ff; border-color: #a9d1f5; color: #1f4f80; }
.flash.err { background: #ffe9ee; border-color: #f7b3c3; color: #8a2140; }
[data-theme="night"] .flash { filter: brightness(.9); }
.announce { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; font-weight: 700; background: var(--card); border: 2px solid var(--line); }
.announce.warn { border-color: #ffd28a; background: #fff8ea; color: #6a4300; }
.announce.party { border-color: #f6b6d6; background: linear-gradient(90deg, #fff0f8, #f0f7ff); color: #5a2b4c; }
.impersonate { background: var(--berry); color: #fff; padding: 8px 16px; text-align: center; font-weight: 800; }
.impersonate button { background: #fff; color: var(--berry); border: 0; border-radius: 999px; padding: 4px 12px; font-weight: 800; margin-left: 8px; cursor: pointer; }

/* ---------- Sky hero ---------- */
.sky-hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 22px; min-height: 230px; color: #17395a;
  background: linear-gradient(180deg, #8fd3ff 0%, #c7ecff 70%, #e9f8ff 100%); box-shadow: var(--shadow); margin-bottom: 18px;
}
.sky-hero.mood-rainy { background: linear-gradient(180deg, #9db3cc 0%, #c8d6e6 75%, #e4ecf5 100%); }
.sky-hero.mood-mixed, .sky-hero.mood-partly { background: linear-gradient(180deg, #a7d6f5 0%, #d1ebfb 75%, #ecf7ff 100%); }
.sky-hero.mood-dawn { background: linear-gradient(180deg, #ffd6a8 0%, #ffe9d1 45%, #e3f4ff 100%); }
[data-theme="night"] .sky-hero { filter: saturate(.85) brightness(.92); }
.sky-hero .hero-sun {
  position: absolute; right: -30px; top: -30px; width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fff8c4, #ffd24a 55%, #ffb400); box-shadow: 0 0 0 18px rgba(255, 214, 74, .25), 0 0 0 40px rgba(255, 214, 74, .12);
  animation: spin-glow 6s ease-in-out infinite;
}
.sky-hero.mood-rainy .hero-sun { opacity: .35; filter: grayscale(.5); }
.sky-hero .hero-cloud { position: absolute; font-size: 64px; opacity: .9; animation: drift 18s linear infinite; }
.sky-hero .hero-cloud.c2 { font-size: 44px; top: 110px; animation-duration: 26s; animation-delay: -8s; }
.sky-hero .hero-body { position: relative; z-index: 2; max-width: 520px; }
.sky-hero .hello { font-family: var(--font-head); font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 800; margin: 0; }
.sky-hero .mood { font-weight: 800; font-size: 1.05rem; opacity: .85; }
.sky-hero .tally { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; min-height: 40px; }
.sky-hero .tally .t { font-size: 2rem; line-height: 1; animation: pop .4s cubic-bezier(.3, 1.6, .5, 1) both; }
.sky-hero .tally .t.cloud { filter: drop-shadow(0 2px 0 rgba(0,0,0,.05)); }
.goal-bar { height: 14px; background: rgba(255,255,255,.65); border-radius: 999px; overflow: hidden; margin-top: 8px; max-width: 360px; }
.goal-bar span { display: block; height: 100%; background: linear-gradient(90deg, #ffd24a, #ffb400); border-radius: 999px; transition: width .6s; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; box-shadow: var(--shadow); }
.stat .v { font-family: var(--font-head); font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.stat .l { font-size: .82rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.stat.sun { background: var(--sun-soft); border-color: #ffe08a; }
.stat.rain { background: var(--rain-soft); }

/* Quick log buttons */
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.qbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 16px 8px; min-height: 104px; border-radius: var(--radius);
  border: 3px solid var(--line); background: var(--card); cursor: pointer; font: 800 .98rem var(--font-body); color: var(--ink); box-shadow: var(--shadow);
  transition: transform .1s; text-decoration: none !important;
}
.qbtn .em { font-size: 2.3rem; line-height: 1; }
.qbtn:active { transform: scale(.96); }
.qbtn.sunny { background: linear-gradient(180deg, #fff8dc, var(--sun-soft)); border-color: #ffe08a; color: #6a4a00; }
.qbtn.rainy { background: linear-gradient(180deg, #f0f5fb, var(--rain-soft)); border-color: #c6d6ea; color: #3f5f85; }
.qbtn.dry { background: linear-gradient(180deg, #f2fbf5, #e3f6ea); border-color: #bfe8cf; color: #2c6b48; }
.qbtn.change { background: linear-gradient(180deg, #f7f2ff, #eee6ff); border-color: #d9ccff; color: #5a3fa8; }
[data-theme="night"] .qbtn { filter: brightness(.88); }

/* Week strip */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week .day { text-align: center; padding: 8px 2px; border-radius: 14px; background: var(--card-2); border: 2px solid var(--line); }
.week .day.today { border-color: var(--sun); background: var(--sun-soft); }
.week .day .dn { font-size: .72rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; }
.week .day .w { font-size: 1.6rem; line-height: 1.3; }
.week .day .n { font-size: .68rem; font-weight: 800; white-space: nowrap; min-height: 1.1em; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 2px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .em { font-size: 1.8rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--card-2); flex: none; }
.timeline .em.sunshine { background: var(--sun-soft); }
.timeline .em.cloud { background: var(--rain-soft); }
.timeline .what { font-weight: 800; }
.timeline .meta { font-size: .85rem; color: var(--ink-soft); font-weight: 700; }
.timeline .acts { margin-left: auto; display: flex; gap: 8px; flex: none; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--card-2); border: 2px solid var(--line); color: var(--ink-soft); white-space: nowrap; }
.pill.sun { background: var(--sun-soft); border-color: #ffe08a; color: #6a4a00; }
.pill.rain { background: var(--rain-soft); border-color: #c6d6ea; color: #3f5f85; }
.pill.ok { background: #e8f8ee; border-color: #9fdcb8; color: #1f6b43; }
.pill.warn { background: #fff4e0; border-color: #ffd28a; color: #7a4b00; }
.pill.bad { background: #ffe9ee; border-color: #f7b3c3; color: #8a2140; }
.pill.lilac { background: #f1ecff; border-color: #d9ccff; color: #5a3fa8; }

/* Little cards (CG home) */
.little-card { display: flex; flex-direction: column; gap: 12px; }
.little-card .who { display: flex; align-items: center; gap: 12px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; background: var(--sun-soft); border: 3px solid #fff; box-shadow: 0 3px 0 var(--line); flex: none; }
.avatar.sm { width: 36px; height: 36px; font-size: 1.2rem; border-width: 2px; }
.mini-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mini-quick button { border: 2px solid var(--line); background: var(--card-2); border-radius: 14px; padding: 8px 2px; font-size: 1.5rem; cursor: pointer; }
.mini-quick button span { display: block; font-size: .66rem; font-weight: 800; color: var(--ink-soft); }
.mini-quick button:active { transform: scale(.94); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .h { text-align: center; font-size: .75rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; }
.cal .c { aspect-ratio: 1; border-radius: 14px; background: var(--card-2); border: 2px solid var(--line); padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.cal .c .d { position: absolute; top: 3px; left: 7px; font-size: .72rem; font-weight: 800; color: var(--ink-soft); }
.cal .c .w { font-size: clamp(1.1rem, 4vw, 1.8rem); }
.cal .c .n { font-size: .65rem; font-weight: 800; }
.cal .c.today { border-color: var(--sun); }
.cal .c.sunny { background: var(--sun-soft); border-color: #ffe08a; }
.cal .c.rainy { background: var(--rain-soft); }
.cal .c.empty { background: transparent; border: 0; }

/* Badges */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 14px 8px; border-radius: var(--radius); background: var(--card); border: 2px solid var(--line); }
.badge .em { font-size: 2.6rem; line-height: 1.1; }
.badge .nm { font-weight: 800; font-family: var(--font-head); }
.badge.locked { opacity: .45; filter: grayscale(1); }
.badge.got { background: linear-gradient(180deg, var(--card), var(--sun-soft)); border-color: #ffe08a; }

/* Rewards */
.reward { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--card-2); border: 2px solid var(--line); }
.reward .em { font-size: 2rem; }
.reward .t { font-weight: 800; flex: 1; }
.reward .cost { font-family: var(--font-head); font-weight: 800; white-space: nowrap; }
.balance-big { font-family: var(--font-head); font-size: 3rem; font-weight: 800; line-height: 1; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 2px solid var(--line); vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
tr:hover td { background: color-mix(in srgb, var(--card-2) 60%, transparent); }

.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 14px; font-weight: 800; }
.empty { text-align: center; padding: 26px 10px; color: var(--ink-soft); }
.empty .em { font-size: 3rem; display: block; margin-bottom: 6px; }

/* Toast */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; left: auto; right: 24px; transform: none; } }
.toast { pointer-events: auto; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 12px 16px; box-shadow: var(--shadow); font-weight: 800; animation: slideup .3s ease both; display: flex; gap: 10px; align-items: center; }
.toast.ok { border-color: #9fdcb8; } .toast.warn { border-color: #ffd28a; }

/* Celebration */
.burst { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.burst span { position: absolute; font-size: 28px; animation: fall 1.6s ease-in forwards; }

/* Modal */
dialog { border: 0; border-radius: 26px; padding: 0; width: min(94vw, 520px); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(23, 57, 90, .45); backdrop-filter: blur(3px); }
dialog .dlg { padding: 20px; }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* Landing */
.landing-hero { text-align: center; padding: 40px 16px 20px; position: relative; }
.landing-hero h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); }
.landing-hero .lead { font-size: 1.2rem; max-width: 620px; margin: 0 auto 22px; color: var(--ink-soft); font-weight: 700; }
.feature .em { font-size: 2.4rem; }
.mascot { width: min(300px, 70vw); margin: 0 auto 6px; display: block; animation: bob 4s ease-in-out infinite; }
.auth-card { max-width: 460px; margin: 24px auto; }
.footer { text-align: center; padding: 20px 16px 30px; font-size: .88rem; color: var(--ink-soft); font-weight: 700; }
.footer a { margin: 0 8px; }

/* Print */
@media print {
  .topbar, .sidenav, .bottomnav, .no-print, .toasts { display: none !important; }
  body { background: #fff !important; }
  .main { padding: 0 !important; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* Animations */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes drift { from { transform: translateX(-120px); } to { transform: translateX(calc(100vw + 120px)); } }
@keyframes spin-glow { 0%, 100% { box-shadow: 0 0 0 18px rgba(255,214,74,.25), 0 0 0 40px rgba(255,214,74,.12); } 50% { box-shadow: 0 0 0 24px rgba(255,214,74,.3), 0 0 0 50px rgba(255,214,74,.1); } }
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideup { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fall { from { transform: translateY(-40px) rotate(0); opacity: 1; } to { transform: translateY(110vh) rotate(360deg); opacity: .8; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 380px) { .topbar .brand { font-size: 1.05rem; } .topbar .brand .logo { width: 32px; height: 32px; } }
.chart-box { position: relative; height: 280px; }
