/* The dashboard's look and motion — every page with the shell (body.ui),
   layered over tokens.css, shell.css and dashboard.css. Chart marks carry
   .c-anim / .c-track / .c-area hooks (common.js) that this sheet turns on.
   Data colours are untouched: the validated slots in tokens.css still carry
   every series. Home-only layout (bento grid, hero overlap, no in-card
   scrolling) lives in home.css. */

/* ================================================================ tokens */
.ui {
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --r-card: 20px;
  --gutter: clamp(14px, 2.2vw, 28px);
  --canvas: #eef2f7;
  --card-bg: #ffffff;
  --ink-soft: #5b6472;
  --hairline: rgba(15, 35, 60, .07);
  --lift: 0 1px 2px rgba(13, 39, 64, .04), 0 8px 24px -12px rgba(13, 39, 64, .14);
  --lift-hover: 0 2px 6px rgba(13, 39, 64, .06), 0 26px 50px -22px rgba(13, 39, 64, .32);
  --glass: rgba(255, 255, 255, .72);
  --accent: var(--series-1);
  font-feature-settings: "cv11", "ss01";
  background:
    radial-gradient(1100px 600px at 100% -200px, color-mix(in oklab, var(--series-1) 10%, transparent), transparent 70%),
    radial-gradient(800px 500px at 0% 30%, color-mix(in oklab, var(--brand-gold) 6%, transparent), transparent 70%),
    radial-gradient(rgba(19, 54, 84, .07) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--canvas);
  background-attachment: fixed;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ui {
    --canvas: #0a0d12; --card-bg: #12161d; --ink-soft: #9aa3b2; --hairline: rgba(255, 255, 255, .06);
    --lift: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 26px -14px rgba(0, 0, 0, .8);
    --lift-hover: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 28px 50px -22px rgba(0, 0, 0, .95);
    --glass: rgba(18, 22, 29, .72);
    background:
      radial-gradient(1100px 600px at 100% -200px, rgba(0, 132, 226, .14), transparent 70%),
      radial-gradient(800px 500px at 0% 30%, rgba(245, 190, 23, .05), transparent 70%),
      radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px) 0 0 / 22px 22px,
      var(--canvas);
    background-attachment: fixed;
  }
}
:root[data-theme="dark"] .ui {
  --canvas: #0a0d12; --card-bg: #12161d; --ink-soft: #9aa3b2; --hairline: rgba(255, 255, 255, .06);
  --lift: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 26px -14px rgba(0, 0, 0, .8);
  --lift-hover: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 28px 50px -22px rgba(0, 0, 0, .95);
  --glass: rgba(18, 22, 29, .72);
  background:
    radial-gradient(1100px 600px at 100% -200px, rgba(0, 132, 226, .14), transparent 70%),
    radial-gradient(800px 500px at 0% 30%, rgba(245, 190, 23, .05), transparent 70%),
    radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--canvas);
  background-attachment: fixed;
}

