/* The AI theme (Nov 2026): glass panels with a thin cyan glow over a
 * faint grid, a glowing segmented tab bar, monospace labels and
 * figures, luminous status pills, and the core orb
 * (views/core-orb.js). Loaded after styles.css, so it restyles without
 * changing its rules; the colours are tokens.css's (--ai-*, shared
 * with the Assistant page).
 *
 * Kept cheap to draw: flat translucent fills, no backdrop blur on
 * panels or rows (only the desktop header and an open dialog's
 * overlay), glows as static box-shadows on panels (rows get a glow on
 * hover only), the background grid on one fixed layer. Life Areas
 * keep their own colours. Reduced motion: nothing moves, the glow
 * stays. Print: plain, no glow or grid.
 */

/* ==== The page: a grid and a vignette, on one fixed layer ==== */
/* body is a stacking context, so the layer (z-index -1) is drawn over
   body's own background and under everything else. */
body { position: relative; z-index: 0; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(var(--ai-rgb), 0.09), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 110%, rgba(2, 6, 14, 0.9), transparent 60%),
    linear-gradient(var(--ai-grid) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, var(--ai-grid) 1px, transparent 1px) 0 0 / 40px 40px;
}

/* ==== Header ==== */
.header {
  background: linear-gradient(180deg, rgba(8, 20, 38, 0.94) 0%, rgba(5, 11, 23, 0.9) 100%);
  border-bottom: 1px solid var(--ai-glass-border);
  box-shadow: 0 10px 30px -18px rgba(var(--ai-rgb), 0.45);
}
/* A line of light along its foot, brightest in the middle. */
.header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(var(--ai-rgb), 0.7) 50%, transparent);
}
/* Phones scroll the header away (styles.css: static); relative keeps
   the line above in it. */
@media (max-width: 768px) { .header { position: relative; } }
/* Sticky on wider screens: a light blur behind it there only (phones
   scroll it away, and the blur would cost every frame). */
@media (min-width: 769px) {
  .header { background: linear-gradient(180deg, rgba(8, 20, 38, 0.86) 0%, rgba(5, 11, 23, 0.8) 100%); backdrop-filter: blur(10px); }
}
/* The mark (the icons' symbol, scripts/make-icons.js): white rings
   round a cyan core that glows and slowly pulses (still with reduced
   motion). */
.brand-mark {
  position: relative; flex: none; width: 2.5rem; height: 2.5rem; align-self: center;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3CradialGradient id='c'%3E%3Cstop offset='0' stop-color='%23e0fbff'/%3E%3Cstop offset='1' stop-color='%23e2e8f0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Cg fill='none' stroke='%23fff'%3E%3Ccircle cx='16' cy='16' r='12.9' stroke-width='1.5'/%3E%3Ccircle cx='16' cy='16' r='9' stroke-width='1.4'/%3E%3Ccircle cx='16' cy='16' r='5.4' stroke-width='1.3'/%3E%3C/g%3E%3Ccircle cx='16' cy='16' r='2.6' fill='url(%23c)'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 5px rgba(var(--ai-rgb), 0.45));
}
/* Its outer ring of ticks, on a layer of its own, turns slowly
   ("Motion" below). */
.brand-mark::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='15.1' fill='none' stroke='%23fff' stroke-width='1.6' stroke-dasharray='0.7 3.25' stroke-opacity='.75'/%3E%3C/svg%3E") center / contain no-repeat;
}
.brand-mark::after {
  content: ''; position: absolute; inset: 30%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(var(--ai-light-rgb), 0.85) 0%, rgba(var(--ai-rgb), 0.35) 45%, rgba(var(--ai-rgb), 0) 72%);
  animation: brand-core-pulse 3.6s ease-in-out infinite;
}
@keyframes brand-core-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}
@media (prefers-reduced-motion: reduce) { .brand-mark::after { animation: none; opacity: 0.8; } }
/* Phones: the title's row has Check in, the save dot and the account
   button too, so there the mark leads the tab row instead (the tabs
   scroll sideways, so it costs no height and the title keeps its
   room), and the line under the title is in the body font (narrower). */
