@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Solid 6 digit hex only. FinAlc dark language: near black, inset lit cards, monochrome with teal and red for change. */
:root {
  --page: #080808;
  --side-bg: #0A0A0A;
  --card: #0E0E0E;
  --raise: #141414;
  --chip: #141414;
  --sel: #1A1A1A;
  --border: #1E1F22;
  --line2: #2A2A2A;
  --text: #F2F2F2;
  --text2: #D4D4D4;
  --muted: #8A8A90;
  --faint: #5A5A60;
  --accent: #F2F2F2;
  --accent-hover: #FFFFFF;
  --accent-strong: #D4D4D4;
  --accent-soft: #1A1A1A;
  --on-accent: #080808;
  --up: #6FC9BE;
  --down: #E1393E;
  --hover: #161616;
  --grid: #1E1F22;
  --cardsh: inset 0 0 0 1px #1C1C1C, inset 0 0 26px #212121, inset 0 0 14px #141414;
  --cardsh2: inset 0 0 0 1px #2A2A2A, inset 0 0 26px #262626, inset 0 0 14px #181818;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --radius: 21px;
  --radius-sm: 11px;
  --side: 240px;
  --gap: 12px;
  --chart-h: 280px;
  --chart-short-h: 210px;
  --kpi-size: 30px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: "Geist", sans-serif;
  font-size: 14.5px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

button, select, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--text2); outline-offset: 2px; border-radius: 8px; }

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.side {
  width: var(--side);
  flex: 0 0 var(--side);
  border-right: 1px solid var(--border);
  background: var(--side-bg);
  padding: 16px 10px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 10px 6px; font-size: 16.5px; font-weight: 600; letter-spacing: -0.04em; }
