/* Algity (named 2026-11-02, with its logo: teal "Alg", white "ity", a blue-to-green spark).
   Apple-style (George 2026-11-02: "prettier, more intelligent looking, Apple style"): the system font, hairlines
   instead of borders. Teal is for things you can press, the spark's green is for money, everything else is grey. */
/* The light theme stays soft (George 2026-11-02: "some sort of white... not bright white, something kinder to the
   eye"): off-white groups on a cool grey, never pure white. Shapes are generously round ("apple style, nintendo kind
   of round"). Colours follow the Algity logo (George 2026-11-02: "recolor the website in similar aesthetics"). */
:root {
  --canvas: #e8eced;
  --surface: #f6f8f8;
  --raised: #fbfcfc;
  --fill: rgba(96, 110, 114, 0.13);
  --fill-soft: rgba(96, 110, 114, 0.075);
  --ink: #1c2124;
  --ink-2: #5e686c;
  --ink-3: #879094;
  --hairline: rgba(28, 40, 44, 0.1);
  --accent: #08776e;
  --accent-soft: rgba(10, 165, 150, 0.12);
  --on-accent: #ffffff;
  --brand: linear-gradient(180deg, #12c9b5, #0a8f84);
  --money: #2f7d17;
  --money-soft: rgba(116, 210, 70, 0.17);
  --warn: #b25000;
  --warn-soft: rgba(255, 149, 0, 0.14);
  --bad: #d70015;
  --bad-soft: rgba(255, 59, 48, 0.11);
  --violet: #8944ab;
  --violet-soft: rgba(175, 82, 222, 0.12);
  --sidebar: rgba(224, 230, 231, 0.78);
  --shadow-group: 0 1px 2px rgba(20, 40, 40, 0.04), 0 6px 22px rgba(20, 40, 40, 0.06);
  --shadow-pop: 0 14px 44px rgba(20, 40, 40, 0.16), 0 0 0 0.5px rgba(20, 40, 40, 0.08);
  --ring: 0 0 0 4px rgba(10, 165, 150, 0.28);
  --r-group: 20px;
  --r-control: 11px;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23646b77' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --magnifier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.6' fill='none' stroke='%238b919c' stroke-width='1.6'/%3E%3Cpath d='m10.5 10.5 3.2 3.2' stroke='%238b919c' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* Dark mode, chosen with the switch in the sidebar (George 2026-11-02: "implement dark mode to the entire app. We need
   a switch"): the charcoal of the Algity logo, with its bright teal. */
:root[data-theme="dark"] {
  --canvas: #121314;
  --surface: #1b1c1e;
  --raised: #242628;
  --fill: rgba(150, 162, 164, 0.18);
  --fill-soft: rgba(150, 162, 164, 0.09);
  --ink: #eef0f0;
  --ink-2: #a4abad;
  --ink-3: #7b8385;
  --hairline: rgba(255, 255, 255, 0.08);
  --accent: #1fd8c3;
  --accent-soft: rgba(31, 216, 195, 0.14);
  --on-accent: #062a26;
  --brand: linear-gradient(180deg, #22e6cf, #0aa596);
  --money: #82e05e;
  --money-soft: rgba(130, 224, 94, 0.14);
  --warn: #ffb340;
  --warn-soft: rgba(255, 179, 64, 0.15);
  --bad: #ff6b61;
  --bad-soft: rgba(255, 107, 97, 0.16);
  --violet: #c78bf0;
  --violet-soft: rgba(199, 139, 240, 0.17);
  --sidebar: rgba(25, 26, 28, 0.86);
  --shadow-group: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 22px rgba(0, 0, 0, 0.22);
  --shadow-pop: 0 14px 44px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  --ring: 0 0 0 4px rgba(31, 216, 195, 0.32);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23a3a7b2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --magnifier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.6' fill='none' stroke='%237b808c' stroke-width='1.6'/%3E%3Cpath d='m10.5 10.5 3.2 3.2' stroke='%237b808c' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  color-scheme: dark;
}
/* The Algity wordmark (views/ui.tsx Wordmark): teal "Alg", "ity" in the ink colour, the spark as the dot of the i. */
.wordmark { display: inline-flex; align-items: baseline; font-size: 27px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.1; white-space: nowrap; }
.wm-alg { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wm-ity { color: var(--ink); }
.wm-i { position: relative; }
.wm-i::before { content: ''; position: absolute; left: 50%; top: 0.1em; width: 0.27em; height: 0.19em; transform: translateX(-42%) skewX(-24deg); border-radius: 0.035em; background: linear-gradient(60deg, #1e8fff, #22d3c0 60%, #86e35a); box-shadow: 0 0 0.28em rgba(34, 211, 192, 0.45); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.008em;
  color: var(--ink);
  background: var(--canvas);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
/* Video and link codes are names people type (mc34), so they read as text in a soft pill, not as program code. */
code { font: inherit; font-size: 0.86em; font-weight: 500; font-variant-numeric: tabular-nums; background: var(--fill-soft); color: var(--ink); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; background: var(--fill-soft); padding: 14px 16px; border-radius: 16px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 10px 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
main:focus { box-shadow: none; }
::selection { background: var(--accent-soft); }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 60; padding: 10px 16px; border-radius: 980px; background: var(--accent); color: var(--on-accent); transform: translateY(-200%); font-weight: 600; }
.skip-link:focus { transform: none; }

/* ---------- shell ---------- */
/* One centred block, like a Mac app window, with the canvas showing on both sides (George 2026-11-02: "what if the
   app becomes tighter, smaller and we have empty space left and right"; then "wider a bit"). The sidebar floats as a
   rounded panel. */
.shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 10px; max-width: 1440px; margin: 0 auto; padding: 0 14px; min-height: 100vh; }
.sidebar {
  position: sticky; top: 14px; height: calc(100vh - 28px); height: calc(100dvh - 28px); margin: 14px 0; overflow-y: auto;
  display: flex; flex-direction: column; padding: 16px 8px 14px;
  background: var(--sidebar); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  border: 0.5px solid var(--hairline); border-radius: 20px; box-shadow: var(--shadow-group);
}
.brand { display: block; padding: 2px 10px 18px; line-height: 1; color: inherit; }
.brand:hover { text-decoration: none; }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sidebar li a { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 12px; border-radius: 999px; color: var(--ink); font-size: 14px; font-weight: 500; }
.sidebar li a:hover { background: var(--fill-soft); text-decoration: none; }
.sidebar li a.active { background: var(--fill); font-weight: 600; }
.nav-icon { width: 17px; height: 17px; flex: none; color: var(--accent); }
.badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 980px; background: #ff3b30; color: #fff; font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; padding: 14px 11px 0; display: grid; gap: 4px; }
.workspace-name { color: var(--ink-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout { margin: 0; }
main { padding: 26px 18px 56px; width: 100%; min-width: 0; container-type: inline-size; }

/* ---------- page header: a large title, the period on the right ---------- */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.page-header h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; position: relative; margin: 0; }

/* Segmented control: radio buttons that submit on change (app.js data-autosubmit). */
.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--fill); gap: 0; border: 0; margin: 0; min-width: 0; }
.segmented legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; min-height: 0; }
.segmented span { display: block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.segmented input:checked + span { background: var(--raised); font-weight: 600; box-shadow: 0 1px 4px rgba(30, 40, 60, 0.14), 0 0 0 0.5px rgba(30, 40, 60, 0.05); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }

.custom-range > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 999px; background: var(--fill); font-size: 13px; font-weight: 500; }
.custom-range > summary::-webkit-details-marker { display: none; }
.custom-range > summary::after { content: ''; width: 10px; height: 10px; background: var(--chevron) no-repeat center / 10px; }
.custom-range[open] > div { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 340px; padding: 16px; border-radius: 22px; background: var(--raised); box-shadow: var(--shadow-pop); }
.custom-range[open] button { grid-column: 1 / -1; }

.demo-banner { display: flex; gap: 10px; align-items: center; padding: 10px 18px; border-radius: 20px; margin-bottom: 22px; background: var(--warn-soft); color: var(--ink); font-size: 13px; }
.demo-banner b { color: var(--warn); }
.flash { padding: 11px 18px; border-radius: 20px; margin-bottom: 20px; font-size: 14px; font-weight: 500; }
.flash.ok { background: var(--money-soft); }
.flash.error { background: var(--bad-soft); color: var(--bad); }

/* ---------- controls ---------- */
input, select, textarea, button, .button { font: inherit; letter-spacing: inherit; }
input, select, textarea {
  color: var(--ink); background: var(--fill-soft); border: 0.5px solid var(--hairline); border-radius: var(--r-control);
  padding: 7px 12px; min-height: 34px; max-width: 100%; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); box-shadow: var(--ring); border-color: transparent; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input[type="checkbox"], input[type="radio"] { min-height: 0; accent-color: var(--accent); width: 16px; height: 16px; }
input[type="search"] { -webkit-appearance: none; appearance: none; border-radius: 999px; padding-left: 34px; background: var(--fill-soft) var(--magnifier) no-repeat 13px center / 15px; min-width: min(280px, 100%); }
select { -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 32px; background: var(--fill-soft) var(--chevron) no-repeat right 11px center / 11px; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  min-height: 32px; padding: 6px 15px; border-radius: 980px; border: 0;
  background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 500;
}
.button:hover { text-decoration: none; }
button:hover:not(:disabled), .button:hover { filter: brightness(1.08); }
button:active:not(:disabled) { filter: brightness(0.94); }
button:disabled { opacity: 0.4; cursor: default; }
button.secondary, .button.secondary { background: var(--fill); color: var(--ink); }
button.danger { background: transparent; color: var(--bad); padding-inline: 0; }
button.small, .button.small { min-height: 28px; padding: 4px 12px; font-size: 13px; }
.link-button { background: none; color: var(--accent); padding: 4px 0; min-height: 0; border-radius: 0; font-weight: 500; }
.link-button:hover { filter: none; text-decoration: underline; }
.copy { background: var(--fill); color: var(--accent); min-height: 26px; padding: 3px 11px; font-size: 12.5px; font-weight: 500; vertical-align: middle; white-space: nowrap; }
.copy.copied { background: var(--money-soft); color: var(--money); }
.copy-manual { display: block; width: 100%; margin-top: 8px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; cursor: pointer; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px 18px; align-items: end; }
.grid-form label, .stack label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.grid-form label.check-inline { display: flex; color: var(--ink); }
.grid-form .wide { grid-column: 1 / -1; }
.grid-form > button { justify-self: start; }
.stack { display: grid; gap: 12px; margin-top: 12px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
input.narrow { width: 120px; }
input.tiny { width: 56px; }
.prefix-input { display: flex; align-items: center; border-radius: var(--r-control); background: var(--fill-soft); border: 0.5px solid var(--hairline); padding-left: 12px; }
.prefix-input > span { color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.prefix-input input { border: 0; background: transparent; padding-left: 1px; box-shadow: none; }
.prefix-input:focus-within { box-shadow: var(--ring); background: var(--surface); }
.prefix-input input:focus { box-shadow: none; background: transparent; }

/* ---------- groups ---------- */
.card { background: var(--surface); border-radius: var(--r-group); box-shadow: var(--shadow-group); padding: 18px 20px; margin-bottom: 14px; min-width: 0; overflow-wrap: break-word; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; letter-spacing: -0.015em; }
.card-head .sub { color: var(--ink-2); font-size: 13px; }
.card h3 { font-size: 15px; margin-bottom: 8px; }
.card-title, .card .card-title { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.table-card { padding: 16px 0 4px; }
.table-card > .card-head, .table-card > .empty, .table-card > .pager, .table-card > .subs-note, .table-card > .note,
.table-card > .toolbar, .live-results > .card-head, .live-results > .empty, .live-results > .pager { margin-left: 20px; margin-right: 20px; }
.table-card > .subs-note { margin: -4px 20px 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; align-items: start; }
.grid-1-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 20px; margin-bottom: 20px; }
.grid-2 > .card, .grid-1-2 > .card { margin-bottom: 0; }
@container (max-width: 760px) { .grid-2, .grid-1-2 { grid-template-columns: minmax(0, 1fr); } }

/* Headline numbers: one group, hairlines between them. */
/* Two to a row on narrow screens, one row when there's room; a hairline between neighbours. */
.kpis, .stat-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; background: var(--surface); border-radius: var(--r-group); box-shadow: var(--shadow-group); padding: 14px 0; margin-bottom: 14px; }
.kpi, .stat { padding: 2px 18px; min-width: 0; }
.kpi:nth-child(even), .stat:nth-child(even) { box-shadow: -0.5px 0 0 var(--hairline); }
@container (min-width: 760px) {
  .kpis, .stat-strip { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .kpi + .kpi, .stat + .stat { box-shadow: -0.5px 0 0 var(--hairline); }
}
.kpi-label, .stat-label { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.kpi-value, .stat-value { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.kpi-hint, .stat-hint { color: var(--ink-2); font-size: 12.5px; margin-top: 3px; line-height: 1.4; }
.kpi.good .kpi-value, .stat.good .stat-value { color: var(--money); }
.kpi .up { color: var(--money); }
.kpi .down { color: var(--bad); }

/* ---------- the overview's opening sentence ---------- */
.story { margin: -4px 0 18px; max-width: 760px; }
/* One step below the page title, so the page has one headline and the sentence reads as its summary. */
.story-lead { font-size: 21px; line-height: 1.3; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; text-wrap: balance; }
.story-more { margin-top: 6px; font-size: 15px; line-height: 1.5; color: var(--ink-2); letter-spacing: -0.012em; max-width: 72ch; text-wrap: pretty; }
.story-more a { color: var(--accent); }

/* Ranked videos with a bar for each one's share of the best. */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; padding: 9px 0; box-shadow: 0 -0.5px 0 var(--hairline); }
.rank-list > li:first-child { box-shadow: none; padding-top: 2px; }
.rank-value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.rank-value.money { color: var(--money); }
.rank-value small { display: block; color: var(--ink-2); font-weight: 400; font-size: 12.5px; }
.rank-bar { grid-column: 1 / -1; height: 6px; border-radius: 980px; background: var(--fill-soft); overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 980px; background: var(--money); opacity: 0.75; }
.rank-bar.violet span { background: var(--violet); }

/* One line saying whether tracking is working. */
.status-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 18px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-group); margin-bottom: 14px; font-size: 14px; }
.status-line .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--money); flex: none; box-shadow: 0 0 0 4px var(--money-soft); }
.status-line.warn .dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.status-line .detail { color: var(--ink-2); }
.status-line a { margin-left: auto; }

/* ---------- toolbar above a table ---------- */
.toolbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type="search"] { flex: 1 1 280px; }
.view-switch { margin-bottom: 12px; }
.filters { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 18px; }
.filters input[type="search"] { flex: 1 1 280px; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; scrollbar-width: thin; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 9px 12px; text-align: left; vertical-align: middle; box-shadow: inset 0 -0.5px 0 var(--hairline); }
.table thead th { color: var(--ink-2); font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--surface); padding-top: 6px; padding-bottom: 6px; }
.table thead th a { color: var(--ink-2); }
.table thead th a:hover { color: var(--ink); text-decoration: none; }
.table thead th a.sorted { color: var(--ink); font-weight: 600; }
.table tbody tr:hover > * { background: var(--fill-soft); }
.table tbody tr:last-child > * { box-shadow: none; }
.table-card .table th:first-child, .table-card .table td:first-child { padding-left: 20px; }
.table-card .table th:last-child, .table-card .table td:last-child { padding-right: 20px; }
.table.compact th, .table.compact td { padding: 9px 10px; }
.table.compact th:first-child, .table.compact td:first-child { padding-left: 0; }
.table.compact th:last-child, .table.compact td:last-child { padding-right: 0; }
.table .money { color: var(--money); font-weight: 600; }
.table.videos th, .table.videos td { padding-left: 12px; padding-right: 12px; }
.table.videos th:first-child, .table.videos td:first-child { min-width: 300px; }
/* The video column stays put while the numbers scroll sideways. */
@media (min-width: 701px) {
  .table-scroll .videos th:first-child, .table-scroll .videos td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: inset -0.5px 0 0 var(--hairline), inset 0 -0.5px 0 var(--hairline); }
  .table-scroll .videos tbody tr:hover td:first-child { background: color-mix(in srgb, var(--surface), var(--ink) 3%); }
  .table-scroll .videos thead th:first-child { z-index: 3; }
}
.table-scroll.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 64px), rgba(0, 0, 0, 0.15)); mask-image: linear-gradient(to right, #000 calc(100% - 64px), rgba(0, 0, 0, 0.15)); }
.scroll-frame { position: relative; }
.scroll-btn { position: absolute; z-index: 4; width: 30px; height: 30px; min-height: 0; padding: 0 0 2px; border-radius: 50%; background: var(--raised); color: var(--ink); box-shadow: var(--shadow-pop); font-size: 20px; font-weight: 400; line-height: 1; transform: translateY(-50%); }
.scroll-btn.next { right: 8px; }
.scroll-btn[hidden] { display: none; }
.sticky-head .scroll-btn { top: 50%; pointer-events: auto; }
.scroll-dock { position: fixed; bottom: 0; z-index: 29; height: 15px; overflow-x: scroll; overflow-y: hidden; background: var(--sidebar); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-top: 0.5px solid var(--hairline); }
.scroll-dock > div { height: 1px; }
.scroll-dock::-webkit-scrollbar { height: 14px; }
.scroll-dock::-webkit-scrollbar-track { background: transparent; }
.scroll-dock::-webkit-scrollbar-thumb { background: var(--ink-3); border: 4px solid transparent; background-clip: padding-box; border-radius: 8px; }
@supports not selector(::-webkit-scrollbar) { .scroll-dock { scrollbar-color: var(--ink-3) transparent; } }
@media (hover: none) { .scroll-btn, .scroll-dock { display: none !important; } }
.num { text-align: right !important; white-space: nowrap; }
.table td form { display: inline; margin: 0; }
.center { text-align: center !important; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.muted-row td { color: var(--ink-2); }
tr.inactive td { opacity: 0.45; }
.truncate { display: inline-block; max-width: 440px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.destinations input[type="url"] { min-width: 240px; }

/* Columns you can hide, and drag to a new place (app.js). */
.head-actions { display: flex; gap: 8px; align-items: center; }
.popover { position: relative; }
.popover > summary { list-style: none; }
.popover > summary::-webkit-details-marker { display: none; }
.popover[open] > div { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(480px, calc(100vw - 32px)); padding: 18px; border-radius: 22px; background: var(--raised); box-shadow: var(--shadow-pop); }
.popover.wide[open] > div { width: min(760px, calc(100vw - 32px)); }
.popover[open] > .column-picker { width: 240px; }
.column-picker { display: grid; gap: 10px; }
.col-off { display: none !important; }
table[data-columns] thead th[data-col] { cursor: grab; user-select: none; }
table[data-columns] thead th[data-col]:hover { background: var(--fill-soft); }
table[data-columns] thead th.col-dragging { opacity: 0.4; cursor: grabbing; }
table[data-columns] thead th.drop-before { box-shadow: inset 2px 0 0 var(--accent); }
table[data-columns] thead th.drop-after { box-shadow: inset -2px 0 0 var(--accent); }
.sticky-head { position: fixed; top: 0; z-index: 30; overflow: hidden; background: var(--sidebar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 0.5px 0 var(--hairline); pointer-events: none; }
.sticky-head .table-scroll { overflow: hidden; }
.sticky-head table { margin: 0; table-layout: fixed; }
.sticky-head .table thead th { background: transparent; }
.sticky-head th { pointer-events: auto; }
.sticky-head table[data-columns] thead th[data-col] { cursor: default; }

/* ---------- videos ---------- */
.video-cell { display: flex; align-items: center; gap: 12px; color: var(--ink); min-width: 0; max-width: 520px; }
.video-cell:hover { text-decoration: none; }
.video-cell:hover .video-title { color: var(--accent); }
/* One square size for Shorts and long videos alike, like album art, so every title starts at the same place. */
.thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 10px; background: var(--fill); flex: none; }
.thumb.short { width: 38px; height: 38px; }
.thumb.placeholder { display: inline-block; }
.video-text { display: grid; min-width: 0; }
.video-title { font-weight: 500; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.video-meta { color: var(--ink-2); font-size: 12.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.kind { font-size: 11.5px; font-weight: 500; padding: 1px 7px; border-radius: 980px; background: var(--fill-soft); color: var(--ink-2); }
.kind.short { background: var(--violet-soft); color: var(--violet); }
.method { font-size: 11.5px; padding: 1px 8px; border-radius: 980px; font-weight: 500; white-space: nowrap; background: var(--fill-soft); color: var(--ink-2); }
.method.exact { background: var(--accent-soft); color: var(--accent); }
.method.picker { background: var(--violet-soft); color: var(--violet); }
.type { font-size: 11.5px; padding: 1px 8px; border-radius: 980px; font-weight: 500; background: var(--fill-soft); color: var(--ink-2); text-transform: capitalize; }
.type.purchase { background: var(--money-soft); color: var(--money); }
.type.application { background: var(--accent-soft); color: var(--accent); }
.credit { display: inline-flex; gap: 4px; align-items: center; margin-right: 8px; white-space: nowrap; }
.split .est { color: var(--ink-2); font-weight: 400; }
a.cell-link { color: inherit; text-decoration: underline; text-decoration-color: var(--ink-3); text-decoration-style: dotted; text-underline-offset: 3px; }
a.cell-link:hover { color: var(--accent); text-decoration-color: var(--accent); }
.subs-note { color: var(--ink-2); font-size: 13px; }

/* People: initials in a circle, and the video someone came from on one line. */
.person { display: flex; align-items: center; gap: 12px; color: var(--ink); min-width: 220px; }
.person:hover { text-decoration: none; }
.person:hover .person-name { color: var(--accent); }
.person-name { display: block; font-weight: 500; }
.person-email { display: block; }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: #fff; background: linear-gradient(180deg, #a9b1bf, #858d9b); }
.video-mini { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); max-width: 360px; min-width: 0; }
.video-mini:hover { text-decoration: none; }
.video-mini:hover .video-mini-title { color: var(--accent); }
.video-mini img, .video-mini .thumb-blank { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; flex: none; background: var(--fill); }
.video-mini > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-mini-title { color: var(--ink-2); }
.table.people td { padding-top: 10px; padding-bottom: 10px; }

.video-header { display: flex; gap: 24px; align-items: center; margin-bottom: 24px; }
.video-header > div { min-width: 0; display: grid; gap: 8px; }
.hero-thumb { width: 192px; height: 108px; object-fit: cover; border-radius: 16px; box-shadow: var(--shadow-group); flex: none; background: var(--fill); }
.hero-thumb.short { width: 84px; height: 150px; }
.video-hero-title { font-size: 22px; line-height: 1.25; letter-spacing: -0.022em; font-weight: 700; }
.video-facts { color: var(--ink-2); font-size: 14px; display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; }

/* ---------- lists and settings ---------- */
.empty { color: var(--ink-2); padding: 26px 18px; text-align: center; line-height: 1.6; font-size: 14px; }
.card .empty { padding: 26px 8px; }
.note { color: var(--ink-2); font-size: 13px; line-height: 1.55; margin-top: 14px; max-width: 90ch; }
.lede { color: var(--ink-2); font-size: 15px; margin: -8px 0 18px; max-width: 70ch; }
.section-gap { margin-top: 26px; }
.callout { background: var(--fill-soft); border-radius: 18px; padding: 14px 16px; }
.error-text { color: var(--bad); }
.chart { position: relative; width: 100%; min-height: 140px; }
.chart + .chart { margin-top: 16px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0 8px; font-size: 13px; }
.pager > a { padding: 5px 12px; border-radius: 980px; background: var(--fill); color: var(--ink); font-weight: 500; }
.pager > a:hover { text-decoration: none; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; font-size: 14px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.howto { padding-left: 20px; display: grid; gap: 18px; margin: 0; font-size: 14px; max-width: 120ch; }
.howto li::marker { color: var(--ink-2); font-weight: 600; }
.howto .table { margin: 8px 0; }
.settings-inline { margin-top: 18px; }
.settings-inline summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.tag { font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 980px; background: var(--fill-soft); color: var(--ink-2); white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.good { background: var(--money-soft); color: var(--money); }
.jobs { margin-top: 18px; }
.table.webhooks pre { max-width: min(560px, 70vw); max-height: 360px; overflow: auto; margin: 8px 0 0; }
.table.webhooks summary { cursor: pointer; color: var(--accent); white-space: nowrap; }
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ''; width: 12px; height: 12px; margin-left: auto; background: var(--chevron) no-repeat center / 12px; transform: rotate(-90deg); }
details.fold[open] > summary { margin-bottom: 16px; }
details.fold[open] > summary::after { transform: none; }
.link-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.link-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); min-width: 0; }
.link-form select, .link-form input { width: 100%; min-width: 0; }
.link-form .link-address { grid-column: 1 / 4; }
/* "Mark as paid" in a table row: a small link that opens a two-field form under it. */
.row-action > summary { cursor: pointer; color: var(--accent); font-size: 13px; white-space: nowrap; list-style: none; }
.row-action > summary::-webkit-details-marker { display: none; }
.mini-form { display: grid; gap: 8px; margin-top: 8px; min-width: 240px; }
.mini-form label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); }

/* Setup: an inset list like iOS Settings, one row per piece, with its live state on the right. */
.setup-list { list-style: none; margin: 0 0 18px; padding: 0 0 0 16px; background: var(--surface); border-radius: var(--r-group); box-shadow: var(--shadow-group); overflow: hidden; }
.setup-list > li > a, .setup-list > li > div { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px 10px 0; color: var(--ink); box-shadow: inset 0 -0.5px 0 var(--hairline); }
.setup-list > li:last-child > a, .setup-list > li:last-child > div { box-shadow: none; }
.setup-list > li > a:hover { text-decoration: none; }
.setup-list > li > a:hover .setup-title { color: var(--accent); }
.setup-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--ink-3); }
.setup-icon svg { width: 15px; height: 15px; }
.setup-icon.done { background: var(--accent); color: var(--on-accent); }
.setup-icon.todo { background: #ff9500; }
.setup-title { font-weight: 500; }
.setup-detail { display: block; color: var(--ink-2); font-size: 13px; margin-top: 1px; }
.setup-state { color: var(--ink-2); font-size: 14px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.setup-state::after { content: ''; width: 8px; height: 13px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath d='M1.5 1.5 6.5 6.5 1.5 11.5' fill='none' stroke='%23c7c7cc' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain; }

/* ---------- alerts ---------- */
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.alert-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 18px; border-radius: var(--r-group); background: var(--surface); box-shadow: var(--shadow-group); }
.alert-item.unseen { box-shadow: inset 3px 0 0 var(--accent); }
.alert-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: var(--accent-soft); color: var(--accent); }
.alert-item.tracking .alert-icon { background: var(--warn-soft); color: var(--warn); }
.alert-item.tracking_ok .alert-icon { background: var(--money-soft); color: var(--money); }
.alert-item h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.alert-body { background: transparent; padding: 0; margin: 0; font-family: inherit; font-size: 14px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; word-break: normal; }
.alert-when { color: var(--ink-2); font-size: 12.5px; margin-top: 8px; }