@media (max-width: 768px) { .brand-mark { width: 2rem; height: 2rem; } }
.brand-mark-phone { display: none; }
@media (max-width: 480px) {
  .header-top > .brand-mark { display: none; }
  .header-controls { flex-wrap: nowrap; gap: 8px; }
  .brand-mark-phone { display: block; width: 1.75rem; height: 1.75rem; }
  .header-controls > .tab-nav { flex: 1 1 auto; min-width: 0; }
  .tab-bar { padding: 2px; }
}
.header h1 .accent { color: var(--ai-cyan-text); text-shadow: 0 0 18px rgba(var(--ai-rgb), 0.45); }
.header-sub, .last-sync, .account-menu-who { font-family: var(--font-family-mono); letter-spacing: 0.02em; }
@media (max-width: 480px) { .header-sub { font-family: inherit; letter-spacing: normal; } }

/* The tab bar: a glowing segmented control. */
/* It scrolls sideways at any width (the monospace labels are wider),
   with the strip's edge fade (more-left / more-right). */
.tab-bar {
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
  padding: 3px; gap: 2px; border-radius: 10px;
  background: rgba(4, 12, 24, 0.7); border: 1px solid var(--ai-glass-border);
  box-shadow: inset 0 0 14px rgba(var(--ai-rgb), 0.06);
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-bar.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent); }
.tab-bar.more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 2.5rem), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 2.5rem), transparent); }
.tab-bar.more-left.more-right {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(to right, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
}
.tab {
  font-family: var(--font-family-mono); font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; border-radius: 7px; white-space: nowrap; flex: none;
}
.tab:hover { color: var(--text); background: var(--ai-cyan-soft); }
.tab.active, .tab.tab-pressing {
  color: var(--ai-cyan-text); border-color: rgba(var(--ai-rgb), 0.55);
  background: linear-gradient(180deg, rgba(var(--ai-rgb), 0.26), rgba(var(--ai-rgb), 0.1));
  box-shadow: 0 0 14px -3px rgba(var(--ai-rgb), 0.65), inset 0 0 8px rgba(var(--ai-rgb), 0.15);
  text-shadow: 0 0 10px rgba(var(--ai-rgb), 0.5);
}
.tab-customise { border-radius: 7px; }

/* Primary buttons: lit cyan glass. */
.fpill-primary, .btn-confirm, .signin .btn {
  color: var(--ai-cyan-text); border: 1px solid rgba(var(--ai-rgb), 0.6);
  background: linear-gradient(180deg, rgba(var(--ai-rgb), 0.3), rgba(var(--ai-rgb), 0.14));
  box-shadow: 0 0 14px -4px rgba(var(--ai-rgb), 0.7);
}
.fpill-primary:hover, .btn-confirm:hover, .signin .btn:hover {
  border-color: var(--ai-cyan); background: linear-gradient(180deg, rgba(var(--ai-rgb), 0.4), rgba(var(--ai-rgb), 0.2));
  box-shadow: var(--ai-glow-shadow-strong);
}
.fpill-primary:disabled { box-shadow: none; text-shadow: none; }
.btn-cancel { border: 1px solid var(--border) !important; }
.add-btn:hover { box-shadow: 0 0 12px -3px rgba(var(--ai-rgb), 0.7); }
.fpill.active { border-color: rgba(var(--ai-rgb), 0.6); box-shadow: 0 0 10px -4px rgba(var(--ai-rgb), 0.7); }
.account-btn {
  font-family: var(--font-family-mono); color: var(--ai-cyan-text);
  background: radial-gradient(circle at 50% 40%, rgba(var(--ai-rgb), 0.22), var(--surface2) 70%);
  border: 1px solid rgba(var(--ai-rgb), 0.45); box-shadow: 0 0 12px -3px rgba(var(--ai-rgb), 0.55);
}
.sound-btn {
  color: var(--ai-cyan-text);
  background: radial-gradient(circle at 50% 40%, rgba(var(--ai-rgb), 0.22), var(--surface2) 70%);
  border: 1px solid rgba(var(--ai-rgb), 0.45); box-shadow: 0 0 12px -3px rgba(var(--ai-rgb), 0.55);
}
.sound-btn.sound-off { color: var(--text-muted); border-color: var(--border); box-shadow: none; background: var(--surface2); }
.search-box { background: rgba(4, 12, 24, 0.7); border-color: var(--ai-glass-border); }
.search-box:focus { border-color: var(--ai-cyan); box-shadow: 0 0 12px -4px rgba(var(--ai-rgb), 0.7); }

/* Status dots light up. */
.sync-dot { box-shadow: 0 0 6px 1px currentColor; }
.sync-indicator[data-state="idle"] .sync-dot, .sync-indicator[data-state="saved"] .sync-dot { color: var(--green); }
.sync-indicator[data-state="saving"] .sync-dot { color: var(--accent-light); }
.sync-indicator:is([data-state="pending"], [data-state="stale"]) .sync-dot { color: var(--amber); }
.sync-indicator[data-state="error"] .sync-dot { color: var(--red); }

/* ==== Glass panels ==== */
/* The cards and groups: a translucent fill, a thin cyan edge and a
   soft glow. Rows inside them stay flat. */
.home-card, .stat-card, .metric-card, .okr-group, .horizon-card, .plan-year-card,
.vision-section, .vision-wheel, .vision-ratings-bar, .focus-card, .page-intro,
.acct-strip, .partner-card, .okr-empty-board, .okr-board-btn, .bucket-item, .win-card,
.rewards-panel {
  background-color: var(--ai-glass);
  border-color: var(--ai-glass-border);
  box-shadow: var(--ai-glow-shadow);
}
/* Edges that mean something keep their colour. */
.win-card { border-left-color: var(--green); }
.rewards-panel { border-color: var(--gold-border); box-shadow: 0 0 18px -6px rgba(251, 191, 36, 0.4); }
.okr-empty-board { border-color: rgba(var(--ai-rgb), 0.3); box-shadow: none; }
.acct-strip[data-mood="good"] { border-color: var(--green-border); background-color: var(--green-bg); }
.acct-strip[data-mood="late"] { border-color: var(--red-border); }
.okr-board-btn.active {
  color: var(--ai-cyan-text); border-color: rgba(var(--ai-rgb), 0.6);
  background: linear-gradient(180deg, rgba(var(--ai-rgb), 0.2), rgba(var(--ai-rgb), 0.08));
  box-shadow: 0 0 14px -4px rgba(var(--ai-rgb), 0.7);
}
.okr-board-add { box-shadow: none; }

/* The big panels get a light along their top edge and corner marks,
   like an instrument's frame. (The top light is the first background
   layer: a dark tint, so text over it reads against the panel.) */
.home-card, .stat-card, .metric-card, .okr-group, .horizon-card, .plan-year-card,
.vision-section, .vision-wheel, .focus-card, .page-intro {
  --ai-corner: rgba(var(--ai-rgb), 0.75);
  background-image:
    linear-gradient(180deg, rgba(var(--ai-rgb), 0.05), rgba(var(--ai-rgb), 0) 3.5rem),
    linear-gradient(var(--ai-corner), var(--ai-corner)), linear-gradient(var(--ai-corner), var(--ai-corner)),
    linear-gradient(var(--ai-corner), var(--ai-corner)), linear-gradient(var(--ai-corner), var(--ai-corner)),
    linear-gradient(var(--ai-corner), var(--ai-corner)), linear-gradient(var(--ai-corner), var(--ai-corner)),
    linear-gradient(var(--ai-corner), var(--ai-corner)), linear-gradient(var(--ai-corner), var(--ai-corner));
  background-size: 100% 100%, 12px 1px, 1px 12px, 12px 1px, 1px 12px, 12px 1px, 1px 12px, 12px 1px, 1px 12px;
  background-position: 0 0, 3px 3px, 3px 3px, calc(100% - 3px) 3px, calc(100% - 3px) 3px,
    3px calc(100% - 3px), 3px calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) calc(100% - 3px);
  background-repeat: no-repeat;
}
.page-intro { border-color: rgba(var(--ai-rgb), 0.4); }
.page-intro-title, .focus-title { color: var(--ai-cyan-text); }