/* ================================================================ shell */
/* a floating rail: inset from the edges, rounded, with a gold active marker */
.ui.app { grid-template-columns: 268px 1fr; }
.ui .side {
  margin: 12px 0 12px 12px; top: 12px; height: calc(100dvh - 24px);
  border-radius: 24px; padding: 0 12px 12px;
  background:
    radial-gradient(300px 220px at 0% 0%, rgba(0, 132, 226, .28), transparent 70%),
    radial-gradient(260px 260px at 100% 100%, rgba(245, 190, 23, .12), transparent 70%),
    linear-gradient(180deg, #0b2036, #0f2c48);
  border: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 0 30px 60px -30px rgba(8, 24, 40, .7);
  animation: railIn .7s var(--ease-out) both;
}
.ui .side__brand { padding: 20px 6px 18px; border-bottom-color: rgba(255, 255, 255, .07); gap: 12px; }
.ui .side__seal {
  width: 42px; height: 42px;
  box-shadow: 0 0 0 3px rgba(245, 190, 23, .35), 0 0 24px rgba(245, 190, 23, .35);
}
.ui .side__name { font-size: 14.5px; font-weight: 700; }
.ui .side__sub { color: var(--brand-gold); opacity: .8; letter-spacing: .14em; }
.ui .side__label { color: rgba(255, 255, 255, .32); padding: 18px 12px 8px; }
.ui .side__link {
  position: relative; padding: 10px 12px; border-radius: 12px; font-weight: 500;
  transition: background .25s var(--ease-out), color .2s, transform .25s var(--ease-out);
}
.ui .side__link:hover { background: rgba(255, 255, 255, .06); transform: translateX(3px); }
.ui .side__link.is-on {
  background: linear-gradient(90deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.ui .side__link.is-on::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--brand-gold);
  box-shadow: 0 0 14px rgba(245, 190, 23, .8);
}
.ui .side__link.is-on .side__icon { color: var(--brand-gold); }
.ui .side__user {
  border: 1px solid rgba(255, 255, 255, .08); border-radius: 16px;
  background: rgba(255, 255, 255, .05); padding: 10px; margin-top: 12px;
}
.ui .side__avatar { width: 34px; height: 34px; border-radius: 11px; font-size: 12px; }

/* the title bar dissolves into the canvas: large type, no navy slab */
.ui .appbar {
  background: transparent; border-bottom: 0; color: var(--text);
  padding: 22px var(--gutter) 6px;
  animation: fadeUp .6s var(--ease-out) both;
}
.ui .appbar h1 { font-size: 26px; font-weight: 800; letter-spacing: -.035em; }
.ui .appbar p { color: var(--ink-soft); font-size: 13.5px; margin-top: 3px; }
.ui .appbar .btn {
  background: var(--card-bg); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--lift); padding: 9px 16px; border-radius: 12px; font-weight: 600;
}
.ui .appbar .btn:hover { background: var(--card-bg); box-shadow: var(--lift-hover); transform: translateY(-1px); }
.ui #export::before {
  content: ''; width: 16px; height: 16px; flex: none;
  background: #1d8f4e;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 11l5 5 5-5M4 21h16'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 11l5 5 5-5M4 21h16'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ui .side__toggle { background: var(--card-bg) !important; color: var(--text) !important; padding: 0 !important; }

.hero__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; animation: fadeUp .8s var(--ease-out) .45s both; }
.hero__btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 650; text-decoration: none;
  color: var(--brand-navy-deep); background: #fff;
  padding: 8px 16px; border-radius: 11px;
  box-shadow: 0 10px 22px -12px rgba(0, 0, 0, .6);
  transition: transform .2s var(--ease-out), box-shadow .25s;
}
.hero__btn:hover { transform: translateY(-2px); box-shadow: 0 16px 28px -14px rgba(0, 0, 0, .7); }
.hero__btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(245, 190, 23, .6); }
.ui .timewarn { margin: 8px var(--gutter) 0; border-radius: 12px; }