/* ---------- side panel (people behind a number) ---------- */
.panel-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(0, 0, 0, 0.28); }
.side-panel { position: fixed; top: 10px; right: 10px; bottom: 10px; z-index: 50; width: min(500px, calc(100vw - 20px)); overflow-y: auto; padding: 26px; border-radius: 30px; background: var(--raised); box-shadow: var(--shadow-pop); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 20px; letter-spacing: -0.02em; margin: 4px 0; }
.panel-head button { width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 50%; font-size: 13px; }
.panel-video { color: var(--ink-2); }
.panel-list { list-style: none; margin: 0; padding: 0; }
.panel-list > li { padding: 12px 0; box-shadow: inset 0 -0.5px 0 var(--hairline); display: grid; gap: 3px; }
.panel-row { display: flex; justify-content: space-between; gap: 12px; }
.panel-items { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.panel-sources { list-style: none; margin: 4px 0 14px; padding: 0; }
.panel-sources li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; box-shadow: inset 0 -0.5px 0 var(--hairline); }

/* ---------- sign in ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: 100%; max-width: 400px; display: grid; gap: 16px; padding: 38px 34px; border-radius: 32px; background: var(--surface); box-shadow: var(--shadow-group); }
.login label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.login h1 { font-size: 24px; letter-spacing: -0.02em; text-align: center; }
.login p { color: var(--ink-2); text-align: center; font-size: 14px; }
.login-wordmark { display: flex; justify-content: center; font-size: 44px; margin: 0 auto 8px; }
.login button { width: 100%; min-height: 40px; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; gap: 0; padding: 0; }
  .sidebar { position: sticky; top: 0; z-index: 40; height: auto; margin: 0; border-radius: 0; border-width: 0 0 0.5px; box-shadow: none; padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; border-right: 0; border-bottom: 0.5px solid var(--hairline); overflow: visible; }
  .brand { padding: 4px 4px; }
  .sidebar ul { grid-column: 1 / -1; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .sidebar li a { white-space: nowrap; padding: 6px 10px; }
  .sidebar-foot { grid-column: 2; grid-row: 1; margin: 0; padding: 0; align-self: center; }
  .workspace-name { display: none; }
  main { padding: 20px 18px 44px; }
}
@media (max-width: 600px) {
  main { padding: 20px 16px 40px; }
  .page-header { margin-bottom: 20px; }
  .page-header h1 { font-size: 26px; }
  .header-actions, .controls { width: 100%; }
  .segmented { max-width: 100%; overflow-x: auto; }
  .segmented span { padding: 5px 10px; }
  .card { padding: 20px 18px; border-radius: 22px; }
  .table-card { padding: 16px 0 4px; }
  .table-card > .card-head, .table-card > .empty, .table-card > .pager, .table-card > .subs-note, .table-card > .note,
  .table-card > .toolbar, .live-results > .card-head, .live-results > .empty, .live-results > .pager { margin-left: 16px; margin-right: 16px; }
  .table-card .table th:first-child, .table-card .table td:first-child { padding-left: 16px; }
  .table-card .table th:last-child, .table-card .table td:last-child { padding-right: 16px; }
  .table.videos th:first-child, .table.videos td:first-child { min-width: 230px; }
  .kpi, .stat { padding: 2px 16px; }
  .story-lead { font-size: 19px; }
  .story-more { font-size: 14px; }
  .video-header { align-items: flex-start; gap: 16px; flex-wrap: wrap; }
  .hero-thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .hero-thumb.short { width: 90px; height: 160px; aspect-ratio: auto; }
  .video-hero-title { font-size: 22px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 12px; }
  .link-form { grid-template-columns: 1fr 1fr; }
  .link-form .link-address, .link-form button { grid-column: 1 / -1; }
  .alert-item { grid-template-columns: 36px minmax(0, 1fr); }
  .alert-item > .copy { grid-column: 2; justify-self: start; }
  .custom-range[open] > div { left: 0; right: auto; width: calc(100vw - 32px); }
  .popover { position: static; }
  .popover[open] > div { left: 16px; right: 16px; width: auto; }
  .status-line a { margin-left: 0; }
}
@media (pointer: coarse) {
  button, .button, input:not([type="checkbox"]):not([type="radio"]), select { min-height: 44px; }
  .segmented span { padding-block: 9px; }
}
@media (prefers-reduced-motion: no-preference) {
  a, button, input, select, summary, .segmented span { transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease; }
  .side-panel { animation: panel-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  @keyframes panel-in { from { transform: translateX(24px); opacity: 0; } }
}


/* ---------- dark mode switch (sidebar) ---------- */
.theme-switch { display: flex; align-items: center; gap: 9px; background: none; color: var(--ink); padding: 4px 0; min-height: 0; border-radius: 999px; font-size: 13px; font-weight: 500; justify-content: flex-start; }
.theme-switch:hover { filter: none; }
.theme-track { position: relative; width: 36px; height: 21px; border-radius: 999px; background: var(--fill); flex: none; transition: background-color 200ms ease; }
.theme-thumb { position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 220ms cubic-bezier(0.3, 0.7, 0.3, 1); }
.theme-switch[aria-checked="true"] .theme-track { background: var(--accent); }
.theme-switch[aria-checked="true"] .theme-thumb { transform: translateX(15px); }
.theme-switch:focus-visible { box-shadow: var(--ring); }
@media (max-width: 860px) { .theme-label { display: none; } .sidebar-foot { display: flex; align-items: center; gap: 12px; } }