/* Astora mark: spins in once on load and turns a full turn on hover, settling with a small overshoot. */
.logo { flex: 0 0 auto; display: block; fill: var(--text); animation: logo-in 1.4s cubic-bezier(0.34, 1.25, 0.64, 1) both; transition: transform 1.1s cubic-bezier(0.34, 1.25, 0.64, 1); }
.brand:hover .logo { transform: rotate(360deg); }
@keyframes logo-in { from { opacity: 0; transform: rotate(-200deg) scale(0.6); } }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 13.5px;
  text-decoration: none;
  isolation: isolate;
  transition: color 0.25s ease;
}
/* The lit card behind a nav item springs in on hover and stays on the current page. */
.nav a::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--card); box-shadow: var(--cardsh);
  opacity: 0; transform: scale(0.97);
  transition: opacity 0.3s ease, transform 0.45s var(--spring);
}
.nav a { gap: 10px; }
.nav .ico { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a.sub { padding-left: 30px; font-size: 13px; }
.nav a.sub .ico { width: 14px; height: 14px; }
/* Icons draw themselves in on load, one link after the other. On hover each one acts out what it stands for
   (FinAlc style micro animations): parts move, then settle with a small overshoot. */
.nav .ico { overflow: visible; --m: cubic-bezier(0.34, 1.3, 0.64, 1); --o: cubic-bezier(0.32, 0.72, 0, 1); }
.nav .ico path, .nav .ico circle, .nav .ico rect { stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.nav:not(.drawn) .ico path, .nav:not(.drawn) .ico circle, .nav:not(.drawn) .ico rect { animation: ico-draw 1.1s cubic-bezier(0.65, 0, 0.35, 1) both; }
.nav .ico g, .nav .ico path, .nav .ico circle, .nav .ico rect { transform-box: view-box; transform-origin: 12px 12px; transition: transform 0.5s var(--m), opacity 0.3s ease; }
.nav a:nth-child(1) .ico * { animation-delay: 0.1s; } .nav a:nth-child(2) .ico * { animation-delay: 0.16s; } .nav a:nth-child(3) .ico * { animation-delay: 0.22s; }
.nav a:nth-child(4) .ico * { animation-delay: 0.28s; } .nav a:nth-child(5) .ico * { animation-delay: 0.34s; } .nav a:nth-child(6) .ico * { animation-delay: 0.4s; }
.nav a:nth-child(7) .ico * { animation-delay: 0.46s; } .nav a:nth-child(8) .ico * { animation-delay: 0.52s; } .nav a:nth-child(9) .ico * { animation-delay: 0.58s; }
.nav a:nth-child(10) .ico * { animation-delay: 0.64s; }
@keyframes ico-draw { from { stroke-dashoffset: 1; } }

/* overview: the tiles swap sizes, one after the other */
@keyframes tileA { 0%, 100% { transform: none; } 45% { transform: scale(0.72); } }
.nav .ico[data-a="overview"] rect { transform-box: fill-box; transform-origin: center; }
.nav a:hover .ico[data-a="overview"] .t1 { animation: tileA 0.55s var(--m); }
.nav a:hover .ico[data-a="overview"] .t2 { animation: tileA 0.55s var(--m) 0.07s; }
.nav a:hover .ico[data-a="overview"] .t3 { animation: tileA 0.55s var(--m) 0.14s; }
.nav a:hover .ico[data-a="overview"] .t4 { animation: tileA 0.55s var(--m) 0.21s; }

/* players: the front person steps forward, the one behind slides out to the side */
.nav a:hover .ico[data-a="players"] .pf { transform: translate(-1px, -1.5px); }
.nav a:hover .ico[data-a="players"] .pb { transform: translate(2.5px, 0.5px); transition-delay: 0.05s; }

/* players online: the waves ping out from the dot, inner then outer, while hovered */
@keyframes wave { 0% { opacity: 0; transform: scale(0.55); } 35% { opacity: 1; } 70%, 100% { opacity: 0; transform: scale(1.08); } }
@keyframes dotbeat { 0%, 100% { transform: none; } 20% { transform: scale(1.5); } }
.nav a:hover .ico[data-a="online"] .w1 path { animation: wave 1.3s var(--o) infinite; }
.nav a:hover .ico[data-a="online"] .w2 path { animation: wave 1.3s var(--o) 0.18s infinite; }
.nav a:hover .ico[data-a="online"] .dot { animation: dotbeat 1.3s var(--m) infinite; }

/* sources: the compass needle swings back, then spins round to the next direction */
@keyframes needle { 0% { transform: none; animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1); } 28% { transform: rotate(-50deg); animation-timing-function: cubic-bezier(0.34, 1.2, 0.64, 1); } 100% { transform: rotate(180deg); } }
.nav a:hover .ico[data-a="sources"] .nd { animation: needle 0.95s forwards; }

/* revenue: the dollar flips like a coin and the S is redrawn */
@keyframes flip { 0% { transform: none; } 100% { transform: rotateY(360deg); } }
@keyframes redraw { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
.nav a:hover .ico[data-a="revenue"] .coin { animation: flip 0.8s cubic-bezier(0.65, 0, 0.35, 1); }
.nav a:hover .ico[data-a="revenue"] .s { animation: redraw 0.7s cubic-bezier(0.65, 0, 0.35, 1) 0.1s both; }

/* economy: the two coins pull apart, then the front one lands back with a bounce */
.nav a:hover .ico[data-a="economy"] .cf { transform: translate(-1.5px, -1.5px); }
.nav a:hover .ico[data-a="economy"] .cb { transform: translate(1.5px, 1.5px); transition-delay: 0.05s; }

/* events: the rings hop one after the other and the day dots come in */
@keyframes hop { 0%, 100% { transform: none; } 40% { transform: translateY(-2.5px); } }
@keyframes dots { 0% { stroke-dashoffset: 1; } 100% { stroke-dashoffset: 0; } }
.nav a:hover .ico[data-a="events"] .r1 { animation: hop 0.5s var(--m); }
.nav a:hover .ico[data-a="events"] .r2 { animation: hop 0.5s var(--m) 0.08s; }
.nav a:hover .ico[data-a="events"] .day { animation: dots 0.6s var(--o) 0.1s both; }

/* gameplay: the swords clash twice */
@keyframes clashA { 0%, 100% { transform: none; } 25% { transform: rotate(-14deg); } 50% { transform: rotate(4deg); } 70% { transform: rotate(-8deg); } }
@keyframes clashB { 0%, 100% { transform: none; } 25% { transform: rotate(14deg); } 50% { transform: rotate(-4deg); } 70% { transform: rotate(8deg); } }
.nav a:hover .ico[data-a="gameplay"] .s1 { animation: clashA 0.7s var(--m); }
.nav a:hover .ico[data-a="gameplay"] .s2 { animation: clashB 0.7s var(--m); }

/* health: a bright beat runs along the line, over and over */
.nav .ico[data-a="health"] .base { opacity: 1; }
.nav .ico[data-a="health"] .beat { opacity: 0; }
@keyframes beat { 0% { stroke-dashoffset: 1.4; } 100% { stroke-dashoffset: -0.4; } }
.nav a:hover .ico[data-a="health"] .base { opacity: 0.35; }
.nav a:hover .ico[data-a="health"] .beat { opacity: 1; stroke-dasharray: 0.4 1.4; animation: beat 1.1s cubic-bezier(0.45, 0, 0.55, 1) infinite; }

/* insights: the bulb lights up and its rays come out */
.nav .ico[data-a="insights"] .rays path { opacity: 0; stroke-dashoffset: 1; }
.nav .ico[data-a="insights"] .bulb { transition: fill 0.4s ease, transform 0.5s var(--m); fill: transparent; }
@keyframes ray { 0% { opacity: 0; stroke-dashoffset: 1; } 100% { opacity: 1; stroke-dashoffset: 0; } }
.nav a:hover .ico[data-a="insights"] .bulb { fill: #3A3A3A; }
.nav a:hover .ico[data-a="insights"] .rays path { animation: ray 0.45s var(--o) both; }
.nav a:hover .ico[data-a="insights"] .rays path:nth-child(2) { animation-delay: 0.05s; }
.nav a:hover .ico[data-a="insights"] .rays path:nth-child(3) { animation-delay: 0.1s; }
.nav a:hover .ico[data-a="insights"] .rays path:nth-child(4) { animation-delay: 0.15s; }
.nav a:hover { color: var(--text); }
.nav a:hover::before { opacity: 0.55; transform: none; }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"]::before { opacity: 1; transform: none; }
.side-foot { margin-top: auto; padding: 0 12px; color: var(--faint); font-size: 12px; line-height: 1.6; }
.side-foot b { color: var(--text2); font-weight: 500; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.side-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.btn.btn-small { height: 28px; padding: 0 11px; font-size: 12px; border-radius: 9px; flex: 0 0 auto; }

/* Main: uses the whole width; only running text has a line length cap. */
main { flex: 1; min-width: 0; padding: 22px clamp(16px, 3vw, 40px) 90px; position: relative; isolation: isolate; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; margin-bottom: 14px; flex-wrap: wrap; }
.top h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.04em; margin: 0; }
.top-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.export-status { margin: 0 0 10px; color: var(--muted); font-size: 14px; max-width: 75ch; }
.export-status:empty { display: none; }
.range, .seg.mode { display: inline-flex; background: var(--card); box-shadow: var(--cardsh); border: 0; border-radius: 13px; padding: 3px; margin: 0; gap: 2px; }
.range button, .seg.mode button {
  border: 0;
  background: transparent;
  color: var(--muted);
  height: 30px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.range button:hover, .seg.mode button:hover { color: var(--text); }
.range button[aria-pressed="true"], .seg.mode button[aria-pressed="true"] { background: var(--sel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }

/* Export split button */
.split { position: relative; display: inline-flex; }
.split .split-main { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.split .split-arrow { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; padding: 0 12px; display: inline-flex; align-items: center; }
.split .split-arrow path { stroke: var(--text); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 290px;
  background: var(--card); box-shadow: var(--cardsh2); border-radius: 16px; padding: 6px;
  animation: pop 0.35s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text);
  padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 13.5px;
}
.menu button small { display: block; color: var(--muted); font-size: 12px; }
.menu button:hover, .menu button:focus-visible { background: var(--sel); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.filters:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--raise); box-shadow: inset 0 0 0 1px var(--line2); border: 0; border-radius: 9px;
  padding: 4px 6px 4px 12px; font-size: 12.5px; font-weight: 500; color: var(--text2);
}
.chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 999px; font-size: 15px; }
.chip button:hover { color: var(--text); }

.lead { color: var(--text2); font-size: 15px; max-width: 75ch; margin: 0 0 4px; text-wrap: pretty; }
.lead b, .summary b { color: var(--text); font-weight: 600; }

/* Page grid: phone 1 column, laptop 2, wide screens 3 or 4. */
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-flow: row dense; gap: var(--gap); align-items: stretch; }
.page-grid > .kpis, .page-grid > .lead, .page-grid > .note, .page-grid > .empty { align-self: start; }
.page-grid > .wide, .page-grid > .kpis, .page-grid > .lead, .page-grid > .empty, .page-grid > .note { grid-column: 1 / -1; }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.kpi {
  background: var(--card); border: 0; box-shadow: var(--cardsh); border-radius: 16px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px; text-align: left; color: var(--text); min-width: 0;
  transition: box-shadow 0.3s ease, transform 0.45s var(--spring);
}
button.kpi { cursor: pointer; font: inherit; }
button.kpi:hover { box-shadow: var(--cardsh2); transform: translateY(-1px); }
.kpi .v { order: 2; font-size: clamp(20px, 1.9vw, var(--kpi-size)); font-weight: 500; letter-spacing: -0.05em; line-height: 1.1; overflow-wrap: anywhere; margin-top: 4px; }
.kpi .l { order: 1; color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .c, .kpi .as-of { order: 3; }
.kpi .c { font-size: 12px; color: var(--faint); }
.kpi .c.pace { order: 4; color: var(--muted); }
.kpi.stale .v { color: var(--muted); }
.kpi .as-of { font-size: 12px; color: var(--faint); }
/* The big number of a section, above its chart (joins per day). */
.headline { display: flex; flex-direction: column; gap: 2px; margin: 0 0 12px; }
.headline .v { font-size: var(--kpi-size); font-weight: 500; letter-spacing: -0.05em; line-height: 1.1; }
.headline .l { color: var(--muted); font-size: 12.5px; }

/* Sections */
.section {
  position: relative;
  background: var(--card);
  border: 0;
  box-shadow: var(--cardsh);
  border-radius: var(--radius);
  padding: 18px 20px;
  scroll-margin-top: 16px;
  transition: box-shadow 0.4s ease;
  min-width: 0;
  container-type: inline-size;
  animation: rise 0.95s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.99); } }
/* Everything comes in one after the other: title, KPI cards, then each card of the page. */
.top h1 { animation: fade-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
.top-tools { animation: fade-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.08s backwards; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
.kpi { animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
.kpi:nth-child(1) { animation-delay: 0.05s; } .kpi:nth-child(2) { animation-delay: 0.1s; } .kpi:nth-child(3) { animation-delay: 0.15s; } .kpi:nth-child(4) { animation-delay: 0.2s; }
.kpi:nth-child(5) { animation-delay: 0.25s; } .kpi:nth-child(6) { animation-delay: 0.3s; } .kpi:nth-child(7) { animation-delay: 0.35s; } .kpi:nth-child(8) { animation-delay: 0.4s; }
.page-grid > .section:nth-child(1) { animation-delay: 0.1s; } .page-grid > .section:nth-child(2) { animation-delay: 0.2s; } .page-grid > .section:nth-child(3) { animation-delay: 0.28s; }
.page-grid > .section:nth-child(4) { animation-delay: 0.36s; } .page-grid > .section:nth-child(5) { animation-delay: 0.44s; } .page-grid > .section:nth-child(6) { animation-delay: 0.52s; }
.page-grid > .section:nth-child(7) { animation-delay: 0.6s; } .page-grid > .section:nth-child(8) { animation-delay: 0.66s; } .page-grid > .section:nth-child(n+9) { animation-delay: 0.72s; }
.section.flash { box-shadow: var(--cardsh2), inset 0 0 0 1px #5A5A60; }
.section h2 { font-size: 13.5px; font-weight: 500; color: var(--text2); letter-spacing: -0.01em; margin: 0 0 4px; }
.summary { color: var(--muted); margin: 0 0 14px; font-size: 13px; max-width: 75ch; text-wrap: pretty; }
.summary b { color: var(--text); }
.section h3 { font-size: 13px; font-weight: 500; color: var(--text); margin: 18px 0 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 32px; }

/* Charts */
.chart { position: relative; width: 100%; height: var(--chart-h); margin: 6px 0 8px; touch-action: pan-y; }
.chart.short { height: var(--chart-short-h); }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .grid line.base { stroke: var(--line2); stroke-dasharray: none; }
.chart .axis text { fill: var(--faint); font-size: 11px; }
.chart .axis-title { fill: var(--faint); font-size: 11px; }
.chart .vlabel { font-size: 11.5px; font-weight: 500; paint-order: stroke; stroke: var(--card); stroke-width: 4px; }
.chart .nodata { fill: var(--faint); font-size: 10.5px; }
.chart .cross { stroke: var(--line2); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .halo { opacity: 0.18; }
.chart .bar { transition: opacity 0.2s ease; }
.chart .bar.grow { transform-box: fill-box; transform-origin: 50% 100%; animation: barup 1.05s cubic-bezier(0.34, 1.2, 0.64, 1) both; }
.chart .reveal { animation: reveal 1.9s cubic-bezier(0.65, 0, 0.35, 1) 0.2s both; }
@keyframes barup { from { transform: scaleY(0); opacity: 0; } 30% { opacity: 1; } }
@keyframes reveal { from { clip-path: inset(-24px 100% -24px -24px); } to { clip-path: inset(-24px -120px -24px -24px); } }
.chart .hit { fill: transparent; cursor: default; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; color: var(--text2); font-size: 12px; font-weight: 500; margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 9px; background: var(--raise); box-shadow: inset 0 0 0 1px var(--line2); }
.legend i { display: inline-block; width: 7px; height: 7px; border-radius: 3px; }
.legend.toggle button { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: 9px; background: var(--raise); box-shadow: inset 0 0 0 1px var(--line2); color: inherit; font: inherit; cursor: pointer; }
.legend.toggle button.off { opacity: 0.4; }
.legend.toggle button.off i { background: var(--line2) !important; }
@media (max-width: 860px) { #export-split, #export-status { display: none !important; } }

.hbars { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 8px; }
.hbar {
  display: grid; grid-template-columns: minmax(90px, 180px) minmax(0, 1fr) auto; align-items: center; gap: 12px;
  border: 0; background: transparent; padding: 6px 8px; border-radius: 10px; text-align: left; width: 100%; color: var(--text2); font-size: 13px;
  transition: background-color 0.2s ease;
}
button.hbar { cursor: pointer; }
button.hbar:hover { background: var(--hover); }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { display: block; height: 6px; background: var(--hover); border-radius: 9px; overflow: hidden; }
.hbar .fill { display: block; height: 100%; background: var(--muted); border-radius: 9px; transform-origin: left; animation: grow 1.2s cubic-bezier(0.34, 1.15, 0.64, 1) 0.2s both; }
.hbar.focus .fill { background: var(--text); }
.hbar .val { min-width: 100px; text-align: right; font-weight: 500; font-size: 12.5px; color: var(--text); }
@keyframes grow { from { transform: scaleX(0); } }

/* First hour funnel */
.funnel { display: flex; flex-direction: column; margin: 8px 0 16px; }
.fstep { padding: 8px 6px; border-radius: var(--radius-sm); outline: none; }
.fstep:hover, .fstep:focus-visible { background: var(--hover); }
.fhead { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.fname { font-weight: 500; font-size: 14px; }
.fnums { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.fnums b { color: var(--text); font-size: 16px; font-weight: 500; letter-spacing: -0.03em; }
.fbar { display: flex; justify-content: center; background: var(--hover); border-radius: 10px; height: 22px; box-shadow: inset 0 0 0 1px var(--border); }
.ffill { display: block; height: 100%; background: var(--text2); border-radius: 10px; animation: grow 1.2s cubic-bezier(0.34, 1.15, 0.64, 1) 0.2s both; transform-origin: center; }
.fstep.drop .ffill { background: var(--down); }
.fstep.drop .fname { color: var(--down); }
.fgap { display: flex; justify-content: center; color: var(--muted); font-size: 14px; padding: 4px 0; text-align: center; }
.fgap.drop { color: var(--down); font-weight: 600; }
.fwhy { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.fstep.untracked .fnums { color: var(--text); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 0 12px; height: 44px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 12px; height: 36px; }
th:first-child, td:first-child { text-align: left; }
td:first-child { white-space: normal; min-width: 110px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--hover); }
tbody td { transition: background-color 0.15s ease; }
tbody tr:hover td { background: var(--hover); }
tbody tr.selected td { background: var(--sel); }
td.muted, .muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.kv td:first-child { color: var(--muted); }
.kv td { padding: 0 12px; height: 40px; }
.kv td:last-child { font-weight: 500; }

.empty {
  border: 1px dashed var(--line2);
  border-radius: 14px;
  padding: 16px 18px;
  color: var(--muted);
  font-size: 13px;
}
.empty strong { display: block; color: var(--text); font-weight: 500; margin-bottom: 2px; }
.note { color: var(--faint); font-size: 12px; margin: 10px 0 0; max-width: 75ch; }

.insight { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.insight:last-child { border-bottom: 0; }
.insight p { margin: 0; max-width: 90ch; text-wrap: pretty; }
.insight .tag { color: var(--muted); font-size: 14px; margin-right: 8px; }
.insight a { color: var(--text); white-space: nowrap; text-decoration: none; font-size: 15px; }
.insight a:hover { color: var(--accent-hover); text-decoration: underline; }

.btn {
  border: 0; background: var(--raise); box-shadow: inset 0 0 0 1px var(--line2); color: var(--text2);
  height: 36px; border-radius: 11px; padding: 0 14px; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { background: var(--sel); color: var(--text); box-shadow: inset 0 0 0 1px #373737; }
.btn[disabled] { color: var(--muted); cursor: default; }
.btn-primary { background: var(--accent); box-shadow: none; color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); box-shadow: none; }

/* Compare tool */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 24px; margin-bottom: 12px; }
.compare fieldset { border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px 14px; margin: 0; min-width: 0; }
.compare legend { color: var(--muted); font-size: 13.5px; padding: 0 6px; }
.compare label { display: block; font-size: 13.5px; color: var(--muted); margin-top: 8px; }
.compare input, .compare select {
  display: block; width: 100%; margin-top: 4px; background: var(--page); border: 1px solid var(--line2); border-radius: 10px;
  height: 36px; padding: 0 10px; color: var(--text); color-scheme: dark;
}
.compare input:focus, .compare select:focus { outline: 2px solid var(--text2); outline-offset: 0; border-color: var(--text2); }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.login .brand { padding: 0; }
.login-card { display: flex; flex-direction: column; gap: 10px; padding: 26px 24px; margin: 0; }
.login-card h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.login-lead { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.login-card label { font-size: 14px; color: var(--text); font-weight: 500; }
.login-card input {
  background: var(--page); border: 1px solid var(--line2); border-radius: 12px;
  padding: 11px 14px; font-size: 16px; color: var(--text); width: 100%;
}
.login-card input:focus { outline: 2px solid var(--text2); outline-offset: 1px; border-color: var(--text2); }
.login-error { margin: 0; color: var(--down); font-size: 14.5px; }
.login-card .btn { margin-top: 8px; font-size: 14px; height: 42px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin-bottom: 12px; border-radius: 13px; background: var(--raise); box-shadow: inset 0 0 0 1px var(--border); }
.seg button { border: 0; background: transparent; color: var(--muted); border-radius: 10px; height: 28px; padding: 0 12px; cursor: pointer; font-size: 12.5px; font-weight: 500; transition: color 0.2s ease, background-color 0.2s ease; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--sel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }

.tip {
  position: fixed; z-index: 30; pointer-events: none;
  background: var(--card); box-shadow: var(--cardsh2), 0 12px 32px #000000; border-radius: 14px;
  padding: 10px 12px; font-size: 12.5px; min-width: 170px;
}
.tip .t { color: var(--text2); font-weight: 500; font-size: 12px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.tip .r { display: flex; justify-content: space-between; align-items: center; gap: 18px; line-height: 1.7; }
.tip .r span:last-child { font-weight: 500; color: var(--text); }
.tip .r span:first-child { color: var(--muted); }

.loading { color: var(--muted); padding: 24px 0; }
.view { transition: opacity 0.2s ease; }
.view.busy { opacity: 0.5; }

/* KPI rows: one even row on laptops and up, two even rows in between, never a lone card on a second line. */
@media (min-width: 861px) and (max-width: 1099px) {
  .kpis.n3, .kpis.n5, .kpis.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.n4, .kpis.n7, .kpis.n8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .kpis.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis.n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpis.n6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpis.n7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .kpis.n8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .kpis.n7 .kpi, .kpis.n8 .kpi { padding: 14px 14px; }
}
/* Seven or eight cards in one row on a laptop: labels can take two lines, so every label keeps two lines and the numbers line up. */
@media (min-width: 1100px) and (max-width: 1399px) {
  .kpis.n7 .kpi .l, .kpis.n8 .kpi .l { min-height: 2.7em; line-height: 1.35; }
}
/* Laptop: two columns. */
@media (min-width: 1000px) {
  .page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-grid > .span-2 { grid-column: span 2; }
}
/* Wide screens: three columns, larger numbers, charts and text. */
@media (min-width: 1600px) {
  html, body { font-size: 16.5px; }
  :root { --gap: 14px; --chart-h: 340px; --chart-short-h: 250px; --kpi-size: 36px; }
  main { padding: 30px 40px 80px; }
  .page-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page-grid > .span-2 { grid-column: span 2; }
  .chart .axis text, .chart .vlabel { font-size: 12px; }
}
/* Very wide screens: four columns. */
@media (min-width: 2300px) {
  html, body { font-size: 17.5px; }
  :root { --chart-h: 400px; --chart-short-h: 290px; --kpi-size: 42px; }
  .page-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .page-grid > .span-2 { grid-column: span 2; }
}

/* Phone: one column. */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .side {
    width: auto; height: auto; flex: 0 0 auto; position: sticky; top: 0; z-index: 15; background: var(--side-bg);
    flex-direction: row; align-items: center; padding: 10px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0; flex: 0 0 auto; }
  .side .brand span { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  .nav a, .nav a.sub { white-space: nowrap; height: 34px; padding: 0 12px; font-size: 13px; }
  .side-foot { display: none; }
  .side-user { padding: 0; border: 0; flex: 0 0 auto; }
  .side-user span { display: none; }
  main { padding: 16px 16px 56px; }
  :root { --gap: 10px; --chart-h: 230px; --chart-short-h: 190px; --kpi-size: 24px; }
  .top h1 { font-size: 23px; }
  .top-tools { width: 100%; }
  .range, .seg.mode { width: 100%; }
  .range button, .seg.mode button { flex: 1; padding: 0 2px; font-size: 12.5px; }
  .split { width: 100%; }
  .split .split-main { flex: 1; }
  .menu { left: 0; right: 0; min-width: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.n3 > :last-child, .kpis.n5 > :last-child, .kpis.n7 > :last-child { grid-column: span 2; }
  .section { padding: 16px 14px; border-radius: 18px; }
  table { font-size: 13px; }
  th, td { padding: 0 7px; }
  .hbar { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .hbar .track { grid-column: 1 / -1; grid-row: 2; }
  .hbar .val { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Per-day charts: the days of the selected range when the chart shows more (at least 30 days). Solid colors, no glow. */
.chart .inrange { fill: var(--hover); }
.chart .inrange-edge { stroke: var(--line2); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .inrange-label { fill: var(--faint); font-size: 11px; }

/* Dot beams at the top and bottom of every page, as on finalc.io: dot columns that fade in towards the edge,
   a slow flicker, and a light travelling along each column from the centre out. Built once by app.js. */
.beams {
  position: absolute; left: 0; right: 0; height: 300px; z-index: -1; pointer-events: none; overflow: hidden; opacity: 0.34;
}
.beams-bottom { bottom: 0; }
/* The sidebar gets its own quieter beams, behind the nav at the top and the footer at the bottom. */
.side { isolation: isolate; }
.side .beams { height: 190px; opacity: 0.22; }
.side .beams-top { height: 150px; opacity: 0.18; }
.beams-top { top: 0; transform: scaleY(-1); height: 240px; opacity: 0.28; }
.beams-cols { position: absolute; inset: 0; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.beams-dots { position: absolute; inset: 0; background-repeat: repeat; animation: beams-flicker 4s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
.beams-pulse { position: absolute; inset: 0; overflow: hidden; mix-blend-mode: screen; -webkit-mask-repeat: repeat; mask-repeat: repeat; }
.beams-col { position: absolute; top: 0; bottom: 0; }
.beams-light {
  position: absolute; left: 0; right: 0; top: 0; height: 56%; opacity: 0; will-change: transform, opacity;
  background: linear-gradient(to bottom, #000000 0%, #404040 25%, #FFFFFF 50%, #404040 75%, #000000 100%);
  animation: beams-pulse 6.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes beams-flicker { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes beams-pulse {
  0% { transform: translateY(150%); opacity: 0; }
  10.55% { opacity: 1; }
  70.3% { opacity: 1; }
  87.88% { transform: translateY(-82.1%); opacity: 0; }
  100% { transform: translateY(-82.1%); opacity: 0; }
}
@media (max-width: 860px) { .beams { display: none; } }