/* ============================================================== filters */
/* a floating toolbar card that sticks just under the top edge */
.ui .filters {
  margin: 10px var(--gutter) 0; padding: 12px 14px;
  border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.8) blur(16px);
  backdrop-filter: saturate(1.8) blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--lift);
  gap: 10px 12px; align-items: flex-end;
  animation: fadeUp .6s var(--ease-out) .08s both;
}
/* a floating sticky toolbar on the other pages (one row there) */
.ui .filters { position: sticky; top: 10px; z-index: 6; }
.ui .filters .field--grow { flex: 1 1 180px; min-width: 160px; max-width: 290px; }
.ui .filters input[type="date"] { width: 146px; }
.ui .filters .label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 5px 3px;
}
.ui .filters__presets {
  background: color-mix(in oklab, var(--surface-2) 90%, transparent);
  border-radius: 12px; padding: 4px; align-self: flex-end;
}
.ui .chip {
  border-radius: 9px; padding: 7px 12px; font-weight: 550;
  transition: background .25s var(--ease-out), color .2s, box-shadow .25s var(--ease-out), transform .15s;
}
.ui .chip:active { transform: scale(.95); }
.ui .chip.is-on {
  background: var(--brand-navy); color: #fff !important;
  box-shadow: 0 6px 14px -6px color-mix(in oklab, var(--brand-navy) 90%, transparent);
}
.ui .input {
  border-radius: 11px; background: var(--card-bg); border-color: var(--border);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.ui .input--sm { padding: 8px 11px; }
.ui .input:hover { border-color: color-mix(in oklab, var(--series-1) 40%, var(--border-firm)); }
.ui .btn { border-radius: 11px; transition: background .2s, border-color .2s, transform .15s, box-shadow .25s; }
.ui .btn:active:not(:disabled) { transform: scale(.97); }
.ui .filters .btn--primary {
  padding: 9px 20px; font-weight: 600;
  background: linear-gradient(135deg, #1f5a8c, var(--brand-navy));
  box-shadow: 0 8px 18px -8px color-mix(in oklab, var(--brand-navy) 90%, transparent);
}
.ui .filters .btn--primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -10px color-mix(in oklab, var(--brand-navy) 95%, transparent); }

/* ========================================================== loading bar */
.home { position: relative; }
.loadbar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60;
  pointer-events: none; opacity: 0; transition: opacity .3s;
  background: linear-gradient(90deg, transparent, var(--brand-gold), var(--series-1), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
}
.home.is-stale .loadbar { opacity: 1; animation: loadbar 1.1s ease-in-out infinite; }
@keyframes loadbar { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.ui .wrap.is-stale { opacity: 1; }
.ui .wrap.is-stale .card.is-in, .ui .wrap.is-stale .tile.is-in {
  filter: saturate(.85); opacity: .78; transition: opacity .3s, filter .3s;
}
.ui .wrap { padding: 18px var(--gutter) 40px; max-width: 1640px; }

/* ================================================================= hero */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: clamp(22px, 2.8vw, 32px) clamp(22px, 3vw, 36px) clamp(54px, 4.8vw, 64px);
  border-radius: 26px;
  color: #fff;
  background:
    radial-gradient(600px 260px at 100% 0%, rgba(245, 190, 23, .24), transparent 60%),
    radial-gradient(500px 300px at 0% 120%, rgba(0, 132, 226, .4), transparent 60%),
    linear-gradient(120deg, #0a1f35, var(--brand-navy) 55%, #1d4a72);
  box-shadow: 0 30px 60px -32px rgba(13, 39, 64, .8);
  animation: heroIn .9s var(--ease-out) both;
}
.hero::after {
  content: ''; position: absolute; z-index: -1;
  width: 320px; height: 320px; right: -60px; top: -90px;
  background: url(/img/logo-512.png) center / contain no-repeat;
  opacity: .09; filter: grayscale(1) brightness(2.2);
  animation: spin 90s linear infinite;
}
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .07) 48%, transparent 60%);
  transform: translateX(-100%);
  animation: sheen 7s ease-in-out 1.2s infinite;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 12px; font-weight: 500; letter-spacing: .02em;
  color: rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
  padding: 5px 12px 5px 10px; border-radius: 999px;
  animation: fadeUp .7s var(--ease-out) .15s both;
}
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; flex: none; }
.live-dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid #3ddc84; animation: ping 2s var(--ease-out) infinite;
}
.hero__title {
  font-size: clamp(26px, 3.2vw, 38px); font-weight: 800; letter-spacing: -.035em; line-height: 1.1;
  margin-top: 14px;
  background: linear-gradient(90deg, #fff 30%, #ffe08a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: fadeUp .8s var(--ease-out) .25s both;
}
.hero__sub { margin-top: 8px; font-size: 14px; color: rgba(255, 255, 255, .72); animation: fadeUp .8s var(--ease-out) .35s both; }
.hero__badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, .85);
  padding: 7px 13px; border-radius: 10px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hero__badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-gold); }

/* ================================================================ tiles */
.ui .tiles { gap: 12px; }
.ui .tile {
  border-radius: 16px; padding: 12px 15px 13px;
  background: var(--card-bg); border: 1px solid var(--border);
  box-shadow: var(--lift);
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out), border-color .3s;
}
.ui .tile::before { display: none; }
.ui .tile::after {
  content: ''; position: absolute; width: 110px; height: 110px; right: -45px; top: -50px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--tile-accent) 24%, transparent), transparent);
  transition: transform .5s var(--ease-out), opacity .4s;
  opacity: .9;
}
.ui .tile > * { position: relative; z-index: 1; }
.ui .tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--lift-hover);
  border-color: color-mix(in oklab, var(--tile-accent) 35%, var(--border));
}
.ui .tile:hover::after { transform: scale(1.4); opacity: 1; }
.tile__top { display: flex; align-items: center; gap: 8px; }
.tile__icon {
  width: 28px; height: 28px; flex: none; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--tile-accent);
  background: color-mix(in oklab, var(--tile-accent) 14%, transparent);
  transition: transform .45s var(--ease-spring);
}
.tile__icon svg { width: 15px; height: 15px; }
.ui .tile:hover .tile__icon { transform: rotate(-8deg) scale(1.1); }
.ui .tile__label { font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--ink-soft); }
.ui .tile__value {
  font-size: clamp(22px, 1.8vw, 27px); font-weight: 800; letter-spacing: -.035em;
  margin-top: 9px; line-height: 1; font-variant-numeric: tabular-nums;
}
.ui .tile__sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tile__meter {
  height: 4px; border-radius: 99px; margin-top: 8px; overflow: hidden;
  background: color-mix(in oklab, var(--tile-accent) 14%, var(--surface-2));
}
.tile__meter span {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in oklab, var(--tile-accent) 60%, #fff), var(--tile-accent));
  transition: width 1.3s var(--ease-out) .25s;
}