/* ---------- Algi, the assistant ---------- */
.algi-avatar { display: block; flex: none; filter: drop-shadow(0 2px 4px rgba(10, 158, 146, 0.28)); }
.ask-fab { position: fixed; right: 22px; bottom: 22px; z-index: 45; display: inline-flex; align-items: center; gap: 9px; padding: 6px 18px 6px 7px; min-height: 0; border-radius: 999px; background: var(--raised); color: var(--ink); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-pop); }
.ask-fab:hover { filter: none; transform: translateY(-1px); }
.ask-fab[aria-expanded="true"] { display: none; }
.ask-panel { position: fixed; right: 18px; bottom: 18px; z-index: 46; width: min(420px, calc(100vw - 24px)); height: min(680px, calc(100vh - 36px)); height: min(680px, calc(100dvh - 36px)); display: flex; flex-direction: column; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow-pop); overflow: hidden; }
.ask-panel[hidden] { display: none; }
.ask-head { display: flex; align-items: center; gap: 11px; padding: 14px 14px 12px 16px; border-bottom: 0.5px solid var(--hairline); }
.ask-title { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.ask-title b { font-size: 15px; }
.ask-title span { color: var(--ink-2); font-size: 12.5px; }
.ask-icon { width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 50%; background: var(--fill-soft); color: var(--ink-2); }
.ask-icon:hover { filter: none; background: var(--fill); color: var(--ink); }
.ask-log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.ask-hello { margin: auto 0; display: grid; justify-items: center; text-align: center; gap: 8px; padding: 10px 8px 4px; }
.ask-hello .algi-avatar { margin-bottom: 4px; }
.ask-hello h3 { font-size: 18px; letter-spacing: -0.01em; }
.ask-hello p { color: var(--ink-2); font-size: 14px; max-width: 30ch; }
.ask-suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 8px; }
.ask-suggestions button { min-height: 0; padding: 7px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; text-align: left; }
.ask-suggestions button:hover { filter: none; background: var(--accent); color: var(--on-accent); }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 84%; padding: 9px 14px; border-radius: 20px; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.ai .bubble { background: var(--fill-soft); color: var(--ink); border-bottom-left-radius: 6px; box-shadow: inset 0 0 0 0.5px var(--hairline); }
.msg.ai .algi-avatar { margin-bottom: 2px; }
.msg.error .bubble { background: var(--bad-soft); color: var(--bad); }
.bubble p { margin: 0; }
.bubble p + p, .bubble p + ul, .bubble ul + p, .bubble p + ol, .bubble ol + p { margin-top: 8px; }
.bubble ul, .bubble ol { margin: 0; padding-left: 20px; }
.bubble li + li { margin-top: 3px; }
.bubble strong { font-weight: 600; }
.bubble a { color: var(--accent); }
/* Thinking: three dots bouncing in a bubble, with what Algi is looking at underneath. */
.thinking { display: inline-flex; gap: 5px; padding: 4px 2px; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: algi-dot 1.2s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: 0.15s; }
.thinking i:nth-child(3) { animation-delay: 0.3s; }
.ask-status { display: block; color: var(--ink-2); font-size: 12px; margin-top: 3px; }
@keyframes algi-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-5px); opacity: 1; } }
/* The question box (George 2026-11-02: "needs to be a box"): room for three lines, growing to about seven, with the
   send button in its bottom-right corner. */