/* Rows: flat, lit on hover. */
.home-line, .focus-item, .yr-head, .plan-year-header { background-color: rgba(17, 32, 56, 0.62); }
button.home-line:hover, .bucket-item:hover {
  border-color: rgba(var(--ai-rgb), 0.6); background-color: rgba(var(--ai-rgb), 0.08);
  box-shadow: 0 0 12px -4px rgba(var(--ai-rgb), 0.6);
}
.okr-header:hover { background: rgba(var(--ai-rgb), 0.06); }
.home-line-go { color: var(--accent-light); }

/* ==== Titles, labels and figures ==== */
/* Card titles get a small lit dot; labels and figures are monospace. */
.home-card-title, .metric-card h3, .metric-card > h4 { display: flex; align-items: center; gap: 0.5rem; }
.home-card-title::before, .metric-card h3::before {
  content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ai-cyan); box-shadow: 0 0 8px 1px rgba(var(--ai-rgb), 0.8);
}
.home-soon .home-card-title::before { background: var(--text-muted); box-shadow: none; }
/* The Assistant's card has its own small core beside the title. */
.home-assistant .home-card-title::before { display: none; }
.stat-value, .home-line-value, .okr-board-pct, .core-orb-value, .metric-big, .fpill-count {
  font-family: var(--font-family-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.stat-value { text-shadow: 0 0 16px currentColor; }
.stat-label, .home-soon-tag, .checkin-step, .today-date, .today-streak, .home-line-detail {
  font-family: var(--font-family-mono); letter-spacing: 0.02em;
}
.stat-label, .checkin-step { text-transform: uppercase; letter-spacing: 0.06em; }
.home-line-value { text-shadow: 0 0 14px currentColor; }

/* ==== Status: small luminous pills ==== */
select.status-sel, .s-not-started, .s-in-progress, .s-complete, .s-wine, .s-abandoned,
.h-none, .h-on-track, .h-behind, .h-at-risk, .h-complete {
  border-radius: 999px;
}
.s-in-progress, .s-complete, .s-wine, .h-on-track, .h-behind, .h-at-risk, .h-complete {
  box-shadow: 0 0 10px -3px currentColor, inset 0 0 6px -2px currentColor;
}
.checkin-dots li.done { box-shadow: 0 0 6px var(--green); }
.checkin-dots li.now { box-shadow: 0 0 0 3px var(--accent-bg), 0 0 10px var(--accent-light); }

/* ==== Progress bars glow ==== */
.prog-bar, .stat-pace-bar, .metric-row-track, .partner-wheel-bar { background: rgba(var(--ai-rgb), 0.12); }
.prog-fill, .metric-row-fill, .partner-wheel-fill, .kr-measure-fill {
  background: linear-gradient(90deg, var(--color-accent), var(--ai-cyan));
  box-shadow: 0 0 8px -1px rgba(var(--ai-rgb), 0.8);
}
.prog-mini[data-pace="behind"] .prog-fill { background: var(--amber); box-shadow: 0 0 8px -1px rgba(251, 191, 36, 0.8); }
.prog-mini[data-pace="ahead"] .prog-fill { background: var(--green); box-shadow: 0 0 8px -1px rgba(52, 211, 153, 0.8); }
.stat-pace-fill { box-shadow: 0 0 8px -1px currentColor; }
.metric-col-fill { box-shadow: 0 0 10px -2px rgba(var(--ai-rgb), 0.7); }

/* ==== The life wheel ==== */
/* A lit field behind it and one glow round the whole drawing (one
   filter, not one per wedge). The wedges keep their area colours. */
.vision-wheel-svg {
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--ai-rgb), 0.1) 0%, rgba(var(--ai-rgb), 0.03) 55%, transparent 72%);
  filter: drop-shadow(0 0 10px rgba(var(--ai-rgb), 0.22));
}
.vision-wheel-swatch { box-shadow: 0 0 6px -1px currentColor; }

