/* ==========================================================================
   Sport Tracker — design system
   Dark first, automatic light theme, one accent gradient (lime -> cyan).
   Strict CSP: no inline styles anywhere, everything lives here.
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
:root {
  color-scheme: dark light;

  /* Palette (dark) */
  --bg: #070b14;
  --bg-2: #0b1120;
  --surface-solid: #111a2c;
  --surface: color-mix(in oklab, #18233a 66%, transparent);
  --surface-2: color-mix(in oklab, #ffffff 6%, transparent);
  --border: color-mix(in oklab, #ffffff 10%, transparent);
  --border-strong: color-mix(in oklab, #ffffff 18%, transparent);
  --text: #eef2fa;
  --text-muted: #a3aec4;          /* 8.4:1 on --bg, >= 6.5:1 on cards */
  --track: color-mix(in oklab, #ffffff 9%, transparent);

  --accent-1: #c6f432;            /* lime */
  --accent-2: #22d3ee;            /* cyan */
  --accent: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
  --accent-ink: #c6f432;          /* accent used as text: 14:1 on --bg */
  --on-accent: #04130c;           /* text on the gradient: >= 9:1 */
  --accent-soft: color-mix(in oklab, var(--accent-1) 14%, transparent);
  --glow-1: color-mix(in oklab, var(--accent-1) 16%, transparent);
  --glow-2: color-mix(in oklab, var(--accent-2) 14%, transparent);

  --danger: #ff9b9b;
  --warn: #ffc46b;               /* above a target: informative, never alarming */
  --danger-bg: color-mix(in oklab, #ff5c5c 14%, transparent);
  --focus: #8be9ff;

  /* Spacing (4px base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;
  --gutter: var(--s-4);

  /* Radius */
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Type */
  --font-body: ui-sans-serif, -apple-system, "SF Pro Rounded", BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --t-xs: 0.75rem;
  --t-sm: 0.875rem;
  --t-md: 1.0625rem;
  --t-lg: 1.25rem;
  --t-xl: 1.75rem;
  --t-display: clamp(2.25rem, 1.6rem + 3.2vw, 3rem);

  /* Elevation */
  --shadow: 0 1px 0 0 color-mix(in oklab, #ffffff 7%, transparent) inset,
            0 20px 40px -24px rgb(0 0 0 / 0.75);
  --shadow-dock: 0 1px 0 0 color-mix(in oklab, #ffffff 10%, transparent) inset,
                 0 18px 44px -12px rgb(0 0 0 / 0.7);
  --blur: saturate(160%) blur(22px);

  /* Interaction */
  --tap: 48px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 220ms;
  --dock-h: 68px;

  /* Safe areas */
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
  --safe-right: env(safe-area-inset-right);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f6fb;
    --bg-2: #e9eef7;
    --surface-solid: #ffffff;
    --surface: color-mix(in oklab, #ffffff 74%, transparent);
    --surface-2: color-mix(in oklab, #0b1220 5%, transparent);
    --border: color-mix(in oklab, #0b1220 9%, transparent);
    --border-strong: color-mix(in oklab, #0b1220 18%, transparent);
    --text: #0b1220;
    --text-muted: #4a5568;          /* 7:1 on --bg */
    --track: color-mix(in oklab, #0b1220 8%, transparent);

    --accent-ink: #0b7a4f;          /* 5.2:1 on white */
    --warn: #9a5b00;
    --accent-soft: color-mix(in oklab, #3fbf3f 16%, transparent);
    --glow-1: color-mix(in oklab, var(--accent-1) 30%, transparent);
    --glow-2: color-mix(in oklab, var(--accent-2) 22%, transparent);

    --danger: #b42318;              /* 5.9:1 on its tinted background */
    --danger-bg: color-mix(in oklab, #f04438 10%, #ffffff);
    --focus: #0369a1;

    --shadow: 0 1px 0 0 #ffffff inset, 0 18px 36px -24px rgb(15 23 42 / 0.35);
    --shadow-dock: 0 1px 0 0 #ffffff inset, 0 16px 40px -14px rgb(15 23 42 / 0.35);
  }
}

/* ---------- 2. Base ------------------------------------------------------ */
@view-transition { navigation: auto; }

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--t-md);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

h1, h2, h3, p, dl, dd, ol { margin: 0; }
ol { padding: 0; list-style: none; }
svg { display: block; flex: none; }
a { color: inherit; }

/* Ambient light behind everything (fixed layer, not background-attachment: iOS ignores it). */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 12% -4%, var(--glow-1), transparent 70%),
    radial-gradient(55% 38% at 100% 104%, var(--glow-2), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon { width: 22px; height: 22px; }

/* ---------- 3. Typography ----------------------------------------------- */
.display {
  font-family: var(--font-display);
  font-size: var(--t-display);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.eyebrow {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lede {
  color: var(--text-muted);
  font-size: var(--t-md);
  max-width: 34ch;
  text-wrap: pretty;
}

.num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---------- 4. Surfaces (frosted glass with opaque fallback) ------------- */
.panel,
.card,
.dock,
.icon-btn {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .panel,
  .card,
  .dock,
  .icon-btn {
    background: var(--surface);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .panel,
  .card,
  .dock,
  .icon-btn {
    background: var(--surface-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* ---------- 5. Controls -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 56px;
  padding: 0 var(--s-6);
  border: 0;
  border-radius: var(--r-md);
  font: inherit;
  font-weight: 700;
  font-size: var(--t-md);
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--dur) var(--ease-out), filter var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.btn--primary {
  background: var(--accent-1);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 10px 28px -12px color-mix(in oklab, var(--accent-2) 70%, transparent);
}

.btn--block { width: 100%; }

.btn__icon { width: 20px; height: 20px; transition: transform var(--dur) var(--ease-out); }

.btn:active { transform: scale(0.97); filter: brightness(0.96); }
.btn--primary:hover .btn__icon { transform: translateX(3px); }

.btn[aria-busy="true"] { pointer-events: none; filter: saturate(0.6); }
.btn[aria-busy="true"] .btn__icon { animation: nudge 0.9s var(--ease-out) infinite; }

.icon-btn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--dur) var(--ease-out);
}
.icon-btn:active { transform: scale(0.92); }

.field { display: grid; gap: var(--s-2); }

.field__label {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--text-muted);
}

.field__input {
  width: 100%;
  min-height: 54px;
  padding: 0 var(--s-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: max(16px, var(--t-md)); /* >= 16px: no iOS zoom on focus */
  caret-color: var(--accent-ink);
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.field__input:focus,
.field__input:focus-visible {
  outline: none;
  border-color: var(--accent-ink);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: var(--t-sm);
  font-weight: 600;
}
.alert__icon { width: 20px; height: 20px; margin-top: 1px; }

.chip {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.chip--xl { width: 64px; height: 64px; border-radius: var(--r-md); }
.chip--xl .icon { width: 30px; height: 30px; }

.soon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--t-xs);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.soon::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

/* ---------- 6. Brand mark ------------------------------------------------ */
.brand-mark { width: 64px; height: 64px; filter: drop-shadow(0 12px 24px color-mix(in oklab, var(--accent-2) 30%, transparent)); }
.brand-mark__tile { fill: #0f172a; }
.brand-mark__track { stroke: rgb(255 255 255 / 0.1); }
.brand-mark__bolt { fill: #eef2fa; }
.stop-a { stop-color: var(--accent-1); }
.stop-b { stop-color: var(--accent-2); }

/* ---------- 7. Auth / offline layout (actions in the thumb zone) ---------- */
.auth {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  min-height: 100vh;
  min-height: 100dvh;
  width: min(100%, 480px);
  margin-inline: auto;
  padding:
    calc(var(--safe-top) + var(--s-12)) calc(var(--safe-right) + var(--gutter))
    calc(var(--safe-bottom) + var(--s-6)) calc(var(--safe-left) + var(--gutter));
}

.auth__intro { display: grid; gap: var(--s-3); justify-items: start; }
.auth__intro .brand-mark,
.auth__intro .chip--xl { margin-bottom: var(--s-4); view-transition-name: brand; }

.auth__form {
  display: grid;
  gap: var(--s-5);
  margin-top: auto; /* push the form down to the thumb zone */
}

.panel {
  padding: var(--s-5);
  border-radius: var(--r-xl);
}

/* ---------- 8. App shell -------------------------------------------------- */
.app {
  width: min(100%, 640px);
  margin-inline: auto;
  padding:
    calc(var(--safe-top) + var(--s-6)) calc(var(--safe-right) + var(--gutter))
    calc(var(--safe-bottom) + var(--dock-h) + var(--s-10)) calc(var(--safe-left) + var(--gutter));
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.topbar__titles { display: grid; gap: var(--s-1); min-width: 0; }
.topbar__titles .eyebrow::first-letter { text-transform: uppercase; }
.topbar__action { margin: 0; flex: none; }

/* ---------- 9. Bento grid ------------------------------------------------- */
.bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
  padding: var(--s-4);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card--hero,
.card--wide { grid-column: 1 / -1; }
.card--hero { border-radius: var(--r-xl); padding: var(--s-5); }

/* Accent hairline on the hero card. */
.card--hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--accent);
  opacity: 0.7;
}

.card__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
}
.card__head .soon { margin-left: auto; }
.card__head--stack { flex-direction: column; align-items: flex-start; gap: var(--s-3); }

.card__title {
  font-size: var(--t-md);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.metric {
  display: flex;
  align-items: baseline;
  gap: var(--s-1);
  margin-top: auto;
}
.metric .num { font-size: var(--t-xl); font-weight: 800; letter-spacing: -0.02em; }
.unit { color: var(--text-muted); font-size: var(--t-sm); font-weight: 600; }

/* Targets: ring + macros */
.targets {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s-5);
}

.ring { position: relative; width: 112px; height: 112px; }
.ring__svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring__track { stroke: var(--track); }
.ring__ticks {
  stroke: var(--accent-ink);
  stroke-dasharray: 0.6 4.4;
  stroke-linecap: round;
  opacity: 0.45;
}
.ring__label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.1;
}
.ring__label .num { font-size: var(--t-xl); font-weight: 800; }

.macros { display: grid; gap: var(--s-3); }
.macro { display: grid; gap: 6px; }
.macro dt { font-size: var(--t-sm); font-weight: 600; color: var(--text-muted); }
.macro dd { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s-3); }
.macro .num { font-size: var(--t-sm); font-weight: 700; min-width: 3.2ch; }

.bar,
.skeleton__line {
  display: block;
  height: 8px;
  border-radius: var(--r-pill);
  background:
    linear-gradient(90deg, transparent 0%, color-mix(in oklab, var(--text) 9%, transparent) 50%, transparent 100%) 0 0 / 200% 100% no-repeat,
    var(--track);
  animation: shimmer 2.8s linear infinite;
}

.skeleton { display: grid; gap: var(--s-2); }
.skeleton__line { height: 10px; width: 62%; }
.skeleton__line--lg { height: 14px; width: 84%; }

.spark { width: 100%; height: 28px; }
.spark__line {
  stroke: var(--accent-ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 3 5;
  opacity: 0.5;
  vector-effect: non-scaling-stroke;
}

.glasses { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.glasses li { height: 28px; border-radius: 6px; background: var(--track); } /* same height as .spark: metrics align */

/* ---------- 10. Floating dock (thumb zone) -------------------------------- */
.dock {
  position: fixed;
  z-index: 10;
  left: calc(var(--safe-left) + var(--gutter));
  right: calc(var(--safe-right) + var(--gutter));
  bottom: calc(var(--safe-bottom) + var(--s-3));
  display: grid;
  grid-auto-flow: column; /* one row whatever the number of items */
  grid-auto-columns: minmax(0, 1fr);
  gap: var(--s-1);
  max-width: 440px;
  min-height: var(--dock-h);
  margin-inline: auto;
  padding: 6px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-dock);
  view-transition-name: dock;
}

.dock__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 56px;
  border-radius: 22px;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  touch-action: manipulation;
  transition: transform var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}
.dock__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock__item[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.dock__item[aria-current="page"] .icon { color: var(--accent-ink); }
.dock__item[aria-disabled="true"] { opacity: 0.62; }
a.dock__item:active { transform: scale(0.94); }

/* ---------- 11. Motion ---------------------------------------------------- */
.rise { animation: rise 520ms var(--ease-out) both; }
.bento > .card { animation: rise 560ms var(--ease-out) both; }
.bento > .card:nth-child(1) { animation-delay: 60ms; }
.bento > .card:nth-child(2) { animation-delay: 120ms; }
.bento > .card:nth-child(3) { animation-delay: 180ms; }
.bento > .card:nth-child(4) { animation-delay: 240ms; }
.auth__form.rise { animation-delay: 90ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes shimmer {
  from { background-position: 150% 0, 0 0; }
  to { background-position: -50% 0, 0 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

::view-transition-old(root) { animation: vt-out 160ms ease-in both; }
::view-transition-new(root) { animation: vt-in 300ms var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after,
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .btn:active, .icon-btn:active, a.dock__item:active { transform: none; }
}

/* ---------- 12. Larger screens ------------------------------------------- */
@media (min-width: 560px) {
  :root { --gutter: var(--s-6); }
  .bento { gap: var(--s-4); }
  .card { padding: var(--s-5); }
}

@media (max-width: 359px) {
  :root { --gutter: 12px; }
  .targets { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .macros { width: 100%; }
  .card { padding: var(--s-3); }
  .soon { max-width: 100%; white-space: normal; border-radius: 10px; }
}

/* SvelteKit mount point (src/app.html): replaces the template's inline style="display: contents",
   which the CSP (style-src 'self') would block. */
.sk-root { display: contents; }

/*
 * SvelteKit's runtime announcer: node_modules/@sveltejs/kit/src/runtime/components/root.svelte
 * hardcodes <div id="svelte-announcer" style="position: absolute; ..."> inside {#if mounted}.
 * Svelte's client runtime inserts it via template.innerHTML (from_html, in the built chunk
 * _app/immutable/chunks/<hash>.js), so under our strict CSP (style-src 'self') the style is blocked
 * and this rule hides the element instead. Kit has no option to remove the announcer or its style.
 * Chrome reports ONE console violation per page load:
 *   "Applying inline style violates the following Content Security Policy directive
 *    'style-src 'self''. Either the 'unsafe-inline' keyword, a hash
 *    ('sha256-S8qMpvofolR8Mpjy4kQvEm7m1q8clzU4dfDH0AmvZjo='), or a nonce ... The action has been blocked."
 * Task I2 may whitelist ONLY a violation whose message starts with "Applying inline style violates"
 * AND contains that exact hash; nothing broader. The hash lives in src/lib/announcerCsp.ts (single
 * source of truth, import it from I2); tests/announcer.test.ts fails if Kit's style string changes.
 * The server CSP deliberately does not get 'unsafe-hashes'. The !important flags are kept.
 */
#svelte-announcer {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.conn__title { font-size: 1.4rem; margin: 0 0 1rem; }
.conn__text { margin: 0.5rem 0; }

.form { display: grid; gap: 1rem; }
.form__section { border: 1px solid var(--line, rgb(255 255 255 / 0.12)); border-radius: 12px; padding: 0.75rem 1rem 1rem; display: grid; gap: 0.5rem; }
.form__section legend { padding: 0 0.4rem; font-weight: 600; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 1rem; }
.check { display: flex; gap: 0.5rem; align-items: center; min-height: 44px; }
.tg__kcal { margin: 0.25rem 0; font-size: 2.2rem; }
.tg__macros { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 1rem; margin: 0.5rem 0; }
.tg__macros div { display: flex; justify-content: space-between; }
.tg__macros dd { margin: 0; font-weight: 600; }
.tg__slots, .tg__reasons { padding-left: 1.1rem; margin: 0.5rem 0; display: grid; gap: 0.3rem; }
.tg__why { min-height: 44px; background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.tg__note { font-size: 0.85rem; opacity: 0.8; margin: 0.5rem 0 0; }

.seg { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.seg__btn { min-height: 44px; padding: 0 0.9rem; border-radius: 999px; border: 1px solid var(--line, rgb(255 255 255 / 0.2)); background: transparent; color: inherit; cursor: pointer; }
.seg__btn[aria-pressed="true"] { background: var(--surface-2); border-color: var(--accent-ink, currentColor); font-weight: 700; }
.sessions, .plan { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.75rem; }
.sessions__item, .plan__day { display: grid; gap: 0.4rem; }
.sessions__title { margin: 0; }
.plan__session { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

.summary { display: grid; gap: 0.6rem; margin: 0.5rem 0 1rem; }
.summary__row { display: grid; gap: 0.2rem; }
.summary__row progress { width: 100%; height: 0.6rem; }

.payload { overflow-x: auto; padding: 0.75rem; border-radius: 12px; background: var(--surface-2); font-size: 0.8rem; white-space: pre-wrap; word-break: break-word; }

.conn__why { opacity: 0.75; }

.week__day { margin: 0.5rem 0; }
.week__title { font-size: 1rem; margin: 0.6rem 0 0.2rem; }

/* ---------- Add panel + day summary ---------- */
.addpanel { display: grid; gap: var(--s-4); margin: var(--s-4) 0; }
.addpanel__body { display: grid; gap: var(--s-4); }
.summary { display: grid; gap: var(--s-4); }
.summary__row { display: grid; gap: 6px; }
.summary__line { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.summary__label { color: var(--text-muted); font-size: var(--t-sm); font-weight: 600; }
.summary__value { font-size: var(--t-sm); color: var(--text-muted); }
.summary__value .num { color: var(--text); font-size: var(--t-md); font-weight: 800; }
.summary__left { font-size: var(--t-xs); color: var(--text-muted); }
.summary__left--over { color: var(--warn); }
.bar { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: var(--r-pill); background: var(--track); overflow: hidden; }
.bar::-webkit-progress-bar { background: var(--track); border-radius: var(--r-pill); }
.bar::-webkit-progress-value { background: var(--accent); border-radius: var(--r-pill); transition: width var(--dur) var(--ease-out); }
.bar::-moz-progress-bar { background: var(--accent); border-radius: var(--r-pill); }
.bar--over::-webkit-progress-value { background: var(--warn); }
.bar--over::-moz-progress-bar { background: var(--warn); }

/* ---------- Lists as soft cards ---------- */
.sessions__item { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); }

.addpanel__bar { display: flex; gap: var(--s-3); align-items: stretch; flex-wrap: wrap; }
.addpanel__toggle { flex: 1 1 12rem; }
.btn--soft { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 var(--s-4); border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text); font-weight: 700; text-decoration: none; }

/* ---------- Session card ---------- */
.scard { display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); }
.scard__icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-ink); }
.scard__icon .icon { width: 24px; height: 24px; }
.scard__main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.scard__title { margin: 0; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; font-size: var(--t-md); }
.scard__meta { margin: 0; color: var(--text); font-size: var(--t-sm); }
.scard__src { margin: 0; color: var(--text-muted); font-size: var(--t-xs); }
.tag { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.tag--soutenu { color: var(--accent-ink); border-color: var(--accent-soft); background: var(--accent-soft); }
.tag--match { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 40%, transparent); background: color-mix(in oklab, var(--warn) 14%, transparent); }