/* ============================================================= sections */
.ui .section {
  font-size: 19px; font-weight: 750; letter-spacing: -.025em; text-transform: none;
  color: var(--text); margin: 44px 2px 16px; align-items: center; gap: 12px;
}
.ui .section::before {
  content: ''; width: 10px; height: 10px; border-radius: 3px; flex: none; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--brand-gold), var(--series-1));
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--series-1) 12%, transparent);
}
.ui .section::after {
  content: ''; flex: 1 1 40px; height: 1px; order: 3;
  background: linear-gradient(90deg, var(--border-firm), transparent);
}
.ui .section__hint { font-size: 12.5px; font-weight: 400; letter-spacing: 0; color: var(--muted); order: 2; }

/* ================================================================ cards */
.ui .card {
  position: relative; overflow: hidden;
  border-radius: var(--r-card); padding: 20px 22px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border); box-shadow: var(--lift);
  transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out), border-color .3s;
}
/* a hairline of brand colour along the top edge, brightening on hover */
.ui .card::before {
  content: ''; position: absolute; left: 22px; right: 22px; top: 0; height: 2px; border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, var(--series-1), var(--brand-gold));
  opacity: .0; transform: scaleX(.3); transition: opacity .4s, transform .6s var(--ease-out);
}
.ui .card:hover::before { opacity: 1; transform: none; }
.ui .card:hover {
  transform: translateY(-4px);
  box-shadow: var(--lift-hover);
  border-color: color-mix(in oklab, var(--series-1) 20%, var(--border));
}
.ui .card__head { margin-bottom: 16px; align-items: center; }
.ui .card__head h2 {
  font-size: 15.5px; font-weight: 700; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 11px;
}
.ui .card__head h2:not(:has(.card__icon))::before {
  content: ''; width: 8px; height: 8px; border-radius: 2px; flex: none; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--series-1), var(--brand-gold));
}
.card__icon {
  width: 34px; height: 34px; flex: none; border-radius: 11px;
  display: grid; place-items: center;
  color: var(--series-1);
  background: linear-gradient(135deg, color-mix(in oklab, var(--series-1) 16%, transparent), color-mix(in oklab, var(--brand-gold) 12%, transparent));
  transition: transform .45s var(--ease-spring);
}
.card__icon svg { width: 17px; height: 17px; }
.ui .card:hover .card__icon { transform: rotate(-8deg) scale(1.08); }
.ui .card__note { font-size: 12.5px; margin-top: 5px; color: var(--muted); }
.ui .card__body { flex: 1 1 auto; }
.ui .card__foot { border-top-color: var(--hairline); margin-top: auto; }
.ui .card__foot .btn {
  color: var(--series-1); font-weight: 600; text-decoration: none; padding: 9px; border-radius: 11px;
}
.ui .card__foot .btn:hover { background: color-mix(in oklab, var(--series-1) 8%, transparent); color: var(--series-1); }

