/* Litter to Registration. Colours come from akc.org: navy, a lighter blue, and coral for what is
   lost. Gold is reserved for "a year earlier" wherever it appears (dashed lines, ticks, chips). */
@font-face { font-family: "Figtree"; src: url("/fonts/Figtree-Variable.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
    --ink: #14213D; --muted: #5B6478; --line: #E1E6EF; --canvas: #F4F6FA; --surface: #FFFFFF; --subtle: #EEF1F6;
    --side: #0B1F4B; --side-line: rgba(255, 255, 255, .1); --side-text: #C3CDE3;
    --navy: #003594; --blue: #0A84D6; --blue-soft: #E5F2FC; --coral: #F0503F; --coral-ink: #B42C1D; --coral-soft: #FDE9E6;
    --gold: #E8A317; --gold-ink: #7A5200; --gold-soft: #FDF3DC; --green-ink: #12715B; --green-soft: #E1F4EE;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(20, 33, 61, .05), 0 10px 28px -16px rgba(20, 33, 61, .2);
    --shadow-lift: 0 2px 4px rgba(20, 33, 61, .06), 0 18px 36px -18px rgba(20, 33, 61, .32);
    --ease: cubic-bezier(.2, .8, .2, 1);
    --side-w: 256px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
table, .chart, .funnel { font-feature-settings: "tnum" 1; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.icon { flex: none; }
.empty { padding: 28px; color: var(--muted); text-align: center; }

/* Shell */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 18px 14px 14px; overflow-y: auto; color: var(--side-text);
    background: radial-gradient(120% 60% at 0% 0%, rgba(10, 132, 214, .28), transparent 60%), var(--side); }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand__mark { display: flex; align-items: flex-end; gap: 3px; width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .1); flex: none; }
.brand__mark i { flex: 1; border-radius: 2px; background: #fff; height: 100%; }
.brand__mark i:nth-child(2) { background: #9DB7E6; height: 72%; }
.brand__mark i:nth-child(3) { background: var(--gold); height: 46%; }
.brand__name { color: #fff; font-weight: 680; font-size: 15.5px; letter-spacing: -.01em; line-height: 1.2; }
.brand__name small { display: block; font-weight: 450; font-size: 12.5px; color: var(--side-text); margin-top: 2px; }
.side__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side__label { font-size: 12px; color: #8FA0C4; padding: 18px 10px 6px; }
.side__item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; transition: background .15s, color .15s; }
.side__item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side__item.is-active { background: #fff; color: var(--side); font-weight: 620; }
.side__count { margin-left: auto; font-size: 12px; font-weight: 700; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 99px; background: var(--gold); color: #3A2600; }
.viewer { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 14px 8px 4px; border-top: 1px solid var(--side-line); font-size: 12px; line-height: 1.3; }
.viewer b { display: block; color: #fff; font-size: 13.5px; font-weight: 600; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; flex: none; }

.stage { display: flex; flex-direction: column; min-width: 0; }
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; min-height: 60px; padding: 10px 32px; background: color-mix(in srgb, var(--canvas) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.bar__title strong { font-weight: 680; margin-right: 4px; }
.main { flex: 1; padding: 26px 32px 40px; max-width: 1520px; width: 100%; }
.main > * { animation: rise .28s var(--ease) both; }
.foot { padding: 0 32px 22px; color: var(--muted); font-size: 12.5px; }

/* Atoms */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 540; line-height: 1.4; background: var(--surface); border: 1px solid var(--line); color: #34405C; white-space: nowrap; }
.chip--gold { background: var(--gold-soft); border-color: transparent; color: var(--gold-ink); }
.chip--blue { background: var(--blue-soft); border-color: transparent; color: #0A5C99; }
.chip--red { background: var(--coral-soft); border-color: transparent; color: var(--coral-ink); }
.chip--green { background: var(--green-soft); border-color: transparent; color: var(--green-ink); }
.chip--sample { background: transparent; border-style: dashed; color: var(--muted); }
.chip--button { cursor: pointer; white-space: normal; text-align: left; padding: 6px 12px; transition: border-color .15s, background .15s; }
.chip--button:hover { border-color: var(--blue); background: var(--blue-soft); color: #0A5C99; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 15px; border-radius: 10px; border: 1px solid transparent; background: var(--navy); color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; transition: transform .12s var(--ease), background .15s; }
.button:hover { background: #00287A; }
.button:active { transform: scale(.97); }
.button--quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.button--quiet:hover { background: var(--subtle); }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.icon-button:hover { background: var(--subtle); color: var(--ink); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: #E6EAF2; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 8px; font-size: 13.5px; font-weight: 560; color: #46506A; transition: background .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 33, 61, .14); }
.select { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.select select { appearance: none; padding: 7px 30px 7px 11px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); font-size: 14px; max-width: 250px; cursor: pointer;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235B6478' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-size: 12.5px; padding: 2px 7px; border-radius: 7px; background: var(--subtle); white-space: nowrap; }
.delta.is-up { background: var(--green-soft); color: var(--green-ink); }
.delta.is-down { background: var(--coral-soft); color: var(--coral-ink); }
.legend { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--muted); }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 8px; }
.sw:first-child { margin-left: 0; }
.sw--worse2 { background: #F7A097; } .sw--worse { background: #FBD3CE; } .sw--better { background: #CFE0F7; } .sw--better2 { background: #6E94D6; }
.sw--tick { width: 3px; height: 14px; border-radius: 1px; background: var(--gold); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin-top: 4px; max-width: 72ch; }
.controls__filters, .hero__filters { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.block { padding: 20px 22px; margin-bottom: 18px; }
.block__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 18px; align-items: start; }
.split--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.scroll { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }

/* Funnel hero: the one dark surface */
.hero { padding: 26px 30px 18px; border-radius: 18px; color: #fff; margin-bottom: 18px; box-shadow: var(--shadow-lift);
    background: radial-gradient(90% 120% at 100% 0%, rgba(10, 132, 214, .45), transparent 55%), linear-gradient(180deg, #0B2A6B, #061B47); }
.hero__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.hero h1 { font-size: 28px; }
.hero p { color: #C3CDE3; margin-top: 4px; }
.hero .select { color: #C3CDE3; }
.hero .select select { background-color: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23C3CDE3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
.hero .select option { color: var(--ink); }
.funnel { width: 100%; height: auto; display: block; max-height: 380px; font-family: inherit; }
.fn-count { font-size: 25px; font-weight: 720; fill: #fff; letter-spacing: -.02em; }
.fn-label { font-size: 13px; fill: #C3CDE3; }
.fn-share { font-size: 17px; font-weight: 700; fill: var(--side); }
.fn-drop { font-size: 12.5px; font-weight: 600; fill: #FFB4AB; }
.fn-note { font-size: 11.5px; font-weight: 550; fill: #3C4A6B; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.kpi__label { font-size: 13.5px; color: var(--muted); min-height: 2.8em; line-height: 1.4; }
.kpi__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.kpi__row b { font-size: 31px; font-weight: 720; letter-spacing: -.03em; line-height: 1; }
.kpi__foot { display: flex; align-items: center; gap: 8px 12px; font-size: 12.5px; flex-wrap: wrap; }
.spark { width: 120px; height: auto; flex: none; }
.bullet { position: relative; height: 8px; border-radius: 99px; background: var(--subtle); }
.bullet i { display: block; height: 100%; border-radius: 99px; background: var(--navy); }
.bullet i.is-under { background: var(--coral); }
.bullet b { position: absolute; top: -4px; bottom: -4px; width: 3px; border-radius: 2px; background: var(--ink); }

.losses { display: flex; flex-direction: column; gap: 2px; }
.loss { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(60px, 1fr) 92px; gap: 12px; align-items: center; padding: 9px 8px; border-radius: 10px; transition: background .15s; }
.loss:hover { background: var(--subtle); }
.loss__name { font-weight: 600; line-height: 1.25; }
.loss__name small, .loss__n small { display: block; font-weight: 450; font-size: 12px; color: var(--muted); }
.loss__bar { height: 10px; border-radius: 99px; background: var(--subtle); overflow: hidden; }
.loss__bar i { display: block; height: 100%; border-radius: 99px; background: var(--coral); }
.loss__n { text-align: right; font-weight: 700; font-feature-settings: "tnum" 1; }
.loss--static:hover { background: transparent; }
.loss__bar.is-gain i { background: var(--navy); }
.bridge__ends { display: flex; align-items: center; gap: 18px; margin: 2px 0 14px; padding: 14px 16px; border-radius: 12px; background: var(--subtle); }
.bridge__ends span { font-size: 26px; font-weight: 720; letter-spacing: -.02em; line-height: 1.1; }
.bridge__ends small { display: block; font-size: 12.5px; font-weight: 450; letter-spacing: 0; color: var(--muted); margin-bottom: 3px; }
.bridge__arrow { color: var(--muted); }
.note { margin-top: 12px; font-size: 13px; color: var(--muted); max-width: 70ch; }

/* Charts and tables */
.chart { width: 100%; max-width: 900px; height: auto; display: block; font-family: inherit; }
.ch-label { font-size: 12.5px; fill: #34405C; }
.ch-value { font-size: 12.5px; font-weight: 700; fill: var(--ink); }
.ch-tick { font-size: 11.5px; fill: var(--muted); }
.ch-end { font-size: 13px; font-weight: 700; }
.ch-end-name { font-size: 11.5px; font-weight: 500; fill: var(--muted); }
.ch-grid { stroke: #E4E8F0; stroke-width: 1; }
.ch-down { fill: var(--coral-ink); font-weight: 650; } .ch-up { fill: var(--green-ink); font-weight: 650; }
.tm-state { font-size: 13px; font-weight: 700; } .tm-value { font-size: 11.5px; font-weight: 550; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th, .grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.grid thead th { font-size: 12.5px; font-weight: 560; color: var(--muted); background: var(--subtle); border-bottom: 0; }
.grid thead th:first-child { border-radius: 9px 0 0 9px; } .grid thead th:last-child { border-radius: 0 9px 9px 0; }
.grid th:first-child, .grid td.is-text { text-align: left; }
.grid tbody th { font-weight: 600; }
.grid tbody tr:hover td, .grid tbody tr:hover th { background: #F7F9FC; }
.grid tbody tr:last-child th, .grid tbody tr:last-child td { border-bottom: 0; }
.grid td.is-empty { background: repeating-linear-gradient(135deg, transparent 0 5px, #EEF1F6 5px 6px); }
.grid td.is-worse { background: #FBD3CE; } .grid td.is-worse2 { background: #F7A097; font-weight: 650; } .grid td.is-better { background: #CFE0F7; }
.rate { min-width: 170px; }
.rate__track { position: relative; display: inline-block; vertical-align: middle; width: 90px; height: 8px; border-radius: 99px; background: var(--subtle); margin-right: 10px; }
.rate__track i { display: block; height: 100%; border-radius: 99px; background: var(--navy); }
.rate__track b { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; border-radius: 2px; background: var(--gold); }
.rate__v { display: inline-block; min-width: 46px; font-weight: 650; }
.stackbar { display: flex; height: 26px; border-radius: 9px; overflow: hidden; margin: 10px 0 14px; }
.stackbar i { display: block; height: 100%; }
.stackbar__key { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13.5px; color: var(--muted); }
.stackbar__key span { display: inline-flex; align-items: center; gap: 7px; }
.stackbar__key i { width: 11px; height: 11px; border-radius: 3px; }
.stackbar__key b { color: var(--ink); font-weight: 680; }

/* Worklist */
.plays { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.play { text-align: left; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.play:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.play.is-active { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(0, 53, 148, .14), var(--shadow); }
.play h2 { font-size: 16px; margin-top: 6px; }
.play dl { align-items: end; }
.play dd { font-size: 19px !important; }
.play p { font-size: 13.5px; }
.play dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.play dt { font-size: 12.5px; color: var(--muted); }
.play dd { font-size: 21px; font-weight: 720; letter-spacing: -.02em; }
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(11, 31, 75, .5); backdrop-filter: blur(3px); animation: fade .2s; }
.modal { position: fixed; z-index: 60; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(620px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow: auto; background: #fff; border-radius: 18px; padding: 22px 24px; box-shadow: var(--shadow-lift); animation: pop .22s var(--ease); }
.modal header, .modal footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal header { margin-bottom: 16px; }
.modal footer { margin-top: 18px; }
.modal footer .muted { margin-right: auto; font-size: 13px; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--canvas); font-size: 14px; line-height: 1.5; resize: vertical; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 70; padding: 10px 16px; border-radius: 11px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 550; box-shadow: var(--shadow-lift); }

/* Ask */
.ask { margin-bottom: 18px; }
.ask label { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 14px; }
.ask__row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--muted); transition: border-color .15s, box-shadow .15s; }
.ask__row:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(10, 132, 214, .16); }
.ask__row input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); padding: 8px 0; }
.ask__try { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.understood { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; }

/* Sources */
.flow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 22px; align-items: center; }
.flow__col { display: flex; flex-direction: column; gap: 8px; }
.flow__node { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--canvas); font-weight: 620; line-height: 1.3; }
.flow__node small { display: block; font-weight: 450; font-size: 12.5px; color: var(--muted); }
.flow__node--out { background: var(--blue-soft); border-color: transparent; }
.mono { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.flow__node--out .mono { background: var(--blue); }
.flow__mid { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.flow__app { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 26px 22px; border-radius: 18px; color: #fff; background: linear-gradient(180deg, #0B2A6B, #061B47); box-shadow: var(--shadow-lift); max-width: 220px; }
.flow__app small { color: #C3CDE3; font-size: 12.5px; line-height: 1.35; }

.skeleton { display: flex; flex-direction: column; gap: 18px; }
.skeleton__hero, .skeleton__row i, .skeleton__block { display: block; border-radius: var(--radius); background: linear-gradient(90deg, #E8ECF3 25%, #F4F6FA 50%, #E8ECF3 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton__hero { height: 300px; } .skeleton__row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; } .skeleton__row i { height: 110px; } .skeleton__block { height: 280px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 1180px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split, .split--even { grid-template-columns: minmax(0, 1fr); }
    .plays { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .flow { grid-template-columns: minmax(0, 1fr); }
    .flow__mid { justify-content: center; }
    .flow__arrows { transform: rotate(90deg); }
}
@media (max-width: 860px) {
    :root { --side-w: 0px; }
    .app { grid-template-columns: minmax(0, 1fr); }
    .side { position: static; height: auto; padding: 12px; }
    .side__nav { flex-direction: row; flex-wrap: wrap; }
    .side__label, .viewer { display: none; }
    .bar, .main, .foot { padding-left: 16px; padding-right: 16px; }
    .hero { padding: 20px 16px 12px; }
    .hero h1 { font-size: 22px; }
    .plays { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .kpis { grid-template-columns: minmax(0, 1fr); }
    .kpi__row { flex-wrap: wrap; }
    .spark { width: 96px; }
}