/* ==== Dialogs and the check-in: glass ==== */
.modal-overlay { background: rgba(2, 6, 14, 0.74); }
.modal-overlay.visible { backdrop-filter: blur(3px); }
.modal {
  background-color: rgba(11, 22, 40, 0.97);
  border-color: rgba(var(--ai-rgb), 0.4);
  box-shadow: 0 0 0 1px rgba(var(--ai-rgb), 0.08), 0 0 40px -8px rgba(var(--ai-rgb), 0.4), 0 24px 60px -20px rgba(0, 0, 0, 0.8);
}
.modal h3 { color: var(--ai-cyan-text); }
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--ai-cyan); box-shadow: 0 0 12px -4px rgba(var(--ai-rgb), 0.7); }
.account-menu, .item-menu {
  border-color: rgba(var(--ai-rgb), 0.35);
  box-shadow: 0 0 30px -8px rgba(var(--ai-rgb), 0.35), 0 12px 30px rgba(0, 0, 0, 0.5);
}

/* ==== The core orb (views/core-orb.js) ==== */
.core-orb {
  --orb-size: 10rem;
  position: relative; flex: none; width: var(--orb-size); height: var(--orb-size);
  display: grid; place-items: center; isolation: isolate;
}
.core-orb-sm { --orb-size: 6rem; }
.core-orb-lg { --orb-size: 14rem; }
.core-orb-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.core-orb-pulse { transform-box: fill-box; transform-origin: center; animation: core-orb-pulse 4.5s ease-in-out infinite; }
.core-orb-ticks, .core-orb-segments { transform-box: view-box; transform-origin: 100px 100px; }
.core-orb-ticks { animation: core-orb-turn 80s linear infinite; }
.core-orb-tick { stroke: rgba(var(--ai-rgb), 0.4); stroke-width: 1; }
.core-orb-tick-major { stroke: rgba(var(--ai-light-rgb), 0.85); stroke-width: 1.5; }
.core-orb-segments {
  fill: none; stroke: rgba(var(--ai-rgb), 0.55); stroke-width: 2.5;
  animation: core-orb-turn 50s linear infinite reverse;
}
.core-orb-track { fill: none; stroke: rgba(var(--ai-rgb), 0.14); stroke-width: 7; }
.core-orb-arc {
  fill: none; stroke: var(--ai-cyan); stroke-width: 7; stroke-linecap: round;
  filter: drop-shadow(0 0 5px rgba(var(--ai-rgb), 0.9));
}
.core-orb-inner { fill: none; stroke: rgba(var(--ai-light-rgb), 0.5); stroke-width: 1; }
.core-orb-core { stroke: rgba(var(--ai-light-rgb), 0.9); stroke-width: 1.5; }
.core-orb-readout {
  position: relative; z-index: 1; max-width: 58%;
  display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.1;
}
.core-orb-value { font-size: 1.75rem; font-weight: 700; color: #e6fbff; text-shadow: 0 0 14px rgba(var(--ai-rgb), 0.9); }
.core-orb-caption {
  margin-top: 4px; font-family: var(--font-family-mono); font-size: 0.75rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ai-cyan-text); overflow-wrap: anywhere;
}
.core-orb-sm .core-orb-value { font-size: 1.125rem; }
@keyframes core-orb-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.97); }
  50% { opacity: 1; transform: scale(1.03); }
}
@keyframes core-orb-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .core-orb-pulse, .core-orb-ticks, .core-orb-segments { animation: none; }
  .core-orb-pulse { opacity: 0.85; }
}