/* segmented chart switch: a pill with a solid active segment */
.ui .seg { background: color-mix(in oklab, var(--surface-2) 90%, transparent); border-radius: 11px; padding: 3px; }
.ui .seg button {
  border-radius: 8px; padding: 5px 12px; font-weight: 550; font-size: 12px;
  transition: background .25s var(--ease-out), color .2s, box-shadow .25s var(--ease-out), transform .15s;
}
.ui .seg button:active { transform: scale(.94); }
.ui .seg button[aria-pressed="true"] {
  background: var(--card-bg); color: var(--series-1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 12px -4px rgba(13, 39, 64, .25);
}

/* =============================================================== charts */
.ui .c-track { fill: color-mix(in oklab, var(--series-1) 7%, var(--surface-2)); }
.ui .c-area { fill: url(#c-area-grad); }
.ui .c-area-stop-top { stop-color: var(--series-1); stop-opacity: .28; }
.ui .c-area-stop-bot { stop-color: var(--series-1); stop-opacity: 0; }
.ui .c-line { stroke-width: 2.5; }
.ui .c-grid { stroke-dasharray: 3 4; }
.ui .c-label { font-size: 12px; fill: var(--ink-soft); }
.ui .c-value { font-weight: 700; }
.ui .card svg:hover .c-grow-x, .ui .card svg:hover .c-bar { filter: saturate(1.15) brightness(1.04); }

.ui .donut { gap: 28px; }
.ui .donut__fig { filter: drop-shadow(0 10px 18px rgba(13, 39, 64, .14)); }
.ui .donut__total { font-size: 30px; font-weight: 800; letter-spacing: -.035em; animation: popIn .7s var(--ease-spring) .35s both; }
.ui .legend { gap: 4px; }
.ui .legend li {
  padding: 7px 10px; margin: 0 -10px; border-radius: 10px;
  transition: background .2s, transform .25s var(--ease-out);
  animation: fadeUp .55s var(--ease-out) both;
}
.ui .legend li:hover { background: var(--surface-2); transform: translateX(3px); }
.ui .legend li:nth-child(2) { animation-delay: 60ms; }
.ui .legend li:nth-child(3) { animation-delay: 120ms; }
.ui .legend li:nth-child(4) { animation-delay: 180ms; }
.ui .legend li:nth-child(5) { animation-delay: 240ms; }
.ui .legend li:nth-child(6) { animation-delay: 300ms; }
.ui .legend__swatch { width: 12px; height: 12px; border-radius: 4px; }
.ui .legend__val { font-weight: 700; }
.ui .statline__value { font-size: 48px; font-weight: 800; letter-spacing: -.04em; animation: popIn .7s var(--ease-spring) both; }

/* tooltip: frosted, springs in */
.ui .tooltip {
  border-radius: 12px; padding: 10px 13px;
  background: color-mix(in oklab, var(--card-bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-color: var(--border);
  box-shadow: 0 16px 36px -14px rgba(13, 39, 64, .4);
  transition: opacity .15s, transform .2s var(--ease-out);
  transform: translate(-50%, calc(-100% + 5px));
}
.ui .tooltip.is-on { transform: translate(-50%, -100%); }

/* =============================================================== tables */
.ui table { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.ui th {
  font-size: 10.5px; font-weight: 650; letter-spacing: .07em; color: var(--muted);
  padding: 9px 10px; border-bottom: 0;
  background: color-mix(in oklab, var(--surface-2) 80%, transparent);
}
.ui th:first-child { border-radius: 10px 0 0 10px; }
.ui th:last-child { border-radius: 0 10px 10px 0; }
.ui td { padding: 11px 10px; border-bottom: 1px solid var(--hairline); }
.ui td.num, .ui th.num { padding-right: 10px; }
.ui tbody tr { transition: background .2s; }
.ui tbody tr:hover td { background: color-mix(in oklab, var(--series-1) 6%, transparent); }
.ui tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--series-1); }
.ui .score-chip {
  border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 700;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .14), 0 4px 10px -6px rgba(0, 0, 0, .4);
}
.ui [data-card="recent"] .card__body { max-height: 520px; }
/* narrow list cards: let names wrap so the score column never gets cut off */
.ui .grid--tables td:first-child { white-space: normal; min-width: 120px; }
.ui [data-card="recent"] td:nth-child(3) { white-space: normal; min-width: 130px; }
.ui [data-card="recent"] th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
.ui [data-card] .card__body tbody tr { animation: rowIn .5s var(--ease-out) both; }
.ui [data-card] .card__body tbody tr:nth-child(n+2)  { animation-delay: 40ms; }
.ui [data-card] .card__body tbody tr:nth-child(n+3)  { animation-delay: 80ms; }
.ui [data-card] .card__body tbody tr:nth-child(n+4)  { animation-delay: 120ms; }
.ui [data-card] .card__body tbody tr:nth-child(n+5)  { animation-delay: 160ms; }
.ui [data-card] .card__body tbody tr:nth-child(n+6)  { animation-delay: 200ms; }
.ui [data-card] .card__body tbody tr:nth-child(n+8)  { animation-delay: 260ms; }
.ui [data-card] .card__body tbody tr:nth-child(n+12) { animation-delay: 320ms; }
.ui .card__body::-webkit-scrollbar { width: 8px; height: 8px; }
.ui .card__body::-webkit-scrollbar-thumb { background: var(--border-firm); border-radius: 8px; }
.ui .empty { padding: 34px 8px; font-size: 13.5px; }
.ui .banner { border-radius: 14px; }

/* =========================================================== chart motion */
.c-grow-x { transform-box: fill-box; transform-origin: 0 50%;
            animation: growX .9s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 55ms + 100ms); }
.c-grow-y { transform-box: fill-box; transform-origin: 50% 100%;
            animation: growY .8s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 18ms + 100ms); }
.c-fade   { animation: fadeIn .6s ease both; animation-delay: calc(var(--i, 0) * 55ms + 550ms); }
.c-sweep  { transform-box: view-box; transform-origin: 50% 50%;
            animation: sweep .9s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms + 80ms); }