.ask-form { display: grid; grid-template-columns: 1fr auto; gap: 4px; margin: 6px 12px 6px; padding: 12px 10px 10px 14px; border-radius: 18px; background: var(--fill-soft); box-shadow: inset 0 0 0 0.5px var(--hairline); cursor: text; }
.ask-form:focus-within { box-shadow: var(--ring); background: var(--surface); }
.ask-form textarea { grid-column: 1 / -1; display: block; width: 100%; min-height: 64px; max-height: 180px; resize: none; border: 0; border-radius: 0; background: transparent; padding: 0 4px 0 0; font: inherit; font-size: 14.5px; line-height: 1.45; box-shadow: none; overflow-y: auto; }
.ask-form textarea:focus { box-shadow: none; background: transparent; }
.ask-send { grid-column: 2; justify-self: end; width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%; flex: none; }
.ask-send:disabled { opacity: 0.35; }
.ask-note { color: var(--ink-3); font-size: 11.5px; text-align: center; padding: 0 16px 12px; }
@media (max-width: 600px) {
  .ask-fab { right: 14px; bottom: 14px; }
  .ask-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .ask-fab-avatar { animation: algi-bob 3.2s ease-in-out infinite; }
  .ask-panel:not([hidden]) { animation: ask-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .msg { animation: msg-in 220ms ease-out; }
  @keyframes algi-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
  @keyframes ask-in { from { transform: translateY(16px) scale(0.98); opacity: 0; } }
  @keyframes msg-in { from { transform: translateY(6px); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { .thinking i { animation: none; opacity: 0.7; } }