/* Home: the orb beside the Goals card's lines (above them on a phone). */
.home-goals-body { display: flex; align-items: center; gap: 20px; }
.home-goals-body > .home-lines { flex: 1 1 auto; min-width: 0; }
.home-core { flex: none; display: flex; justify-content: center; }
@media (max-width: 600px) {
  .home-goals-body { flex-direction: column; align-items: stretch; gap: 12px; }
  .home-core .core-orb { --orb-size: 8.5rem; }
}

/* ==== Motion: a living hologram ==== */
/* ai-motion.js marks the panels on screen `.ai-live` (the same list as
   LIVE_PANELS there); only those move, so a long page animates a few
   panels, not all of them. Everything moves by transform, opacity,
   background-position or one registered angle (a slow, stepped update:
   10-15 frames a second). Nothing animates a shadow or a blur. While
   the page is hidden (html.ai-paused) everything stops; with reduced
   motion nothing moves at all. The light passes behind the text
   (z-index -1 inside each panel), at under 8% opacity, so text keeps
   its contrast at every frame. */
@property --ai-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@property --ai-sweep { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

.home-card, .stat-card, .metric-card, .okr-group, .horizon-card, .plan-year-card,
.vision-section, .vision-wheel, .focus-card, .page-intro, .assistant-card {
  position: relative; isolation: isolate;
}

/* The border: a light runs round the edge, cyan into violet and teal. */
.ai-live::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  padding: 1px;
  background: conic-gradient(from var(--ai-angle), transparent 0deg 200deg,
    rgba(var(--ai-rgb), 0.85) 250deg, rgba(167, 139, 250, 0.7) 290deg, rgba(45, 212, 191, 0.55) 320deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: ai-border 14s steps(168) infinite;
  animation-delay: calc(var(--ai-stagger, 0s) * -1.5);
}
@keyframes ai-border { to { --ai-angle: 360deg; } }

/* The sheen: a soft diagonal band drifts across the glass, then rests;
   each panel at its own point in the cycle (--ai-stagger). */
.ai-live::after {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(var(--ai-rgb), 0.07) 46%,
    rgba(167, 139, 250, 0.06) 50%, rgba(45, 212, 191, 0.05) 54%, transparent 60%) no-repeat;
  background-size: 250% 100%; background-position: 160% 0;
  animation: ai-sheen 9s ease-in-out infinite;
  animation-delay: calc(var(--ai-stagger, 0s) * -1);
}
@keyframes ai-sheen {
  0% { background-position: 160% 0; }
  40%, 100% { background-position: -60% 0; }
}