.c-draw   { animation: draw 1.6s cubic-bezier(.65, 0, .35, 1) .2s both; }
.c-pop    { transform-box: fill-box; transform-origin: 50% 50%; animation: popIn .6s var(--ease-spring) .3s both; }

.reveal:not(.is-in) .c-anim, .reveal:not(.is-in) tbody tr, .reveal:not(.is-in) .legend li { animation-play-state: paused; }
.calm .c-anim, .calm tbody tr, .calm .legend li, .calm .donut__total, .calm .statline__value { animation: none !important; }

/* ========================================================= scroll reveal */
.reveal {
  opacity: 0; transform: translateY(22px) scale(.98);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }
.ui .card.reveal.is-in, .ui .tile.reveal.is-in {
  transition: opacity .8s var(--ease-out) var(--d, 0ms), transform .4s var(--ease-out), box-shadow .4s var(--ease-out), border-color .3s;
}

/* ============================================================ keyframes */
@keyframes growX  { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes growY  { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes rowIn  { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes popIn  { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@keyframes sweep  { from { opacity: 0; transform: rotate(-70deg) scale(.82); } to { opacity: 1; transform: none; } }
@keyframes draw   { from { stroke-dasharray: 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }
@keyframes heroIn { from { opacity: 0; transform: translateY(-10px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes railIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes sheen  { 0% { transform: translateX(-100%); } 45%, 100% { transform: translateX(100%); } }
@keyframes ping   { 0% { transform: scale(.6); opacity: .9; } 80%, 100% { transform: scale(1.8); opacity: 0; } }

/* ========================================================= small screens */
@media (max-width: 1000px) {
  .ui.app { grid-template-columns: 1fr; }
  .ui .side { margin: 0; top: 0; height: 100dvh; border-radius: 0 24px 24px 0; animation: none; }
  .ui .appbar { padding-top: 14px; }
  .ui .appbar h1 { font-size: 22px; }
}
@media (max-width: 640px) {
  .hero { border-radius: 20px; }
  .hero::after { width: 200px; height: 200px; right: -50px; top: -50px; }
  .ui .tiles { gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui .tile { padding: 14px; }
  .ui .card { padding: 16px 14px 12px; }
  .ui .filters { position: static; }
}

/* ================================================ reduced motion and print */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .hero::before, .hero::after, .live-dot::after, .loadbar { animation: none !important; }
}
@media print {
  .reveal { opacity: 1 !important; transform: none !important; }
  .hero, .loadbar { display: none !important; }
  .ui .tiles { margin-top: 0; }
  .c-anim, tbody tr, .legend li { animation: none !important; }
}

/* =====================================================================
   v3 — structural redesign: pill filters, numbered sections, meter lists,
   ranked lists, the answer feed. Everything below overrides the above.
   ===================================================================== */

/* ------------------------------------------------- pill-style filter fields */
.ui .filters { gap: 10px; align-items: center; padding: 10px; }
.ui .filters .field {
  flex-direction: row; align-items: center; gap: 0;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
  padding-left: 12px; height: 40px;
  transition: border-color .2s, box-shadow .2s;
}
.ui .filters .field:hover { border-color: color-mix(in oklab, var(--series-1) 40%, var(--border)); }
.ui .filters .field:focus-within { border-color: var(--series-1); box-shadow: var(--ring); }
.ui .filters .field .label {
  margin: 0; padding-right: 8px; white-space: nowrap;
  font-size: 10.5px; letter-spacing: .07em; color: var(--muted);
  border-right: 1px solid var(--border);
}
.ui .filters .field .input {
  border: 0; background: transparent; box-shadow: none; height: 38px; padding: 0 10px; min-width: 0;
  font-weight: 550; color: var(--text); cursor: pointer;
}
.ui .filters .field .input:focus { box-shadow: none; }
.ui .filters .field--grow { flex: 1 1 200px; max-width: 320px; }
.ui .filters input[type="date"] { width: 138px; }
.ui .filters__presets { height: 40px; align-items: center; }
.ui .filters .btn--primary { height: 40px; padding: 0 22px; margin-left: auto; }

/* ------------------------------------------------------ numbered sections */
.ui .wrap.home { counter-reset: sect; }
.ui .section { counter-increment: sect; }
.ui .section::before {
  content: counter(sect, decimal-leading-zero);
  width: auto; height: auto; transform: none; box-shadow: none; border-radius: 8px;
  padding: 3px 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #fff;
  background: linear-gradient(135deg, var(--brand-navy-soft), var(--brand-navy));
}

/* ------------------------------------------------------------ meter lists */
.mlist { display: grid; gap: 14px; padding: 2px 0 4px; }
.mrow {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 8px; margin: -6px -8px; border-radius: 12px;
  transition: background .2s;
  animation: fadeUp .5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms + 80ms);
}
.mrow:hover, .mrow:focus-visible { background: color-mix(in oklab, var(--series-1) 6%, transparent); outline: none; }
.mrow__main { flex: 1 1 auto; min-width: 0; }
.mrow__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mrow__name { font-size: 13px; font-weight: 550; color: var(--text); line-height: 1.35; overflow-wrap: break-word; }
.mrow__val { font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.01em; flex: none; }
.mrow__track {
  position: relative; height: 8px; margin-top: 7px; border-radius: 99px; overflow: hidden;
  background: color-mix(in oklab, var(--series-1) 8%, var(--surface-2));
}
.mrow__fill {
  position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in oklab, var(--c) 55%, #fff), var(--c));
  transform-origin: 0 50%;
  animation: growX 1s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms + 200ms);
}
.mrow__fill::after {     /* a soft moving glint on hover */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: translateX(-100%);
}
.mrow:hover .mrow__fill::after { animation: glint .9s ease; }
.mrow__meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.mrow__rank {
  width: 28px; height: 28px; flex: none; border-radius: 9px; display: grid; place-items: center;
  font-size: 12px; font-weight: 750; color: var(--ink-soft); background: var(--surface-2);
}
.mrow:nth-child(1) .mrow__rank { background: linear-gradient(135deg, #ffd65a, var(--brand-gold)); color: #4a3500; }
.mrow:nth-child(2) .mrow__rank { background: linear-gradient(135deg, #e9edf2, #c4ccd6); color: #39424e; }
.mrow:nth-child(3) .mrow__rank { background: linear-gradient(135deg, #f1c8a4, #d29a6b); color: #4a2a10; }
.mrow__avatar {
  width: 36px; height: 36px; flex: none; border-radius: 12px; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 750; color: #fff;
  background: linear-gradient(135deg, var(--series-1), var(--brand-navy));
  box-shadow: 0 6px 14px -8px color-mix(in oklab, var(--series-1) 90%, transparent);
}
.mrow__val .score-chip { font-size: 12px; }
.mlist .mrow:has(.mrow__val .score-chip) .mrow__top { align-items: center; }

/* ------------------------------------------------------------------- feed */
.feed { display: grid; gap: 10px; }
.feed__item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start;
  padding: 14px; border-radius: 16px;
  border: 1px solid var(--border); background: color-mix(in oklab, var(--surface-2) 35%, var(--card-bg));
  position: relative; overflow: hidden;
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out), border-color .3s;
  animation: fadeUp .55s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms + 80ms);
}
.feed__item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c);
}
.feed__item:hover { transform: translateX(4px); box-shadow: var(--lift); border-color: color-mix(in oklab, var(--c) 40%, var(--border)); }
.feed__score {
  width: 54px; height: 54px; border-radius: 15px; display: grid; place-content: center; text-align: center;
  color: #fff; background: linear-gradient(135deg, color-mix(in oklab, var(--c) 70%, #fff), var(--c));
  box-shadow: 0 10px 20px -12px var(--c);
}
.feed__score b { font-size: 19px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.feed__score small { font-size: 9px; opacity: .85; letter-spacing: .04em; margin-top: 3px; }
.feed__body { min-width: 0; }
.feed__title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.feed__meta { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: pre-wrap; }
.feed__answers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.feed__ans {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px;
  font-size: 11.5px; font-weight: 550; color: var(--text-2);
  background: var(--card-bg); border: 1px solid var(--border);
  transition: transform .2s var(--ease-out), border-color .2s;
}
.feed__ans:hover { transform: translateY(-2px); border-color: var(--c); }
.feed__ans i {
  font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 750; color: #fff; background: var(--c);
}
.feed__time { text-align: right; display: grid; gap: 2px; }
.feed__time b { font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; }
.feed__time small { font-size: 11.5px; color: var(--muted); }
.ui [data-card="recent"] .card__body { max-height: 640px; overflow-y: auto; padding-right: 4px; }

/* ----------------------------------------------------------- vertical bars */
.ui .c-bar { fill: url(#c-bar-grad); }
.ui .c-bar-stop-top { stop-color: var(--series-1); }
.ui .c-bar-stop-bot { stop-color: color-mix(in oklab, var(--series-1) 45%, #fff); }

/* lists and the feed follow the same pause / calm rules as the charts */
.reveal:not(.is-in) .mrow, .reveal:not(.is-in) .mrow__fill, .reveal:not(.is-in) .feed__item { animation-play-state: paused; }
.calm .mrow, .calm .mrow__fill, .calm .feed__item { animation: none !important; }

@keyframes glint { to { transform: translateX(100%); } }

@media (max-width: 640px) {
  .ui .filters .field, .ui .filters .field--grow { flex: 1 1 100%; max-width: none; }
  .ui .filters input[type="date"] { width: 100%; }
  .ui .filters .btn--primary { width: 100%; margin-left: 0; }
  .feed__item { grid-template-columns: auto 1fr; }
  .feed__time { grid-column: 2; text-align: left; display: flex; gap: 8px; }
}
@media print { .mrow, .mrow__fill, .feed__item { animation: none !important; } }


/* ------------------------------------------------- shared fixes (all pages) */
.ui a.btn { text-decoration: none; }
/* a secondary action in the toolbar reads as a button, not a stray link */
.ui .filters .btn--ghost {
  height: 40px; padding: 0 16px; font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--card-bg); border: 1px solid var(--border);
}
.ui .filters .btn--ghost:hover { border-color: var(--series-1); color: var(--series-1); background: var(--card-bg); }
.ui .filters .btn--ghost + .btn--primary { margin-left: 0; }
/* tables wrap their text instead of running off the card's right edge */
.ui .card__body td { white-space: normal; overflow-wrap: break-word; }
.ui .card__body td.num, .ui .card__body th.num, .ui .card__body td .score-chip { white-space: nowrap; overflow-wrap: normal; }
.ui .card__body td.wrap-cell { min-width: 0; }
.ui .card__body th, .ui .card__body td { padding-left: 8px; padding-right: 8px; }
.ui .card__body th:first-child, .ui .card__body td:first-child { padding-left: 4px; }
/* QR sheet cards pick up the card language */
.ui .qr-card { border-radius: 14px; border-style: solid; border-color: var(--border); background: var(--card-bg); box-shadow: var(--lift); }
.ui .qr-card--clickable:hover { transform: translateY(-3px); box-shadow: var(--lift-hover); border-color: color-mix(in oklab, var(--series-1) 35%, var(--border)); }
.ui .qr-modal__box { border-radius: 22px; }
.ui .page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.03em; }

/* ------------------------------------------------ phone: stacked table rows */
/* a 6–8 column table cannot fit 360px without breaking words or scrolling, so
   each row becomes a small block: "LABEL ……… value" per cell */
@media (max-width: 640px) {
  .ui table.stackable, .ui table.stackable tbody, .ui table.stackable tr, .ui table.stackable td { display: block; width: 100%; }
  .ui table.stackable thead { display: none; }
  .ui table.stackable tr {
    padding: 10px 12px; margin-bottom: 10px; border-radius: 14px;
    border: 1px solid var(--border); background: color-mix(in oklab, var(--surface-2) 35%, var(--card-bg));
  }
  .ui table.stackable td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
    padding: 5px 0 !important; border: 0; text-align: right; white-space: normal;
  }
  .ui table.stackable td::before {
    content: attr(data-label); flex: none; text-align: left;
    font-size: 10.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  }
  .ui table.stackable tbody tr:hover td { background: none; box-shadow: none; }
}

/* ------------------------------------------- dense card (long lists, e.g. the
   day's 200+ lessons): tighter cells so more rows fit on a screen */
.ui .card--dense { padding: 14px 16px 10px; }
.ui .card--dense .card__head { margin-bottom: 10px; }
.ui .card--dense table { font-size: 12.5px; line-height: 1.35; }
.ui .card--dense .card__body th { padding: 6px 8px; }
.ui .card--dense .card__body td { padding: 5px 8px; }
.ui .card--dense .card__body th:first-child, .ui .card--dense .card__body td:first-child { padding-left: 6px; }
/* pair number and time never wrap — "08:00–09:20" on two lines doubles every row */
.ui .card--dense .card__body td:nth-child(-n+2) { white-space: nowrap; }