/* Progress bars: a light runs along the filled part. */
.prog-fill, .metric-row-fill, .kr-measure-fill, .partner-wheel-fill { position: relative; }
.prog-fill, .metric-row-fill, .kr-measure-fill, .partner-wheel-fill, .stat-pace-fill { overflow: hidden; }
.ai-live :is(.prog-fill, .metric-row-fill, .kr-measure-fill, .stat-pace-fill)::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: ai-run 3.2s ease-in-out infinite;
  animation-delay: calc(var(--ai-stagger, 0s) * -0.4);
}
@keyframes ai-run {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(260%); }
}

/* The life wheel: a slow radar sweep of light under the wedges,
   clockwise (the wedges' own order, from 12 o'clock). The bright edge
   leads at the sweep's angle and its glow trails behind it. */
.vision-wheel.ai-live .vision-wheel-svg {
  background:
    conic-gradient(from var(--ai-sweep), transparent 0deg 305deg, rgba(var(--ai-rgb), 0) 305deg, rgba(var(--ai-rgb), 0.24) 360deg),
    radial-gradient(circle, rgba(var(--ai-rgb), 0.1) 0%, rgba(var(--ai-rgb), 0.03) 55%, transparent 72%);
  animation: ai-sweep 8s steps(120) infinite;
}
@keyframes ai-sweep { to { --ai-sweep: 360deg; } }

/* The page: the grid breathes, and a faint scanline drifts down. */
body::before { animation: ai-grid-breathe 9s ease-in-out infinite; }
@keyframes ai-grid-breathe { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
body::after {
  content: ''; position: fixed; left: 0; right: 0; top: 0; height: 40vh; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(var(--ai-rgb), 0.03) 46%,
    rgba(var(--ai-light-rgb), 0.07) 50%, rgba(var(--ai-rgb), 0.03) 54%, transparent);
  transform: translateY(-40vh);
  animation: ai-scan 14s linear infinite;
}
@keyframes ai-scan { to { transform: translateY(100vh); } }

/* The header's foot: its light travels along it. */
.header::after { background-size: 200% 100%; animation: ai-foot 10s ease-in-out infinite alternate; }
@keyframes ai-foot { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* The logo: its ticks turn slowly round the breathing core. */
.brand-mark::before { animation: core-orb-turn 40s linear infinite; }

/* The page is hidden: everything stops. */
html.ai-paused *, html.ai-paused *::before, html.ai-paused *::after { animation-play-state: paused !important; }

/* Reduced motion: no movement at all. */
@media (prefers-reduced-motion: reduce) {
  body::before, body::after, .header::after, .brand-mark::before, .brand-mark::after,
  .ai-live::before, .ai-live::after, .ai-live :is(.prog-fill, .metric-row-fill, .kr-measure-fill, .stat-pace-fill)::after,
  .vision-wheel.ai-live .vision-wheel-svg { animation: none !important; }
  body::after, .ai-live::after, .ai-live :is(.prog-fill, .metric-row-fill, .kr-measure-fill, .stat-pace-fill)::after { display: none; }
}

/* ==== Print: plain paper ==== */
@media print {
  body::before, body::after, .header::after, .brand-mark, .ai-live::before, .ai-live::after { display: none !important; }
  .core-orb-pulse, .core-orb-ticks, .core-orb-segments { animation: none !important; }
  * { box-shadow: none !important; text-shadow: none !important; backdrop-filter: none !important; }
}
