  :root {
    --bg:       #f0fafa;
    --surface:  #ffffff;
    --surface2: #f1f8f7;
    --surface3: #e2f0ee;
    --border:   rgba(0,0,0,0.08);
    --border2:  rgba(0,0,0,0.13);
    --accent:   #0d9488;
    --accent2:  #14b8a6;
    --glow:     rgba(13,148,136,0.18);
    --text:     #0f172a;
    --text2:    #475569;
    --text3:    #94a3b8;
    --user-bg:  #e8faf8;
    --r:        12px;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; overflow: hidden; }

  /* ════════════════════════════════════════
     LANDING / HOME PAGE
  ════════════════════════════════════════ */
  #landing {
    position: fixed; inset: 0; z-index: 60;
    background: var(--bg);
    display: flex; flex-direction: column; align-items: center;
    overflow-y: auto; padding: 0 24px 40px;
    transition: opacity .35s ease, transform .35s ease;
  }
  #landing.hidden {
    opacity: 0; pointer-events: none; transform: translateY(-12px);
  }

  /* ── Boot gate ──────────────────────────────────────────────────────────
     While <html data-boot="pending"> (set synchronously in index.html's
     <head>, cleared by _finishBoot() once auth state is known) hold the
     landing overlay invisible and show a neutral brand splash. Stops
     logged-in users from seeing a flash of the marketing landing page
     before the app loads. #landing keeps its .35s opacity transition, so it
     fades in smoothly for logged-out users when the gate clears. Applies in
     both v1 and v2 (keyed off data-boot, not data-ui). */
  #bootSplash { display: none; }
  html[data-boot="pending"] #bootSplash {
    display: flex; position: fixed; inset: 0; z-index: 100;
    align-items: center; justify-content: center;
    background: var(--bg);
  }
  html[data-boot="pending"] #landing { opacity: 0 !important; pointer-events: none; }
  /* Also hide #auth-overlay during boot — its initial markup is v1, and
     views-init.js mutates it to v2 on DOMContentLoaded. Without this,
     between first paint and that mutation the user sees a flash of the
     v1 auth UI (the "v1 UI sometimes shows up" symptom). */
  html[data-boot="pending"] #auth-overlay { opacity: 0 !important; pointer-events: none; }
  .boot-splash-mark {
    font-weight: 700; font-size: 30px; letter-spacing: .12em;
    color: var(--accent); animation: bootPulse 1.1s ease-in-out infinite;
  }
  @keyframes bootPulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

  /* landing top nav bar — same visual language as chat header */
  .l-topbar {
    width: calc(100% + 48px);
    margin: 0 -24px 36px;
    padding: 0 24px;
    height: 52px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg);
    border-bottom: 1px solid rgba(0,0,0,0.07);
    position: sticky; top: 0; z-index: 2;
  }
  .l-topbar .logo { display: flex; align-items: center; gap: 8px; }

  /* hide the old centered user pill — replaced by topbar user chip */
  #userBar { display: none !important; }

  .landing-report-cards {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  }
  .lrcard {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 18px 10px 14px;
    cursor: pointer; font-family: inherit; transition: all .18s;
    text-align: center;
  }
  .lrcard:hover {
    border-color: var(--accent); box-shadow: 0 4px 16px var(--glow);
    transform: translateY(-2px);
  }
  .lrcard-icon { font-size: 24px; line-height: 1; }
  .lrcard-label { font-size: 12px; font-weight: 600; color: var(--text2); }

  @media (max-width: 540px) {
    .landing-report-cards { grid-template-columns: repeat(2, 1fr); }
  }

  /* hero */
  .l-hero {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; margin-bottom: 44px;
  }
  .l-logo-wrap {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    border-radius: 22px; display: grid; place-items: center;
    font-size: 30px; font-weight: 900; color: #fff;
    box-shadow: 0 0 56px rgba(13,148,136,0.35);
    margin-bottom: 18px;
  }
  .l-title {
    font-size: 32px; font-weight: 800; letter-spacing: -0.8px;
    background: linear-gradient(135deg, #0f172a 30%, #0d9488 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  .l-tagline {
    font-size: 14px; color: var(--text2); margin-top: 6px;
    line-height: 1.6; max-width: 300px;
  }

  /* section label */
  .l-section-label {
    font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px;
    text-transform: uppercase; color: var(--text3);
    text-align: center; margin-bottom: 14px;
  }

  /* platforms grid */
  .platforms-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 14px; width: 100%; max-width: 620px;
    margin-bottom: 14px;
  }

  /* ── Platform card — utility-forward with brand soul ── */
  .pcard {
    background: #fff;
    border: 1px solid #e8eeec;
    border-radius: 16px;
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: box-shadow .2s, transform .18s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  }
  .pcard:hover:not(.coming-soon) {
    box-shadow: 0 6px 24px rgba(0,0,0,0.11);
    transform: translateY(-2px);
  }
  .pcard.coming-soon { opacity: 0.45; }
  .pcard.connectable { cursor: pointer; }

  /* coloured top accent bar */
  .pcard-accent {
    height: 4px; width: 100%; flex-shrink: 0;
  }
  .pcard-accent.strava     { background: linear-gradient(90deg,#FC5200,#ff7a3d); }
  .pcard-accent.garmin     { background: linear-gradient(90deg,#007bbf,#009cda); }
  .pcard-accent.fitbit     { background: linear-gradient(90deg,#00a0b0,#00c4b4); }
  .pcard-accent.google     { background: linear-gradient(90deg,#4285f4,#34a853); }
  .pcard-accent.whoop      { background: linear-gradient(90deg,#1e1e1e,#3a3a3a); }
  .pcard-accent.ultrahuman { background: linear-gradient(90deg,#b8860b,#d4a84b); }

  /* card inner wrapper */
  .pcard-body {
    padding: 16px 16px 0;
    display: flex; flex-direction: column; gap: 11px;
    flex: 1;
  }

  /* header row: logo + title */
  .pcard-head {
    display: flex; align-items: flex-start; gap: 10px;
  }
  .pcard-title { flex: 1; min-width: 0; }

  /* platform logo */
  .p-logo {
    width: 38px; height: 38px; border-radius: 10px;
    display: grid; place-items: center;
    font-size: 14px; font-weight: 800; color: #fff;
    flex-shrink: 0;
  }
  .p-logo.strava     { background: linear-gradient(135deg,#FC5200,#ff7a3d); }
  .p-logo.garmin     { background: linear-gradient(135deg,#007bbf,#009cda); }
  .p-logo.fitbit     { background: linear-gradient(135deg,#00a0b0,#00c4b4); }
  .p-logo.google     { background: linear-gradient(135deg,#4285f4,#34a853); }
  .p-logo.whoop      { background: linear-gradient(135deg,#1e1e1e,#3a3a3a); border:1px solid #444; }
  .p-logo.ultrahuman { background: linear-gradient(135deg,#b8860b,#d4a84b); }

  .p-name    { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.2; }
  .p-tagline { font-size: 11px; color: var(--text3); line-height: 1.4; margin-top: 2px; }

  /* stat pills */
  .pcard-stats { display: flex; flex-wrap: wrap; gap: 5px; }
  .pstat-pill {
    font-size: 10.5px; font-weight: 600; color: var(--text2);
    background: var(--surface2); border-radius: 20px;
    padding: 3px 9px; white-space: nowrap;
  }

  /* card footer — sits below a separator line */
  .pcard-foot {
    margin-top: auto;
    border-top: 1px solid #f0f5f3;
    padding: 10px 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
  }

  /* left side of footer: status dot + synced-ago text */
  .p-foot-left {
    display: flex; align-items: center; gap: 5px;
    min-width: 0; overflow: hidden;
  }
  .p-foot-right {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  }

  /* status badges */
  .p-badge {
    display: flex; align-items: center; gap: 5px;
    font-size: 10.5px; font-weight: 600;
  }
  .p-badge.ok   { color: #22c55e; }
  .p-badge.soon { color: var(--text3); font-size: 10px; }
  .p-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #22c55e; flex-shrink: 0;
    box-shadow: 0 0 6px rgba(34,197,94,0.5);
  }
  .p-synced-ago {
    font-size: 10px; color: var(--text3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  /* sync button */
  .p-sync-btn {
    background: none; border: 1.5px solid #d1ede9;
    color: var(--text2); font-size: 11px; font-weight: 600;
    border-radius: 8px; padding: 4px 10px; cursor: pointer;
    transition: color .18s, border-color .18s, background .18s;
    white-space: nowrap; font-family: inherit;
  }
  .p-sync-btn:hover:not(:disabled) {
    color: var(--accent); border-color: var(--accent);
    background: rgba(13,148,136,0.05);
  }
  .p-sync-btn:disabled { opacity: 0.45; cursor: default; }

  /* disconnect button */
  .p-disc-btn {
    background: none; border: 1.5px solid #e8eeec;
    color: var(--text3); font-size: 11px; font-weight: 600;
    border-radius: 8px; padding: 4px 10px; cursor: pointer;
    transition: color .18s, border-color .18s, background .18s;
    white-space: nowrap; font-family: inherit;
  }
  .p-disc-btn:hover {
    color: #ef4444; border-color: #fca5a5;
    background: rgba(239,68,68,0.05);
  }

  /* connect / notify badges */
  .p-badge.connect {
    color: var(--accent); cursor: pointer;
    background: rgba(13,148,136,0.1);
    border-radius: 8px; padding: 4px 11px;
    font-size: 11px; font-weight: 700;
    transition: background .15s; white-space: nowrap;
  }
  .pcard.connectable:hover .p-badge.connect { background: rgba(13,148,136,0.2); }

  .p-notify-link {
    font-size: 10.5px; font-weight: 600; color: var(--accent);
    text-decoration: none; cursor: pointer;
    padding: 4px 0;
    transition: opacity .15s;
  }
  .p-notify-link:hover { opacity: 0.7; }

  /* sync-all bar */
  .sync-all-bar {
    width: 100%; max-width: 620px;
    display: flex; align-items: center; justify-content: space-between;
    background: #fff; border: 1px solid #e8eeec;
    border-radius: 14px; padding: 12px 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 28px;
  }
  .sync-all-label {
    font-size: 12px; font-weight: 600; color: var(--text2);
  }
  .sync-all-btn {
    background: var(--accent); color: #fff;
    border: none; border-radius: 10px;
    padding: 7px 18px; font-size: 12px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    transition: background .18s, transform .12s;
  }
  .sync-all-btn:hover { background: var(--accent2); transform: translateY(-1px); }
  .sync-all-btn:active { transform: translateY(0); }
  .sync-all-btn:disabled { opacity: 0.45; cursor: default; transform: none; }

  /* skeleton loaders */
  .pcard-skel {
    border-radius: 16px; height: 155px;
    background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
  }

  /* "connect first" notice */
  #connectNotice {
    font-size: 12px; color: var(--text2); text-align: center;
    margin-bottom: 12px; line-height: 1.6;
    background: rgba(13,148,136,0.08);
    border: 1px solid rgba(13,148,136,0.18);
    border-radius: 10px; padding: 10px 16px;
    max-width: 420px; width: 100%;
  }

  /* logged-in user bar on landing */
  #userBar {
    display: none;
    align-items: center; gap: 10px;
    margin-bottom: 14px;
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.2);
    border-radius: 10px; padding: 9px 14px;
    max-width: 420px; width: 100%;
  }
  #userBar.show { display: flex; }
  .user-avatar {
    width: 28px; height: 28px; border-radius: 8px;
    background: linear-gradient(135deg,var(--accent),var(--accent2));
    display: grid; place-items: center;
    font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0;
  }
  .user-bar-name { font-size: 12px; font-weight: 600; color: var(--text); flex: 1; }
  .user-bar-status { font-size: 10.5px; color: #22c55e; }
  .logout-btn {
    background: none; border: 1px solid var(--border2);
    border-radius: 6px; padding: 3px 8px;
    font-size: 10.5px; color: var(--text3); cursor: pointer;
    font-family: inherit; transition: all .15s;
  }
  .logout-btn:hover { border-color: #f87171; color: #f87171; }

  /* ── Header user chip (top-right) ── */
  #headerUser {
    display: none; align-items: center; gap: 8px;
  }
  #headerUser.show { display: flex; }
  .header-avatar {
    width: 28px; height: 28px; border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: grid; place-items: center;
    font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0;
    letter-spacing: 0;
  }
  .header-username {
    font-size: 12px; font-weight: 600; color: var(--text);
    max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .header-signout {
    background: none; border: 1px solid var(--border2);
    border-radius: 7px; padding: 3px 9px;
    font-size: 11px; color: var(--text3); cursor: pointer;
    font-family: inherit; transition: border-color .15s, color .15s, background .15s;
  }
  .header-signout:hover { border-color: #fca5a5; color: #ef4444; background: rgba(239,68,68,0.05); }

  /* OAuth result toast (top banner) */
  #oauthToast {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-64px);
    padding: 10px 20px; border-radius: 12px;
    font-size: 13px; font-weight: 600; color: #fff;
    z-index: 200; transition: transform .35s cubic-bezier(.34,1.56,.64,1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    white-space: nowrap; pointer-events: none;
  }
  #oauthToast.show   { transform: translateX(-50%) translateY(0); }
  #oauthToast.ok     { background: #16a34a; }
  #oauthToast.err    { background: #dc2626; }
  #oauthToast.setup  { background: #0d9488; }

  /* disabled enter btn */
  .enter-btn:disabled {
    opacity: 0.35; cursor: not-allowed;
    transform: none !important; box-shadow: none !important;
  }

  /* ── Garmin credentials modal ──────────────────────────────── */
  /* ── In-app confirm dialog ──────────────────────────────────────── */
  #yuha-confirm-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.45); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; pointer-events: none;
    transition: opacity .18s ease;
  }
  #yuha-confirm-overlay.open { opacity: 1; pointer-events: auto; }
  #yuha-confirm-box {
    background: #fff; border: 1px solid rgba(0,0,0,0.08);
    border-radius: 20px; width: 100%; max-width: 360px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.22);
    padding: 28px 24px 22px;
    transform: translateY(12px) scale(.97);
    transition: transform .2s cubic-bezier(.16,1,.3,1);
    text-align: center;
  }
  #yuha-confirm-overlay.open #yuha-confirm-box { transform: none; }
  #yuha-confirm-icon { font-size: 32px; margin-bottom: 10px; line-height: 1; }
  #yuha-confirm-title {
    font-size: 16px; font-weight: 700; color: var(--text);
    margin-bottom: 8px;
  }
  #yuha-confirm-msg {
    font-size: 13px; color: var(--text2); line-height: 1.55;
    margin-bottom: 22px;
  }
  .yuha-confirm-btns {
    display: flex; gap: 10px; justify-content: center;
  }
  .yuha-confirm-cancel {
    flex: 1; padding: 10px 0; border-radius: 99px;
    border: 1.5px solid var(--border2); background: var(--surface2);
    color: var(--text2); font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: background .15s;
  }
  .yuha-confirm-cancel:hover { background: var(--surface3); }
  #yuha-confirm-ok {
    flex: 1; padding: 10px 0; border-radius: 99px;
    border: none; background: #dc2626; color: #fff;
    font-size: 14px; font-weight: 700;
    cursor: pointer; font-family: inherit; transition: background .15s;
  }
  #yuha-confirm-ok:hover { background: #b91c1c; }
  #yuha-confirm-ok.warn { background: #d97706; }
  #yuha-confirm-ok.warn:hover { background: #b45309; }

  #garmin-modal-overlay {
    position: fixed; inset: 0; z-index: 110;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  #garmin-modal-overlay.open { opacity: 1; pointer-events: auto; }
  #garmin-modal {
    background: #ffffff; border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px; width: 100%; max-width: 380px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.25);
    transform: translateY(16px) scale(.96);
    transition: transform .22s cubic-bezier(.16,1,.3,1);
    position: relative; overflow: hidden;
  }
  #garmin-modal-overlay.open #garmin-modal { transform: none; }
  .gm-top-bar {
    height: 5px;
    background: linear-gradient(90deg, #009cda, #005f85);
  }
  .gm-body { padding: 28px 28px 24px; background: #ffffff; }
  .gm-header {
    display: flex; align-items: center; gap: 14px; margin-bottom: 22px;
  }
  .gm-logo {
    width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
    background: linear-gradient(135deg,#009cda,#005f85);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff; font-weight: 800;
    box-shadow: 0 4px 12px rgba(0,156,218,.3);
  }
  .gm-header-text { flex: 1; min-width: 0; }
  .gm-header-text .gm-title {
    font-size: 17px; font-weight: 700; color: #0f172a; line-height: 1.2;
  }
  .gm-header-text .gm-sub {
    font-size: 12px; color: #64748b; margin-top: 3px; line-height: 1.45;
  }
  .gm-field { margin-bottom: 14px; }
  .gm-label {
    font-size: 11px; font-weight: 700; color: #475569;
    margin-bottom: 6px; display: block; letter-spacing: .5px;
    text-transform: uppercase;
  }
  .gm-input {
    width: 100%; padding: 11px 14px; border-radius: 10px;
    border: 1.5px solid #e2e8f0; background: #f8fafc;
    color: #0f172a; font-size: 14px; outline: none;
    box-sizing: border-box; transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
  }
  .gm-input::placeholder { color: #94a3b8; }
  .gm-input:focus {
    border-color: #009cda; background: #fff;
    box-shadow: 0 0 0 3px rgba(0,156,218,.12);
  }
  .gm-actions { display: flex; gap: 10px; margin-top: 22px; }
  .gm-cancel {
    padding: 11px 18px; border-radius: 10px; font-size: 14px;
    font-weight: 600; border: 1.5px solid #e2e8f0;
    background: #fff; color: #475569; cursor: pointer;
    transition: background .15s, border-color .15s;
  }
  .gm-cancel:hover { background: #f1f5f9; border-color: #cbd5e1; }
  .gm-save {
    flex: 1; padding: 11px; border-radius: 10px; font-size: 14px;
    font-weight: 700; border: none; cursor: pointer;
    background: linear-gradient(135deg,#009cda,#005f85);
    color: #fff; transition: opacity .15s, transform .1s;
    letter-spacing: .2px;
  }
  .gm-save:hover   { opacity: .88; transform: translateY(-1px); }
  .gm-save:active  { transform: translateY(0); }
  .gm-save:disabled { opacity: .4; cursor: not-allowed; transform: none; }
  .gm-note {
    font-size: 11px; color: #94a3b8; margin-top: 14px;
    text-align: center; line-height: 1.5;
  }
  .gm-close {
    position: absolute; top: 14px; right: 14px;
    background: #f1f5f9; border: none; font-size: 13px;
    color: #64748b; cursor: pointer; line-height: 1;
    padding: 6px 8px; border-radius: 8px; z-index: 1;
    transition: background .15s, color .15s;
  }
  .gm-close:hover { color: #0f172a; background: #e2e8f0; }

  /* ════════════════════════════════════════
     PROFILE MODAL
  ════════════════════════════════════════ */
  #profile-overlay {
    position: fixed; inset: 0; z-index: 120;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
  }
  #profile-overlay.open { opacity: 1; pointer-events: auto; }
  #profile-modal {
    background: #fff; border: 1px solid rgba(0,0,0,.09);
    border-radius: 22px; width: 100%; max-width: 460px;
    max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
    box-shadow: 0 32px 80px rgba(0,0,0,.25);
    transform: translateY(16px) scale(.96);
    transition: transform .22s cubic-bezier(.16,1,.3,1);
  }
  #profile-overlay.open #profile-modal { transform: none; }
  .pm-top-bar {
    height: 4px; flex-shrink: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
  }
  .pm-header {
    display: flex; align-items: center; gap: 14px;
    padding: 22px 24px 16px; flex-shrink: 0;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
  }
  .pm-avatar-wrap {
    position: relative; flex-shrink: 0; cursor: pointer;
  }
  .pm-avatar {
    width: 58px; height: 58px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 800; color: #fff;
    overflow: hidden; border: 3px solid #fff;
    box-shadow: 0 4px 14px rgba(99,102,241,.25);
  }
  .pm-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .pm-avatar-edit {
    position: absolute; bottom: -2px; right: -2px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent); color: #fff; border: 2px solid #fff;
    font-size: 11px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.2);
  }
  .pm-user-info { flex: 1; min-width: 0; }
  .pm-user-name { font-size: 17px; font-weight: 700; color: #0f172a; }
  .pm-user-email { font-size: 12px; color: #64748b; margin-top: 2px; }
  .pm-close {
    position: absolute; top: 14px; right: 14px;
    background: #f1f5f9; border: none; font-size: 13px;
    color: #64748b; cursor: pointer; padding: 6px 8px;
    border-radius: 8px; transition: background .15s, color .15s;
  }
  .pm-close:hover { color: #0f172a; background: #e2e8f0; }
  .pm-tabs {
    display: flex; gap: 2px; padding: 0 24px;
    border-bottom: 1px solid #f1f5f9; flex-shrink: 0;
    background: #fafbfc;
  }
  .pm-tab {
    padding: 11px 14px; font-size: 12px; font-weight: 600;
    color: #94a3b8; cursor: pointer; border: none; background: none;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color .15s, border-color .15s; letter-spacing: .3px;
  }
  .pm-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
  .pm-tab:hover:not(.active) { color: #475569; }
  .pm-body {
    flex: 1; overflow-y: auto; padding: 20px 24px 24px;
  }
  .pm-section { display: none; }
  .pm-section.active { display: block; }
  .pm-field { margin-bottom: 14px; }
  .pm-label {
    font-size: 11px; font-weight: 700; color: #475569;
    margin-bottom: 5px; display: block;
    letter-spacing: .5px; text-transform: uppercase;
  }
  .pm-input, .pm-select {
    width: 100%; padding: 10px 13px; border-radius: 10px;
    border: 1.5px solid #e2e8f0; background: #f8fafc;
    color: #0f172a; font-size: 14px; outline: none;
    box-sizing: border-box; transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; font-family: inherit;
  }
  .pm-input:focus, .pm-select:focus {
    border-color: var(--accent); background: #fff;
    box-shadow: 0 0 0 3px rgba(99,102,241,.1);
  }
  .pm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .pm-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
  .pm-unit-row { display: flex; gap: 8px; align-items: center; }
  .pm-unit-row .pm-input { flex: 1; }
  .pm-unit-toggle {
    display: flex; border-radius: 8px;
    border: 1.5px solid #e2e8f0; flex-shrink: 0;
    position: relative; z-index: 1;
  }
  .pm-unit-toggle button {
    padding: 8px 11px; font-size: 11px; font-weight: 600;
    border: none; cursor: pointer; background: #f8fafc; color: #94a3b8;
    transition: background .15s, color .15s;
    position: relative; z-index: 1;
  }
  .pm-unit-toggle button:first-child { border-radius: 6px 0 0 6px; }
  .pm-unit-toggle button:last-child  { border-radius: 0 6px 6px 0; }
  .pm-unit-toggle button.active { background: var(--accent); color: #fff; }
  .act-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
  .act-chip {
    padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
    border: 1.5px solid #e2e8f0; background: #f8fafc; color: #475569;
    cursor: pointer; transition: all .15s; user-select: none;
  }
  .act-chip.selected {
    background: var(--accent); border-color: var(--accent); color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,.3);
  }
  .pm-divider {
    height: 1px; background: #f1f5f9; margin: 18px 0;
  }
  .pm-section-title {
    font-size: 13px; font-weight: 700; color: #0f172a;
    margin-bottom: 14px; display: flex; align-items: center; gap: 6px;
  }
  .pm-footer {
    padding: 14px 24px 18px; border-top: 1px solid #f1f5f9;
    display: flex; gap: 10px; flex-shrink: 0;
    background: #fafbfc;
  }
  .pm-save {
    flex: 1; padding: 11px; border-radius: 10px; font-size: 14px;
    font-weight: 700; border: none; cursor: pointer;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff; transition: opacity .15s, transform .1s;
  }
  .pm-save:hover   { opacity: .88; transform: translateY(-1px); }
  .pm-save:active  { transform: translateY(0); }
  .pm-save:disabled { opacity: .4; cursor: not-allowed; transform: none; }
  .pm-cancel {
    padding: 11px 18px; border-radius: 10px; font-size: 14px;
    font-weight: 600; border: 1.5px solid #e2e8f0;
    background: #fff; color: #475569; cursor: pointer;
    transition: background .15s;
  }
  .pm-cancel:hover { background: #f1f5f9; }
  .pm-msg { font-size: 12px; margin-top: 8px; text-align: center; }
  .pm-msg.ok    { color: #10b981; }
  .pm-msg.error { color: #ef4444; }
  .pm-pwd-note { font-size: 11px; color: #94a3b8; margin-top: 6px; line-height: 1.5; }

  /* ── Digest toggle switch ─────────────────────────────── */
  .digest-toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
  .digest-toggle input { opacity: 0; width: 0; height: 0; }
  .digest-slider {
    position: absolute; inset: 0; background: var(--surface3);
    border-radius: 24px; cursor: pointer; transition: background .2s;
  }
  .digest-slider::before {
    content: ""; position: absolute; width: 18px; height: 18px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
    transition: transform .2s;
  }
  .digest-toggle input:checked + .digest-slider { background: var(--accent); }
  .digest-toggle input:checked + .digest-slider::before { transform: translateX(20px); }
  /* Profile icon button in navbars */
  .profile-nav-btn {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: 2px solid rgba(255,255,255,.3); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; color: #fff;
    overflow: hidden; transition: transform .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(99,102,241,.25);
    flex-shrink: 0;
  }
  .profile-nav-btn:hover { transform: scale(1.08); box-shadow: 0 4px 14px rgba(99,102,241,.4); }
  .profile-nav-btn img { width: 100%; height: 100%; object-fit: cover; }

  /* ════════════════════════════════════════
     AUTH OVERLAY (Sign In / Sign Up)
  ════════════════════════════════════════ */
  #auth-overlay {
    position: fixed; inset: 0; z-index: 80;
    background: #fff;
    display: flex; flex-direction: row;
    overflow: hidden;
    transition: opacity .35s ease;
  }
  #auth-overlay.hidden {
    opacity: 0; pointer-events: none;
  }

  /* Left panel: forms */
  .auth-left {
    flex: 0 0 460px; display: flex; flex-direction: column;
    align-items: flex-start; justify-content: flex-start;
    padding: 48px 52px; overflow-y: auto;
    background: #fff;
    box-shadow: 4px 0 32px rgba(0,0,0,0.06);
    position: relative; z-index: 1;
  }
  .auth-logo-fixed {
    margin-bottom: 40px;
    flex-shrink: 0;
  }
  .auth-view {
    flex: 1;
    display: flex; flex-direction: column; justify-content: center;
    width: 100%;
  }

  /* Right panel: hero image */
  .auth-right {
    flex: 1; position: relative; overflow: hidden;
    background: linear-gradient(135deg, #e8faf8 0%, #ccfbf1 100%);
  }
  .auth-hero-img {
    display: block;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center top;
  }
  .auth-hero-placeholder {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 16px;
  }
  .auth-hero-placeholder .ph-icon { font-size: 64px; opacity: 0.35; }
  .auth-hero-placeholder .ph-text {
    font-size: 13px; color: #64748b; text-align: center;
    background: rgba(255,255,255,0.8); border-radius: 10px;
    padding: 10px 20px; max-width: 240px; line-height: 1.5;
  }

  .auth-view { width: 100%; max-width: 360px; }
  .auth-view.hidden { display: none !important; }
  .auth-logo-fixed { width: 100%; max-width: 360px; }

  /* Logo on left panel */
  .auth-logo-row {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 36px;
  }
  .auth-logo-wrap {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    border-radius: 11px; display: grid; place-items: center;
    font-size: 17px; font-weight: 900; color: #fff;
    box-shadow: 0 4px 16px rgba(13,148,136,0.3);
  }
  .auth-logo-name {
    font-size: 18px; font-weight: 800; letter-spacing: -0.3px;
    color: #0f172a;
  }

  /* Hero text */
  .auth-title {
    font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
    color: #0f172a; margin-bottom: 6px; line-height: 1.25;
  }
  .auth-tagline {
    font-size: 14px; color: #475569; margin-bottom: 28px;
    line-height: 1.6; max-width: 320px;
  }

  /* Feature list */
  .feature-list {
    display: flex; flex-direction: column; gap: 12px;
    width: 100%; margin-bottom: 32px;
  }
  .feature-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 13.5px; color: #475569; line-height: 1.5;
  }
  .feature-icon {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    display: grid; place-items: center; font-size: 14px;
  }

  /* Auth CTA buttons */
  .auth-btn-row { display: flex; flex-direction: column; gap: 10px; width: 100%; }
  .auth-btn-primary {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    border: none; border-radius: 12px; padding: 14px 28px;
    font-family: inherit; font-size: 14.5px; font-weight: 700; color: #fff;
    cursor: pointer; width: 100%;
    box-shadow: 0 4px 20px rgba(13,148,136,0.3);
    transition: transform .15s, box-shadow .15s;
  }
  .auth-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(13,148,136,0.42); }
  .auth-btn-primary:active { transform: scale(.97); }
  .auth-btn-ghost {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: #fff; border: 1.5px solid #e2e8f0;
    border-radius: 12px; padding: 13px 28px;
    font-family: inherit; font-size: 14px; font-weight: 600; color: #0f172a;
    cursor: pointer; width: 100%;
    transition: border-color .15s, background .15s;
  }
  .auth-btn-ghost:hover { border-color: #0d9488; background: #f0fafa; }

  .auth-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 16px 0; color: #94a3b8; font-size: 11px;
  }
  .auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: #e2e8f0;
  }

  .auth-strava-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: rgba(252,76,2,0.06); border: 1.5px solid rgba(252,76,2,0.25);
    border-radius: 12px; padding: 13px 28px;
    font-family: inherit; font-size: 13.5px; font-weight: 600;
    color: #FC5200; cursor: pointer; width: 100%; text-decoration: none;
    transition: background .15s, border-color .15s;
  }
  .auth-strava-btn:hover { background: rgba(252,76,2,0.12); border-color: rgba(252,76,2,0.45); }

  /* Auth forms */
  .auth-back-btn {
    background: none; border: none; color: #94a3b8;
    font-family: inherit; font-size: 12px; font-weight: 600;
    cursor: pointer; padding: 0; margin-bottom: 28px;
    display: flex; align-items: center; gap: 5px;
    transition: color .15s;
  }
  .auth-back-btn:hover { color: #0f172a; }

  .auth-form-title {
    font-size: 22px; font-weight: 800; letter-spacing: -0.4px;
    margin-bottom: 4px; color: #0f172a;
  }
  .auth-form-sub {
    font-size: 13px; color: #475569; margin-bottom: 26px; line-height: 1.5;
  }

  .auth-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
  .auth-field label {
    font-size: 12px; font-weight: 600; color: #0f172a; letter-spacing: 0.1px;
  }
  .auth-field input {
    background: #f8fafc; border: 1.5px solid #e2e8f0;
    border-radius: 10px; padding: 12px 14px;
    font-family: inherit; font-size: 14px; color: #0f172a;
    outline: none; transition: border-color .15s, box-shadow .15s;
  }
  .auth-field input:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
    background: #fff;
  }
  .auth-field input::placeholder { color: #94a3b8; }

  .auth-error {
    font-size: 12.5px; color: #dc2626;
    background: rgba(220,38,38,0.06);
    border: 1px solid rgba(220,38,38,0.18);
    border-radius: 8px; padding: 9px 13px;
    margin-bottom: 14px; display: none;
  }
  .auth-error.show { display: block; }

  .auth-success {
    font-size: 12.5px; color: #16a34a;
    background: rgba(22,163,74,0.07);
    border: 1px solid rgba(22,163,74,0.2);
    border-radius: 8px; padding: 9px 13px;
    margin-bottom: 14px; line-height: 1.5;
  }

  .auth-switch {
    text-align: center; font-size: 12.5px; color: #94a3b8;
    margin-top: 18px;
  }
  .auth-switch a {
    color: #0d9488; cursor: pointer; font-weight: 600;
    text-decoration: none;
  }
  .auth-switch a:hover { text-decoration: underline; }

  /* ── Missing class aliases (HTML uses these names) ─────────────────────── */

  /* Logo row in auth-left */
  .auth-brand {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 36px;
  }
  .auth-logo {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    border-radius: 11px; display: grid; place-items: center;
    font-size: 17px; font-weight: 900; color: #fff;
    box-shadow: 0 4px 16px rgba(13,148,136,0.3);
  }
  .auth-brand-name {
    font-size: 18px; font-weight: 800; letter-spacing: -0.3px;
    color: #0f172a;
  }

  /* Headline & sub on left panel */
  .auth-headline {
    font-size: 28px; font-weight: 800; letter-spacing: -0.5px;
    color: #0f172a; margin-bottom: 10px; line-height: 1.25;
  }
  .auth-sub {
    font-size: 14px; color: #475569; line-height: 1.6;
    margin-bottom: 0; max-width: 340px;
  }

  /* Description text below form headings */
  .auth-desc {
    font-size: 13px; color: #475569; margin-bottom: 22px; line-height: 1.55;
  }

  /* Standalone label + input (used directly in HTML without .auth-field wrapper) */
  .auth-label {
    display: block;
    font-size: 12px; font-weight: 600; color: #0f172a;
    letter-spacing: 0.1px; margin-bottom: 5px;
  }
  .auth-input {
    width: 100%;
    background: #f8fafc; border: 1.5px solid #e2e8f0;
    border-radius: 10px; padding: 12px 14px;
    font-family: inherit; font-size: 14px; color: #0f172a;
    outline: none; transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
  }
  .auth-input:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
    background: #fff;
  }
  .auth-input::placeholder { color: #94a3b8; }

  /* Secondary (ghost) button */
  .auth-btn-secondary {
    display: flex; align-items: center; justify-content: center;
    background: #fff; border: 1.5px solid #e2e8f0;
    border-radius: 12px; padding: 13px 28px;
    font-family: inherit; font-size: 14px; font-weight: 600; color: #0f172a;
    cursor: pointer; width: 100%;
    transition: border-color .15s, background .15s;
    margin-top: 10px;
  }
  .auth-btn-secondary:hover { border-color: #0d9488; background: #f0fafa; }

  /* Mobile: stack vertically, hide right panel */
  @media (max-width: 720px) {
    #auth-overlay { flex-direction: column; overflow-y: auto; }
    .auth-left { flex: none; padding: 36px 28px; box-shadow: none; align-items: center; }
    .auth-view { max-width: 100%; }
    .auth-right { display: none; }
    .auth-logo-row { margin-bottom: 28px; }
  }


    /* ════════════════════════════════════════
     ONBOARDING OVERLAY
  ════════════════════════════════════════ */
  #onboard-overlay {
    position: fixed; inset: 0; z-index: 70;
    background: var(--bg);
    display: flex; flex-direction: column; align-items: center;
    overflow-y: auto; padding: 40px 24px 40px;
    transition: opacity .35s ease, transform .35s ease;
  }
  #onboard-overlay.hidden {
    opacity: 0; pointer-events: none; transform: translateY(-12px);
  }

  .onboard-step { width: 100%; max-width: 480px; }
  .onboard-step.hidden { display: none !important; }

  .onboard-progress {
    display: flex; align-items: center; gap: 6px; margin-bottom: 28px;
  }
  .progress-pip {
    height: 3px; border-radius: 2px; flex: 1;
    background: var(--surface3); transition: background .3s;
  }
  .progress-pip.active { background: var(--accent); }
  .progress-label {
    font-size: 10.5px; color: var(--text3); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.8px;
    margin-left: 4px; white-space: nowrap;
  }

  .onboard-icon { font-size: 36px; margin-bottom: 14px; }
  .onboard-title {
    font-size: 22px; font-weight: 800; letter-spacing: -0.4px;
    color: var(--text); margin-bottom: 6px;
  }
  .onboard-sub {
    font-size: 13.5px; color: var(--text2); line-height: 1.65;
    max-width: 420px; margin-bottom: 24px;
  }

  /* Supported apps grid (step 1) */
  .apps-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 8px; margin-bottom: 28px;
  }
  .app-chip {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; background: var(--surface2);
    border: 1px solid var(--border2); border-radius: 12px;
    padding: 12px 8px; font-size: 10.5px; font-weight: 600;
    color: var(--text2); text-align: center;
  }
  .app-chip-icon {
    width: 32px; height: 32px; border-radius: 9px;
    display: grid; place-items: center;
    font-size: 13px; font-weight: 800; color: #fff;
  }
  .app-chip-icon.strava     { background: linear-gradient(135deg,#FC5200,#ff7a3d); }
  .app-chip-icon.garmin     { background: linear-gradient(135deg,#007bbf,#009cda); }
  .app-chip-icon.apple      { background: linear-gradient(135deg,#555,#888); }
  .app-chip-icon.google     { background: linear-gradient(135deg,#4285f4,#34a853); }
  .app-chip-icon.fitbit     { background: linear-gradient(135deg,#00a0b0,#00c4b4); }
  .app-chip-icon.whoop      { background: linear-gradient(135deg,#1e1e1e,#3a3a3a); border:1px solid #444; }
  .app-chip-icon.oura       { background: linear-gradient(135deg,#374151,#6b7280); }
  .app-chip-icon.ultrahuman { background: linear-gradient(135deg,#b8860b,#d4a84b); }

  /* Onboarding action row */
  .onboard-actions {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
  }
  .onboard-skip {
    background: none; border: none; font-family: inherit;
    font-size: 13px; color: var(--text3); cursor: pointer;
    padding: 10px 0; transition: color .15s;
  }
  .onboard-skip:hover { color: var(--text2); }
  .onboard-next {
    display: flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none; border-radius: 12px; padding: 12px 24px;
    font-family: inherit; font-size: 14px; font-weight: 700; color: #fff;
    cursor: pointer; flex: 1; justify-content: center;
    box-shadow: 0 0 24px rgba(13,148,136,0.25);
    transition: transform .15s, box-shadow .15s;
  }
  .onboard-next:hover { transform: translateY(-1px); box-shadow: 0 4px 32px rgba(13,148,136,0.4); }
  .onboard-next:active { transform: scale(.97); }

  /* ── Goal tiles (Step 1) ───────────────────────────────────── */
  .goal-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; margin-bottom: 28px;
  }
  .goal-tile {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 4px; padding: 16px; text-align: left;
    background: var(--surface2); border: 1.5px solid var(--border2);
    border-radius: 14px; cursor: pointer; font-family: inherit;
    transition: border-color .18s, background .18s, transform .12s;
  }
  .goal-tile:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, var(--surface2));
    transform: translateY(-1px);
  }
  .goal-tile.selected {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface2));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
  }
  .goal-emoji { font-size: 22px; margin-bottom: 4px; }
  .goal-label {
    font-size: 13.5px; font-weight: 700; color: var(--text);
  }
  .goal-desc {
    font-size: 11.5px; color: var(--text3); line-height: 1.4;
  }

  /* ── Race form (Step 2) ────────────────────────────────────── */
  .race-form { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
  .race-field { display: flex; flex-direction: column; gap: 6px; }
  .race-label {
    font-size: 11.5px; font-weight: 700; color: var(--text2);
    text-transform: uppercase; letter-spacing: 0.6px;
  }
  .race-input {
    background: var(--surface2); border: 1.5px solid var(--border2);
    border-radius: 10px; padding: 11px 14px;
    font-family: inherit; font-size: 14px; color: var(--text);
    outline: none; transition: border-color .15s;
  }
  .race-input:focus { border-color: var(--accent); }
  .race-input::placeholder { color: var(--text3); }

  /* Disabled next button style */
  .onboard-next:disabled {
    opacity: 0.4; cursor: not-allowed;
    transform: none !important; box-shadow: none !important;
  }

  /* Step 3 platform cards are the same as #landing's platform cards */
  #onboard-platforms { margin-bottom: 20px; }

  /* ── Onboarding classes used in HTML ───────────────────────── */
  .onboard-logo {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
    border-radius: 20px; display: grid; place-items: center;
    font-size: 28px; font-weight: 900; color: #fff;
    box-shadow: 0 0 40px rgba(13,148,136,0.3);
    margin: 0 auto 20px; text-align: center;
  }
  .onboard-body {
    font-size: 14px; color: var(--text2); line-height: 1.7;
    max-width: 420px; margin-bottom: 28px; text-align: center;
  }
  .onboard-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none; border-radius: 12px; padding: 14px 28px;
    font-family: inherit; font-size: 15px; font-weight: 700; color: #fff;
    cursor: pointer; width: 100%; max-width: 340px; margin: 0 auto;
    box-shadow: 0 4px 24px rgba(13,148,136,0.28);
    transition: transform .15s, box-shadow .15s;
  }
  .onboard-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 32px rgba(13,148,136,0.4); }
  .onboard-btn-secondary {
    display: flex; align-items: center; justify-content: center;
    background: none; border: 1.5px solid var(--border2);
    border-radius: 12px; padding: 12px 24px;
    font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text2);
    cursor: pointer; width: 100%; max-width: 340px; margin: 12px auto 0;
    transition: border-color .15s, color .15s;
  }
  .onboard-btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

  /* CTA button */
  .enter-btn {
    display: flex; align-items: center; gap: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none; border-radius: 14px;
    padding: 14px 32px; font-family: inherit;
    font-size: 15px; font-weight: 700; color: #fff;
    cursor: pointer; letter-spacing: -0.2px;
    box-shadow: 0 0 32px rgba(13,148,136,0.3);
    transition: transform .15s, box-shadow .15s, opacity .15s;
    margin-bottom: 14px;
  }
  .enter-btn:hover  { transform: translateY(-1px); box-shadow: 0 4px 40px rgba(13,148,136,0.45); }
  .enter-btn:active { transform: scale(.97); }
  .enter-arrow { font-size: 18px; transition: transform .2s; }
  .enter-btn:hover .enter-arrow { transform: translateX(4px); }

  /* ── Landing page site footer ──────────────────────────────── */
  .l-site-footer {
    width: calc(100% + 48px);
    margin: 16px -24px 0;
    padding: 20px 24px 24px;
    text-align: center;
    border-top: 1px solid var(--border, #e2e8f0);
  }
  .l-site-footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 20px;
    margin-bottom: 14px;
  }
  .l-site-footer-link {
    font-size: 13px;
    color: var(--text3);
    text-decoration: none;
    transition: color 0.15s;
  }
  .l-site-footer-link:hover { color: var(--accent); }
  .l-site-footer-link-primary {
    color: var(--text2);
    font-weight: 600;
  }
  .l-site-footer-link-primary:hover { color: var(--accent); }
  .l-site-footer-legal {
    font-size: 11px;
    color: var(--text3);
    line-height: 1.6;
    margin: 0;
  }
  .l-site-footer-legal a {
    color: var(--text3);
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .l-site-footer-legal a:hover { color: var(--accent); }
  /* Legacy footer classes — kept for any remaining references */
  .l-footer { font-size: 10.5px; color: var(--text3); text-align: center; line-height: 1.6; }
  .l-foot-strava { color: #FC5200; font-weight: 600; letter-spacing: .02em; }
  .l-foot-link { color: var(--text3); text-decoration: underline; text-underline-offset: 2px; }
  .l-foot-link:hover { color: var(--accent); }
  /* Official "Compatible with Strava" SVG asset wrapper — kept smaller than
     the surrounding text per Strava brand guidelines (logo size must not
     exceed the page's primary brand element). */
  .l-foot-strava-wrap { margin-top: 12px; text-align: center; line-height: 0; }
  .l-foot-strava-logo { height: 18px; width: auto; opacity: 0.95; display: inline-block; }
  .l-foot-strava-logo:hover { opacity: 1; }

  /* conn counter badge on enter btn */
  .conn-badge {
    background: rgba(255,255,255,0.2);
    border-radius: 20px; padding: 2px 8px;
    font-size: 11px; font-weight: 600;
  }

  @media (max-width: 480px) {
    .platforms-grid { grid-template-columns: repeat(1, 1fr); }
    .l-title { font-size: 26px; }
    #landing { padding: 36px 18px 32px; }
  }

  body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  /* ── Header ── */
  header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 52px;
    background: #fff;
    border-bottom: 1px solid #e8f0ee;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    flex-shrink: 0;
  }

  .logo {
    display: flex; align-items: center; gap: 8px;
  }
  .logo-icon {
    width: 26px; height: 26px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 7px;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 800; color: #fff;
    box-shadow: 0 0 12px var(--glow);
  }
  .logo-name { font-size: 14px; font-weight: 700; letter-spacing: -0.2px; }

  .last-sync {
    display: flex; align-items: center; gap: 5px;
    font-size: 11.5px; color: var(--text3);
  }
  .sync-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34,197,94,0.5);
  }

  /* ── Chat area ── */
  .chat-wrap {
    flex: 1; display: flex; flex-direction: column;
    overflow: hidden;
  }

  #messages {
    flex: 1; overflow-y: auto;
    padding: 40px 24px 16px;
    display: flex; flex-direction: column;
    scroll-behavior: smooth;
  }

  /* center all content */
  .msg-row, .welcome { max-width: 680px; width: 100%; margin: 0 auto; }

  /* ── Welcome ── */
  .welcome {
    display: flex; flex-direction: column;
    align-items: center; text-align: center;
    gap: 12px; padding: 48px 0;
    animation: up 0.25s ease;
  }
  .welcome-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 18px;
    display: grid; place-items: center; font-size: 24px;
    box-shadow: 0 0 32px var(--glow);
  }
  .welcome h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
  .welcome p  { font-size: 13px; color: var(--text2); line-height: 1.7; max-width: 340px; }
  .src-chips  { display: flex; gap: 6px; }
  .src {
    padding: 4px 11px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; border: 1px solid;
  }
  .src.strava { color: #fb7c3c; border-color: rgba(251,124,60,0.3); background: rgba(251,124,60,0.07); }
  .src.garmin { color: #38bdf8; border-color: rgba(56,189,248,0.3); background: rgba(56,189,248,0.07); }

  /* ── Insight cards ── */
  .insight-cards {
    display: flex; flex-direction: column; gap: 8px;
    width: 100%; margin-top: 4px;
  }
  .icard {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    text-align: left;
    width: 100%;
    font-family: inherit;
  }
  .icard:hover { background: var(--surface3); border-color: var(--accent); }
  .icard-icon  { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
  .icard-body  { flex: 1; }
  .icard-title {
    font-size: 11px; font-weight: 600;
    color: var(--text2); text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 3px;
  }
  .icard-text  { font-size: 13px; color: var(--text); line-height: 1.5; }
  .icard-text strong { color: #0d9488; font-weight: 600; }
  .icard-cta   {
    font-size: 11px; color: var(--accent);
    margin-top: 5px; display: flex; align-items: center; gap: 3px;
  }

  /* ── Agent nudge cards (dismissible variant of icard) ── */
  .nudge-card {
    cursor: default;        /* not a button click — actions are inside */
    border-left: 3px solid var(--accent);
  }
  .nudge-card:hover { background: var(--surface2); border-color: var(--accent); }
  .nudge-actions {
    display: flex; align-items: center; gap: 8px; margin-top: 6px;
  }
  .nudge-ask {
    background: none; border: none; cursor: pointer; padding: 0;
    font-size: 11px; color: var(--accent); font-family: inherit;
    font-weight: 600;
  }
  .nudge-ask:hover { text-decoration: underline; }
  .nudge-dismiss {
    margin-left: auto;
    background: none; border: none; cursor: pointer;
    font-size: 12px; color: var(--text3);
    padding: 2px 5px; border-radius: 4px;
    transition: background .12s, color .12s;
    font-family: inherit; line-height: 1;
  }
  .nudge-dismiss:hover { background: var(--surface3); color: var(--text); }

  /* loading skeleton */
  .icard-skeleton {
    height: 68px; border-radius: var(--r);
    background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
  }
  @keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

  /* ── Messages ── */
  .msg-row {
    display: flex; gap: 0;
    padding: 3px 0;
    animation: up 0.18s ease;
  }
  @keyframes up {
    from { opacity:0; transform:translateY(6px); }
    to   { opacity:1; transform:translateY(0); }
  }
  .msg-row.user { flex-direction: row-reverse; }

  .av {
    width: 26px; height: 26px; border-radius: 7px;
    display: grid; place-items: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0; margin-top: 3px;
  }
  .msg-row.ai   .av { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
  .msg-row.user .av { background: var(--user-bg); border: 1px solid rgba(13,148,136,0.25); font-size: 13px; }

  .msg-body {
    flex: 1; display: flex; flex-direction: column; gap: 8px;
    padding: 0 10px;
  }
  .msg-row.user .msg-body { align-items: flex-end; }

  .bubble {
    padding: 14px 18px; border-radius: var(--r);
    /* Reading-optimised body type — Claude.ai uses ~15px / 1.62.
       Bumped from 13.5px / 1.75 for better scannability on long
       coaching replies. */
    font-size: 15px; line-height: 1.62;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
  }
  .msg-row.user .bubble {
    background: #e6faf7;
    border: 1px solid rgba(13,148,136,0.18);
    border-bottom-right-radius: 3px;
    color: var(--text); max-width: 72%;
  }
  .msg-row.ai .bubble {
    background: #fff;
    border: 1px solid var(--border2);
    border-bottom-left-radius: 3px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
    width: 100%;
    /* Leave room for the copy button (top-right, 26px wide + 8px gap)
       so first-line text doesn't underrun it on hover. */
    padding-right: 44px;
  }

  /* ── Reading typography (ChatGPT/Claude.ai-style hierarchy) ─────────── */
  .bubble p { margin: 0 0 12px; }
  .bubble p:last-child { margin-bottom: 0; }

  /* Real heading scale. Headings are dark slate (NOT teal) — teal is
     reserved for the metric chip so numbers carry the accent colour. */
  .bubble h1, .bubble h2, .bubble h3, .bubble h4 {
    color: #0f172a; font-weight: 600;
    letter-spacing: -0.005em;
    margin: 18px 0 8px;
    line-height: 1.3;
  }
  .bubble > :first-child,
  .bubble-lead > :first-child,
  .bubble-body > :first-child { margin-top: 0 !important; }
  .bubble h1 { font-size: 22px; line-height: 1.25; margin-top: 8px; }
  .bubble h2 { font-size: 18px; }
  .bubble h3 { font-size: 16px; }
  .bubble h4 { font-size: 15px; color: #334155; }

  /* Bold is dark slate, not coloured. Numeric chip carries the accent. */
  .bubble strong { color: #0f172a; font-weight: 600; }
  .bubble em     { color: var(--text2); font-style: italic; }

  /* Inline code — neutral, monospace, soft slate bg. */
  .bubble code {
    background: #f1f5f9; color: #0f172a;
    padding: 1px 6px; border-radius: 5px;
    font-size: 0.88em;
    font-family: 'SFMono-Regular','Menlo','Monaco','Consolas','Liberation Mono','Courier New',monospace;
  }
  .bubble pre.md-pre {
    background: #0f172a; color: #e2e8f0;
    padding: 12px 14px; border-radius: 10px;
    overflow-x: auto;
    font-size: 13px; line-height: 1.55;
    margin: 12px 0;
  }
  .bubble pre.md-pre code {
    background: transparent; color: inherit;
    padding: 0; border-radius: 0; font-size: inherit;
  }

  /* Lists — comfortable indent + line-height; teal bullet/marker. */
  .bubble ul, .bubble ol { padding-left: 22px; margin: 4px 0 12px; }
  .bubble li { margin: 4px 0; line-height: 1.55; }
  .bubble li::marker { color: #0d9488; }
  .bubble li > p { margin: 0; }
  .bubble li > ul, .bubble li > ol { margin: 4px 0; }

  /* Blockquote — teal left accent bar, slightly muted text. */
  .bubble blockquote {
    border-left: 3px solid #0d9488;
    background: #f0fdfa;
    padding: 8px 12px;
    margin: 12px 0;
    color: #334155;
    border-radius: 0 8px 8px 0;
    font-style: normal;
  }
  .bubble blockquote p { margin: 0; }

  /* Horizontal rule — soft gradient. */
  .bubble hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #cbd5e1, transparent);
    margin: 16px 0;
  }

  /* Links — teal with subtle underline-on-hover. */
  .bubble a {
    color: #0d9488;
    text-decoration: none;
    border-bottom: 1px solid rgba(13,148,136,0.25);
    transition: border-color 0.15s ease;
  }
  .bubble a:hover { border-bottom-color: #0d9488; }

  /* Tables — alt-row tint, condensed cells, mobile horizontal scroll. */
  .bubble .md-table-wrap {
    overflow-x: auto;
    margin: 12px 0;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
  }
  .bubble .md-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
  }
  .bubble .md-table th,
  .bubble .md-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
  }
  .bubble .md-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
  .bubble .md-table tbody tr:nth-child(even) { background: #fafbfc; }
  .bubble .md-table tbody tr:last-child td { border-bottom: 0; }
  .bubble .md-table td:not(:first-child) {
    font-variant-numeric: tabular-nums;
  }

  /* ── Metric chip — headline numbers + units pop ─────────────────────── */
  /* Auto-applied to <strong> tags whose text matches `<number> <unit>`
     (e.g. "**42 km**", "**5:30/km**", "**168 bpm**"). The AI doesn't
     need to know about this — it's a post-processor in md(). */
  .bubble .metric-chip {
    display: inline-block;
    padding: 1px 9px;
    background: linear-gradient(180deg, #f0fdfa 0%, #e6faf7 100%);
    color: #0d9488;
    border: 1px solid rgba(13,148,136,0.22);
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95em;
    line-height: 1.45;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.005em;
    vertical-align: baseline;
  }
  .msg-row.user .bubble .metric-chip {
    background: rgba(255,255,255,0.55);
    color: #134e4a;
    border-color: rgba(13,148,136,0.18);
  }

  /* ── Chat history separator ── */
  .history-sep {
    text-align: center;
    font-size: 11px;
    color: var(--text3, #94a3b8);
    letter-spacing: 0.04em;
    margin: 8px 0 12px;
    user-select: none;
  }
  .history-msg .bubble { opacity: 0.75; }

  /* ── No-sources CTA ── */
  .no-src-cta {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 4px;
    background: var(--accent); color: #fff;
    border: none; border-radius: 10px;
    padding: 8px 16px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background .18s;
  }
  .no-src-cta:hover { background: var(--accent2); }

  /* ── Calendar export CTA (shown after plan generated) ── */
  .cal-export-cta {
    display: inline-flex; align-items: center; gap: 12px;
    background: #f0fdf9; border: 1px solid #6ee7b7;
    border-radius: 10px; padding: 10px 16px;
    margin-top: 4px; font-size: 13px; color: #065f46;
    flex-wrap: wrap;
  }
  .cal-export-btn {
    display: inline-flex; align-items: center; gap: 5px;
    background: #0d9488; color: #fff;
    text-decoration: none; border-radius: 8px;
    padding: 6px 14px; font-size: 12px; font-weight: 600;
    transition: background .15s; white-space: nowrap;
  }
  .cal-export-btn:hover { background: #0f766e; }

  /* ── Chart card ── */
  .chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden;
    width: 100%;
  }
  .chart-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px 8px;
    border-bottom: 1px solid var(--border);
  }
  .chart-title { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.6px; }
  .chart-body  { padding: 10px 14px 8px; position: relative; height: 210px; }
  .chart-hint  { font-size: 10px; color: var(--text3); margin-top: 4px; text-align: center; }
  .chart-dl-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text3); font-size: 13px; padding: 2px 4px;
    border-radius: 6px; transition: color .15s, background .15s;
    line-height: 1;
  }
  .chart-dl-btn:hover { color: var(--accent); background: var(--surface2); }
  /* ── Heatmap card ── */
  .heatmap-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden;
    width: 100%;
  }
  .heatmap-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px 8px;
    border-bottom: 1px solid var(--border);
  }
  .heatmap-title { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.6px; }
  .heatmap-body  { padding: 12px 14px 14px; overflow-x: auto; }
  .heatmap-svg   { display: block; min-width: 100%; }
  .heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 10px; color: var(--text3); }
  .heatmap-legend-swatch { width: 10px; height: 10px; border-radius: 2px; }

  /* ── Route map card ── */
  .map-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden;
    width: 100%;
  }
  .map-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--border);
  }
  .map-title { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.6px; }
  .map-body  { position: relative; height: 280px; }
  .map-body .leaflet-container {
    width: 100%; height: 100%;
    background: #e8f5f3;
  }
  /* Route tabs for multi-activity view */
  .map-tabs {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 8px 14px; border-top: 1px solid var(--border);
    background: var(--surface);
  }
  .map-tab {
    padding: 3px 10px; border-radius: 20px;
    font-size: 10.5px; font-weight: 600;
    border: 1px solid var(--border2);
    background: none; color: var(--text2);
    cursor: pointer; font-family: inherit;
    transition: all .15s;
  }
  .map-tab.active, .map-tab:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

  /* ── Typing / thinking indicator ── */
  .typing-bub {
    display: flex; gap: 8px; align-items: center;
    padding: 11px 16px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--r); border-bottom-left-radius: 3px;
    width: fit-content; max-width: 280px;
  }
  .typing-dots { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
  .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: bop 1.2s infinite ease-in-out; }
  .dot:nth-child(2) { animation-delay:.18s; }
  .dot:nth-child(3) { animation-delay:.36s; }
  @keyframes bop { 0%,60%,100%{transform:translateY(0);opacity:.35} 30%{transform:translateY(-4px);opacity:1} }
  .typing-label {
    font-size: 12px; color: var(--text3); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
    animation: fadeLabel .35s ease;
  }
  @keyframes fadeLabel { from { opacity:0; transform: translateY(3px); } to { opacity:1; transform: translateY(0); } }

  /* ── Input area ── */
  .input-area {
    padding: 8px 24px 20px;
    background: #fff;
    border-top: 1px solid #e8f0ee;
    flex-shrink: 0;
  }
  .input-inner { max-width: 680px; margin: 0 auto; }

  /* Quick chips */
  /* ── Mode bar (Coach / My data / Log run) ── */
  .mode-bar {
    display: flex; gap: 6px; margin-bottom: 10px; align-items: center;
  }

  /* ── + button and dropdown ──────────────────────────────────── */
  .plus-wrap { position: relative; }
  .plus-btn {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    font-size: 18px; font-weight: 300;
    color: #64748b;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    cursor: pointer;
    outline: none;
    transition: background 0.15s;
  }
  .plus-btn:hover { background: #e2e8f0; color: #1e293b; }
  .plus-menu {
    display: none;
    position: absolute;
    bottom: 36px; left: 0;
    background: #fff;
    border: 1.5px solid var(--border2);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 170px;
    z-index: 100;
    overflow: hidden;
  }
  .plus-menu.open { display: block; }
  .plus-menu-item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 13px;
    font-size: 13px; color: var(--text1);
    cursor: pointer;
    transition: background 0.1s;
  }
  .plus-menu-item:hover { background: var(--bg2); }
  .plus-menu-icon { font-size: 15px; }
  /* Destructive item — visually separated, red accent on hover */
  .plus-menu-item.plus-menu-danger {
    border-top: 1px solid var(--border1);
    color: #b91c1c;
  }
  .plus-menu-item.plus-menu-danger:hover {
    background: #fef2f2;
  }

  /* ── Chip suggestions wrapper ───────────────────────────── */
  .chips-wrapper {
    overflow: hidden;
    max-height: 200px;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.2s ease;
    opacity: 1;
    margin-bottom: 0;
  }
  .chips-wrapper.collapsed {
    max-height: 0 !important;
    opacity: 0;
    margin-bottom: 0;
    pointer-events: none;
  }
  /* Fix: make .hidden actually hide chip rows */
  .chips.hidden { display: none !important; }

  .chips {
    display: flex; gap: 5px; flex-wrap: wrap;
    margin-bottom: 8px;
  }
  .chip {
    padding: 5px 11px;
    background: #f0fafa;
    border: 1px solid #d1ede9;
    border-radius: 20px;
    font-size: 11.5px; color: #475569;
    cursor: pointer; font-family: inherit;
    transition: all 0.12s; white-space: nowrap;
  }
  .chip:hover { background: #e2f5f1; color: #0f172a; border-color: var(--accent); }

  /* ── Suggestions toggle button ──────────────────────────── */
  .suggestions-toggle {
    background: none; border: none; cursor: pointer;
    padding: 3px 6px; border-radius: 6px;
    color: #94a3b8; font-size: 11px;
    display: flex; align-items: center; gap: 3px;
    transition: color 0.15s, background 0.15s;
    margin-left: auto; flex-shrink: 0;
    line-height: 1;
  }
  .suggestions-toggle:hover { color: var(--accent); background: #f0fafa; }
  .suggestions-toggle .toggle-chevron {
    display: inline-block;
    transition: transform 0.25s ease;
    font-size: 10px;
  }
  .suggestions-toggle.collapsed .toggle-chevron { transform: rotate(-90deg); }

  /* Input box */
  .ibox {
    display: flex; align-items: flex-end; gap: 8px;
    background: #f8fafb;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 10px 10px 15px;
    transition: border-color .2s, box-shadow .2s;
  }
  .ibox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,148,136,0.1); background: #fff; }

  #input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text); font-size: 13.5px;
    font-family: inherit; resize: none;
    line-height: 1.55; max-height: 120px;
  }
  #input::placeholder { color: var(--text3); }

  #send {
    width: 32px; height: 32px; flex-shrink: 0;
    background: var(--accent); border: none;
    border-radius: 9px; cursor: pointer;
    display: grid; place-items: center; color: #fff;
    transition: opacity .15s, transform .1s;
  }
  #send:hover  { opacity: .82; }
  #send:active { transform: scale(.92); }
  #send:disabled { opacity: .2; cursor: not-allowed; }

  .hint { text-align: center; font-size: 10.5px; color: var(--text3); margin-top: 7px; }

  /* scrollbar */
  ::-webkit-scrollbar       { width: 3px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }

  /* ── Goals section ── */
  .goals-section {
    width: 100%; margin-top: 8px;
  }
  .goals-label {
    font-size: 10.5px; font-weight: 700; color: var(--text3);
    text-transform: uppercase; letter-spacing: 0.6px;
    margin-bottom: 6px; display: flex; align-items: center; gap: 5px;
  }
  .gcard {
    background: var(--surface2); border: 1px solid var(--border2);
    border-radius: var(--r); padding: 11px 13px;
    margin-bottom: 6px; cursor: pointer;
    transition: border-color .15s, background .15s;
    text-align: left; width: 100%; font-family: inherit;
  }
  .gcard:hover { background: var(--surface3); border-color: var(--accent); }
  .gcard-top {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 7px;
  }
  .gcard-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
  .gcard-status { font-size: 11px; color: var(--text2); }
  .gcard-meta {
    display: flex; justify-content: space-between;
    font-size: 11px; color: var(--text2); margin-bottom: 6px;
  }
  .gcard-current { color: var(--accent); font-weight: 600; }
  .progress-bar {
    width: 100%; height: 4px; background: var(--surface3);
    border-radius: 2px; overflow: hidden;
  }
  .progress-fill {
    height: 100%; border-radius: 2px;
    transition: width 0.6s ease;
  }
  .progress-fill.on-track  { background: #22c55e; }
  .progress-fill.off-track { background: #f59e0b; }
  .progress-fill.done      { background: var(--accent); }
  .gcard-del {
    background: none; border: none; color: var(--text3);
    cursor: pointer; font-size: 12px; padding: 0 2px; flex-shrink: 0;
    transition: color .15s;
  }
  .gcard-del:hover { color: #f87171; }

  /* ── Reports panel ─────────────────────────────────────────────────────── */
  .reports-panel {
    position: fixed; top: 0; right: -110%; bottom: 0;
    width: min(480px, 100vw);
    background: var(--surface); border-left: 1px solid var(--border);
    box-shadow: -6px 0 32px rgba(0,0,0,0.12);
    z-index: 1200; display: flex; flex-direction: column;
    transition: right 0.30s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
  }
  .reports-panel.open { right: 0; }

  .reports-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 13px; border-bottom: 1px solid var(--border);
    flex-shrink: 0; background: var(--surface);
  }
  .reports-title { font-weight: 700; font-size: 15px; color: var(--text); display: flex; align-items: center; gap: 7px; }
  .reports-close {
    background: none; border: none; cursor: pointer; font-size: 15px;
    color: var(--text3); width: 28px; height: 28px; border-radius: 8px;
    display: grid; place-items: center; transition: all .15s;
  }
  .reports-close:hover { background: var(--surface2); color: var(--text); }

  .reports-tabs {
    display: flex; flex-shrink: 0; border-bottom: 1px solid var(--border);
    overflow-x: auto; scrollbar-width: none; background: var(--surface);
  }
  .reports-tabs::-webkit-scrollbar { display: none; }
  .rtab {
    flex: 1 0 auto; padding: 10px 12px; font-size: 11.5px; font-weight: 500;
    background: none; border: none; border-bottom: 2px solid transparent;
    cursor: pointer; color: var(--text3); transition: all .15s;
    white-space: nowrap; font-family: inherit; letter-spacing: 0.01em;
  }
  .rtab:hover { color: var(--text); background: var(--surface2); }
  .rtab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

  .report-body {
    flex: 1; overflow-y: auto; padding: 18px 16px 32px; background: var(--bg);
  }

  .report-placeholder, .report-loading {
    display: flex; align-items: center; justify-content: center;
    height: 120px; color: var(--text3); font-size: 13px;
  }
  .report-loading::before { content: ''; width: 16px; height: 16px; border: 2px solid var(--border2);
    border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin-right: 8px; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .report-error {
    background: #fff1f1; border: 1px solid #fca5a5; border-radius: 10px;
    color: #dc2626; font-size: 12.5px; padding: 14px 16px; margin-top: 8px;
  }

  /* Reports no-source empty state */
  .report-nosrc {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 60px 24px; gap: 12px;
  }
  .report-nosrc-icon { font-size: 48px; line-height: 1; }
  .report-nosrc-title { font-size: 18px; font-weight: 700; color: var(--text); }
  .report-nosrc-sub { font-size: 13px; color: var(--text3); max-width: 340px; line-height: 1.6; }

  /* Report title block */
  .report-hero {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 14px 16px 12px; margin-bottom: 14px;
  }
  .report-hero-title { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.3; }
  .report-hero-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

  /* Stat cards grid — 2 columns */
  .stat-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 9px; margin-bottom: 16px;
  }
  .stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 13px 14px 12px;
    display: flex; flex-direction: column; gap: 5px;
    transition: box-shadow .15s;
  }
  .stat-card:hover { box-shadow: 0 2px 12px var(--glow); border-color: var(--accent2); }
  .stat-icon { font-size: 20px; line-height: 1; }
  .stat-label {
    font-size: 10px; color: var(--text3); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px;
  }
  .stat-value { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.2; }
  .stat-delta { font-size: 10.5px; color: var(--text3); }
  .stat-delta.pos { color: #059669; }
  .stat-delta.neg { color: #dc2626; }

  /* Chart card */
  .report-chart-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 14px 14px 12px; margin-bottom: 12px;
  }
  .report-chart-title {
    font-size: 11.5px; font-weight: 600; color: var(--text2);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px;
  }
  .report-chart-wrap { position: relative; height: 190px; }

  @media (max-width: 600px) {
    #messages, .input-area { padding-left: 14px; padding-right: 14px; }
    .last-sync { display: none; }
    .reports-panel { width: 100vw; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
  }

/* ══════════════════════════════════════════════════
   DESKTOP APP LAYOUT
══════════════════════════════════════════════════ */
.desktop-app {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: row;
  background: var(--bg);
}

/* Hide old chat header when desktop app is active */
.desktop-mode #appHeader { display: none !important; }
.desktop-mode #landing   { display: none !important; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 0 0 20px;
  overflow: hidden;
}

.sb-logo {
  height: 50px; flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.sb-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px; color: #fff; font-size: 15px; font-weight: 900;
  display: grid; place-items: center; flex-shrink: 0;
}
.sb-logo-name { font-size: 17px; font-weight: 800; color: var(--text); }

.sb-nav { flex: 1; padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text2);
  transition: all .15s; user-select: none;
}
.sb-item.sb-active { background: #f0fafa; color: var(--accent); }
.sb-item:not(.sb-active):hover { background: #f8fafc; color: var(--text); }
.sb-icon { width: 20px; text-align: center; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sb-icon svg { width: 18px; height: 18px; }
.sb-badge {
  margin-left: auto; background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700; border-radius: 99px; padding: 2px 6px;
}

.sb-sources-label {
  font-size: 9px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .07em;
  padding: 12px 18px 6px;
}
.sb-sources { padding: 0 10px; display: flex; flex-direction: column; gap: 2px; }
.sb-src-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px;
}
.sb-src-dot {
  width: 22px; height: 22px; border-radius: 7px;
  font-size: 10px; font-weight: 900; color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
.sb-src-name { font-size: 11px; font-weight: 700; color: var(--text); flex: 1; }
.sb-src-badge {
  font-size: 10px; padding: 4px 10px; border-radius: 99px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
}
.sb-src-badge .sb-src-dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  opacity: .7; flex-shrink: 0;
}
.sb-src-badge.active   { background: #dcfce7; color: #16a34a; }
.sb-src-badge.inactive { background: var(--surface2); color: var(--text3); }
.sb-src-badge.strava   { background: #fff1eb; color: #c05621; }
.sb-src-badge.garmin   { background: #ebf5ff; color: #1e6db4; }
/* Google Health uses YUHA's GH brand green (#34a853 brand mark / #1f8a3a
   readable text) on a pale-green tint — visually distinct from the Google-
   blue chip we render when a "google" generic platform appears, and
   matches the dot colour below. */
.sb-src-badge.google   { background: #ecfdf5; color: #1f8a3a; }
.sb-src-badge.google .sb-src-dot { background: #34a853; }
.sb-src-none { font-size: 11px; color: var(--text3); padding: 4px 8px; }

.sb-bottom {
  padding: 12px 10px 0; border-top: 1px solid var(--border);
  margin-top: auto; display: flex; flex-direction: column; gap: 6px;
}
.sb-user {
  display: flex; align-items: center; gap: 9px;
  padding: 8px; border-radius: 10px; cursor: pointer;
}
.sb-user:hover { background: var(--surface2); }
.sb-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 13px; font-weight: 700;
  display: grid; place-items: center; flex-shrink: 0;
}
.sb-user-name { font-size: 12px; font-weight: 700; color: var(--text); }
.sb-user-sub { font-size: 10px; color: var(--text3); }
.sb-signout-btn {
  margin: 0 8px; padding: 7px 10px; border-radius: 8px;
  background: none; border: 1px solid var(--border); cursor: pointer;
  font-size: 11px; font-weight: 600; color: var(--text3); text-align: center;
  font-family: inherit; transition: all .15s;
}
.sb-signout-btn:hover { border-color: var(--text3); color: var(--text); }

/* ── Main content area ───────────────────────────── */
.desk-main {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
  position: relative;
}

/* ── Consistent top nav bar ──────────────────────────────────── */
.top-nav {
  height: 50px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}
.top-nav-left { display: flex; align-items: center; }
.top-nav-page { font-size: 16px; font-weight: 700; color: var(--text); }
.top-nav-right { display: flex; align-items: center; gap: 6px; }
.top-nav-sync {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text3); font-weight: 500;
}
.top-nav-divider { width: 1px; height: 18px; background: var(--border2); margin: 0 4px; }
.top-nav-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 99px; border: none;
  background: none; cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 600; color: var(--text2);
  transition: all .15s;
}
.top-nav-btn:hover { background: var(--surface2); color: var(--text); }
.top-nav-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; cursor: pointer;
  border: 2px solid transparent; transition: border-color .15s; flex-shrink: 0;
}
.top-nav-avatar:hover { border-color: var(--accent); }

/* Each view fills the full main area */
.desk-view {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
}

/* Chat view — pure flex column: messages grow, input sticks to bottom */
#viewChat {
  background: linear-gradient(155deg, #e4f2f0 0%, #f0fafa 45%, #e8f5f3 100%);
}
#viewChat .chat-wrap {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}
#viewChat #messages {
  flex: 1; min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 24px 60px 16px;
  display: flex; flex-direction: column;
}
/* Spacer pushes content to bottom; shrinks away as messages fill the view */
#viewChat #messages #msg-spacer {
  flex: 1; min-height: 0;
}
#viewChat #messages::-webkit-scrollbar { width: 4px; }
#viewChat #messages::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }
#viewChat .input-area {
  flex-shrink: 0;
  padding: 12px 40px 20px;
  background: linear-gradient(to top,
    rgba(228,242,240,1) 60%,
    rgba(228,242,240,0) 100%);
}

/* Dashboard view scrollable */
#viewDash { overflow: hidden; }

/* Reports as a full page view */
#viewReports {
  background: var(--surface);
}
.reports-view-hdr {
  flex-shrink: 0;
  display: flex; align-items: center;
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--border);
}
.reports-view-title {
  font-size: 18px; font-weight: 800; color: var(--text);
  flex: 1;
}
/* Slim variant — used when the title was removed (top-nav already says it).
   Right-aligns the refresh button and tightens vertical padding. */
.reports-view-hdr-slim {
  justify-content: flex-end;
  padding: 12px 28px;
  border-bottom: none;
}
#viewReports .reports-tabs {
  flex-shrink: 0;
  background: var(--surface);
}
/* .report-body scroll is now handled by .ins-scroll-area (overridden above) */

/* ── Nutrition view (desktop defaults — mobile overrides in media query) ── */
/* Moved off the inline style on #nutScroll in index.html so the mobile
   media query can override padding without `!important`. */
.nut-scroll {
  overflow-y: auto; height: 100%;
  padding: 24px; max-width: 920px; margin: 0 auto;
}

/* ── Goals view ─────────────────────────────────────────────── */
#viewGoals { background: var(--bg); }
.goals-scroll {
  flex: 1; overflow-y: auto; padding: 28px 36px 48px;
  display: flex; flex-direction: column;
}
.goals-scroll::-webkit-scrollbar { width: 4px; }
.goals-scroll::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }

/* Empty state */
.goals-empty-hero { text-align: center; padding: 12px 0 24px; }
.goals-empty-icon { font-size: 52px; line-height: 1; margin-bottom: 14px; }
.goals-empty-title { font-size: 20px; font-weight: 800; color: var(--text); }
.goals-empty-sub { font-size: 13px; color: var(--text3); margin-top: 6px; max-width: 380px; margin-left: auto; margin-right: auto; line-height: 1.6; }

.goals-templates-label { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.goals-templates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.gtpl {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 18px 20px; cursor: pointer;
  text-align: left; font-family: inherit;
  transition: all .18s; display: flex; flex-direction: column; gap: 8px;
}
.gtpl:hover { border-color: var(--accent); box-shadow: 0 4px 20px var(--glow); transform: translateY(-2px); }
.gtpl-icon { font-size: 26px; line-height: 1; }
.gtpl-title { font-size: 13px; font-weight: 700; color: var(--text); }
.gtpl-desc { font-size: 11.5px; color: var(--text3); line-height: 1.5; }
.gtpl-cta { font-size: 11px; font-weight: 700; color: var(--accent); margin-top: 4px; }

.goals-divider { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.goals-divider::before, .goals-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.goals-divider span { font-size: 11px; color: var(--text3); font-weight: 600; white-space: nowrap; }
.goals-custom-row { display: flex; gap: 10px; }
.goals-custom-input {
  flex: 1; padding: 11px 16px; border-radius: 12px;
  border: 1.5px solid var(--border); font-size: 13px; font-family: inherit;
  background: var(--surface); color: var(--text); outline: none;
}
.goals-custom-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,148,136,0.08); }
.goals-custom-btn {
  padding: 11px 20px; border-radius: 12px; background: var(--accent);
  color: #fff; border: none; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit; white-space: nowrap; transition: background .15s;
}
.goals-custom-btn:hover { background: #0f766e; }

/* Active goals */
.goals-active-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.goal-add-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 20px 18px 16px; margin-bottom: 20px;
}
.goals-active-label { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .08em; }
.goals-add-btn { display: flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 99px; background: var(--accent); color: #fff; border: none; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .15s; }
.goals-add-btn:hover { background: #0f766e; }

/* Goal card — Phase 1: vertical layout with header row, diagnostic, actions */
.goal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
  margin-bottom: 12px; transition: box-shadow .15s;
}
.goal-card:hover { box-shadow: 0 4px 20px var(--glow); }
.goal-card-top { display: flex; align-items: center; gap: 20px; min-width: 0; }

/* Progress ring */
.goal-ring { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.goal-ring svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface3); stroke-width: 6; }
.ring-fill { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-fill.on-track  { stroke: var(--accent); }
.ring-fill.off-track { stroke: #f59e0b; }
.ring-fill.done      { stroke: #22c55e; }
.ring-fill.no-data   { stroke: var(--border2, #d1d5db); }
.ring-pct { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-pct-num { font-size: 15px; font-weight: 800; color: var(--text); line-height: 1; }
.ring-pct-lbl { font-size: 9px; color: var(--text3); font-weight: 600; margin-top: 1px; }

.goal-info { flex: 1; min-width: 0; }
.goal-hdr-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.goal-label { font-size: 15px; font-weight: 700; color: var(--text); }
.goal-meta { display: flex; gap: 22px; margin-top: 8px; flex-wrap: wrap; }
.goal-meta-item { display: flex; flex-direction: column; gap: 2px; }
.goal-meta-val { font-size: 14px; font-weight: 700; color: var(--text); }
.goal-meta-lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.g-mt-cur { color: var(--text); }
.g-mt-sep { color: var(--text3); font-weight: 500; }
.g-mt-tgt { color: var(--text2); font-weight: 600; }
.g-mt-missing { color: var(--text3); font-weight: 600; font-style: italic; }
/* Predicted-current info icon — sits next to the time, hover for source */
.g-mt-pred-info {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  color: var(--text3);
  cursor: help;
  font-weight: 400;
  vertical-align: 1px;
}
.g-mt-pred-info:hover { color: var(--text2); }

/* Status badge moves to the header row */
.goal-status-badge { font-size: 10.5px; font-weight: 700; padding: 4px 11px; border-radius: 99px; white-space: nowrap; }
.goal-status-badge.on-track  { background: #dcfce7; color: #16a34a; }
.goal-status-badge.off-track { background: #fef3c7; color: #b45309; }
.goal-status-badge.done      { background: #dcfce7; color: #16a34a; }
.goal-status-badge.no-data   { background: var(--surface2); color: var(--text3); }

/* Phase 2: resolved-race chip on race_time goals */
.goal-race-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  margin-bottom: 4px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.22);
  color: #0d9488;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.goal-race-chip:hover {
  background: rgba(13, 148, 136, 0.14);
  border-color: rgba(13, 148, 136, 0.4);
  transform: translateY(-1px);
}

/* Diagnostic sentence — actionable coaching line below the metrics */
.goal-diag {
  font-size: 13px; line-height: 1.5; font-weight: 500;
  padding: 10px 14px; border-radius: 12px;
  color: var(--text2);
  background: var(--surface2);
  border-left: 3px solid var(--accent2, #94a3b8);
}
.goal-diag.on-track  { border-left-color: #16a34a; background: #f0fdf4; color: #14532d; }
.goal-diag.off-track { border-left-color: #d97706; background: #fffbeb; color: #78350f; }
.goal-diag.done      { border-left-color: #16a34a; background: #f0fdf4; color: #14532d; }
.goal-diag.no-data   { border-left-color: #94a3b8; background: var(--surface2); color: var(--text3); font-style: italic; }

/* Actions row */
.goal-actions-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  justify-content: space-between;
}
.goal-fix-btn {
  font-size: 12px; font-weight: 700; padding: 8px 16px; border-radius: 99px;
  border: none; background: var(--accent); color: #fff;
  cursor: pointer; font-family: inherit; transition: background .15s;
}
.goal-fix-btn:hover { background: #0f766e; }

.goal-actions { display: flex; gap: 7px; margin-left: auto; flex-wrap: wrap; }
.goal-ask-btn { font-size: 11px; font-weight: 600; padding: 6px 14px; border-radius: 99px; border: 1px solid rgba(13,148,136,0.3); background: var(--surface2); color: var(--accent); cursor: pointer; font-family: inherit; transition: background .15s; }
.goal-ask-btn:hover { background: var(--surface3); }
/* Manual-log button — shown for weekly_km/weekly_runs/pace/strength/custom goals */
.goal-log-btn {
  font-size: 11px; font-weight: 700;
  padding: 6px 12px; border-radius: 99px;
  border: 1px solid rgba(13,148,136,0.35);
  background: #fff; color: var(--accent);
  cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s;
}
.goal-log-btn:hover  { background: var(--accent); color: #fff; }
.goal-log-btn:active { transform: scale(0.97); }
.goal-edit-btn {
  font-size: 11px; font-weight: 600; padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text2);
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.goal-edit-btn:hover { background: var(--surface3); color: var(--text); border-color: var(--accent2); }
.goal-del-btn { font-size: 11px; font-weight: 600; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--border); background: none; color: var(--text3); cursor: pointer; font-family: inherit; transition: all .15s; }
.goal-del-btn:hover { background: #fff1f1; color: #dc2626; border-color: #fca5a5; }

/* ── Inline delete confirmation overlay ── */
.goal-del-confirm {
  position: absolute; inset: 0;
  border-radius: 18px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  z-index: 10;
  animation: fadeInFast .15s ease;
}
@keyframes fadeInFast { from { opacity: 0 } to { opacity: 1 } }
.goal-del-confirm-msg { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; text-align: center; }
.goal-del-confirm-yes {
  font-size: 12px; font-weight: 700; padding: 7px 16px;
  border-radius: 99px; border: none; cursor: pointer;
  background: #dc2626; color: #fff; font-family: inherit;
  transition: background .15s;
  flex-shrink: 0;
}
.goal-del-confirm-yes:hover { background: #b91c1c; }
.goal-del-confirm-cancel {
  font-size: 12px; font-weight: 600; padding: 7px 16px;
  border-radius: 99px; border: 1.5px solid var(--border2); cursor: pointer;
  background: var(--surface2); color: var(--text2); font-family: inherit;
  transition: all .15s;
  flex-shrink: 0;
}
.goal-del-confirm-cancel:hover { background: var(--surface3); }

/* No-data goal (strength — no numeric target) */
.goal-card.qualitative .goal-ring { display: none; }

/* ── Phase 2 visuals ─────────────────────────────────────────────────────── */

/* Race-time sparkline */
.goal-spark {
  padding: 12px 14px 10px;
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.goal-spark-hdr {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 2px;
}
.goal-spark-ttl {
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em;
}
.goal-spark-best {
  font-size: 11px; font-weight: 700; color: var(--accent);
}
.goal-spark-svg {
  width: 100%; height: 68px; display: block;
}
.goal-spark-axis {
  display: flex; justify-content: space-between;
  font-size: 10px; font-weight: 600; color: var(--text3);
  letter-spacing: .02em;
}
.goal-spark-empty {
  padding: 18px 14px; text-align: center;
  background: var(--surface2); border-radius: 12px; border: 1px dashed var(--border);
  font-size: 12px; font-style: italic; color: var(--text3);
}

/* 7-day bars (weekly_km, weekly_runs, sleep) */
.goal-bars {
  padding: 12px 14px 10px;
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.goal-bars-row {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  height: 72px; align-items: end;
}
.goal-bar-col {
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; gap: 4px; height: 100%;
}
.goal-bar-track {
  width: 100%; flex: 1; min-height: 50px;
  display: flex; align-items: flex-end;
  background: transparent;
  border-radius: 5px;
  overflow: hidden;
}
.goal-bar-fill {
  width: 100%; border-radius: 5px 5px 2px 2px;
  transition: height .28s ease-out;
}
.goal-bar-fill.hit   { background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%); }
.goal-bar-fill.miss  { background: linear-gradient(180deg, #fcd34d 0%, #f59e0b 100%); }
.goal-bar-fill.empty { background: repeating-linear-gradient(135deg, var(--surface3) 0 4px, transparent 4px 8px); min-height: 4px; width: 100%; }
.goal-bar-lbl {
  font-size: 10px; font-weight: 700; color: var(--text3);
  letter-spacing: .02em;
}
.goal-bars-tgt {
  margin-top: 10px; padding-top: 8px;
  font-size: 10.5px; font-weight: 600; color: var(--text3);
  border-top: 1px dashed var(--border);
  text-align: center;
}

/* Milestones checklist */
.goal-milestones {
  padding: 12px 14px;
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.goal-ms-hdr {
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 10px;
}
.goal-ms-list {
  display: flex; flex-direction: column; gap: 9px;
}
.goal-ms-item {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 8px 10px; border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color .15s;
}
.goal-ms-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  background: var(--surface2);
  color: var(--text3);
  border: 1.5px solid var(--border);
  flex-shrink: 0;
}
.goal-ms-item.achieved .goal-ms-icon {
  background: #0d9488; color: #fff; border-color: #0d9488;
}
.goal-ms-item.today    .goal-ms-icon {
  background: #fef3c7; color: #b45309; border-color: #f59e0b;
}
.goal-ms-item.pending  .goal-ms-icon {
  background: #fff; color: #94a3b8; border-color: #d1d5db;
}
.goal-ms-item.upcoming .goal-ms-icon {
  background: var(--surface2); color: var(--text3); border-style: dashed;
}
.goal-ms-body { flex: 1; min-width: 0; }
.goal-ms-top {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px;
}
.goal-ms-label  { font-size: 13px; font-weight: 700; color: var(--text); }
.goal-ms-tgt    { font-size: 11.5px; font-weight: 600; color: var(--text3); white-space: nowrap; }
.goal-ms-bot    { margin-top: 3px; }
.goal-ms-cur    { font-size: 12px; font-weight: 600; color: var(--text2); }
.goal-ms-cur.muted { color: var(--text3); font-style: italic; font-weight: 500; }
.goal-ms-item.achieved .goal-ms-cur { color: #14532d; }
.goal-ms-item.achieved .goal-ms-top { }
.goal-ms-item.achieved { border-color: rgba(13, 148, 136, 0.30); }

/* ── Goal Setup / Edit modal ─────────────────────────────────────────────── */
.gsm-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeInFast .15s ease;
}
.gsm-card {
  width: 100%; max-width: 480px;
  background: var(--surface); border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  display: flex; flex-direction: column; max-height: 92vh; overflow: hidden;
  animation: gsmIn .18s ease;
}
@keyframes gsmIn { from { transform: translateY(16px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

.gsm-hdr {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 20px 22px 10px; position: relative;
}
.gsm-icon {
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--surface2); flex-shrink: 0;
  display: grid; place-items: center; font-size: 22px;
}
.gsm-hdr-txt { flex: 1; min-width: 0; }
.gsm-title { font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.3; }
.gsm-sub   { font-size: 12.5px; color: var(--text3); margin-top: 4px; line-height: 1.5; }
.gsm-close {
  background: none; border: none; color: var(--text3);
  font-size: 15px; cursor: pointer; padding: 4px 8px; border-radius: 8px;
  align-self: flex-start; transition: all .15s;
}
.gsm-close:hover { background: var(--surface2); color: var(--text); }

.gsm-body {
  padding: 8px 22px 4px;
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto;
}
.gsm-row  { display: flex; flex-direction: column; gap: 6px; }
.gsm-lbl  { font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; }
.gsm-hint { font-size: 11.5px; color: var(--text3); line-height: 1.4; }

.gsm-input {
  font-size: 14px; padding: 11px 14px;
  border: 1.5px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--text);
  font-family: inherit; font-weight: 600;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.gsm-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.gsm-tval-wrap { position: relative; }
.gsm-tval-wrap .gsm-input { padding-right: 76px; }
.gsm-tval-suffix {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 700; color: var(--text3);
  pointer-events: none; letter-spacing: .02em;
}

.gsm-seg {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding: 4px; background: var(--surface2); border-radius: 11px;
}
.gsm-seg button {
  font-size: 13px; font-weight: 700; color: var(--text3);
  background: none; border: none; padding: 9px 0; border-radius: 8px;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.gsm-seg button:hover { color: var(--text); }
.gsm-seg button.on {
  background: var(--surface); color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.gsm-err {
  font-size: 12.5px; color: #b91c1c; font-weight: 600;
  background: #fef2f2; border: 1px solid #fecaca;
  padding: 9px 12px; border-radius: 10px;
  margin-top: -4px;
}

.gsm-ftr {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.gsm-cancel {
  font-size: 13px; font-weight: 600; padding: 10px 18px;
  border-radius: 99px; border: 1.5px solid var(--border);
  background: var(--surface2); color: var(--text2);
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.gsm-cancel:hover { background: var(--surface3); color: var(--text); }
.gsm-save {
  font-size: 13px; font-weight: 700; padding: 10px 22px;
  border-radius: 99px; border: none;
  background: var(--accent); color: #fff;
  cursor: pointer; font-family: inherit; transition: background .15s;
}
.gsm-save:hover { background: #0f766e; }
.gsm-save:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 640px) {
  .gsm-backdrop { padding: 0; align-items: flex-end; }
  .gsm-card {
    max-width: 100%; max-height: 94vh;
    border-radius: 20px 20px 0 0;
  }
  .gsm-hdr { padding: 18px 18px 8px; }
  .gsm-body { padding: 8px 18px 4px; }
  .gsm-ftr  { padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)); }
}

/* Suggest more */
.goals-suggest-more {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1.5px dashed var(--border);
  border-radius: 16px; padding: 16px 20px; cursor: pointer;
  width: 100%; text-align: left; font-family: inherit;
  transition: all .15s; margin-top: 4px;
}
.goals-suggest-more:hover { border-color: var(--accent); background: var(--surface2); }
.goals-suggest-icon { font-size: 22px; color: var(--text3); }
.goals-suggest-title { font-size: 13px; font-weight: 700; color: var(--text); }
.goals-suggest-sub { font-size: 11.5px; color: var(--text3); margin-top: 2px; }

/* ── Sources view ────────────────────────────────────────────── */
#viewSources { background: var(--bg); }
.sv-hdr { padding: 24px 32px 0; flex-shrink: 0; }
.sv-title { font-size: 20px; font-weight: 800; color: var(--text); }
.sv-sub { font-size: 13px; color: var(--text3); margin-top: 4px; }
.sources-scroll {
  flex: 1; overflow-y: auto; padding: 16px 32px 40px;
  display: flex; flex-direction: column;
}
.sources-scroll::-webkit-scrollbar { width: 4px; }
.sources-scroll::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }
.sources-section-label {
  font-size: 10px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 20px 0 10px;
}
.sources-section-label:first-child { margin-top: 0; }
.src-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px 20px; margin-bottom: 10px;
  transition: box-shadow .15s, border-color .15s;
}
.src-card:hover { box-shadow: 0 2px 16px var(--glow); border-color: var(--accent2); }
.src-card-logo {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 900; color: #fff; flex-shrink: 0;
}
.src-card-logo.strava { background: #FC5200; }
.src-card-logo.garmin { background: #007cc2; }
.src-card-logo.google { background: linear-gradient(135deg,#4285f4,#34a853); }
/* Strava brand asset variant — uses the official "Powered by Strava" SVG
   (downloaded from developers.strava.com/guidelines). No colored background,
   no rounded letter. Width auto so the wordmark+chevron isn't squished. */
.src-card-logo.src-card-logo-asset {
  width: auto; height: 46px;
  background: none; border-radius: 0;
  padding: 4px 0;
  display: inline-flex; align-items: center;
}
.src-card-logo.src-card-logo-asset img {
  height: 100%; width: auto;
  display: block;
}
.src-card-logo.apple  { background: #1c1c1e; font-size: 20px; }
.src-card-logo.fitbit { background: #00b0b9; }
.src-card-logo.whoop  { background: #1a1a1a; }
.src-card-logo.default { background: #6366f1; }
.src-card-info { flex: 1; min-width: 0; }
.src-card-name { font-size: 14px; font-weight: 700; color: var(--text); }
.src-card-desc { font-size: 12px; color: var(--text3); margin-top: 3px; }
.src-card-synced { font-size: 11px; color: var(--accent); margin-top: 5px; font-weight: 600; }
.src-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.src-status-badge { font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.src-status-badge.on   { background: #dcfce7; color: #16a34a; }
.src-status-badge.off  { background: var(--surface2); color: var(--text3); }
.src-status-badge.soon { background: #fef9c3; color: #a16207; }
.src-status-badge.warn { background: #fff7ed; color: #c2410c; }
.src-status-badge.err  { background: #fee2e2; color: #dc2626; }
.src-card-err { font-size: 11px; color: #dc2626; margin-top: 5px; font-weight: 500; }
.src-card-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.src-btn { font-size: 11px; font-weight: 600; padding: 6px 13px; border-radius: 99px; border: none; cursor: pointer; font-family: inherit; transition: all .15s; white-space: nowrap; }
.src-btn.connect  { background: var(--accent); color: #fff; }
.src-btn.connect:hover  { background: #0f766e; }
.src-btn.sync-now { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.src-btn.sync-now:hover { background: var(--surface3); color: var(--accent); }
.src-btn.edit     { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.src-btn.edit:hover     { background: var(--surface3); color: var(--accent); }
.src-btn.disc     { background: none; color: #dc2626; border: 1px solid #fca5a5; }
.src-btn.disc:hover     { background: #fff1f1; }
.src-btn.coming   { background: var(--surface2); color: var(--text3); cursor: default; }
/* Strava brand-compliant connect button: official orange #FC5200 */
.src-btn.connect.connect-strava { background: #FC5200; color: #fff; }
.src-btn.connect.connect-strava:hover { background: #e34402; }
/* "Powered by Strava" attribution shown next to connected Strava cards */
.src-card-attr { font-size: 11px; color: #FC5200; margin-top: 4px; font-weight: 600; letter-spacing: .02em; }
/* ════════════════════════════════════════
   DASHBOARD — SCROLL CONTAINER
════════════════════════════════════════ */
.dash-scroll {
  flex: 1; overflow-y: auto; padding: 28px 32px 40px;
  display: flex; flex-direction: column; gap: 20px;
}
.dash-scroll::-webkit-scrollbar { width: 4px; }
.dash-scroll::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }

/* Skeleton loading */
.dash-mc-skel {
  background: var(--surface2); border-radius: 14px;
  animation: pulse 1.4s ease-in-out infinite; flex: 1;
}
.dash-skel-hero { height: 130px; background: var(--surface2); border-radius: 20px; animation: pulse 1.4s ease-in-out infinite; }
.dash-skel-row  { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.dash-skel-row .dash-mc-skel { height: 96px; }
.dash-skel-row2 { display: flex; gap: 12px; }
.dash-skel-row2 .dash-mc-skel { height: 180px; }

/* New skeleton matching the current dashboard layout. Each block fades
   while the real content lands — keeps the screen "alive" instead of
   showing blank space between sections. */
#dashSkeleton {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dash-skel-hero-zone {
  background: linear-gradient(180deg, #1e6a85 0%, #0f3f55 60%, #082c40 100%);
  border-radius: 24px;
  padding: 22px 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.dash-skel-greet {
  height: 26px;
  width: 60%;
  background: rgba(255,255,255,0.18);
  border-radius: 8px;
  animation: pulse 1.4s ease-in-out infinite;
}
.dash-skel-readiness {
  height: 140px;
  background: rgba(255,255,255,0.10);
  border-radius: 20px;
  animation: pulse 1.4s ease-in-out infinite;
}
.dash-skel-section-title {
  height: 14px;
  width: 110px;
  background: var(--surface2);
  border-radius: 4px;
  animation: pulse 1.4s ease-in-out infinite;
  margin-top: 14px;
}
.dash-skel-recent {
  height: 96px;
  background: var(--surface2);
  border-radius: 14px;
  animation: pulse 1.4s ease-in-out infinite;
}
.dash-skel-wc {
  height: 220px;
  background: var(--surface2);
  border-radius: 14px;
  animation: pulse 1.4s ease-in-out infinite;
}
.dash-skel-goal {
  height: 56px;
  background: var(--surface2);
  border-radius: 14px;
  animation: pulse 1.4s ease-in-out infinite;
}

/* ── Section header (shared) ── */
.sh { display: flex; align-items: center; justify-content: space-between; margin-top: 28px; margin-bottom: 12px; }
.sh:first-child { margin-top: 8px; }
.sh-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text3); }
.sh-link  { font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer; }

/* ── Shared card ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px 22px; }
.card-hdr { font-size: 12px; font-weight: 700; color: var(--text2); margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.card-hdr-pill { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface2); color: var(--text3); }
.card-hdr-pill.good      { background: #dcfce7; color: #16a34a; }
.card-hdr-pill.excellent { background: #d1fae5; color: #059669; }
.card-hdr-pill.fair      { background: #fef3c7; color: #b45309; }
.card-hdr-pill.poor      { background: #fee2e2; color: #dc2626; }
.chart-wrap { height: 136px; }

/* ── Two / Three column grids ── */
.two-col   { display: grid; grid-template-columns: 1.5fr 1fr;  gap: 12px; }
.three-col { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 12px; }
.two-col-act { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ════════════════════════════════════════
   HERO BANNER — CONNECTED STATE
════════════════════════════════════════ */
.dash-hero {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 45%, #1e40af 100%);
  border-radius: 20px; padding: 26px 30px; margin-bottom: 4px;
  display: flex; align-items: center; justify-content: space-between;
  color: #fff; position: relative; overflow: hidden;
}
.dash-hero::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
}
.hero-left { position: relative; }
.hero-greeting { font-size: 12px; font-weight: 500; opacity: 0.8; margin-bottom: 4px; }
.hero-name { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 14px; }
.hero-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-badge { display: flex; align-items: center; gap: 5px; background: rgba(255,255,255,0.18); border-radius: 99px; padding: 5px 13px; font-size: 12px; font-weight: 600; }


/* ════════════════════════════════════════
   HERO ZONE — PHOTO BACKDROP (Phase 1)
   Wraps .dash-hero + .dash-readiness so the waterfront photo sits behind
   both. Inside this zone the readiness card flips to glass-on-photo;
   outside, every other consumer of these classes stays unchanged.
════════════════════════════════════════ */
.dash-hero-zone {
  position: relative;
  border-radius: 24px;
  padding: 22px 22px 26px;
  margin-bottom: 16px;
  overflow: hidden;
  /* CSS-only waterfront approximation: layered gradients evoking
     calm-water teal at the bottom, soft cyan-tinted sky at the top, and a
     warm-light accent in the upper right. Zero image weight, paints
     instantly, no flicker. */
  background:
    /* warm light spilling from upper-right (corner sun glow) */
    radial-gradient(80% 60% at 92% 8%, rgba(253,224,71,0.10) 0%, transparent 55%),
    /* soft brand-teal wash on the right (water + path edge) */
    radial-gradient(70% 110% at 105% 60%, rgba(20,184,166,0.22) 0%, transparent 60%),
    /* deeper teal anchoring the bottom for card legibility */
    radial-gradient(90% 60% at 50% 105%, rgba(6,78,59,0.55) 0%, transparent 70%),
    /* main sky→water vertical gradient */
    linear-gradient(180deg, #1e6a85 0%, #0f3f55 55%, #082c40 100%);
  color: #fff;
  isolation: isolate;
}
.dash-hero-zone::after {
  /* Subtle film grain / luminosity to keep it from looking flat. */
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 0% 100%, rgba(255,255,255,0.04) 0%, transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 30%);
  pointer-events: none;
  z-index: 0;
}
.dash-hero-zone > * {
  position: relative;
  z-index: 1;
}

/* When .dash-hero is inside .dash-hero-zone, drop its own gradient so the
   wrapper's photo shows through. The greeting/name/badges keep their white
   styling — the photo just replaces the background. */
.dash-hero-zone .dash-hero {
  background: transparent;
  padding: 0;
  margin-bottom: 18px;
  border-radius: 0;
  overflow: visible;
}
.dash-hero-zone .dash-hero::before { display: none; }

/* Soft text shadows — gentle halo, not harsh drop-shadow */
.dash-hero-zone .hero-greeting {
  color: rgba(255,255,255,0.86);
  text-shadow: 0 1px 8px rgba(0,0,0,0.30);
}
.dash-hero-zone .hero-name {
  color: rgba(255,255,255,0.98);
  text-shadow:
    0 1px 4px rgba(0,0,0,0.35),
    0 4px 20px rgba(0,0,0,0.28);
}
.dash-hero-zone .hero-badge {
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Readiness card → glass treatment when inside the photo zone.
   Outside this zone it keeps its original light-surface styling. */
.dash-hero-zone .dash-readiness,
.dash-hero-zone .dash-readiness.drd-ready,
.dash-hero-zone .dash-readiness.drd-caution,
.dash-hero-zone .dash-readiness.drd-rest,
.dash-hero-zone .dash-readiness-building {
  /* Dark-tinted glass: subtle white film over dark base for legibility */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.05) 100%),
    rgba(0,30,30,0.42);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.16);
  border-left-width: 4px;       /* keep the verdict-color cue */
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
}
/* Brighter verdict colors so they read against dark glass */
.dash-hero-zone .dash-readiness.drd-ready    { border-left-color: #5eead4; }
.dash-hero-zone .dash-readiness.drd-caution  { border-left-color: #fbbf24; }
.dash-hero-zone .dash-readiness.drd-rest     { border-left-color: #fca5a5; }
.dash-hero-zone .dash-readiness-building     { border-left-color: rgba(255,255,255,0.25); }

/* Inner readiness text — soft white, not harsh */
.dash-hero-zone .dash-readiness .drd-label {
  color: #5eead4;   /* default — overridden below per verdict */
}
.dash-hero-zone .dash-readiness.drd-ready   .drd-label { color: #5eead4; }
.dash-hero-zone .dash-readiness.drd-caution .drd-label { color: #fcd34d; }
.dash-hero-zone .dash-readiness.drd-rest    .drd-label { color: #fca5a5; }

.dash-hero-zone .dash-readiness .drd-score    { color: rgba(255,255,255,0.98); }
.dash-hero-zone .dash-readiness .drd-head     { color: rgba(255,255,255,0.94); }
.dash-hero-zone .dash-readiness .drd-plan     { color: rgba(255,255,255,0.82); }
.dash-hero-zone .dash-readiness .drd-reco     { color: rgba(255,255,255,0.78); }
.dash-hero-zone .dash-readiness .drd-stale {
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.85);
}

/* Score-ring background track — barely-visible white ring on dark glass */
.dash-hero-zone .dash-readiness .drd-ring circle:first-of-type {
  stroke: rgba(255,255,255,0.18);
}

/* "Building" state — title + sub */
.dash-hero-zone .dash-readiness-building .drd-title,
.dash-hero-zone .dash-readiness-building .drd-sub {
  color: rgba(255,255,255,0.92);
}
.dash-hero-zone .dash-readiness-building .drd-ico {
  background: rgba(255,255,255,0.14);
}

/* Action buttons — adapt to glass surface */
.dash-hero-zone .dash-readiness .drd-btn {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dash-hero-zone .dash-readiness .drd-btn-primary {
  background: rgba(94,234,212,0.85);
  border-color: rgba(94,234,212,0.40);
  color: #042f2e;
}
.dash-hero-zone .dash-readiness .drd-btn-primary:hover {
  background: #5eead4;
  box-shadow: 0 4px 16px rgba(94,234,212,0.30);
}
.dash-hero-zone .dash-readiness .drd-btn-ghost { color: rgba(255,255,255,0.85); }
.dash-hero-zone .dash-readiness .drd-btn-ghost:hover {
  border-color: #5eead4;
  color: #5eead4;
}
.dash-hero-zone .dash-readiness .drd-inline-btn {
  background: rgba(94,234,212,0.85);
  color: #042f2e;
  border: 1px solid rgba(94,234,212,0.40);
}
.dash-hero-zone .dash-readiness .drd-inline-btn.drd-inline-ghost {
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.95);
  border: 1px solid rgba(255,255,255,0.20);
}

/* Feel chips ("How did it feel?") — adapted for glass */
.dash-hero-zone .dash-readiness .drd-feel {
  border-top-color: rgba(255,255,255,0.18);
}
.dash-hero-zone .dash-readiness .drd-feel-q { color: rgba(255,255,255,0.65); }
.dash-hero-zone .dash-readiness .drd-feel-chip {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.88);
}
.dash-hero-zone .dash-readiness .drd-feel-chip:hover {
  border-color: #5eead4;
  color: #5eead4;
}
.dash-hero-zone .dash-readiness .drd-feel-pill {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.95);
  border: 1px solid rgba(255,255,255,0.18);
}
.dash-hero-zone .dash-readiness .drd-feel-clear {
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.70);
  border-color: rgba(255,255,255,0.18);
}
.dash-hero-zone .dash-readiness .drd-feel-clear:hover {
  color: rgba(255,255,255,0.95);
  border-color: rgba(255,255,255,0.30);
}
.dash-hero-zone .dash-readiness .drd-feel-chip.sel {
  background: rgba(94,234,212,0.20);
  border-color: #5eead4;
  color: #5eead4;
}
.dash-hero-zone .dash-readiness .drd-checkin-note {
  background: rgba(251,191,36,0.14);
  border-color: rgba(251,191,36,0.35);
  color: #fcd34d;
}

/* Planned-session chip stays teal-on-mint but readable on dark */
.dash-hero-zone .dash-readiness .drd-plan-chip {
  background: rgba(94,234,212,0.16);
  color: #5eead4;
  border: 1px solid rgba(94,234,212,0.32);
}

/* Mobile tightening — give the photo more breathing room on phones */
@media (max-width: 768px) {
  .dash-hero-zone {
    padding: 18px 16px 22px;
    border-radius: 20px;
  }
}


/* ════════════════════════════════════════
   HERO BANNER — NO SOURCE STATE
════════════════════════════════════════ */
.dash-hero-nosrc {
  background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 60%, #312e81 100%);
  border-radius: 20px; padding: 26px 30px;
  display: flex; align-items: center; justify-content: space-between;
  color: #fff; position: relative; overflow: hidden;
}
.dash-hero-nosrc::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
}
.dhn-left { position: relative; }
.dhn-date  { font-size: 12px; opacity: 0.8; margin-bottom: 4px; }
.dhn-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; }
.dhn-sub   { font-size: 13px; opacity: 0.75; max-width: 380px; line-height: 1.55; margin-bottom: 18px; }
.dhn-cta-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.3);
  border-radius: 99px; padding: 9px 20px; font-size: 13px; font-weight: 700;
  color: #fff; cursor: pointer; font-family: inherit; transition: background .15s;
  backdrop-filter: blur(4px);
}
.dhn-cta-btn:hover { background: rgba(255,255,255,0.28); }
/* Two side-by-side CTA buttons in the empty-state hero. Connect Strava/Garmin
   gets primary weight; "Log via chat" sits next to it as a real first-class
   alternative for users who don't want to connect. */
.dhn-cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.dhn-cta-btn.dhn-cta-secondary {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
}
.dhn-cta-btn.dhn-cta-secondary:hover {
  background: rgba(255,255,255,0.18);
}
.dhn-right { position: relative; }
.dhn-illus { width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; font-size: 38px; }

/* ── Setup steps ── */
.dash-setup-steps { display: flex; flex-direction: column; gap: 10px; }
.dash-step {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 20px; display: flex; align-items: center; gap: 16px; transition: all .15s;
}
.dash-step.active { border-color: var(--accent); box-shadow: 0 3px 14px var(--glow); }
.dash-step.done   { opacity: 0.65; }
.dash-step-num {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border2);
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--text3); flex-shrink: 0;
}
.dash-step.done .dash-step-num   { background: #dcfce7; border-color: #86efac; color: #16a34a; font-size: 16px; }
.dash-step.active .dash-step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.dash-step-body { flex: 1; }
.dash-step-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.dash-step-sub   { font-size: 12px; color: var(--text3); }
.dash-step-action { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.dash-step.done .dash-step-action { color: var(--text3); font-weight: 500; }

/* Two-action variant: Connect | Log via chat. Both equally prominent. */
.dash-step-actions-2 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.dash-step-or {
  color: var(--text3);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dash-step-link {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
  transition: opacity 0.15s ease;
}
.dash-step-link:hover { opacity: 0.75; }

/* On narrow screens stack the two-action layout vertically so it doesn't
   overflow or push the title down. */
@media (max-width: 480px) {
  .dash-step-actions-2 {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
  .dash-step-or { display: none; }
}

/* ── Source connect cards (no-source state) ── */
.dash-src-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dash-src-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 18px;
  padding: 20px 22px; display: flex; align-items: center; gap: 16px;
  cursor: pointer; transition: all .18s;
}
.dash-src-card:hover { border-color: var(--accent); box-shadow: 0 4px 20px var(--glow); transform: translateY(-2px); }
.dash-src-logo { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 18px; font-weight: 900; flex-shrink: 0; color: #fff; }
.dash-src-logo.strava { background: #FC5200; }
.dash-src-logo.garmin { background: #009cda; }
.dash-src-logo.google { background: #34a853; }
/* Strava brand asset variant — uses the official "Powered by Strava" SVG
   from developers.strava.com instead of a colored "S" badge. No background,
   width auto so the wordmark+chevron isn't squished. */
.dash-src-logo.dash-src-logo-asset {
  width: auto; min-width: 48px;
  background: none; border-radius: 0;
  padding: 2px;
}
.dash-src-logo.dash-src-logo-asset img {
  height: 100%; width: auto;
  display: block;
}
.dash-src-body { flex: 1; min-width: 0; }
.dash-src-name { font-size: 14px; font-weight: 800; margin-bottom: 3px; }
.dash-src-desc { font-size: 11px; color: var(--text3); line-height: 1.5; }
/* Strava "Powered by" attribution lockup — required by brand guidelines
 * to sit inside the source tile. Without a max-height the SVG renders
 * at its 176×60 intrinsic size and overflows the card width on phones.
 * Cap to a single-line height that lines up with .dash-src-desc, with
 * width:auto so the aspect ratio is preserved. */
.dash-src-attr-logo {
  display: block;
  height: 20px;
  width: auto;
  max-width: 140px;
  margin-top: 6px;
}
.dash-src-btn { padding: 8px 18px; border-radius: 99px; font-size: 12px; font-weight: 700; border: none; cursor: pointer; font-family: inherit; background: var(--accent); color: #fff; flex-shrink: 0; }
/* Strava brand-compliant variant for the dashboard Connect tile */
.dash-src-btn.connect-strava { background: #FC5200; }
.dash-src-btn.connect-strava:hover { background: #e34800; }

/* ── Preview teaser cards ── */
.dash-preview-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dash-preview-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  min-height: 120px; position: relative; overflow: hidden; padding: 20px;
}
.dash-preview-blur { filter: blur(5px); opacity: 0.3; pointer-events: none; display: flex; flex-direction: column; gap: 8px; }
.dpb-bar { background: var(--surface3); border-radius: 6px; }
.dash-preview-lock {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
}
.dpl-label { font-size: 11px; font-weight: 700; color: var(--text3); text-align: center; }
.dpl-link  { font-size: 11px; font-weight: 700; color: var(--accent); cursor: pointer; }

/* ════════════════════════════════════════
   METRIC TILES
════════════════════════════════════════ */
.dash-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
/* 3-col variant — used since nutrition tile was removed (Distance / Sleep / Movement). */
.dash-metrics.dash-metrics-3col { grid-template-columns: repeat(3, 1fr); }
.mc {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; transition: box-shadow .15s;
}
.mc:hover { box-shadow: 0 4px 20px var(--glow); }
.mc-top { display: flex; align-items: center; justify-content: space-between; }
.mc-icon  { font-size: 20px; }
.mc-delta { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.mc-delta.up   { background: #dcfce7; color: #16a34a; }
.mc-delta.down { background: #fee2e2; color: #dc2626; }
.mc-delta.flat { background: var(--surface2); color: var(--text3); }
.mc-val  { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
.mc-unit { font-size: 13px; font-weight: 500; color: var(--text3); }
.mc-lbl  { font-size: 11px; font-weight: 500; color: var(--text3); }
.mc-bar  { height: 3px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.mc-bar-fill { height: 100%; border-radius: 99px; }
.mc-bar-fill.teal   { background: linear-gradient(90deg,#0d9488,#14b8a6); }
.mc-bar-fill.purple { background: linear-gradient(90deg,#8b5cf6,#a78bfa); }
.mc-bar-fill.red    { background: linear-gradient(90deg,#ef4444,#f87171); }


/* ════════════════════════════════════════
   LAST ACTIVITY CARD  (Strava-style)
════════════════════════════════════════ */
.act-card  { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.act-map   { height: 165px; background: linear-gradient(145deg,#e8f5e9,#e3f2fd); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.act-map .leaflet-control-zoom { display: none; }
.act-map .leaflet-attribution-container { display: none; }
.act-map-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }

/* Sport badge — bottom-left overlay on map */
.act-sport-badge { position: absolute; bottom: 10px; left: 10px; display: flex; align-items: center; gap: 5px; background: rgba(0,0,0,0.52); backdrop-filter: blur(6px); border-radius: 8px; padding: 4px 10px; }
.act-sport-ico   { font-size: 13px; line-height: 1; }
.act-sport-txt   { font-size: 11px; font-weight: 700; color: #fff; }

/* Source pill — top-right overlay on map */
.act-src-pill         { position: absolute; top: 10px; right: 10px; font-size: 10px; font-weight: 800; letter-spacing: .4px; padding: 3px 9px; border-radius: 6px; color: #fff; background: rgba(0,0,0,0.42); backdrop-filter: blur(4px); }
.act-src-pill.strava  { background: rgba(252,76,2,0.85); }
.act-src-pill.garmin  { background: rgba(0,112,200,0.85); }
.act-src-pill.manual  { background: rgba(100,116,139,0.85); }   /* slate — manual entry */

/* Body */
.act-body  { padding: 13px 16px 15px; }
.act-meta  { font-size: 11px; color: var(--text3); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-title { font-size: 15px; font-weight: 800; line-height: 1.25; margin-bottom: 12px; }

/* Stats bar with vertical dividers */
.act-stats { display: flex; align-items: center; border-top: 1px solid var(--border); padding-top: 11px; }
.as-item   { flex: 1; text-align: center; }
.as-val    { font-size: 15px; font-weight: 800; }
.as-lbl    { font-size: 10px; color: var(--text3); margin-top: 2px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.as-sep    { width: 1px; height: 30px; background: var(--border); flex-shrink: 0; }

/* Kudos footer */
.act-footer { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border); }
.act-kudos  { font-size: 12px; color: var(--text3); font-weight: 600; }

/* ════════════════════════════════════════
   STREAK + RACE CARDS
════════════════════════════════════════ */
.streak-count { font-size: 32px; font-weight: 900; text-align: center; margin-top: 4px; }
.streak-sub   { font-size: 11px; color: var(--text3); text-align: center; margin-bottom: 12px; }
.streak-row   { display: flex; gap: 5px; justify-content: center; }
.sd { width: 27px; height: 27px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: var(--text3); background: var(--surface2); }
.sd.active { background: linear-gradient(135deg,var(--accent),var(--accent2)); color: #fff; }
.sd.today  { background: linear-gradient(135deg,#6366f1,#8b5cf6); color: #fff; }
.race-days     { font-size: 42px; font-weight: 900; color: var(--accent); letter-spacing: -2px; line-height: 1; text-align: center; margin-top: 4px; }
.race-days-lbl { font-size: 11px; color: var(--text3); font-weight: 600; text-align: center; margin-bottom: 8px; }
.race-name { font-size: 13px; font-weight: 700; text-align: center; }
.race-date { font-size: 11px; color: var(--text3); text-align: center; margin-bottom: 10px; }
.race-line { height: 1px; background: var(--border); margin: 10px 0; }
.race-prep { font-size: 11px; color: var(--text2); line-height: 1.5; text-align: center; }
.race-prep strong { color: var(--accent); }


/* ════════════════════════════════════════
   NUTRITION CARD (dashboard "Recent Activity" row)
   Replaced the activity streak card. Wider variant of
   the metric tile with a dedicated "Log food" CTA.
════════════════════════════════════════ */
.nutr-card { display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.nutr-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.nutr-headline {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  margin-top: 6px;
  letter-spacing: -0.5px;
}
.nutr-headline strong { color: #ea580c; font-weight: 900; }
.nutr-bar {
  height: 6px;
  background: var(--surface2, #f1f5f9);
  border-radius: 99px;
  overflow: hidden;
}
.nutr-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #fb923c, #ea580c);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.nutr-last {
  font-size: 11px;
  color: var(--text3);
  text-align: center;
}
.nutr-last span {
  color: var(--text2);
  font-weight: 600;
}
/* Water + alcohol chips on the Dashboard nutrition card. Distinct
 * background colours so users see them as DIFFERENT categories, not
 * lumped into a single "drinks" line. */
.nutr-fluids {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.nutr-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.nutr-chip-water { background: #e0f2fe; color: #075985; }
.nutr-chip-alc   { background: #fef2f2; color: #991b1b; }
.nutr-empty-msg {
  font-size: 13px;
  color: var(--text2);
  text-align: center;
  margin-top: 10px;
  font-weight: 600;
}
.nutr-empty-sub {
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  line-height: 1.4;
}
.nutr-log-btn {
  margin-top: 4px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.02em;
}
.nutr-log-btn:hover {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}
.nutr-log-btn.primary {
  background: linear-gradient(135deg, #fb923c, #ea580c);
  color: #fff;
  border-color: #ea580c;
}
.nutr-log-btn.primary:hover {
  background: linear-gradient(135deg, #f97316, #c2410c);
  color: #fff;
}


/* ════════════════════════════════════════
   GOALS STRIP
════════════════════════════════════════ */
.goals-strip  { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.goals-strip::-webkit-scrollbar { display: none; }
.gcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
  min-width: 200px; flex-shrink: 0; cursor: pointer; transition: all .15s;
}
.gcard:hover { border-color: var(--accent); box-shadow: 0 4px 16px var(--glow); transform: translateY(-1px); }
.g-ring   { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.g-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: var(--text); }
.g-info   { flex: 1; min-width: 0; }
.g-label  { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-sub    { font-size: 10px; color: var(--text3); margin-top: 2px; }
.g-add    { background: var(--surface2); border: 1.5px dashed var(--border2); border-radius: 16px; padding: 14px 20px; display: flex; align-items: center; gap: 8px; min-width: 130px; flex-shrink: 0; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text3); transition: all .15s; }
.g-add:hover { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.dash-goals-empty {
  background: var(--surface); border: 1.5px dashed var(--border2); border-radius: 16px;
  padding: 16px 20px; display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 13px; color: var(--text2); transition: all .15s;
}
.dash-goals-empty:hover { border-color: var(--accent); }

/* ════════════════════════════════════════
   AI INSIGHTS
════════════════════════════════════════ */
.dash-insights { display: flex; flex-direction: column; gap: 10px; }
.icard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; display: flex; align-items: flex-start; gap: 12px;
  cursor: pointer; text-align: left; width: 100%; font-family: inherit; transition: all .15s;
}
.icard:hover { border-color: var(--accent); box-shadow: 0 3px 14px var(--glow); }
.icard-ico  { font-size: 18px; width: 36px; height: 36px; background: var(--surface2); border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.icard-body { flex: 1; }
.icard-title { font-size: 12px; font-weight: 700; margin-bottom: 3px; }
.icard-text  { font-size: 12px; color: var(--text2); line-height: 1.5; }
.icard-cta   { font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 6px; }
.icard-tag   { font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 99px; flex-shrink: 0; align-self: flex-start; }
.icard-tag.tr { background: #dcfce7; color: #16a34a; }
.icard-tag.sl { background: #ede9fe; color: #7c3aed; }
.icard-tag.rc { background: #fef3c7; color: #b45309; }

/* ── Floating Chat Panel ─────────────────────────── */
.chat-float {
  position: fixed; bottom: 0; z-index: 200;
  /* Center in the main content area (sidebar is 220px wide) */
  left: calc(220px + (100vw - 220px) / 2);
  transform: translateX(-50%);
  width: 560px;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 40px rgba(0,0,0,.16), 0 0 0 1px rgba(0,0,0,.07);
  overflow: hidden;
  display: flex; flex-direction: column;
}

.cf-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #0f766e);
  flex-shrink: 0;
  user-select: none;
}
.cf-header-left { display: flex; align-items: center; gap: 10px; }
.cf-yuha-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.2); border: 1.5px solid rgba(255,255,255,.35);
  color: #fff; font-size: 13px; font-weight: 900;
  display: grid; place-items: center; flex-shrink: 0;
}
.cf-title { font-size: 13px; font-weight: 700; color: #fff; }
.cf-subtitle { font-size: 10px; color: rgba(255,255,255,.65); margin-top: 1px; }

.cf-header-right { display: flex; align-items: center; gap: 6px; }
.cf-icon-btn {
  background: rgba(255,255,255,.12); border: none; border-radius: 7px;
  padding: 5px 8px; cursor: pointer; font-size: 14px; line-height: 1;
  transition: background .15s;
}
.cf-icon-btn:hover { background: rgba(255,255,255,.25); }

.cf-minimize-btn {
  background: rgba(255,255,255,.12); border: none; border-radius: 7px;
  width: 28px; height: 28px; cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s;
  flex-shrink: 0;
}
.cf-minimize-btn:hover { background: rgba(255,255,255,.25); }
.cf-minimize-icon {
  width: 14px; height: 2px; background: #fff; border-radius: 99px;
  transition: transform .2s;
}

.cf-body {
  flex: 1; display: flex; flex-direction: column;
  background: var(--surface);
  overflow: hidden;
  /* Smooth open/close */
  max-height: 520px;
  transition: max-height .3s cubic-bezier(.4,0,.2,1);
}
.cf-body.cf-collapsed {
  max-height: 0;
}

/* ── Desktop chat view: glass input ─────────────── */
#viewChat .input-inner {
  max-width: 780px;
  margin: 0 auto;
}

/* Glass card */
.glass-input {
  background: rgba(255,255,255,0.62);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.82);
  border-radius: 20px;
  padding: 18px 18px 14px 20px;
  box-shadow: 0 4px 32px rgba(13,148,136,0.09), 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow .2s, border-color .2s;
  overflow: visible;
}
.glass-input:focus-within {
  border-color: rgba(13,148,136,0.35);
  box-shadow: 0 4px 32px rgba(13,148,136,0.14), 0 0 0 3px rgba(13,148,136,0.07);
}

.glass-input #input {
  width: 100%; background: none; border: none; outline: none;
  font-size: 15px; color: var(--text); font-family: inherit;
  resize: none; line-height: 1.6;
  min-height: 28px; max-height: 140px;
  margin-bottom: 14px; display: block;
}
.glass-input #input::placeholder { color: var(--text3); font-size: 15px; }

.glass-input-bottom {
  display: flex; align-items: center; gap: 8px;
}
.glass-input-bottom .mode-bar {
  flex: 1; margin-bottom: 0; flex-wrap: nowrap; overflow: visible;
}
.glass-icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 15px; padding: 4px 6px; border-radius: 7px;
  color: var(--text3); transition: background .15s;
  flex-shrink: 0;
}
.glass-icon-btn:hover { background: rgba(0,0,0,0.05); }

/* Send button — circle with arrow */
#viewChat #send {
  width: 38px; height: 38px; flex-shrink: 0;
  background: var(--accent);
  border: none; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 2px 8px rgba(13,148,136,0.35);
  transition: background .15s, transform .1s, box-shadow .15s;
}
#viewChat #send:hover { background: #0f766e; box-shadow: 0 3px 12px rgba(13,148,136,0.45); }
#viewChat #send:active { transform: scale(.93); }
#viewChat #send:disabled { opacity: .3; cursor: not-allowed; box-shadow: none; }

/* Welcome screen inside desktop chat */
#viewChat .welcome {
  max-width: 680px; margin: 0 auto;
}
#viewChat .hint {
  text-align: center; margin-top: 9px; font-size: 10.5px; color: var(--text3);
}

/* ══════════════════════════════════════════════════════
   MOBILE RESPONSIVE  (≤ 768 px)
══════════════════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ── */
.mob-menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--text2); flex-shrink: 0;
  transition: background .15s;
}
.mob-menu-btn:hover { background: var(--surface2); }
.mob-menu-btn svg { display: block; }

/* ── Sidebar overlay (hidden on desktop) ── */
/* z-index must be HIGHER than Leaflet's tallest pane (popupPane=700)
   so the overlay covers map content when the mobile sidebar is open.
   Was 299 — Leaflet panes burst through and a map on the page behind
   would render on top of the sidebar drawer. */
#sb-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 1099;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }

/* ── Mobile bottom nav (hidden on desktop) ── */
/* Height includes the iOS home-indicator safe area so the nav background
   fills all the space reserved by .desktop-app's bottom inset. Without
   `calc(60px + safe-area)` the nav stays 60px tall while the app shell
   reserves 60 + ~34pt, leaving a visible gap on iPhones with a home
   indicator. With border-box, padding-bottom is inside `height`, so the
   icon content area stays a clean 60px tall. */
#mob-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 150;
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}
.mob-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  padding: 6px 2px 4px; font-family: inherit;
  transition: color .15s;
  color: var(--text3);
}
.mob-tab.mob-active { color: var(--accent); }
.mob-tab-icon { line-height: 1; display: flex; align-items: center; justify-content: center; }
.mob-tab-icon svg { width: 26px; height: 26px; }
.mob-tab-lbl  { font-size: 10.5px; font-weight: 600; letter-spacing: 0.2px; }

@media (max-width: 768px) {

  /* ── Show mobile-only elements ── */
  .mob-menu-btn   { display: flex; }
  #mob-bottom-nav { display: flex; }

  /* ── Push entire app shell above the bottom nav so nothing is hidden ── */
  .desktop-app { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }

  /* ── Collapse suggestion chips by default on mobile (save vertical space) ── */
  /* display:none by default; chips-open class added by JS when Ideas is tapped */
  .chips-wrapper { display: none !important; }
  .chips-wrapper.chips-open { display: block !important; max-height: 200px; opacity: 1; pointer-events: auto; }

  /* ── Sidebar becomes a slide-in drawer ── */
  /* z-index must clear Leaflet's tallest pane (popupPane=700). At 300
     the drawer was BELOW any Leaflet map on the page behind it, so the
     map bled through onto the sidebar. Bumped to 1100 (1 above the
     overlay's 1099) — Leaflet stacks max around 700, so 1100 wins. */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1100;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  }
  .sidebar.mob-open {
    transform: translateX(0);
  }

  /* ── Overlay visible when sidebar open ── */
  #sb-overlay.show { display: block; }

  /* ── Main area is full width ── */
  .desk-main { width: 100%; }

  /* ── Top nav ── */
  .top-nav { padding: 0 10px 0 6px; gap: 6px; }
  .top-nav-left { gap: 6px; }
  .top-nav-page { font-size: 15px; font-weight: 700; }
  .top-nav-sync { display: none; }
  .top-nav-divider { display: none; }
  .top-nav-btn { padding: 5px 8px; font-size: 11px; }
  /* shrink memory button label on very small screens */
  @media (max-width: 380px) {
    .top-nav-btn { font-size: 0; padding: 5px 7px; }
    .top-nav-btn::before { content: '🧠'; font-size: 15px; }
  }

  /* ── Chat view ── */
  #viewChat #messages {
    padding: 16px 14px 8px;
  }
  #viewChat .input-area {
    padding: 8px 12px 12px;
  }
  #viewChat .input-inner { max-width: 100%; }

  /* Mode bar — no wrap, visible overflow so + menu shows */
  .glass-input-bottom .mode-bar {
    overflow: visible;
    flex-wrap: nowrap;
    gap: 4px;
  }
  .glass-input-bottom .mode-bar::-webkit-scrollbar { display: none; }
  .mode-pill { font-size: 11px; padding: 5px 10px; flex-shrink: 0; }

  /* Textarea on mobile. IMPORTANT: font-size must be ≥16px or iOS Safari
     auto-zooms the page on focus, leaves the page zoomed after blur, and
     the layout then renders wider than the viewport — bottom-nav icons
     get clipped and users have to pinch-zoom out. Placeholder size can
     stay smaller (doesn't trigger zoom). */
  .glass-input #input { font-size: 16px; min-height: 22px; margin-bottom: 10px; }
  .glass-input #input::placeholder { font-size: 14px; }
  .glass-input { padding: 14px 14px 10px 16px; border-radius: 16px; }

  /* Same iOS-zoom guard for every other input/textarea/select on mobile.
     The visual size delta from 14 → 16px is small enough that this doesn't
     hurt density meaningfully, and it's the only reliable way to suppress
     the focus-zoom behaviour on iOS Safari + PWA standalone. */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input:not([type]),
  textarea,
  select {
    font-size: 16px;
  }

  /* Hide hint text */
  #viewChat .hint { display: none; }

  /* Message bubbles */
  .msg-row, .welcome { max-width: 100%; }
  .welcome { padding: 20px 0 16px; }
  .welcome h2 { font-size: 17px; }
  .welcome p  { font-size: 12.5px; }
  /* Mobile bubble fine-tune. Keep body ~15px for readability (iOS HIG
     recommends ≥15px for prose) but tighten padding so usable text
     width grows on narrow screens. Headings step down half a notch. */
  .bubble {
    padding: 13px 14px;
    font-size: 15px; line-height: 1.6;
  }
  .msg-row.ai .bubble { padding-right: 40px; }
  .bubble h1 { font-size: 20px; }
  .bubble h2 { font-size: 17px; }
  .bubble h3 { font-size: 15.5px; }
  .bubble h4 { font-size: 14.5px; }
  .bubble .md-table { font-size: 13px; }
  .bubble .md-table th, .bubble .md-table td { padding: 6px 9px; }

  /* ── Nutrition page (mobile) ────────────────────────────────────────
     Defaults are set on .nut-scroll outside the media query (padding
     24px, max-width 920px). On mobile we tighten everything so the
     "+ Log a meal" button doesn't get clipped and the calendar fits
     on a narrow viewport without horizontal scroll. */
  #nutScroll.nut-scroll {
    padding: 14px 12px 24px;
  }
  /* Hero — let title and button wrap when the row is tight */
  .np-hero {
    padding: 16px 14px !important;       /* override inline <style> */
    border-radius: 12px !important;
  }
  .np-hero-hd {
    flex-wrap: wrap !important;
    gap: 10px !important;
  }
  .np-hero-hd h1 { font-size: 20px !important; }
  .np-hero-hd .v2d-btn {
    flex: 1 1 100% !important;            /* button takes full row */
    min-width: 0 !important;
    white-space: nowrap;
  }
  /* Metric tiles — was minmax(180px, 1fr) which forces 2 cols at ~370px.
     On narrow phones the second tile overflows. Drop the floor to 130px
     so the grid genuinely auto-fits (1 col on tiny screens, 2 on bigger). */
  .np-tile-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
  }
  .np-tile-val { font-size: 18px !important; }
  /* Calendar — 7 columns × cells with aspect-ratio 1/1.05 + min-height
     74px forced minimum width ~500px (wider than mobile viewport). On
     mobile, relax to a smaller min-height and let aspect-ratio shrink. */
  .nc-card { padding: 12px !important; }
  .nc-mhdr { gap: 8px !important; margin-bottom: 10px !important; }
  .nc-mtitle { font-size: 15px !important; }
  .nc-mstats { font-size: 11px !important; gap: 6px !important; }
  .nc-grid { gap: 3px !important; }
  .nc-cell {
    aspect-ratio: auto !important;        /* let height float */
    min-height: 56px !important;
    padding: 4px 5px !important;
    font-size: 10px !important;
    border-radius: 6px !important;
  }
  .nc-cell-num { font-size: 11px !important; }
  .nc-cell-cal { font-size: 12px !important; }
  .nc-cell-sub { font-size: 9px !important; }
  .nc-cell.empty .nc-cell-empty-cta { font-size: 9.5px !important; }
  .nc-dows { font-size: 9.5px !important; }

  /* ── Dashboard ── */
  .dash-scroll { padding: 16px 14px 24px; gap: 14px; }
  .dash-metrics { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  /* 3-col variant on mobile — keep as 3 across so Distance / Sleep / Movement
     stay visually balanced even on narrow widths. Tile padding tightens
     in the existing .mc rules. */
  .dash-metrics.dash-metrics-3col { grid-template-columns: repeat(3, 1fr); }
  .two-col   { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }
  .two-col-act { grid-template-columns: 1fr; }
  .dash-src-cards { grid-template-columns: 1fr; }
  .dash-preview-row { grid-template-columns: 1fr; }
  .dash-skel-row  { grid-template-columns: repeat(2,1fr); }
  .dash-hero {
    padding: 18px 16px 16px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .hero-left { flex: 1; min-width: 0; }
  .hero-name { font-size: 18px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hero-badges { flex-wrap: wrap; gap: 5px; }
  .hero-badge { font-size: 11px; padding: 4px 10px; }
  .dash-hero-nosrc { flex-direction: column; gap: 16px; padding: 20px 18px; }
  .dhn-title { font-size: 20px; }
  .dhn-right { display: none; }

  /* Skeleton */
  .dash-skel-hero { height: 110px; }
  .dash-skel-row .dash-mc-skel { height: 80px; }

  /* ── Goals view ── */
  .goals-scroll { padding: 16px 14px calc(env(safe-area-inset-bottom, 0px) + 76px); }
  .goals-templates-grid { grid-template-columns: 1fr; gap: 8px; }
  .goal-card { padding: 16px; }
  .goal-card-top { gap: 14px; }
  .goal-hdr-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .goal-meta { gap: 14px; }
  .goal-actions-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .goal-fix-btn { width: 100%; padding: 11px 16px; }
  .goal-actions { margin-left: 0; justify-content: flex-start; flex-wrap: wrap; }
  .goal-diag { font-size: 12.5px; padding: 10px 12px; }
  /* Phase 2 visuals — tighter mobile padding */
  .goal-spark, .goal-bars, .goal-milestones { padding: 10px 12px; }
  .goal-bars-row { height: 64px; gap: 5px; }
  .goal-ms-label { font-size: 12.5px; }
  .goal-ms-tgt   { font-size: 11px; }

  /* ── Sources view ── */
  .sv-hdr { padding: 16px 14px 8px; }
  .sv-title { font-size: 17px; }
  .sources-scroll { padding: 8px 14px calc(env(safe-area-inset-bottom, 0px) + 76px); }
  .src-card { padding: 12px 14px; gap: 10px; align-items: flex-start; }
  .src-card-logo { width: 36px; height: 36px; font-size: 13px; border-radius: 10px; margin-top: 2px; }
  .src-card-right { gap: 6px; align-items: flex-end; }
  .src-card-btns { gap: 5px; }
  .src-btn { padding: 5px 11px; font-size: 10.5px; }

  /* ── Reports view ── */
  .reports-view-hdr { padding: 14px 14px 10px; }
  .reports-view-title { font-size: 16px; }
  .reports-view-hdr-slim { padding: 8px 14px; }
  .ins-scroll-area { padding: 0 14px; }
  .ins-tabs-sticky { margin: 0 -14px; padding: 0 14px; }
  .ins-reports-divider { margin: 14px -14px 8px; padding: 0 14px; }
  #viewReports .report-body {
    padding: 14px 0 calc(env(safe-area-inset-bottom, 0px) + 76px);
  }
  .rtab { padding: 10px 10px; font-size: 11px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-value { font-size: 16px; }

  /* ── General scroll views: add bottom nav clearance ── */
  .report-body { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); }
  /* Insights page: bottom clearance on the scroll area itself */
  .ins-scroll-area { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); }

  /* ── Landing page on mobile ── */
  .l-topbar { margin: 0 -18px 24px; width: calc(100% + 36px); }

}

/* ── Desktop: ensure mob-only elements stay hidden ── */
@media (min-width: 769px) {
  .mob-menu-btn   { display: none !important; }
  #mob-bottom-nav { display: none !important; }
  #sb-overlay     { display: none !important; }
}

/* ═══════════════════════════════════════════════════════
   INSIGHTS PAGE
   ═══════════════════════════════════════════════════════ */
.ins-refresh-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text2); font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; padding: 6px 14px; margin-left: auto; white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.ins-refresh-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--surface2); }

/* Single scrollable column for the whole Insights page (cards + tabs + report) */
.ins-scroll-area {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 0 28px;
}
/* Tabs stick to top of the scroll area while the report body scrolls below */
.ins-tabs-sticky {
  position: sticky; top: 0; z-index: 10;
  margin: 0 -28px; padding: 0 28px;  /* break out of scroll-area padding */
}
/* Report body no longer needs its own scroll — parent handles it */
#viewReports .report-body {
  flex: none; overflow-y: visible;
}

.ins-section { width: 100%; padding: 0 0 4px; }
.ins-grid    { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 0 6px; }

.ins-reports-divider {
  display: flex; align-items: center; gap: 10px; margin: 18px -28px 10px;
  padding: 0 28px;
  color: var(--text2); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
}
.ins-reports-divider::before,
.ins-reports-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Base card */
.ins-card {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 14px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.ins-card:hover       { border-color: var(--accent); box-shadow: 0 2px 12px var(--glow); }
.ins-card--locked     { opacity: 0.7; }
.ins-card--stale      { border-style: dashed; }
.ins-card--building   { border-color: #d97706; }
.ins-card--empty      { opacity: 0.6; }

.ins-card-hdr   { display: flex; align-items: center; gap: 8px; }
.ins-icon       { font-size: 18px; flex-shrink: 0; }
.ins-lock       { font-size: 14px; margin-left: auto; opacity: 0.5; }
.ins-card-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text2); flex: 1; }
.ins-card-badges { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.ins-trend    { font-size: 13px; font-weight: 700; }
.ins-trend-up { color: #0d9488; }
.ins-trend-dn { color: #dc2626; }
.ins-trend-eq { color: var(--text2); }

.ins-badge          { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.4px; }
.ins-badge-stale    { background: #fef3c7; color: #b45309; }
.ins-badge-building { background: #fef9c3; color: #a16207; }

.ins-conf        { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 99px; text-transform: uppercase; }
.ins-conf-high   { background: #dcfce7; color: #15803d; }
.ins-conf-medium { background: #e0f2fe; color: #0369a1; }
.ins-conf-low    { background: #f3f4f6; color: #6b7280; }
.ins-conf-none   { display: none; }

.ins-headline    { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.ins-supporting  { font-size: 11px; color: var(--text2); line-height: 1.5; }
.ins-action      { font-size: 11px; color: var(--accent); font-weight: 500; line-height: 1.4; }
.ins-locked-msg  { font-size: 12px; color: var(--text2); line-height: 1.4; }
.ins-building-msg { font-size: 12px; color: #b45309; }

.ins-progress-bar  { height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; }
.ins-progress-fill { height: 100%; background: #d97706; border-radius: 99px; transition: width .3s; }
.ins-progress-lbl  { font-size: 10px; color: var(--text2); }

/* Health score card — spans both columns */
.ins-health-score-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--surface2) 0%, var(--surface3) 100%);
  border-color: var(--accent);
}
.ins-hs-top   { display: flex; align-items: flex-start; gap: 16px; }
.ins-hs-left  { display: flex; align-items: baseline; gap: 4px; flex-shrink: 0; }
.ins-hs-score { font-size: 42px; font-weight: 800; line-height: 1; }
.ins-hs-denom { font-size: 14px; color: var(--text2); font-weight: 600; align-self: flex-end; padding-bottom: 4px; }
.ins-hs-trend { font-size: 18px; font-weight: 700; align-self: flex-end; padding-bottom: 4px; margin-left: 2px; }
.ins-hs-right { flex: 1; }
.ins-hs-comps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ins-hs-comp  { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; }
.ins-hs-comp span { font-weight: 800; }
.ins-dot-ok   { background: #dcfce7; color: #15803d; }
.ins-dot-warn { background: #fef3c7; color: #92400e; }
.ins-dot-bad  { background: #fee2e2; color: #dc2626; }
.ins-dot-miss { background: var(--border); color: var(--text2); opacity: 0.7; }

/* Health score — title row with info tooltip */
.ins-hs-title-row { display: flex; align-items: center; gap: 6px; }
.hs-info-wrap     { position: relative; display: inline-flex; align-items: center; }
.hs-info-btn {
  background: none; border: none; cursor: pointer; padding: 0 2px;
  font-size: 13px; color: var(--text2); line-height: 1;
  transition: color .15s;
}
.hs-info-btn:hover { color: var(--accent); }
/* Tooltip — hidden by default, shown on hover (desktop) or .open (mobile tap) */
.hs-tooltip {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  z-index: 300; text-align: left;
}
/* On insight cards the ⓘ always sits at the right of the header row
   (.ins-card-title has flex:1, so .hs-info-wrap / .ins-card-badges gets
   pushed to the right). Keep the default right: 0 so the tooltip opens
   leftward into the card body instead of overflowing off the right edge. */
.ins-card .hs-tooltip { right: 0; left: auto; }
/* On small cards, cap width so the tooltip never extends past the card's
   left edge. 200px fits inside any insight card at our current breakpoints. */
@media (max-width: 480px) {
  .hs-tooltip { width: min(220px, calc(100vw - 64px)); }
}
.hs-info-wrap:hover .hs-tooltip,
.hs-info-wrap.open  .hs-tooltip { display: block; }
.hs-tt-body  { font-size: 11px; color: var(--text2); line-height: 1.5; margin-bottom: 8px; }
.hs-tt-scale { font-size: 10px; color: var(--text2); border-top: 1px solid var(--border); padding-top: 7px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 0; }
.hs-tt-dot   { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 3px; vertical-align: middle; }

/* Skeletons */
.ins-skeleton-wrap { display: contents; }
.ins-skel {
  height: 110px; border-radius: 14px;
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: ins-shimmer 1.4s infinite;
}
/* Skeletons inside the new at-a-glance grid: all 6 are equal-size */
.ins-ag-grid .ins-skel { height: 130px; grid-column: auto; }
@keyframes ins-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.ins-empty { color: var(--text2); font-size: 13px; padding: 20px 0; text-align: center; grid-column: 1 / -1; }
.ins-error { color: #dc2626; font-size: 13px; padding: 12px 0; grid-column: 1 / -1; }

@media (max-width: 768px) {
  .ins-grid { grid-template-columns: 1fr; }
  .ins-health-score-card { grid-column: 1; }
  .ins-hs-score { font-size: 36px; }
}

/* ═══════════════════════════════════════════════════════
   INSIGHTS PAGE — REDESIGN (themed at-a-glance cards)
   ═══════════════════════════════════════════════════════ */


/* Section header above the card grid */
.ins-sec-hdr {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 6px 2px 10px; gap: 10px;
}
.ins-sec-hdr h3 {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin: 0; letter-spacing: -0.005em;
}
.ins-sec-hdr .sub { font-size: 11px; color: var(--text3); }

/* At-a-glance grid: 2-up mobile / 3-up >=600px.
   Selector specificity (id+id+class = 0,1,2) is intentional — it has to
   beat v2/style.css's `[data-ui="v2"] #viewReports #insightCardsBody`
   override that otherwise forces flex-column on the container. */
#viewReports #insightCardsBody.ins-ag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
  padding: 0;
}
@media (min-width: 600px) {
  #viewReports #insightCardsBody.ins-ag-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* Themed card shell */
.ag-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 14px;
  position: relative; overflow: hidden;
  transition: border-color .15s, transform .12s, box-shadow .18s;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 130px;
}
.ag-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
}
.ag-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 2px rgba(15,26,22,0.04), 0 12px 24px -8px rgba(15,26,22,0.10);
}

/* Six themes — top accent bar + soft gradient wash */
.ag-card.theme-health     { background: linear-gradient(180deg, #effbf6 0%, var(--surface) 60%); }
.ag-card.theme-health::before     { background: linear-gradient(90deg, #0f766e, #2dd4bf); }
.ag-card.theme-sleep      { background: linear-gradient(180deg, #faf5ff 0%, var(--surface) 60%); }
.ag-card.theme-sleep::before      { background: linear-gradient(90deg, #7c3aed, #c084fc); }
.ag-card.theme-zone2      { background: linear-gradient(180deg, #eff6ff 0%, var(--surface) 60%); }
.ag-card.theme-zone2::before      { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.ag-card.theme-efficiency { background: linear-gradient(180deg, #fffbeb 0%, var(--surface) 60%); }
.ag-card.theme-efficiency::before { background: linear-gradient(90deg, #b45309, #fbbf24); }
.ag-card.theme-stress     { background: linear-gradient(180deg, #ecfdf5 0%, var(--surface) 60%); }
.ag-card.theme-stress::before     { background: linear-gradient(90deg, #059669, #34d399); }
.ag-card.theme-vo2        { background: linear-gradient(180deg, #fff1f2 0%, var(--surface) 60%); }
.ag-card.theme-vo2::before        { background: linear-gradient(90deg, #be123c, #fb7185); }

/* Header row: icon + label */
.ag-card .ag-row1 {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.ag-card .ag-ico {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 14px; flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}
.ag-card.theme-health     .ag-ico { background: linear-gradient(160deg, #99f6e4, #d1fae5); color: #0f766e; }
.ag-card.theme-sleep      .ag-ico { background: linear-gradient(160deg, #e9d5ff, #f3e8ff); color: #7c3aed; }
.ag-card.theme-zone2      .ag-ico { background: linear-gradient(160deg, #bfdbfe, #dbeafe); color: #2563eb; }
.ag-card.theme-efficiency .ag-ico { background: linear-gradient(160deg, #fde68a, #fffbeb); color: #b45309; }
.ag-card.theme-stress     .ag-ico { background: linear-gradient(160deg, #a7f3d0, #d1fae5); color: #059669; }
.ag-card.theme-vo2        .ag-ico { background: linear-gradient(160deg, #fecdd3, #ffe4e6); color: #be123c; }

.ag-card .ag-lbl {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ag-card.theme-health     .ag-lbl { color: #0f766e; }
.ag-card.theme-sleep      .ag-lbl { color: #7c3aed; }
.ag-card.theme-zone2      .ag-lbl { color: #2563eb; }
.ag-card.theme-efficiency .ag-lbl { color: #b45309; }
.ag-card.theme-stress     .ag-lbl { color: #059669; }
.ag-card.theme-vo2        .ag-lbl { color: #be123c; }

/* Right-side badges (info, conf, stale, trend) */
.ag-card .ag-badges {
  display: flex; align-items: center; gap: 4px; margin-left: auto;
  flex-shrink: 0;
}

/* Compact confidence dot — replaces verbose text badges in the at-a-glance card */
.ag-card .ag-conf-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; flex: none;
}
/* Single-emoji "building" indicator (replaces the wider BUILDING text pill in the
   at-a-glance card so the label has room to breathe) */
.ag-card .ag-build-dot { font-size: 12px; line-height: 1; flex: none; }
.ag-card .ag-conf-excellent { background: #15803d; }
.ag-card .ag-conf-good      { background: #0d9488; }
.ag-card .ag-conf-fair      { background: #d97706; }
.ag-card .ag-conf-low       { background: #94a3b8; }

/* Big number + supporting text */
.ag-card .ag-big {
  font-size: 22px; font-weight: 800; color: var(--text);
  line-height: 1.1; margin-bottom: 2px; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.ag-card .ag-big .ag-unit {
  font-size: 11px; font-weight: 500; color: var(--text2);
  margin-left: 4px;
}
.ag-card .ag-delta {
  font-size: 11px; font-weight: 600; color: #0f766e;
}
.ag-card .ag-delta.warn { color: #be123c; }
.ag-card .ag-delta.flat { color: var(--text3); }

/* Headline (used when no big-number primary metric) and supporting line */
.ag-card .ag-headline {
  font-size: 13px; font-weight: 600; color: var(--text);
  line-height: 1.4;
}
.ag-card .ag-supporting {
  font-size: 11px; color: var(--text2); line-height: 1.45; margin-top: 2px;
}

/* Building-state progress (shown when not enough data yet) */
.ag-card.is-building .ag-headline { color: #92400e; }
.ag-card .ag-prog-bar {
  height: 4px; background: var(--border); border-radius: 99px;
  overflow: hidden; margin-top: 8px;
}
.ag-card .ag-prog-fill {
  height: 100%; background: #d97706; border-radius: 99px;
  transition: width .3s;
}
.ag-card .ag-prog-lbl {
  font-size: 10px; color: var(--text2); margin-top: 4px;
}

/* Locked / source-missing card state */
.ag-card.is-locked { opacity: 0.78; }
.ag-card.is-locked .ag-lock {
  font-size: 13px; opacity: 0.6;
}

/* Relates-to-goal pill — narrow margin, sits under big number */
.ag-card .ins-relates { margin-top: auto; padding-top: 8px; }

/* Mobile tweak: keep the title row tight */
@media (max-width: 480px) {
  .ag-card { padding: 12px; min-height: 120px; }
  .ag-card .ag-big { font-size: 20px; }
}

/* At-a-glance cards are now click-targets — keyboard + cursor affordance */
.ag-card { cursor: pointer; outline: none; }
.ag-card:focus-visible {
  box-shadow: 0 0 0 2px var(--accent), 0 12px 24px -8px rgba(15,26,22,0.10);
}

/* ═══════════════════════════════════════════════════════
   INSIGHTS PAGE — DETAIL OVERLAY (per-card bottom sheet)
   ═══════════════════════════════════════════════════════ */
.ins-ovl {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none;
}
.ins-ovl[hidden] { display: none; }
.ins-ovl-scrim {
  position: absolute; inset: 0;
  background: rgba(15, 26, 22, 0.45);
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: auto;
}
.ins-ovl.open .ins-ovl-scrim { opacity: 1; }

.ins-ovl-sheet {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: 90vh;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -16px 60px -10px rgba(15,26,22,0.30),
              0 0 0 1px rgba(15,26,22,0.06);
  padding: 18px 20px 22px;
  overflow-y: auto;
  pointer-events: auto;
  transform: translateY(100%);
  transition: transform .22s cubic-bezier(0.32, 0.72, 0, 1);
}
.ins-ovl.open .ins-ovl-sheet { transform: translateY(0); }
@media (min-width: 720px) {
  .ins-ovl { align-items: center; }
  .ins-ovl-sheet {
    border-radius: 18px;
    max-height: 80vh;
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    transition: transform .18s ease, opacity .18s ease;
  }
  .ins-ovl.open .ins-ovl-sheet { transform: translateY(0) scale(1); opacity: 1; }
}

/* The themed accent stripe at the top of the sheet — color set inline by JS */
.ins-ovl-sheet::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0;
  height: 4px; border-radius: 22px 22px 0 0;
  background: var(--ovl-accent, var(--accent));
}
@media (min-width: 720px) {
  .ins-ovl-sheet::before { border-radius: 18px 18px 0 0; }
}

.ins-ovl-grip {
  display: block; margin: 0 auto 8px;
  width: 36px; height: 4px;
  border-radius: 99px;
  background: var(--text3);
  opacity: 0.4;
}
@media (min-width: 720px) { .ins-ovl-grip { display: none; } }

.ins-ovl-close {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 99px;
  font-size: 13px; color: var(--text2); line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s, color .12s;
}
.ins-ovl-close:hover { background: var(--surface2); color: var(--text); border-color: var(--text3); }

/* Inside-overlay layout */
.ins-ovl-body { padding-top: 4px; }
.ovl-hdr {
  display: flex; align-items: center; gap: 10px;
  padding-right: 36px;          /* leave room for the close button */
  margin-bottom: 14px;
}
.ovl-hdr .ovl-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px; flex-shrink: 0;
}
.ovl-hdr .ovl-ttls { min-width: 0; flex: 1; }
.ovl-hdr h3 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 0 0 2px; letter-spacing: -0.01em;
}
.ovl-hdr .ovl-sub {
  font-size: 11px; color: var(--text2); line-height: 1.45;
}

/* Big number block — used for the Health Score card */
.ovl-score-row {
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 12px;
}
.ovl-score-row .ovl-score {
  font-size: 38px; font-weight: 800; color: var(--text);
  letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ovl-score-row .ovl-score-denom {
  font-size: 13px; color: var(--text2); font-weight: 600;
}
.ovl-score-row .ovl-score-trend {
  margin-left: auto; font-size: 13px; font-weight: 700;
}

/* Headline + supporting text inside the overlay */
.ovl-headline { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.45; margin: 0 0 6px; }
.ovl-supporting { font-size: 12.5px; color: var(--text2); line-height: 1.55; margin: 0 0 12px; }

/* Component grid (Health Score) */
.ovl-comps {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 6px 0 14px;
}
.ovl-comp {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
}
.ovl-comp b { font-weight: 800; }
.ovl-comp.ovl-comp-ok   { background: #dcfce7; color: #15803d; }
.ovl-comp.ovl-comp-warn { background: #fef3c7; color: #92400e; }
.ovl-comp.ovl-comp-bad  { background: #fee2e2; color: #b91c1c; }
.ovl-comp.ovl-comp-miss { background: var(--surface2); color: var(--text2); opacity: 0.75; }

/* Meta row at the bottom — confidence / data age / trend pills */
.ovl-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 6px 0 14px;
}
.ovl-meta .ovl-tag {
  font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: 99px;
  background: var(--surface2); color: var(--text2);
}
.ovl-meta .ovl-tag.ovl-tag-good  { background: #dcfce7; color: #15803d; }
.ovl-meta .ovl-tag.ovl-tag-warn  { background: #fef3c7; color: #92400e; }
.ovl-meta .ovl-tag.ovl-tag-stale { background: #fef9c3; color: #a16207; }

/* "What this means" guidance — definition + a trend-specific paragraph */
.ovl-guidance {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.ovl-guidance h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 6px;
}
.ovl-guidance p {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.55;
  margin: 0 0 8px;
}
.ovl-guidance p:last-child { margin-bottom: 0; }
.ovl-guidance p b {
  color: var(--text);
  font-weight: 700;
}

/* Action ("💡 ...") callout */
.ovl-action {
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px; color: var(--text);
  line-height: 1.5;
  margin-bottom: 14px;
}

/* Footer CTA row */
.ovl-foot {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 4px;
}
.ovl-cta {
  flex: 1; min-width: 140px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.ovl-cta.ovl-cta-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 3px 10px -2px rgba(13,148,136,0.40);
}
.ovl-cta.ovl-cta-primary:hover { background: #0f766e; }
.ovl-cta.ovl-cta-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text2);
}
.ovl-cta.ovl-cta-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* Lock body scroll while overlay open */
body.ins-ovl-locked { overflow: hidden; }

/* ═══════════════════════════════════════════════════════
   INSIGHTS PAGE — PATTERNS TAB
   Pure-data pace-vs-HR scatter + sport-mix donut.
   ═══════════════════════════════════════════════════════ */

/* "NEW" badge on the Patterns tab */
.rtab .rtab-new {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 99px;
  background: #f59e0b;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Top intro inside the patterns tab body */
.pat-hdr { margin: 12px 0 4px; }
.pat-hdr h3 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 0 0 4px; letter-spacing: -0.005em;
}
.pat-hdr p {
  font-size: 12px; color: var(--text2); margin: 0;
}

/* Window chips (30d / 90d / 6mo / All) */
.pat-win-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 10px 0 14px;
}
.pat-win-chip {
  padding: 5px 12px; border-radius: 99px;
  background: var(--surface2); border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; color: var(--text2);
  cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.pat-win-chip:hover { border-color: var(--accent); color: var(--accent); }
.pat-win-chip.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.pat-win-chip.active:hover { color: #fff; }

/* Charts row — 2-up on desktop, stacked on mobile */
.pat-charts-row {
  display: grid; grid-template-columns: 1fr; gap: 14px;
}
@media (min-width: 760px) {
  .pat-charts-row { grid-template-columns: 1fr 1fr; }
}

/* Each chart card */
.pat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(15,26,22,0.04);
  display: flex; flex-direction: column; gap: 10px;
}
.pat-card-hdr {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.pat-card-hdr h4 {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin: 0; letter-spacing: -0.005em;
}
.pat-card-hdr .pat-card-meta {
  font-size: 11px; color: var(--text3); white-space: nowrap;
}
.pat-card-desc {
  font-size: 11.5px; color: var(--text2); line-height: 1.45; margin: 0;
}

/* Chart canvas wrapper — fixed height so charts don't grow infinitely */
.pat-chart-wrap {
  position: relative;
  width: 100%;
  height: 240px;
}
@media (max-width: 480px) {
  .pat-chart-wrap { height: 220px; }
}

/* Donut layout — donut on left, breakdown on right (stacked on narrow) */
.pat-donut-wrap {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
}
@media (max-width: 380px) {
  .pat-donut-wrap { grid-template-columns: 1fr; justify-items: center; }
}
.pat-donut-canvas { position: relative; width: 140px; height: 140px; }
.pat-donut-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pat-stat .pat-stat-row {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11.5px; gap: 6px; margin-bottom: 3px;
}
.pat-stat .pat-stat-row .pat-stat-name {
  font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pat-stat .pat-stat-row .pat-stat-val {
  color: var(--text2); font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.pat-stat .pat-stat-bar {
  height: 5px; background: var(--surface2); border-radius: 99px; overflow: hidden;
}
.pat-stat .pat-stat-bar > div {
  height: 100%; border-radius: 99px; transition: width .3s;
}
.pat-stat.pat-stat-faded { opacity: 0.45; }

/* Legend (scatter card) */
.pat-legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: 11px; color: var(--text2);
}
.pat-legend .pat-leg {
  display: inline-flex; align-items: center; gap: 5px;
}
.pat-legend .pat-sw {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
}

/* Insight pills under each chart */
.pat-pill {
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.45;
}
.pat-pill b { color: var(--text); font-weight: 600; }
.pat-pill.pat-pill-amber {
  background: #fffbeb;
  border-left-color: #d97706;
  color: #78350f;
}
.pat-pill.pat-pill-amber b { color: #78350f; }

/* Loading + empty states */
.pat-loading, .pat-empty {
  font-size: 12px; color: var(--text2);
  text-align: center; padding: 28px 12px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

/* ═══════════════════════════════════════════════════════
   DASHBOARD — HEALTH SCORE + TOP INSIGHT STRIP
   ═══════════════════════════════════════════════════════ */

.dash-ins-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 4px 0 8px;
}

/* Shared card shell */
.dash-hs-card,
.dash-tip-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
  text-decoration: none;
}
.dash-hs-card:hover,
.dash-tip-card:hover {
  box-shadow: 0 4px 16px rgba(13,148,136,.10);
  transform: translateY(-1px);
}

/* ── Health Score card ── */
.dash-hs-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 48px;
}
.dash-hs-num {
  font-size: 34px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.dash-hs-trend {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 6px;
}
.dash-hs-trend.up   { color: #15803d; background: #dcfce7; }
.dash-hs-trend.down { color: #dc2626; background: #fee2e2; }
.dash-hs-trend.flat { color: var(--text3); background: var(--surface3); }

.dash-hs-right  { flex: 1; min-width: 0; }
.dash-hs-title  {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 2px;
}
.dash-hs-sub    { font-weight: 400; color: var(--text3); font-size: 10px; }
.dash-hs-action {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.35;
  margin: 4px 0 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-hs-link   { font-size: 11px; color: var(--accent); font-weight: 600; }

/* ── Top Insight card ── */
.dash-tip-ico   { font-size: 26px; flex-shrink: 0; }
.dash-tip-body  { flex: 1; min-width: 0; }
.dash-tip-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
}
.dash-tip-head  {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dash-tip-action {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dash-tip-link  { font-size: 11px; color: var(--accent); font-weight: 600; }

@media (max-width: 640px) {
  .dash-ins-strip { grid-template-columns: 1fr; gap: 10px; }
  .dash-hs-num    { font-size: 28px; }
}

/* ═══════════════════════════════════════════════════════
   DASHBOARD — NUTRITION STRIP
   ═══════════════════════════════════════════════════════ */

.dash-nutr-strip {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}
.dash-nutr-strip .muted { color: var(--text2); font-weight: 500; }

/* Macros — side-by-side on wide, stacked on narrow */
.dash-nutr-macros {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.dash-nutr-macro      { display: flex; flex-direction: column; gap: 6px; }
.dash-nutr-macro-hdr  { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; }
.dash-nutr-macro-lbl  { color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; font-size: 10px; }
.dash-nutr-macro-val  { color: var(--text); font-weight: 700; }
.dash-nutr-bar        { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.dash-nutr-fill       { height: 100%; border-radius: 99px; transition: width 0.3s; }
.dash-nutr-fill.kcal    { background: linear-gradient(90deg, #f97316, #f59e0b); }
.dash-nutr-fill.protein { background: linear-gradient(90deg, #0d9488, #14b8a6); }

/* Micro-nutrient chip line */
.dash-nutr-micro {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 11px; color: var(--text2);
  border-top: 1px solid var(--border); padding-top: 10px;
}
.dash-nutr-micro strong { color: var(--text); font-weight: 700; }

/* Meal rows */
.dash-nutr-meals {
  display: flex; flex-direction: column; gap: 4px;
}
.dash-nutr-meal {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  padding: 6px 0;
}
.dash-nutr-meal-ico   { font-size: 18px; flex-shrink: 0; width: 22px; text-align: center; }
.dash-nutr-meal-name  { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-nutr-meal-kcal  { color: var(--text2); font-weight: 600; flex-shrink: 0; font-size: 12px; }

/* Last-logged (state-waiting) */
.dash-nutr-last { display: flex; align-items: center; gap: 12px; }
.dash-nutr-last-ico  { font-size: 26px; flex-shrink: 0; }
.dash-nutr-last-body { flex: 1; min-width: 0; }
.dash-nutr-last-lbl  { font-size: 10px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }
.dash-nutr-last-meal { font-size: 14px; color: var(--text); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Empty state */
.dash-nutr-empty { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dash-nutr-empty-ico { font-size: 32px; flex-shrink: 0; }
.dash-nutr-empty-body { flex: 1; min-width: 160px; }
.dash-nutr-empty-ttl  { font-size: 14px; font-weight: 700; color: var(--text); }
.dash-nutr-empty-sub  { font-size: 12px; color: var(--text2); margin-top: 2px; line-height: 1.4; }

/* Actions row */
.dash-nutr-actions { display: flex; justify-content: flex-end; }
.dash-nutr-log {
  background: var(--accent); color: #fff;
  border: none; border-radius: 99px;
  padding: 7px 14px; font-size: 12px; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
  transition: transform 0.1s, box-shadow 0.15s;
}
.dash-nutr-log:hover  { box-shadow: 0 2px 10px var(--glow); }
.dash-nutr-log:active { transform: scale(0.97); }

.dash-nutr-hint {
  font-size: 11px; color: var(--text2);
  border-top: 1px solid var(--border);
  padding-top: 8px; line-height: 1.4;
}

@media (max-width: 640px) {
  .dash-nutr-macros { grid-template-columns: 1fr; gap: 10px; }
  .dash-nutr-last   { flex-wrap: wrap; }
  .dash-nutr-last .dash-nutr-log { margin-left: 38px; /* align under meal text */ }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PHASE 3 — TRAINING PLAN MODAL (race_time goal CTA)
   ═══════════════════════════════════════════════════════════════════════════ */

.goal-plan-btn {
  font-size: 11px; font-weight: 700; padding: 6px 14px; border-radius: 99px;
  border: 1px solid rgba(13,148,136,0.3);
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  color: #fff; cursor: pointer; font-family: inherit;
  transition: transform .12s, box-shadow .15s;
}
.goal-plan-btn:hover  { box-shadow: 0 2px 10px var(--glow); transform: translateY(-1px); }
.goal-plan-btn:active { transform: scale(0.97); }

/* Plan preview modal */
.plan-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  z-index: 9500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
.plan-modal-overlay.open { opacity: 1; pointer-events: auto; }

.plan-modal {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  width: 100%; max-width: 680px; max-height: 86vh;
  display: flex; flex-direction: column;
  transform: translateY(10px) scale(0.98);
  transition: transform .18s ease;
  overflow: hidden;
}
.plan-modal-overlay.open .plan-modal { transform: none; }

.plan-modal-hdr {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);
}
.plan-modal-ttl { font-size: 17px; font-weight: 800; color: var(--text); line-height: 1.25; }
.plan-modal-sub { font-size: 12.5px; color: var(--text2); margin-top: 3px; }
.plan-modal-close {
  flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 99px;
  border: none; background: var(--surface2); color: var(--text2);
  cursor: pointer; font-size: 14px; font-weight: 700;
  transition: background .15s, color .15s;
}
.plan-modal-close:hover { background: var(--surface3); color: var(--text); }

.plan-modal-body {
  flex: 1; min-height: 120px;
  overflow-y: auto;
  padding: 16px 20px;
}
.plan-modal-text {
  font-family: 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.55;
}
.plan-modal-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 40px 20px;
  color: var(--text2); font-size: 13px;
}
.plan-modal-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--surface3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: plan-modal-spin 0.9s linear infinite;
}
@keyframes plan-modal-spin { to { transform: rotate(360deg); } }
.plan-modal-err {
  padding: 30px 20px; text-align: center;
  color: #dc2626; font-size: 13px; font-weight: 600;
}
.plan-modal-err-toast {
  margin-top: 12px;
  padding: 10px 14px; border-radius: 10px;
  background: #fee2e2; color: #991b1b;
  font-size: 12.5px; font-weight: 600;
  border: 1px solid #fecaca;
}

.plan-modal-ftr {
  border-top: 1px solid var(--border);
  padding: 12px 20px 16px;
  background: var(--surface);
}
.plan-modal-note {
  font-size: 11.5px; color: var(--text2);
  margin-bottom: 10px; line-height: 1.45;
}
.plan-modal-btns { display: flex; gap: 10px; justify-content: flex-end; }
.plan-modal-cancel {
  padding: 9px 16px; font-size: 13px; font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border); background: #fff; color: var(--text2);
  cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.plan-modal-cancel:hover { background: var(--surface2); }
.plan-modal-save {
  padding: 9px 20px; font-size: 13px; font-weight: 700;
  border-radius: 10px;
  border: none;
  background: var(--accent); color: #fff;
  cursor: pointer; font-family: inherit;
  transition: background .15s, transform .1s;
}
.plan-modal-save:hover:not(:disabled)  { background: #0f766e; }
.plan-modal-save:active:not(:disabled) { transform: scale(0.97); }
.plan-modal-save:disabled { background: var(--surface3); color: var(--text3); cursor: not-allowed; }
.plan-modal-save.saved    { background: #22c55e; color: #fff; }
.plan-modal-save.saved:disabled { background: #22c55e; color: #fff; }

/* Goal card scroll-to-highlight pulse (from dashboard focus chip / insight link) */
.goal-card.goal-highlight {
  animation: goal-highlight-pulse 2s ease;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.35);
}
@keyframes goal-highlight-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.55); }
  30%  { box-shadow: 0 0 0 6px rgba(13, 148, 136, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0); }
}

@media (max-width: 640px) {
  .plan-modal-overlay { padding: 10px; }
  .plan-modal { max-height: 92vh; border-radius: 14px; }
  .plan-modal-hdr { padding: 14px 16px 12px; }
  .plan-modal-ttl { font-size: 16px; }
  .plan-modal-body { padding: 12px 14px; }
  .plan-modal-text { font-size: 11.5px; padding: 12px; }
  .plan-modal-ftr  { padding: 10px 14px 14px; }
  .plan-modal-btns { flex-direction: column-reverse; }
  .plan-modal-cancel, .plan-modal-save { width: 100%; padding: 11px 16px; }
  .goal-plan-btn { width: 100%; padding: 10px 14px; font-size: 12px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PHASE 3 — DASHBOARD GOAL FOCUS CHIP
   ═══════════════════════════════════════════════════════════════════════════ */

.dash-focus-chip {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f0fdfa 0%, #ffffff 100%);
  border: 1px solid rgba(13, 148, 136, 0.25);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease;
  margin-bottom: 14px;
}
.dash-focus-chip:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--glow); }
.dash-focus-chip:active { transform: translateY(0); }

.dash-focus-ring {
  position: relative;
  width: 40px; height: 40px;
  flex-shrink: 0;
}
.dash-focus-pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800; color: var(--text);
}

.dash-focus-body { flex: 1; min-width: 0; }
.dash-focus-hdr {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-bottom: 3px;
}
.dash-focus-ico  { font-size: 14px; flex-shrink: 0; }
.dash-focus-lbl  { font-size: 13.5px; font-weight: 700; color: var(--text); }
.dash-focus-days {
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 99px;
  background: var(--surface2); color: var(--text2);
}
.dash-focus-days.overdue { background: #fee2e2; color: #991b1b; }
.dash-focus-diag {
  font-size: 12px; color: var(--text2); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.dash-focus-ask {
  flex-shrink: 0;
  padding: 7px 12px; border-radius: 99px;
  border: 1px solid rgba(13, 148, 136, 0.3);
  background: #fff; color: var(--accent);
  font-size: 11.5px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s;
}
.dash-focus-ask:hover { background: var(--accent); color: #fff; }

@media (max-width: 640px) {
  .dash-focus-chip { padding: 12px 14px; gap: 10px; }
  .dash-focus-lbl  { font-size: 13px; }
  .dash-focus-ask {
    font-size: 11px; padding: 6px 10px;
  }
  /* If very narrow, drop the ask button below the body */
}
@media (max-width: 480px) {
  .dash-focus-chip { flex-wrap: wrap; }
  .dash-focus-ask  { margin-left: 52px; /* align under body, past ring */ }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PHASE 3 — INSIGHT CARD "RELATES TO" CROSS-LINK
   ═══════════════════════════════════════════════════════════════════════════ */

.ins-relates {
  /* Single-row flex layout: label fixed, goal fills + ellipsis-
     truncates, arrow fixed. Was `inline-flex flex-wrap: wrap` which
     let the goal text spill to row 2; on row 2 the goal's old
     `max-width: 60ch` (~420 px) overflowed mobile cards (content
     area ~160 px). Now everything stays on one row and the goal
     shrinks instead. */
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  margin-top: 10px; padding: 7px 11px;
  border-radius: 99px;
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.18);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  max-width: 100%;
  min-width: 0;          /* allow the pill itself to shrink in its grid cell */
  box-sizing: border-box;
}
.ins-relates:hover {
  background: rgba(13, 148, 136, 0.14);
  border-color: rgba(13, 148, 136, 0.38);
}
.ins-relates:active { transform: scale(0.98); }

.ins-relates-lbl {
  font-size: 11px; font-weight: 600; color: var(--text2);
  white-space: nowrap;
  flex: 0 0 auto;        /* fixed — never shrink the label */
}
.ins-relates-goal {
  font-size: 12px; font-weight: 700; color: var(--accent);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1 1 0;           /* fill remaining space */
  min-width: 0;          /* required for ellipsis inside flex */
}
.ins-relates-arrow {
  font-size: 13px; font-weight: 700; color: var(--accent);
  margin-left: 2px;
  flex: 0 0 auto;        /* fixed — never shrink the arrow */
}


/* ════════════════════════════════════════════════════════════════════════
   TODAY'S READINESS — dashboard hero card
════════════════════════════════════════════════════════════════════════ */
.dash-readiness {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 22px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 18px;
  margin: 16px 0 8px;
  box-shadow: 0 2px 10px rgba(13,148,136,0.06);
}
.dash-readiness.drd-ready   { border-left-color: #0d9488; background: linear-gradient(90deg,#f0fdfa 0%, var(--surface) 45%); }
.dash-readiness.drd-caution { border-left-color: #d97706; background: linear-gradient(90deg,#fffbeb 0%, var(--surface) 45%); }
.dash-readiness.drd-rest    { border-left-color: #dc2626; background: linear-gradient(90deg,#fef2f2 0%, var(--surface) 45%); }
.dash-readiness-building    { border-left-color: #94a3b8; background: var(--surface); }

.drd-ring-wrap {
  position: relative; flex-shrink: 0;
  width: 90px; height: 90px;
  display: flex; align-items: center; justify-content: center;
}
.drd-ring { display: block; }
.drd-score {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -1px;
}

.drd-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.drd-hdr  { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
/* "TODAY'S READINESS" prefix — anchors the user that this is *today's*
   number, distinct from the Insights screen's Weekly Health Score. */
.drd-section {
  font-size: 11px; font-weight: 800; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text3);
  opacity: 0.95;
}
.drd-sep {
  font-size: 11px; font-weight: 800; color: var(--text3);
  opacity: 0.55;
}
.drd-label {
  font-size: 11px; font-weight: 800; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text3);
}
.drd-ready   .drd-label { color: #0d9488; }
.drd-caution .drd-label { color: #d97706; }
.drd-rest    .drd-label { color: #dc2626; }
.drd-stale {
  font-size: 10px; font-weight: 600; color: var(--text3);
  background: var(--surface2); padding: 2px 6px; border-radius: 4px;
}
.drd-head { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.35; }
.drd-plan {
  font-size: 12px; font-weight: 600; color: var(--text2);
  margin-top: 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.drd-plan-text { flex: 1; min-width: 0; }
.drd-plan-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f0fdfa;
  color: #0d9488;
  border: 1px solid #0d948833;
  white-space: nowrap;
}
.drd-reco {
  font-size: 13px; color: var(--text2); line-height: 1.45; margin-top: 2px;
}

.drd-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.drd-btn {
  font-size: 12px; font-weight: 700; padding: 7px 14px; border-radius: 99px;
  border: 1px solid var(--border); cursor: pointer; transition: all .15s;
  background: var(--surface);
}
.drd-btn:hover { transform: translateY(-1px); }
.drd-btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.drd-btn-primary:hover { background: #0f766e; box-shadow: 0 4px 12px rgba(13,148,136,0.25); }
.drd-btn-ghost { color: var(--text2); }
.drd-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* "How did it feel?" chip row — sits between recommendation and action buttons */
.drd-feel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.drd-feel-q {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}
.drd-feel-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.drd-feel-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.drd-feel-ico { font-size: 13px; }
.drd-feel-set { gap: 8px; }
.drd-feel-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
}
.drd-feel-clear {
  font-size: 16px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text3);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.drd-feel-clear:hover { color: var(--text); border-color: var(--text3); }

/* Daily check-in — selected feel + the "eased off" cap note */
.drd-feel-chip.sel {
  border-color: var(--accent);
  color: var(--accent);
  background: #f0fdfa;
  font-weight: 700;
}
.drd-checkin-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 7px 10px;
}

/* Building state is simpler — no ring, no score */
.dash-readiness-building {
  padding: 16px 18px; gap: 14px;
}
.dash-readiness-building .drd-ico {
  font-size: 28px; opacity: 0.7;
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--surface2);
}
.dash-readiness-building .drd-title { font-size: 14px; font-weight: 700; color: var(--text); }
.dash-readiness-building .drd-sub   { font-size: 13px; color: var(--text2); margin-top: 2px; }


/* ════════════════════════════════════════════════════════════════════════
   METRIC TILE EXTRAS — nutrition tile + sub-label
════════════════════════════════════════════════════════════════════════ */
.mc-sub-lbl { font-size: 11px; color: var(--text3); font-weight: 500; }
.mc-bar-fill.orange { background: linear-gradient(90deg,#f97316,#fb923c); }

.mc-nutr { cursor: pointer; }
.mc-nutr:hover { border-color: rgba(249,115,22,0.4); }
.mc-nutr-cta .mc-cta-val {
  font-size: 16px; font-weight: 700; color: #f97316; letter-spacing: 0;
}
.mc-nutr-logged { font-size: 22px; font-weight: 700; color: var(--text); }

/* ════════════════════════════════════════════════════════════════════════
   RECENT MEALS MODAL — shown from nutrition tile click
════════════════════════════════════════════════════════════════════════ */
.rm-modal-bg {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.rm-modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%; max-width: 420px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
}
.rm-hdr {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700; color: var(--text);
}
.rm-close {
  background: transparent; border: 0; font-size: 22px;
  color: var(--text3); cursor: pointer; line-height: 1;
}
.rm-close:hover { color: var(--text); }
.rm-body {
  flex: 1; overflow-y: auto; padding: 4px 0;
}
.rm-row {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "meta right" "name right";
  gap: 2px 10px;
}
.rm-row:last-child { border-bottom: 0; }
.rm-meta { grid-area: meta; font-size: 11px; color: var(--text3); font-weight: 500; text-transform: capitalize; }
.rm-name { grid-area: name; font-size: 14px; color: var(--text); font-weight: 500; }
.rm-right { grid-area: right; align-self: center; }
.rm-cal { font-size: 12.5px; font-weight: 700; color: #f97316; }
.rm-cal-dim { color: var(--text3); font-weight: 500; }
.rm-empty { padding: 32px 18px; text-align: center; color: var(--text3); font-size: 13px; }
.rm-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rm-log-btn {
  width: 100%;
  background: #f97316; color: #fff;
  border: 0; border-radius: 10px;
  padding: 10px 16px;
  font-size: 13.5px; font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.rm-log-btn:hover { background: #ea580c; }
.rm-see-all {
  width: 100%;
  background: transparent; color: var(--accent);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.rm-see-all:hover { background: #f8fafc; border-color: var(--accent); }

/* Empty-state metric tile — replaces "0 mi with red delta" with a friendly CTA */
.mc.mc-empty {
  cursor: pointer;
  background: var(--surface);
  border-style: dashed;
  border-color: var(--border);
}
.mc.mc-empty:hover { border-color: var(--accent); }
.mc.mc-empty .mc-cta-val {
  font-size: 15px; font-weight: 700; color: var(--accent); letter-spacing: 0;
}

/* ════════════════════════════════════════════════════════════════════════
   YUHA'S TAKE — contextual one-liner under readiness card
════════════════════════════════════════════════════════════════════════ */
.yuha-take {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 16px;
  background: linear-gradient(90deg, rgba(13,148,136,0.06), transparent 80%);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  margin: 14px 0 4px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
}
.yt-ico { font-size: 15px; line-height: 1.4; flex-shrink: 0; }
.yt-msg { flex: 1; min-width: 0; }

/* ════════════════════════════════════════════════════════════════════════
   READINESS BUILDING — inline CTA buttons (sync / connect / refresh)
════════════════════════════════════════════════════════════════════════ */
.drd-building-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.drd-inline-btn {
  font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px;
  background: var(--accent); color: #fff; border: 0;
  cursor: pointer; transition: background .15s, transform .1s;
}
.drd-inline-btn:hover { background: #0f766e; transform: translateY(-1px); }
.drd-inline-btn.drd-inline-ghost {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border);
}
.drd-inline-btn.drd-inline-ghost:hover {
  border-color: var(--accent); color: var(--accent); background: transparent;
}


/* ════════════════════════════════════════════════════════════════════════
   DASHBOARD GOALS ROW — merged focus chip + goals strip
════════════════════════════════════════════════════════════════════════ */
.dash-goals-row {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px 16px;
}
.dgr-row {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 4px; border-radius: 10px;
  cursor: pointer; transition: background .15s;
}
.dgr-row:hover { background: var(--surface2); }
.dgr-ico { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.dgr-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.dgr-top { display: flex; align-items: center; gap: 8px; }
.dgr-lbl {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.dgr-days {
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
  background: var(--surface2); color: var(--text3);
  flex-shrink: 0;
}
.dgr-days.urgent  { background: #fef3c7; color: #d97706; }
.dgr-days.overdue { background: #fee2e2; color: #dc2626; }

.dgr-bar {
  height: 5px; border-radius: 99px; background: var(--surface3); overflow: hidden;
}
.dgr-bar-fill { height: 100%; border-radius: 99px; transition: width .4s; }
.dgr-bar-fill.ok   { background: linear-gradient(90deg,#0d9488,#14b8a6); }
.dgr-bar-fill.warn { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.dgr-bar-fill.done { background: linear-gradient(90deg,#22c55e,#4ade80); }

.dgr-pct {
  font-size: 13px; font-weight: 700; color: var(--text2);
  min-width: 40px; text-align: right; flex-shrink: 0;
}

.dash-goals-done {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(90deg,#f0fdfa,var(--surface));
  border: 1px solid var(--border); border-radius: 14px;
  cursor: pointer;
  font-size: 13px; color: var(--text2);
}
.dash-goals-done:hover { border-color: var(--accent); }


/* ════════════════════════════════════════════════════════════════════════
   MOBILE — readiness card + goals row
════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .dash-readiness {
    padding: 16px; gap: 14px;
    flex-wrap: wrap;
  }
  .drd-ring-wrap { width: 72px; height: 72px; }
  .drd-ring { width: 72px; height: 72px; }
  .drd-score { font-size: 22px; }
  .drd-head  { font-size: 14px; }
  .drd-reco  { font-size: 12px; }
  .drd-btn   { font-size: 11px; padding: 6px 12px; }

  .dash-goals-row { padding: 10px 12px; gap: 8px; }
  .dgr-lbl { font-size: 12px; }
  .dgr-pct { font-size: 12px; min-width: 34px; }
}

@media (max-width: 420px) {
  .dash-readiness { flex-direction: column; align-items: flex-start; }
  .drd-actions { width: 100%; }
  .drd-btn { flex: 1; min-width: 0; }
}

/* ─── Readiness report (Insights → Readiness tab) ───────────────────────── */
.rd-summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0 16px;
}
.rd-summary-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.rd-summary-lbl {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rd-summary-val {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}
.rd-summary-unit {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  margin-left: 4px;
}
.rd-summary-sub {
  font-size: 11px;
  color: #6b7280;
}
.rd-verdict-mix {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.rd-vmix-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid;
}
.rd-vmix-ready   { color: #0d9488; border-color: #0d948855; background: #f0fdfa; }
.rd-vmix-caution { color: #d97706; border-color: #d9770655; background: #fffbeb; }
.rd-vmix-rest    { color: #dc2626; border-color: #dc262655; background: #fef2f2; }

.rd-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.rd-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
}
.rd-spark-wrap {
  width: 100%;
  overflow: hidden;
}
.rd-spark-svg {
  display: block;
  width: 100%;
  height: 130px;
}
.rd-spark-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: #6b7280;
  margin-top: 6px;
  align-items: center;
}
.rd-leg-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  margin-left: 4px;
}
.rd-leg-dot:first-child { margin-left: 0; }

.rd-comp-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rd-comp-row { display: flex; flex-direction: column; gap: 5px; }
.rd-comp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}
.rd-comp-name {
  font-weight: 600;
  color: #111827;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.rd-comp-icon { font-size: 14px; }
.rd-comp-val {
  font-weight: 700;
  color: #111827;
  font-size: 13px;
}
.rd-comp-sub {
  font-weight: 400;
  color: #6b7280;
  font-size: 11px;
}
.rd-comp-bar {
  width: 100%;
  height: 8px;
  background: #f3f4f6;
  border-radius: 999px;
  overflow: hidden;
}
.rd-comp-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.rd-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 16px 0 8px;
}
.rd-driver-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rd-driver-chip {
  font-size: 12px;
  padding: 4px 10px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  color: #374151;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.rd-driver-count {
  color: #6b7280;
  font-weight: 600;
  margin-left: 2px;
}

.rd-empty-card {
  background: var(--surface, #fff);
  border: 1px dashed var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  margin-top: 12px;
}
.rd-empty-icon { font-size: 32px; margin-bottom: 8px; }
.rd-empty-msg { font-size: 13px; color: #6b7280; }

@media (max-width: 540px) {
  .rd-summary-row { grid-template-columns: 1fr; }
  .rd-summary-card { padding: 10px 12px; }
  .rd-summary-val { font-size: 22px; }
  .rd-spark-svg { height: 110px; }
}

/* ─── Weekly Charts (Insights → 7-Day Summary tab) ────────────────────── */
.wc-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.wc-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wc-card-empty { opacity: 0.7; }

.wc-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wc-icon { font-size: 18px; }
.wc-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  flex: 1;
  min-width: 0;
}
.wc-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.wc-trend-ico { font-weight: 900; }
.wc-trend-up   { color: #0d9488; border-color: #0d948844; background: #f0fdfa; }
.wc-trend-down { color: #dc2626; border-color: #dc262644; background: #fef2f2; }
.wc-trend-mix  { color: #d97706; border-color: #d9770644; background: #fffbeb; }
.wc-trend-flat { color: #6b7280; border-color: #e5e7eb;   background: #f9fafb; }

.wc-stats {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.wc-stat-main { display: flex; flex-direction: column; min-width: 0; }
.wc-stat-val {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}
.wc-stat-unit {
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  margin-left: 3px;
}
.wc-stat-lbl {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.wc-stat-side {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.wc-stat-avg {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
}
.wc-baseline {
  font-size: 10px;
  color: #9ca3af;
  font-weight: 500;
}

.wc-chart-wrap {
  position: relative;
  height: 100px;
  width: 100%;
}

.wc-summary {
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
  background: #f9fafb;
  border-left: 3px solid var(--accent, #0d9488);
  border-radius: 6px;
  padding: 10px 12px;
}

@media (max-width: 540px) {
  .wc-card { padding: 14px 14px; }
  .wc-stat-val { font-size: 24px; }
  .wc-chart-wrap { height: 90px; }
  .wc-summary { font-size: 12.5px; }
}

/* Embedded Weekly Charts on Dashboard — loading + empty placeholder. The
   actual rendered cards reuse the .wc-* classes above, no extra styling. */
/* Dashboard content fade — kills the abrupt skeleton→content swap flicker */
#dashContent {
  animation: dashFadeIn 220ms ease-out both;
}
@keyframes dashFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Reserve vertical space for weekly charts so when they hydrate the page
   doesn't jump downward. ~2200px holds the typical 10-card stack on
   mobile; collapses cleanly on first render via the loading state. */
.dash-weekly-charts { margin-bottom: 20px; min-height: 320px; }
.dash-wc-loading,
.dash-wc-empty {
  text-align: center;
  padding: 28px 18px;
  color: var(--text3, #9ca3af);
  font-size: 13px;
  background: var(--surface, #fff);
  border: 1px dashed var(--border, #e5e7eb);
  border-radius: 14px;
}
.dash-wc-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.dash-wc-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border, #e5e7eb);
  border-top-color: var(--accent, #0d9488);
  border-radius: 50%;
  animation: dashWcSpin 0.7s linear infinite;
}
@keyframes dashWcSpin {
  to { transform: rotate(360deg); }
}

/* ─── Daily Plan card — Today's Session state machine ──────────────────
   States (see docs/todays-session-design.md):
     • no_plan           — card is suppressed entirely
     • pre_plan          — countdown banner + soft easy-base prescription
     • active_prescribed — existing rich layout (today + upcoming)
     • active_completed  — ✓ done + reflection (Phase 3)
     • post_plan         — closeout card with compliance summary

   Variants of active_prescribed:
     • rest              — different copy ("Mark rest taken")
     • race_day          — dedicated race-day card (Phase 5)
   ─────────────────────────────────────────────────────────────────── */

/* pre_plan — countdown banner above the soft prescription */
.dp-state-pre-plan .dp-pre-plan-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.dp-state-pre-plan .dp-pre-icon { font-size: 22px; }
.dp-state-pre-plan .dp-pre-headline {
  font-size: 14px; font-weight: 700; color: #78350f;
}
.dp-state-pre-plan .dp-pre-detail {
  font-size: 12.5px; color: #92400e; margin-top: 2px;
}

/* post_plan — closeout card with last-4-week stats */
.dp-state-post-plan .dp-post-body {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-left: 3px solid #10b981;
  border-radius: 8px;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.dp-state-post-plan .dp-post-headline {
  font-size: 14px; font-weight: 600; color: #065f46;
}
.dp-state-post-plan .dp-post-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 12px;
}
.dp-state-post-plan .dp-post-stat {
  background: #ffffff;
  border: 1px solid #d1fae5;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}
.dp-state-post-plan .dp-post-stat-val {
  font-size: 22px; font-weight: 700; color: #065f46;
  line-height: 1.1;
}
.dp-state-post-plan .dp-post-stat-lbl {
  font-size: 11px; color: #047857; margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* Phase 3 — reflection (coaching note inside the completed card)
   Severity-coded: celebrate = green, watch = amber, ok = neutral.
   Renders below the autoMatch badge so the user sees:
     ✓ Logged · 7:33am
     ⚡ Auto-matched from Strava
     💡 [coaching note]   ← this  */
.dp-reflection {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid #94a3b8;
  background: #f8fafc;
}
.dp-reflection-head {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; font-weight: 600; color: #0f172a;
  line-height: 1.35;
}
.dp-reflection-icon { font-size: 14px; }
.dp-reflection-detail {
  margin-top: 4px;
  font-size: 12.5px; line-height: 1.5; color: #475569;
}
.dp-reflection-celebrate {
  background: #f0fdf4;
  border-left-color: #10b981;
}
.dp-reflection-celebrate .dp-reflection-headline { color: #065f46; }
.dp-reflection-watch {
  background: #fffbeb;
  border-left-color: #f59e0b;
}
.dp-reflection-watch .dp-reflection-headline { color: #92400e; }

/* Phase 2 — adaptation banner (readiness / weather / fatigue / sleep)
   Sits between the plan badge and the today block. Severity drives
   color: watch = amber, warn = red. User can apply the swap or dismiss
   the banner. */
.dp-adaptation {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid;
}
.dp-adaptation-watch {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #f59e0b;
}
.dp-adaptation-warn {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #ef4444;
}
.dp-adaptation-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.dp-adaptation-icon { font-size: 22px; line-height: 1; }
.dp-adaptation-text { flex: 1; min-width: 0; }
.dp-adaptation-headline {
  font-size: 13px; font-weight: 700; line-height: 1.35;
}
.dp-adaptation-watch .dp-adaptation-headline { color: #78350f; }
.dp-adaptation-warn  .dp-adaptation-headline { color: #991b1b; }
.dp-adaptation-detail {
  font-size: 12.5px; line-height: 1.5; margin-top: 4px;
}
.dp-adaptation-watch .dp-adaptation-detail { color: #92400e; }
.dp-adaptation-warn  .dp-adaptation-detail { color: #b91c1c; }
.dp-adaptation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dp-cta-ghost {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
}
.dp-cta-ghost:hover { background: #f8fafc; }

/* ─── Daily Plan card (dashboard) ──────────────────────────────────────
   Sits between Recent Activity and Last 7 Days. Race-plan-aware when
   active. Layout: header → today (prominent) → upcoming (compact strip). */
.dash-daily-plan {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.dp-hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.dp-title {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dp-headline {
  font-size: 12px;
  color: var(--text3, #94a3b8);
  font-weight: 500;
}
.dp-today {
  background: linear-gradient(135deg, rgba(13,148,136,0.04) 0%, rgba(13,148,136,0.01) 100%);
  border-left: 3px solid #0d9488;
  border-radius: 8px;
  padding: 14px 14px 12px;
  margin-bottom: 10px;
}
.dp-today-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.dp-today-session {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  text-transform: capitalize;
}
.dp-intensity {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--ic, #0d9488);
  background: color-mix(in srgb, var(--ic, #0d9488) 12%, transparent);
}
.dp-today-meta {
  margin-bottom: 8px;
}
.dp-dur {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.dp-today-guidance {
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
  margin-bottom: 12px;
}
/* Phase 4 — Session breakdown <details> block */
.dp-breakdown {
  margin: -4px 0 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: #f8fafc;
  overflow: hidden;
  transition: background 0.15s;
}
.dp-breakdown[open] { background: #fff; }
.dp-breakdown-summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  user-select: none;
}
.dp-breakdown-summary::-webkit-details-marker { display: none; }
.dp-breakdown-summary:hover { color: #0d9488; }
.dp-bd-chevron {
  font-size: 12px;
  color: #94a3b8;
  transition: transform 0.18s;
}
.dp-breakdown[open] .dp-bd-chevron { transform: rotate(180deg); }
.dp-breakdown-body {
  padding: 4px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-top: 1px solid #f1f5f9;
}
.dp-bd-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  align-items: start;
}
.dp-bd-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 2px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.dp-bd-icon { font-size: 13px; }
.dp-bd-text {
  font-size: 12.5px;
  color: #334155;
  line-height: 1.5;
}
@media (max-width: 480px) {
  .dp-bd-row { grid-template-columns: 1fr; gap: 2px; }
  .dp-bd-label { font-size: 10.5px; }
}
.dp-rest-tip {
  font-size: 12.5px;
  color: #64748b;
  margin: -6px 0 12px;
  padding: 8px 12px;
  background: #f8fafc;
  border-left: 3px solid #94a3b8;
  border-radius: 6px;
  line-height: 1.45;
}
/* Phase 6 — auto-match badge on completed sessions */
.dp-auto-match {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(13, 148, 136, 0.08);
  color: #0f766e;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid rgba(13, 148, 136, 0.2);
}
.dp-auto-icon { font-size: 13px; }
.dp-auto-conf {
  margin-left: 6px;
  padding: 1px 6px;
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dp-today-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dp-cta {
  background: #0d9488;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.dp-cta:hover { background: #0f766e; }
.dp-cta-secondary {
  background: transparent;
  color: #475569;
  border: 1px solid var(--border, #e5e7eb);
}
.dp-cta-secondary:hover { background: #f8fafc; color: #0d9488; border-color: #0d9488; }
.dp-upcoming {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.dp-upcoming-item {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 10px 12px;
}
.dp-up-day {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.dp-up-session {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  text-transform: capitalize;
  margin-bottom: 2px;
}
.dp-up-meta {
  font-size: 11px;
  color: #94a3b8;
}
.dp-up-check {
  display: inline-block;
  margin-left: 4px;
  color: #10b981;
  font-weight: 700;
}
.dp-upcoming-item.dp-up-done {
  background: color-mix(in srgb, #10b981 6%, transparent);
  border-color: color-mix(in srgb, #10b981 25%, transparent);
}

/* ── Completed / skipped today states ── */
.dp-today.dp-today-done {
  background: linear-gradient(135deg, rgba(16,185,129,0.08) 0%, rgba(16,185,129,0.02) 100%);
  border-left-color: #10b981;
}
.dp-today.dp-today-skipped {
  background: linear-gradient(135deg, rgba(148,163,184,0.08) 0%, rgba(148,163,184,0.02) 100%);
  border-left-color: #94a3b8;
  opacity: 0.85;
}
.dp-completed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dp-completed-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--cc, #10b981);
  background: color-mix(in srgb, var(--cc, #10b981) 12%, transparent);
  padding: 6px 12px;
  border-radius: 8px;
  letter-spacing: 0.02em;
}
.dp-cta-undo {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.dp-cta-undo:hover { color: #475569; text-decoration: none; }

/* ── Feel chips (post-completion) ── */
.dp-feel-prompt {
  margin-top: 14px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.dp-feel-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.dp-feel-chip {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.dp-feel-chip:hover { border-color: #0d9488; color: #0d9488; background: #f0fdfa; }
.dp-feel-badge {
  margin-top: 10px;
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  padding: 5px 11px;
}

/* ── More-options modal (Daily Plan card) ── */
.dpo-modal-bg {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: dpoFade 0.18s ease-out;
}
@keyframes dpoFade { from { opacity: 0; } to { opacity: 1; } }
.dpo-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: dpoSlide 0.2s ease-out;
}
@keyframes dpoSlide { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.dpo-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.dpo-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.dpo-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}
.dpo-close:hover { background: #f1f5f9; color: #0f172a; }
.dpo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  overflow-y: auto;
  flex: 1;
}
.dpo-row {
  text-align: left;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.dpo-row:hover {
  border-color: #0d9488;
  background: #f0fdfa;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(13,148,136,0.08);
}
.dpo-row-planned {
  background: linear-gradient(135deg, rgba(13,148,136,0.04) 0%, rgba(13,148,136,0.01) 100%);
  border-color: color-mix(in srgb, #0d9488 30%, var(--border, #e5e7eb));
}
.dpo-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.dpo-label {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  text-transform: capitalize;
}
.dpo-intensity {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--ic, #0d9488);
  background: color-mix(in srgb, var(--ic, #0d9488) 12%, transparent);
}
.dpo-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  color: #0d9488;
  background: rgba(13,148,136,0.1);
  border: 1px solid rgba(13,148,136,0.25);
}
.dpo-meta {
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
}
.dpo-foot {
  padding: 10px 18px 14px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  border-top: 1px solid var(--border, #e5e7eb);
}

/* ── Race Intel card (rendered inline in chat under AI bubble) ───────────── */
.ri-card {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  max-width: 720px;
}
.ri-hdr { margin-bottom: 14px; }
.ri-name {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}
.ri-sub {
  font-size: 12px;
  color: #64748b;
}
.ri-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.ri-tile {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}
.ri-tile-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 3px;
}
.ri-tile-val {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ri-map-wrap { margin-bottom: 14px; }
.ri-map {
  width: 100%;
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f5f9;
}
.ri-map-disclaimer {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 6px;
  font-style: italic;
}
.ri-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 8px;
}
.ri-elev-wrap { margin-bottom: 16px; }
.ri-elev {
  position: relative;
  height: 120px;
  background: #f8fafc;
  border-radius: 8px;
  padding: 6px;
}
.ri-notes {
  margin-bottom: 16px;
}
.ri-notes p {
  font-size: 13px;
  color: #334155;
  line-height: 1.55;
  margin: 0;
}
.ri-segs-wrap { margin-bottom: 16px; }
.ri-segs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ri-seg {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border-left: 3px solid #0d9488;
  border-radius: 6px;
}
.ri-seg-range {
  font-size: 11px;
  font-weight: 700;
  color: #0d9488;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 60px;
}
.ri-seg-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 2px;
}
.ri-seg-desc {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}
.ri-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #e5e7eb);
}

/* Phase 3: similar past runs */
.ri-similar-wrap { margin-bottom: 16px; }
.ri-similar-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: -4px;
  margin-bottom: 8px;
  font-style: italic;
}
.ri-similar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ri-run {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 9px 12px;
}
.ri-run-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.ri-run-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}
.ri-run-match {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0d9488;
  background: rgba(13, 148, 136, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.ri-run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 11.5px;
  color: #475569;
  align-items: center;
}
.ri-similar-empty {
  font-size: 12px;
  color: #94a3b8;
  background: #f8fafc;
  border: 1px dashed var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

/* ── Route estimate card (chat: "I walked from X to Y") ─────────────────── */
.reC-card {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  max-width: 720px;
}
.reC-hdr {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.reC-mode {
  font-size: 13px;
  font-weight: 700;
  color: #0d9488;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.reC-rtrip {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  background: #ecfeff;
  color: #0e7490;
  border-radius: 99px;
  letter-spacing: 0.03em;
  text-transform: lowercase;
}

/* Save / Discard buttons on the route estimate + confirm-activity cards.
   Eliminates the "type the right magic word" UX fragility — user clicks
   to save or discard explicitly. */
.reC-actions, .ca-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.reC-btn {
  flex: 1 1 auto;
  min-width: 130px;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.reC-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.reC-btn-primary {
  background: #0d9488;
  color: #fff;
  border-color: #0d9488;
}
.reC-btn-primary:hover:not(:disabled) {
  background: #0f766e;
  border-color: #0f766e;
}
.reC-btn-secondary {
  background: #fff;
  color: #475569;
  border-color: #e2e8f0;
}
.reC-btn-secondary:hover:not(:disabled) {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}
.reC-cta-hint, .ca-edit-hint {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text3, #94a3b8);
  text-align: center;
  line-height: 1.5;
}

/* Confirm-activity card (text-only path — no map). Sits below the AI's
   "Here's what I'll log..." reply with Save / Discard buttons. */
.ca-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.ca-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text);
}
.ca-icon { font-size: 18px; }
.ca-text strong { color: #0f172a; }

/* "Saved!" / "Discarded" replacement card after click */
.reC-saved-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 8px 0;
  font-size: 13px;
  color: #166534;
  animation: caSavedFadeIn 0.2s ease;
}
.reC-saved-card.reC-saved-card-discard {
  background: #fafafa;
  border-color: #e5e7eb;
  color: #6b7280;
}
.reC-saved-icon {
  font-size: 16px;
  font-weight: 800;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #bbf7d0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.reC-saved-card-discard .reC-saved-icon {
  background: #e5e7eb;
}
.reC-saved-text { flex: 1; }
.reC-saved-text strong { color: #166534; font-weight: 700; }
.reC-saved-link {
  color: #16a34a;
  font-weight: 700;
  text-decoration: none;
  font-size: 12.5px;
}
.reC-saved-link:hover { text-decoration: underline; }
@keyframes caSavedFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Route-estimate error card — shown when geocode/routing fails so the
   user knows WHY they didn't get a route card, and what to do next. */
.reC-card-err {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #fffbeb;
  border-color: #fde68a;
}
.reC-err-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fef3c7;
  border-radius: 10px;
}
.reC-err-body { flex: 1; }
.reC-err-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 4px;
}
.reC-err-msg {
  font-size: 13px;
  color: #78350f;
  line-height: 1.5;
  margin-bottom: 6px;
}
.reC-err-tried {
  font-size: 12px;
  color: var(--text3, #94a3b8);
  margin-bottom: 12px;
}
.reC-err-tried strong { color: var(--text2, #475569); font-weight: 600; }
.reC-err-actions { display: flex; gap: 10px; }


/* ════════════════════════════════════════
   WIN + WATCH CARD (dashboard "Recent Activity" row)
   Replaces the static "Next Race" tile. Two-column layout
   with celebratory win on the left, watch signal on the
   right, plus one actionable idea below.
════════════════════════════════════════ */
.ww-card { display: flex; flex-direction: column; gap: 12px; }
.ww-card .card-hdr { display: flex; align-items: center; justify-content: space-between; }
.ww-refresh {
  font-size: 12px;
  color: var(--text3, #94a3b8);
  cursor: pointer;
  padding: 0 6px;
  border-radius: 4px;
  transition: color 0.15s ease, transform 0.3s ease;
}
.ww-refresh:hover {
  color: #0d9488;
  transform: rotate(180deg);
}
.ww-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ww-col {
  background: linear-gradient(135deg, #f8fafc, #ffffff);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 90px;
}
.ww-col-win {
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  border-color: #bbf7d0;
}
.ww-col-watch {
  background: linear-gradient(135deg, #fef3c7, #fffbeb);
  border-color: #fde68a;
}
.ww-col-empty {
  background: #fafafa;
  border-color: #e5e7eb;
}
.ww-col-hdr {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ww-col-icon { font-size: 18px; line-height: 1; }
.ww-col-lbl {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text3, #94a3b8);
  letter-spacing: 0.08em;
}
.ww-col-win .ww-col-lbl   { color: #059669; }
.ww-col-watch .ww-col-lbl { color: #b45309; }
.ww-col-headline {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  margin-top: 2px;
}
.ww-col-detail {
  font-size: 11.5px;
  color: var(--text2, #475569);
  line-height: 1.4;
}
.ww-col-soft {
  color: var(--text2, #475569);
  font-weight: 600;
}
/* Hover affordance + Ask YUHA CTA on the win/watch tiles */
.ww-col-win, .ww-col-watch {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ww-col-win:hover, .ww-col-watch:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.ww-col-cta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.ww-col-win .ww-col-cta   { color: #059669; }
.ww-col-watch .ww-col-cta { color: #b45309; }
.ww-col-win:hover .ww-col-cta,
.ww-col-watch:hover .ww-col-cta {
  opacity: 1;
}
/* Refresh icon — spin while a refresh is in flight */
.ww-refreshing {
  pointer-events: none;
  animation: wwSpin 0.8s linear infinite;
  color: #0d9488 !important;
}
@keyframes wwSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.ww-idea {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
}
.ww-idea-icon {
  font-size: 18px;
  line-height: 1.2;
  flex-shrink: 0;
}
.ww-idea-body { flex: 1; }
.ww-idea-headline {
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
  line-height: 1.4;
}
.ww-idea-detail {
  font-size: 11.5px;
  color: #1e3a8a;
  line-height: 1.4;
  margin-top: 2px;
  opacity: 0.85;
}
.ww-empty {
  font-size: 12px;
  color: var(--text3, #94a3b8);
  text-align: center;
  padding: 20px 8px;
  line-height: 1.5;
}
.ww-empty p { margin: 0; }
@media (max-width: 480px) {
  .ww-cols { grid-template-columns: 1fr; }
}
.reC-route {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.reC-from, .reC-to { color: #0f172a; }
.reC-arrow { color: #94a3b8; font-weight: 400; }
.reC-map {
  width: 100%;
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f5f9;
  margin-bottom: 14px;
}
.reC-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.reC-tile {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
}
.reC-tile-lbl {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 4px;
}
.reC-tile-val {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}
.reC-conf {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
}
.reC-conf-high   { color: #16a34a; background: rgba(22, 163, 74, 0.1); }
.reC-conf-medium { color: #d97706; background: rgba(217, 119, 6, 0.1); }
.reC-conf-low    { color: #dc2626; background: rgba(220, 38, 38, 0.1); }
.reC-disclaimers {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 12px;
}
.reC-disc-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 6px;
}
.reC-disclaimers ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.reC-disclaimers li {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}
.reC-defaults {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border, #e5e7eb);
  font-style: italic;
}
.reC-defaults a { color: #0d9488; }
.reC-cta {
  font-size: 13px;
  color: #475569;
  background: rgba(13, 148, 136, 0.05);
  border-left: 3px solid #0d9488;
  padding: 10px 14px;
  border-radius: 6px;
  line-height: 1.5;
}
@media (max-width: 600px) {
  .reC-tiles { grid-template-columns: repeat(2, 1fr); }
}


/* Dashboard last-activity card click affordance */
.act-card-clickable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.act-card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* My Activities — "View details" button styling */
.act-detail-btn {
  background: transparent;
  color: #0d9488;
  border: 1px solid #0d9488;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 8px;
}
.act-detail-btn:hover {
  background: #0d9488;
  color: #fff;
}
.ri-mini-lbl {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 3px;
}
.ri-mini-val {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}
@media (max-width: 600px) {
  .ri-tiles { grid-template-columns: repeat(2, 1fr); }
}

/* ─── My Activities view ──────────────────────────────────────────────── */
.acts-scroll {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 24px 80px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.acts-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.acts-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}
.acts-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}
.acts-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.acts-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #fff);
  color: var(--text2, #374151);
  cursor: pointer;
  transition: all 0.15s;
}
.acts-chip:hover {
  border-color: var(--accent, #0d9488);
  color: var(--accent, #0d9488);
}
.acts-chip-active {
  background: var(--accent, #0d9488);
  border-color: var(--accent, #0d9488);
  color: #fff;
}
.acts-chip-active:hover {
  color: #fff;
}

.acts-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Loading / empty / error blocks */
.acts-loading,
.acts-error,
.acts-empty {
  text-align: center;
  padding: 48px 16px;
  color: #6b7280;
  font-size: 13px;
}
.acts-empty {
  background: var(--surface, #fff);
  border: 1px dashed var(--border, #e5e7eb);
  border-radius: 14px;
}
.acts-empty-icon { font-size: 36px; margin-bottom: 10px; }
.acts-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}
.acts-empty-msg { color: #6b7280; margin-bottom: 16px; }
.acts-empty-btn {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--accent, #0d9488);
  color: #fff;
  border: none;
  cursor: pointer;
}
.acts-empty-btn:hover { background: #0f766e; }

/* Activity card */
.act-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.act-summary {
  font-size: 13px;
  line-height: 1.55;
  color: #374151;
  background: #f9fafb;
  border-left: 3px solid var(--accent, #0d9488);
  border-radius: 6px;
  padding: 10px 12px;
}
.act-summary-pending {
  font-style: italic;
  color: #9ca3af;
}

.act-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
}
.act-icon {
  font-size: 22px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2, #f3f4f6);
  border-radius: 10px;
  flex-shrink: 0;
}
.act-titles { flex: 1; min-width: 0; }
.act-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.act-meta {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.act-src {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.act-src-strava { color: #FC5200; background: #fff4ee; border: 1px solid #FC520033; }
.act-src-garmin { color: #007cc3; background: #eff6fb; border: 1px solid #007cc333; }
/* Google Health uses the same green (#34a853) as the Sources card brand
   mark so the activity pill ties back visually to where it was connected. */
.act-src-google { color: #1f8a3a; background: #ecfdf5; border: 1px solid #34a85333; }
.act-src-manual { color: #6b7280; background: #f3f4f6; border: 1px solid #e5e7eb; }

.act-stats-bar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border, #e5e7eb);
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.act-stat {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.act-stat-val {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}
.act-stat-lbl {
  font-size: 10px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
  font-weight: 600;
}
.act-stat-divider {
  width: 1px;
  background: var(--border, #e5e7eb);
}

.act-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.act-map-btn,
.act-ask-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #fff);
  color: var(--text2, #374151);
  cursor: pointer;
  transition: all 0.15s;
}
.act-map-btn:hover {
  border-color: var(--accent, #0d9488);
  color: var(--accent, #0d9488);
}
.act-ask-btn {
  border-color: var(--accent, #0d9488);
  color: var(--accent, #0d9488);
}
.act-ask-btn:hover {
  background: var(--accent, #0d9488);
  color: #fff;
}
.act-analyze-btn {
  font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid #0d9488;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff; cursor: pointer;
  transition: all 0.15s;
}
.act-analyze-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Strava brand-compliant attribution link — required on any UI showing
   Strava-sourced activity data per developers.strava.com/guidelines.
   Bold + underlined + official orange #FC5200 identifies as clickable. */
.act-view-strava {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #FC5200;
  text-decoration: underline;
  text-underline-offset: 2px;
  border-radius: 8px;
  white-space: nowrap;
}
.act-view-strava:hover {
  background: #fff4ee;
  text-decoration: underline;
}

.act-map {
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 4px;
}

.acts-loadmore-wrap {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.acts-loadmore {
  font-size: 13px;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 999px;
  border: 1px solid var(--accent, #0d9488);
  background: var(--surface, #fff);
  color: var(--accent, #0d9488);
  cursor: pointer;
  transition: all 0.15s;
}
.acts-loadmore:hover {
  background: var(--accent, #0d9488);
  color: #fff;
}

@media (max-width: 540px) {
  .acts-scroll { padding: 14px 14px 80px; }
  .acts-title { font-size: 18px; }
  .act-card { padding: 14px 14px; }
  .act-stat-val { font-size: 13px; }
  .act-footer { flex-wrap: wrap; }
}

/* ─── PWA install banner ────────────────────────────────────────────── */
.pwa-install-banner {
  position: fixed;
  left: 50%;
  bottom: 80px;                    /* sits above mobile bottom nav */
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 460px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #0f766e;             /* solid teal — high contrast */
  color: #fff;
  box-shadow: 0 8px 24px rgba(15,118,110,0.35);
  border: 1px solid rgba(255,255,255,0.10);
  animation: pwaSlideUp 280ms ease-out;
}
@keyframes pwaSlideUp {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}
.pwa-install-icon { font-size: 20px; flex-shrink: 0; }
.pwa-install-text {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(255,255,255,0.95);
}
.pwa-install-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  background: #fff;
  color: #0f766e;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.pwa-install-btn:hover { background: #f0fdfa; }
.pwa-install-dismiss {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.16);
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pwa-install-dismiss:hover { background: rgba(255,255,255,0.28); }

/* On desktop, sit at top-right instead of above the bottom nav */
@media (min-width: 768px) {
  .pwa-install-banner {
    left: auto;
    right: 24px;
    bottom: 24px;
    transform: none;
    animation-name: pwaSlideUpDesk;
  }
  @keyframes pwaSlideUpDesk {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
}

/* ─── Tier pill (top nav) + Upgrade modal ─────────────────────────────── */
.tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 11px;
  user-select: none;
}
.tier-pill:hover { border-color: var(--accent, #0d9488); }
.tier-pill .tp-count { font-weight: 700; color: var(--text, #111827); letter-spacing: -0.2px; }
.tier-pill .tp-sep   { color: var(--text3, #9ca3af); margin: 0 2px; font-weight: 400; }
.tier-pill .tp-tier  {
  font-size: 10px; font-weight: 600;
  color: var(--accent, #0d9488);
  text-transform: uppercase; letter-spacing: 0.04em;
  padding-left: 6px;
  border-left: 1px solid var(--border, #e5e7eb);
}
.tier-pill-warn { border-color: #f59e0b; }
.tier-pill-warn .tp-count { color: #d97706; }
.tier-pill-over { border-color: #dc2626; background: #fef2f2; }
.tier-pill-over .tp-count { color: #dc2626; }
.tier-pill-premium {
  border: 0; background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff; box-shadow: 0 2px 8px rgba(13,148,136,.28);
}
.tier-pill-premium .tp-tier { color: #fff; font-weight: 800; letter-spacing: .02em; }

/* Locked nav items (Premium-gated) — a small lock badge after the label. */
.nav-locked { position: relative; }
.nav-locked::after {
  content: "🔒"; font-size: 11px; margin-left: 6px; opacity: .55; vertical-align: middle;
}

@media (max-width: 540px) {
  /* Hide the tier WORD on phones so free pills show just "12/20".
     Premium pills have no count — their whole content is the ★ label —
     so they must NOT be hidden, or the pill renders empty. */
  .tier-pill:not(.tier-pill-premium) .tp-tier { display: none; }
}

/* ─── Upgrade modal ────────────────────────────────────────────────── */
.upg-modal-bg {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: upgFade 200ms ease-out;
}
@keyframes upgFade { from { opacity: 0; } to { opacity: 1; } }

.upg-modal {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 28px 28px 22px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
  max-height: 90vh;
  overflow-y: auto;
}
.upg-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none; cursor: pointer;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 20px;
  display: inline-flex; align-items: center; justify-content: center;
}
.upg-close:hover { background: #e5e7eb; }

.upg-hdr { text-align: center; margin-bottom: 22px; }
.upg-title {
  font-size: 22px; font-weight: 700;
  color: #111827;
  letter-spacing: -0.3px;
}
.upg-sub {
  font-size: 13px; color: #6b7280;
  margin-top: 6px;
  line-height: 1.5;
}

.upg-tiers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 600px) {
  .upg-tiers { grid-template-columns: 1fr; }
}

.upg-tier {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px 14px;
  background: #fafbfc;
  display: flex; flex-direction: column;
  text-align: center;
}
.upg-tier-current {
  border-color: var(--accent, #0d9488);
  background: #f0fdfa;
}
.upg-tier-name {
  font-size: 12px; font-weight: 700;
  color: #6b7280;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.upg-price {
  font-size: 26px; font-weight: 700;
  color: #111827; line-height: 1;
}
.upg-price-sub {
  font-size: 12px; font-weight: 500;
  color: #9ca3af;
  margin-left: 2px;
}
.upg-price-annual {
  font-size: 11px; color: #0d9488; font-weight: 500;
  margin-top: 4px;
}
.upg-trial {
  font-size: 11px; font-weight: 600;
  color: #d97706;
  background: #fffbeb;
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-block;
  margin: 8px auto 0;
}
.upg-tier-limit {
  font-size: 14px; font-weight: 600;
  color: #111827;
  margin-top: 12px;
}
.upg-tier-features {
  font-size: 11px; color: #6b7280;
  margin-top: 4px;
  flex: 1;
}
.upg-cta {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  background: var(--accent, #0d9488);
  color: #fff;
  font-size: 13px; font-weight: 700;
  cursor: pointer;
}
.upg-cta:hover:not(:disabled) { background: #0f766e; }
.upg-cta-current {
  background: #fff;
  color: var(--accent, #0d9488);
  border: 1px solid var(--accent, #0d9488);
  cursor: default;
}
.upg-cta-ghost {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: default;
}

.upg-footer {
  border-top: 1px solid #e5e7eb;
  padding-top: 16px;
  display: flex; gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.upg-have-code {
  font-size: 12px; color: #6b7280;
  font-weight: 500;
}
.upg-code-input {
  flex: 1; min-width: 160px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 12px;
  font-family: 'Inter', monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.upg-code-input:focus {
  outline: none;
  border-color: var(--accent, #0d9488);
  box-shadow: 0 0 0 2px rgba(13,148,136,0.15);
}
.upg-code-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent, #0d9488);
  background: #fff;
  color: var(--accent, #0d9488);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
}
.upg-code-btn:hover { background: var(--accent, #0d9488); color: #fff; }

.upg-msg {
  font-size: 12px; line-height: 1.45;
  margin-top: 10px;
  min-height: 16px;
}
.upg-msg-ok  { color: #059669; }
.upg-msg-err { color: #dc2626; }

/* ════════════════════════════════════════════════════════════════════════
   Activity Detail PAGE VIEW — replaces the older modal. Lives under
   #viewActivityDetail. Plain block-flow layout, scoped to .actd-* names
   so it can never conflict with the modal styles we removed.
   ════════════════════════════════════════════════════════════════════════ */
.actd-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 80px;
}
.actd-back-row {
  margin-bottom: 16px;
}
.actd-back-btn {
  background: transparent;
  border: 1px solid var(--border, #e5e7eb);
  color: #475569;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.actd-back-btn:hover { background: #f8fafc; border-color: #0d9488; color: #0d9488; }
.actd-back-arrow { margin-right: 4px; }

.actd-loading {
  padding: 60px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: #94a3b8; font-size: 14px;
}
.actd-spinner {
  width: 28px; height: 28px;
  border: 3px solid #e5e7eb;
  border-top-color: #0d9488;
  border-radius: 50%;
  animation: actdSpin 0.7s linear infinite;
}
@keyframes actdSpin { to { transform: rotate(360deg); } }
.actd-error {
  padding: 60px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: #475569;
  text-align: center;
}
.actd-error-icon { font-size: 32px; opacity: 0.6; }
.actd-error-msg { font-size: 14px; max-width: 480px; line-height: 1.5; }

/* Hero */
.actd-hero {
  margin-bottom: 24px;
}
.actd-hero-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  flex-wrap: wrap;
}
.actd-sport-ico {
  font-size: 32px;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; border-radius: 12px;
  flex-shrink: 0;
}
.actd-hero-text { flex: 1; min-width: 0; }
.actd-title {
  font-size: 22px; font-weight: 700; color: #0f172a;
  margin-bottom: 4px;
  word-break: break-word;
}
.actd-meta { font-size: 13px; color: #64748b; }
.actd-src-pill {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 5px 12px; border-radius: 999px;
  color: var(--src-c, #0d9488);
  background: color-mix(in srgb, var(--src-c, #0d9488) 12%, transparent);
  flex-shrink: 0;
  white-space: nowrap;
  align-self: center;
}
.actd-kudos {
  margin-top: 12px;
  font-size: 13px; font-weight: 600; color: #475569;
}

/* Stats grid — 4 across desktop, 2 across mobile */
.actd-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.actd-stat {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 12px 14px;
}
.actd-stat-lbl {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #94a3b8; margin-bottom: 4px;
}
.actd-stat-val {
  font-size: 18px; font-weight: 700; color: #0f172a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.actd-stat-unit { font-size: 13px; color: #64748b; font-weight: 500; }
@media (max-width: 700px) {
  .actd-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Generic section */
.actd-section { margin-bottom: 28px; }
.actd-section-title {
  font-size: 14px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #475569;
  margin: 0 0 12px 0;
}

/* ── Coach's analysis (hero block at top of activity detail) ─────────────
 * Houses headline + summary + general-anchor insights from the
 * activity_insights engine. Visually distinct from neutral data sections
 * because the analysis IS the story for users who only skim charts. */
.actd-coach-section {
  background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
  border: 1px solid #99f6e4;
  border-radius: 12px;
  padding: 16px 18px;
}
.actd-coach-head {
  font-size: 16px; font-weight: 700; color: #134e4a;
  line-height: 1.35; margin-bottom: 6px;
}
.actd-coach-summary {
  font-size: 13px; color: #115e59;
  line-height: 1.5; margin-bottom: 12px;
}

/* ── Per-insight card — appears under each matching chart section ─────
 * Signal colours: warn = red, watch = amber, celebrate = green, ok = grey.
 * Compact layout so several stacked under a chart don't dominate
 * vertically. */
.actd-insight-stack {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 12px;
}
.actd-insight {
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid #cbd5e1;
  background: #f8fafc;
  font-size: 13px;
}
.actd-insight-head {
  display: flex; gap: 8px; align-items: baseline;
  font-weight: 600; color: #0f172a;
  line-height: 1.35;
}
.actd-insight-icon { font-size: 14px; }
.actd-insight-headline { flex: 1; }
.actd-insight-detail {
  margin-top: 4px;
  color: #475569;
  line-height: 1.5;
  font-size: 12.5px;
}
/* Signal variants */
.actd-insight-warn      { background: #fef2f2; border-left-color: #ef4444; }
.actd-insight-warn      .actd-insight-headline { color: #991b1b; }
.actd-insight-watch     { background: #fffbeb; border-left-color: #f59e0b; }
.actd-insight-watch     .actd-insight-headline { color: #92400e; }
.actd-insight-celebrate { background: #f0fdf4; border-left-color: #10b981; }
.actd-insight-celebrate .actd-insight-headline { color: #065f46; }
.actd-insight-ok        { background: #f8fafc; border-left-color: #94a3b8; }
.actd-section-sub {
  font-size: 11px; color: #94a3b8; font-weight: 500;
  text-transform: none; letter-spacing: 0;
  margin-left: 6px;
}

/* Map — full width, 360px tall */
.actd-map {
  width: 100%;
  height: 360px;
  border-radius: 12px;
  overflow: hidden;
  background: #f1f5f9;
}

/* Performance charts — 2x2 grid on desktop, 1 col on mobile */
.actd-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 700px) {
  .actd-charts-grid { grid-template-columns: 1fr; }
}
.actd-chart-card {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 12px 14px;
}
.actd-chart-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.actd-chart-wrap {
  position: relative;
  height: 160px;
}
.actd-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Splits table */
.actd-splits-wrap {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  overflow-x: auto;
}
.actd-splits {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.actd-splits th, .actd-splits td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border, #e5e7eb);
  font-variant-numeric: tabular-nums;
}
.actd-splits th {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #94a3b8;
  background: #fff;
}
.actd-splits tr:last-child td { border-bottom: none; }
.actd-spl-num { font-weight: 700; color: #0d9488; }

/* HR zones bars */
.actd-zones { display: flex; flex-direction: column; gap: 10px; }
.actd-zone-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; margin-bottom: 4px;
}
.actd-zone-name { font-weight: 600; color: #0f172a; }
.actd-zone-pct { color: #64748b; }
.actd-zone-bar {
  width: 100%; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden;
}
.actd-zone-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.actd-zone-z1 { background: #94a3b8; }
.actd-zone-z2 { background: #10b981; }
.actd-zone-z3 { background: #f59e0b; }
.actd-zone-z4 { background: #f97316; }
.actd-zone-z5 { background: #dc2626; }

/* Pace distribution */
.actd-pd { display: flex; flex-direction: column; gap: 9px; }
.actd-pd-row-top {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; margin-bottom: 4px;
}
.actd-pd-label { font-weight: 600; color: #0f172a; font-variant-numeric: tabular-nums; }
.actd-pd-unit { color: #94a3b8; font-weight: 400; margin-left: 2px; font-size: 11px; }
.actd-pd-val { color: #64748b; font-variant-numeric: tabular-nums; }
.actd-pd-bar {
  width: 100%; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden;
}
.actd-pd-bar-fill {
  height: 100%; background: linear-gradient(90deg, #3b82f6 0%, #6366f1 100%); border-radius: 4px;
}
.actd-pd-peak .actd-pd-label::before { content: "★ "; color: #f59e0b; font-size: 10px; }
.actd-pd-peak .actd-pd-bar-fill { background: linear-gradient(90deg, #0d9488 0%, #5eead4 100%); }

/* Training effect (Garmin) */
.actd-te-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .actd-te-grid { grid-template-columns: 1fr; } }
.actd-te-tile {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 14px 16px;
}
.actd-te-lbl {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #64748b; margin-bottom: 6px;
}
.actd-te-val { font-size: 24px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.actd-te-of { font-size: 14px; color: #94a3b8; font-weight: 500; }
.actd-te-bar { width: 100%; height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.actd-te-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.actd-te-bar-fill.aerobic   { background: #0d9488; }
.actd-te-bar-fill.anaerobic { background: #f97316; }

/* Movement breakdown (Garmin) */
.actd-movement { display: flex; flex-direction: column; gap: 9px; }
.actd-mv-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; margin-bottom: 4px;
}
.actd-mv-name { font-weight: 600; color: #0f172a; }
.actd-mv-val { color: #64748b; }
.actd-mv-bar { width: 100%; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.actd-mv-bar-fill {
  height: 100%; background: linear-gradient(90deg, #0d9488 0%, #5eead4 100%); border-radius: 4px;
}

/* Similar past runs */
.actd-similar-sub {
  font-size: 12px; color: #94a3b8; font-style: italic;
  margin-top: -8px; margin-bottom: 10px;
}
.actd-similar { display: flex; flex-direction: column; gap: 8px; }
.actd-sim {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 11px 14px;
}
.actd-sim-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 4px;
}
.actd-sim-name {
  font-size: 14px; font-weight: 600; color: #0f172a;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 70%;
}
.actd-sim-match {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #0d9488;
  background: rgba(13, 148, 136, 0.1);
  padding: 3px 9px; border-radius: 999px;
  white-space: nowrap;
}
.actd-sim-meta {
  display: flex; flex-wrap: wrap; gap: 5px;
  font-size: 12px; color: #475569;
  align-items: center;
}

/* Notes */
.actd-notes {
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-left: 3px solid #0d9488;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px; color: #334155; line-height: 1.55;
  white-space: pre-wrap;
}

/* Footer actions */
.actd-footer {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding-top: 18px;
  margin-top: 16px;
  border-top: 1px solid var(--border, #e5e7eb);
}
.actd-cta {
  background: transparent;
  color: #475569;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.actd-cta:hover { background: #f8fafc; color: #0d9488; border-color: #0d9488; }
.actd-cta-primary {
  background: #0d9488;
  color: #fff;
  border-color: #0d9488;
}
.actd-cta-primary:hover { background: #0f766e; color: #fff; border-color: #0f766e; }

/* ════════════════════════════════════════════════════════════════════════
   AI Coach Analysis (Conversational Coach style)
   ════════════════════════════════════════════════════════════════════════ */

/* ── CTA Button on activity detail page ──────────────────────────────── */
.ca-cta-wrap { padding: 0 0 16px; }
.ca-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 20px;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 50%, #14b8a6 100%);
  color: #fff; font-size: 15px; font-weight: 600;
  border: none; border-radius: 12px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(13,148,136,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative; overflow: hidden;
}
.ca-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(13,148,136,0.4); }
.ca-cta::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: ca-shimmer 3s infinite;
}
@keyframes ca-shimmer { 0% { left: -100%; } 100% { left: 200%; } }
.ca-cta-icon { font-size: 18px; }

/* ── Loading state ───────────────────────────────────────────────────── */
.ca-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 80px 20px; min-height: 60vh;
}
.ca-spinner {
  width: 44px; height: 44px;
  border: 3px solid #e2e8f0; border-top-color: #14b8a6;
  border-radius: 50%; animation: ca-spin 0.8s linear infinite;
}
@keyframes ca-spin { to { transform: rotate(360deg); } }
.ca-loading-text { font-size: 15px; color: #475569; font-weight: 500; }
.ca-loading-sub { font-size: 12px; color: #94a3b8; text-align: center; }
.ca-loading-dots::after { content: ''; animation: ca-dots 1.5s infinite; }
@keyframes ca-dots { 0% { content: '.'; } 33% { content: '..'; } 66% { content: '...'; } }

/* ── Result page ─────────────────────────────────────────────────────── */
.ca-result { background: #fff; }
.ca-body { padding: 16px; }

/* Native header (full-screen) */
.ca-native-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: #fff; border-bottom: 1px solid #f1f5f9;
  position: sticky; top: 0; z-index: 10;
}
.ca-back-btn {
  font-size: 20px; color: #64748b; background: none; border: none;
  cursor: pointer; padding: 0; line-height: 1;
}
.ca-native-header-text { font-size: 14px; font-weight: 600; color: #1e293b; flex: 1; }
.ca-header-pill {
  font-size: 10px; font-weight: 700; color: #14b8a6; background: #f0fdfa;
  padding: 3px 8px; border-radius: 8px;
}

/* Coach intro bubble */
.ca-intro { display: flex; gap: 10px; margin-bottom: 20px; }
.ca-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; color: #fff; font-weight: 700;
}
.ca-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0; color: #fff; font-weight: 700;
}
.ca-intro-bubble {
  flex: 1; padding: 14px 16px;
  background: #f0fdfa; border-radius: 4px 16px 16px 16px;
}
.ca-headline { font-size: 16px; font-weight: 700; color: #134e4a; line-height: 1.35; margin-bottom: 8px; }
.ca-summary { font-size: 13.5px; color: #334155; line-height: 1.55; }

/* Section labels */
.ca-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: #94a3b8; margin: 24px 0 12px; padding-left: 2px;
}

/* Finding bubbles */
.ca-finding { display: flex; gap: 10px; margin-bottom: 10px; }
.ca-find-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0; background: #f8fafc;
}
.ca-find-icon.warn      { background: #fef2f2; }
.ca-find-icon.watch     { background: #fffbeb; }
.ca-find-icon.celebrate { background: #f0fdf4; }
.ca-find-icon.ok        { background: #f8fafc; }

.ca-find-bubble {
  flex: 1; padding: 12px 14px;
  border-radius: 4px 14px 14px 14px; background: #f8fafc;
}
.ca-find-bubble.warn      { background: #fef2f2; }
.ca-find-bubble.watch     { background: #fffbeb; }
.ca-find-bubble.celebrate { background: #f0fdf4; }

.ca-find-title {
  font-size: 13.5px; font-weight: 600; color: #1e293b; margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.ca-signal-tag {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
  padding: 2px 6px; border-radius: 4px; line-height: 1.3;
}
.ca-signal-tag.warn      { background: #fca5a5; color: #7f1d1d; }
.ca-signal-tag.watch     { background: #fde68a; color: #78350f; }
.ca-signal-tag.celebrate { background: #86efac; color: #14532d; }
.ca-signal-tag.ok        { background: #e2e8f0; color: #475569; }

.ca-find-detail { font-size: 13px; color: #475569; line-height: 1.5; }

/* Training impact */
.ca-impact { display: flex; gap: 10px; margin-bottom: 10px; }
.ca-impact-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #ede9fe, #f5f3ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.ca-impact-bubble {
  flex: 1; padding: 14px 16px;
  background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
  border-radius: 4px 14px 14px 14px; border-left: 3px solid #8b5cf6;
}
.ca-impact-text { font-size: 13px; color: #475569; line-height: 1.5; }

/* Recommendations */
.ca-recs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.ca-rec {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; background: #f0fdfa; border-radius: 12px;
}
.ca-rec-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: #14b8a6; color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ca-rec-text { font-size: 13px; color: #1e293b; line-height: 1.45; }

/* Footer */
.ca-footer-note {
  text-align: center; font-size: 11px; color: #94a3b8;
  padding: 16px 0 8px;
}
.ca-footer-btn {
  display: block; margin: 8px auto 0; padding: 10px 20px;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: #64748b; cursor: pointer;
}
.ca-footer-btn:hover { background: #f1f5f9; color: #0d9488; border-color: #0d9488; }

/* ── Web modal overlay ───────────────────────────────────────────────── */
.ca-modal-backdrop {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.ca-modal-card {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 85vh; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}
.ca-modal-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.ca-modal-title { font-size: 14px; font-weight: 600; color: #1e293b; flex: 1; }
.ca-modal-close {
  font-size: 22px; color: #94a3b8; background: none; border: none;
  cursor: pointer; line-height: 1; padding: 0;
}
.ca-modal-close:hover { color: #475569; }
.ca-modal-body { overflow-y: auto; flex: 1; }

/* ════════════════════════════════════════════════════════════════════════
   Training Plan view (Phase 1 flagship — full multi-week plan layout)
   ════════════════════════════════════════════════════════════════════════ */
.tp-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 80px;
}
.tp-loading,
.tp-empty {
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: #475569;
  text-align: center;
}
.tp-spinner {
  width: 28px; height: 28px;
  border: 3px solid #e5e7eb;
  border-top-color: #0d9488;
  border-radius: 50%;
  animation: tpSpin 0.7s linear infinite;
}
@keyframes tpSpin { to { transform: rotate(360deg); } }
.tp-empty-icon { font-size: 36px; opacity: 0.7; }
.tp-empty-title { font-size: 17px; font-weight: 700; color: #0f172a; }
.tp-empty-msg { font-size: 14px; max-width: 440px; line-height: 1.5; }
.tp-empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.tp-cta {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  color: #475569;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.tp-cta:hover { background: #f8fafc; color: #0d9488; border-color: #0d9488; }
.tp-cta-primary {
  background: #0d9488;
  color: #fff;
  border-color: #0d9488;
}
.tp-cta-primary:hover { background: #0f766e; color: #fff; border-color: #0f766e; }
.tp-cta-danger {
  color: #b91c1c;
  border-color: #fecaca;
}
.tp-cta-danger:hover {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fca5a5;
}

/* Header */
.tp-header { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border, #e5e7eb); }
.tp-header-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 12px;
}
.tp-race-name {
  font-size: 22px; font-weight: 700; color: #0f172a;
  word-break: break-word;
}
.tp-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.tp-meta-pills {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.tp-meta-pill {
  font-size: 11.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: #f1f5f9; color: #475569;
}
.tp-meta-date  { background: rgba(13, 148, 136, 0.1); color: #0d9488; }
.tp-meta-warn  { background: #fef3c7; color: #92400e; }

/* Phase timeline — visual bar showing base/build/peak/taper proportions */
.tp-phase-timeline {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
  height: 38px;
}
.tp-phase-seg {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; min-width: 40px; padding: 0 6px;
}
.tp-phase-seg .tp-phase-name { line-height: 1.1; }
.tp-phase-seg .tp-phase-range { font-size: 9.5px; opacity: 0.85; font-weight: 500; letter-spacing: 0; }
.tp-phase-base    { background: #94a3b8; }
.tp-phase-build   { background: #0ea5e9; }
.tp-phase-peak    { background: #f59e0b; }
.tp-phase-taper   { background: #8b5cf6; }
.tp-phase-race_week { background: #dc2626; }
.tp-phase-unknown { background: #64748b; }

/* Phase 5 — Course-Intel header card on Plan tab */
.tp-course-intel {
  margin-bottom: 18px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  overflow: hidden;
  transition: box-shadow 0.18s;
}
.tp-course-intel[open] { box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.tp-ci-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  user-select: none;
}
.tp-ci-summary::-webkit-details-marker { display: none; }
.tp-ci-headline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tp-ci-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-ci-where {
  font-size: 12.5px;
  color: #64748b;
}
.tp-ci-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.tp-ci-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: #0d9488;
  background: rgba(13, 148, 136, 0.08);
  padding: 4px 10px;
  border-radius: 12px;
  text-transform: capitalize;
}
.tp-ci-chevron {
  font-size: 13px;
  color: #94a3b8;
  transition: transform 0.18s;
}
.tp-course-intel[open] .tp-ci-chevron { transform: rotate(180deg); }

.tp-ci-body {
  padding: 4px 18px 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tp-ci-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.tp-ci-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.tp-ci-stat-icon { font-size: 18px; line-height: 1; }
.tp-ci-stat-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tp-ci-stat-label {
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tp-ci-stat-value {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  text-transform: capitalize;
}

.tp-ci-section { display: flex; flex-direction: column; gap: 8px; }
.tp-ci-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tp-ci-hill-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.tp-ci-hill {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  padding: 8px 12px;
}
.tp-ci-hill-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.tp-ci-hill-meta {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}
.tp-ci-notes {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  background: #fff;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.tp-ci-adaptations {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 14px;
}
.tp-ci-adaptations .tp-ci-section-title { color: #047857; }
.tp-ci-adapt-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: #065f46;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tp-ci-adapt-list li::marker { color: #10b981; }

@media (max-width: 480px) {
  .tp-ci-summary { padding: 12px 14px; }
  .tp-ci-body { padding: 4px 14px 14px; }
  .tp-ci-stats { grid-template-columns: 1fr 1fr; }
  .tp-ci-hill-list { grid-template-columns: 1fr; }
}

/* Week chip strip */
.tp-week-chips {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 4px 2px 12px;
  margin-bottom: 8px;
  scrollbar-width: thin;
}
.tp-week-chips::-webkit-scrollbar { height: 4px; }
.tp-week-chips::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.tp-week-chip {
  display: flex; flex-direction: column; align-items: center;
  min-width: 56px; padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.tp-week-chip:hover { border-color: #0d9488; }
.tp-week-chip-active {
  background: #0d9488;
  border-color: #0d9488;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}
.tp-week-chip-active .tp-wc-num,
.tp-week-chip-active .tp-wc-phase { color: #fff; }
.tp-wc-num   { font-size: 13px; font-weight: 700; color: #0f172a; }
.tp-wc-phase {
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: #94a3b8; margin-top: 2px;
}

/* Week detail */
.tp-week-detail {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 18px 20px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  margin-top: 8px;
}
.tp-week-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 8px;
}
.tp-week-title {
  font-size: 16px; font-weight: 700; color: #0f172a;
}
.tp-week-phase {
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff;
  margin-left: 4px;
}
.tp-week-vol {
  font-size: 13px; color: #475569;
  background: #f1f5f9; padding: 4px 10px; border-radius: 6px;
  font-weight: 600;
}
.tp-week-rationale {
  font-size: 13px; color: #64748b; font-style: italic;
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px dashed var(--border, #e5e7eb);
}

/* Sessions list (7 days) */
.tp-sessions {
  display: flex; flex-direction: column; gap: 8px;
}
.tp-session {
  display: flex; gap: 14px;
  padding: 11px 14px;
  background: #f8fafc;
  border-left: 3px solid #0d9488;
  border-radius: 8px;
  position: relative;
  transition: background 0.15s;
}
.tp-session-rest {
  border-left-color: #cbd5e1;
  opacity: 0.7;
}
/* Phase 7 — per-session completion state colouring */
.tp-sess-done {
  background: #f0fdf4;
  border-left-color: #10b981;
}
.tp-sess-swapped {
  background: #fffbeb;
  border-left-color: #f59e0b;
}
.tp-sess-skipped {
  background: #f8fafc;
  border-left-color: #94a3b8;
  opacity: 0.85;
}
.tp-sess-missed {
  background: #fef2f2;
  border-left-color: #fb7185;
  opacity: 0.92;
}
.tp-sess-today {
  background: #ecfeff;
  border-left-color: #0ea5e9;
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2);
}
.tp-sess-day {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: #0d9488;
  min-width: 50px;
  padding-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tp-sess-day-name { font-size: 11px; }
.tp-sess-day-date {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: none;
  letter-spacing: 0;
}
/* State pill near the session-type label */
.tp-sess-state {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  margin-left: auto;
}
.tp-sess-state-done    { background: #d1fae5; color: #047857; }
.tp-sess-state-swapped { background: #fed7aa; color: #c2410c; }
.tp-sess-state-skipped { background: #f1f5f9; color: #475569; }
.tp-sess-state-missed  { background: #fee2e2; color: #b91c1c; }
.tp-sess-state-today   { background: #cffafe; color: #0e7490; }
.tp-session-rest .tp-sess-day { color: #94a3b8; }
.tp-sess-body { flex: 1; }

/* Phase 7 — Week-level completion summary line */
.tp-week-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  margin: 6px 0 12px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  align-items: center;
}
.tp-ws-done    { color: #047857; }
.tp-ws-swapped { color: #c2410c; }
.tp-ws-skipped { color: #475569; }
.tp-ws-missed  { color: #b91c1c; }
.tp-ws-pending { color: #64748b; font-weight: 500; }
.tp-ws-adh     { color: #0f172a; }

/* Phase 7 — current-week emphasis */
.tp-week-current {
  position: relative;
}
.tp-week-now {
  font-size: 11px;
  font-weight: 700;
  color: #0e7490;
  background: #cffafe;
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: 8px;
  letter-spacing: 0.02em;
}

/* Phase 10 — Public Plan View (when ?share=TOKEN is in the URL) */
.public-plan-view {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: #0f172a;
}
.ppv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 24px;
}
.ppv-brand { display: flex; align-items: baseline; gap: 8px; }
.ppv-logo {
  font-weight: 800;
  font-size: 20px;
  color: #0d9488;
  letter-spacing: -0.02em;
}
.ppv-shared { font-size: 13px; color: #64748b; }
.ppv-cta {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #0d9488;
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s;
}
.ppv-cta:hover { background: #0f766e; }
.ppv-body { padding-bottom: 60px; }
.ppv-footer {
  padding: 24px 0;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  border-top: 1px solid #e5e7eb;
}

/* Phase 9 — Suggested-adjustment cards (Loop 2) */
.tp-sugs {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tp-sugs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}
.tp-sugs-title { color: #92400e; }
.tp-sugs-count {
  background: #fef3c7;
  color: #92400e;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
}
.tp-sug {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-left: 4px solid #f59e0b;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.15s;
}
.tp-sug:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.tp-sug-sev-high   { border-left-color: #ef4444; background: linear-gradient(180deg, #fef2f2 0%, #fff 60%); }
.tp-sug-sev-medium { border-left-color: #f59e0b; background: linear-gradient(180deg, #fffbeb 0%, #fff 60%); }
.tp-sug-sev-low    { border-left-color: #10b981; background: linear-gradient(180deg, #f0fdf4 0%, #fff 60%); }
.tp-sug-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tp-sug-sev {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #0f172a;
}
.tp-sug-sev-high .tp-sug-sev   { background: #fee2e2; color: #991b1b; }
.tp-sug-sev-medium .tp-sug-sev { background: #fef3c7; color: #92400e; }
.tp-sug-sev-low .tp-sug-sev    { background: #d1fae5; color: #065f46; }
.tp-sug-affected {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  text-align: right;
}
.tp-sug-headline {
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
}
.tp-sug-rationale {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.5;
}
.tp-sug-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.tp-sug-btn {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.tp-sug-btn-apply {
  background: #0d9488;
  color: #fff;
}
.tp-sug-btn-apply:hover { background: #0f766e; }
.tp-sug-btn-apply:disabled { opacity: 0.6; cursor: not-allowed; }
.tp-sug-btn-dismiss {
  background: transparent;
  color: #64748b;
  border-color: #e5e7eb;
}
.tp-sug-btn-dismiss:hover { background: #f8fafc; color: #475569; border-color: #cbd5e1; }
.tp-sug-btn-dismiss:disabled { opacity: 0.5; cursor: not-allowed; }

/* Phase 8 — Adherence status header card on the Plan tab */
.tp-adh {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-left: 4px solid #94a3b8;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tp-adh-status-on_track  { border-left-color: #10b981; background: linear-gradient(180deg, #f0fdf4 0%, #fff 60%); }
.tp-adh-status-slipping  { border-left-color: #f59e0b; background: linear-gradient(180deg, #fffbeb 0%, #fff 60%); }
.tp-adh-status-off_plan  { border-left-color: #ef4444; background: linear-gradient(180deg, #fef2f2 0%, #fff 60%); }
.tp-adh-complete         {
  border-left-color: #0d9488;
  background: linear-gradient(180deg, #ecfdf5 0%, #fff 60%);
  display: flex;
  flex-direction: row;
  gap: 14px;
  align-items: center;
}
.tp-adh-complete .tp-adh-icon {
  font-size: 32px;
  line-height: 1;
}
.tp-adh-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tp-adh-status-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #0f172a;
}
.tp-adh-status-on_track .tp-adh-status-pill { background: #d1fae5; color: #065f46; }
.tp-adh-status-slipping .tp-adh-status-pill { background: #fef3c7; color: #92400e; }
.tp-adh-status-off_plan .tp-adh-status-pill { background: #fee2e2; color: #991b1b; }
.tp-adh-trend {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 600;
}
.tp-adh-body { display: flex; flex-direction: column; gap: 6px; }
.tp-adh-headline {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.tp-adh-subline {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}
.tp-adh-signals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.tp-adh-sig {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
}
.tp-adh-sig-high   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.tp-adh-sig-medium { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.tp-adh-sig-low    { background: #f0fdf4; color: #065f46; border: 1px solid #bbf7d0; }
.tp-adh-sig-icon { font-weight: 700; min-width: 14px; }
.tp-adh-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.tp-adh-cta {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.tp-adh-cta-primary {
  background: #0d9488;
  color: #fff;
}
.tp-adh-cta-primary:hover { background: #0f766e; }
.tp-adh-cta-secondary {
  background: transparent;
  color: #475569;
  border-color: #e5e7eb;
}
.tp-adh-cta-secondary:hover { background: #f8fafc; color: #0d9488; border-color: #0d9488; }

/* Phase 7 — Plan-overview banner (top of plan) */
.tp-overview {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
}
.tp-ov-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.tp-ov-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tp-ov-adh {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.tp-ov-adh-good { background: #d1fae5; color: #065f46; }
.tp-ov-adh-ok   { background: #fef3c7; color: #92400e; }
.tp-ov-adh-low  { background: #fee2e2; color: #991b1b; }
.tp-ov-bar {
  display: flex;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  background: #e5e7eb;
}
.tp-ov-seg { transition: width 0.3s; }
.tp-ov-seg-done    { background: #10b981; }
.tp-ov-seg-swapped { background: #f59e0b; }
.tp-ov-seg-skipped { background: #94a3b8; }
.tp-ov-seg-missed  { background: #fb7185; }
.tp-ov-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  align-items: center;
}
.tp-ov-leg-done    { color: #047857; }
.tp-ov-leg-swapped { color: #c2410c; }
.tp-ov-leg-skipped { color: #475569; }
.tp-ov-leg-missed  { color: #b91c1c; }
.tp-ov-leg-total   {
  color: #94a3b8;
  font-weight: 500;
  margin-left: auto;
}
.tp-sess-top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.tp-sess-ico { font-size: 16px; }
.tp-sess-type { font-size: 14px; font-weight: 600; color: #0f172a; }
.tp-sess-int {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em; padding: 2px 7px; border-radius: 999px;
}
.tp-int-rest { background: #f1f5f9; color: #64748b; }
.tp-int-z1   { background: #e0e7ff; color: #3730a3; }
.tp-int-z2   { background: #d1fae5; color: #047857; }
.tp-int-z3   { background: #fef3c7; color: #b45309; }
.tp-int-z4   { background: #fed7aa; color: #c2410c; }
.tp-int-z5   { background: #fee2e2; color: #b91c1c; }
.tp-sess-stats {
  display: flex; gap: 12px;
  font-size: 12.5px; color: #475569;
  margin-bottom: 4px;
}
.tp-sess-stat { font-weight: 500; }
.tp-sess-notes {
  font-size: 12.5px; color: #475569;
  line-height: 1.5;
}

/* Chat-side CTA when a plan is freshly built */
.tp-built-cta {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.08) 0%, rgba(13, 148, 136, 0.02) 100%);
  border: 1px solid rgba(13, 148, 136, 0.25);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-top: 8px;
}
.tp-built-cta-text {
  font-size: 13px; color: #0f172a; line-height: 1.5;
}
.tp-built-cta-btn {
  background: #0d9488; color: #fff; border: none;
  border-radius: 8px; padding: 9px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.tp-built-cta-btn:hover { background: #0f766e; }
/* Error variant — when GENERATE_PLAN raises, the chat now shows a
 * red card with the actual reason instead of swallowing the failure. */
.tp-built-cta-err {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.02) 100%);
  border-color: rgba(239, 68, 68, 0.30);
}
.tp-built-cta-err-msg {
  font-size: 12px; color: #991b1b; margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tp-built-cta-err .tp-built-cta-btn {
  background: #dc2626;
}
.tp-built-cta-err .tp-built-cta-btn:hover { background: #b91c1c; }

/* Daily Plan card — Phase 1 visual indicators + hide control */
.dash-daily-plan-from-plan {
  border-left: 3px solid #0d9488;
}
.dp-plan-badge {
  display: inline-flex; align-items: center; gap: 4px;
  margin: -4px 0 10px;
  padding: 5px 11px;
  background: rgba(13, 148, 136, 0.1);
  border: 1px solid rgba(13, 148, 136, 0.25);
  color: #0d9488;
  font-size: 11.5px; font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.dp-plan-badge:hover {
  background: rgba(13, 148, 136, 0.18);
  border-color: rgba(13, 148, 136, 0.45);
}
.dp-hdr { position: relative; }
.dp-hide-btn {
  position: absolute;
  top: -2px;
  right: -4px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 9px;
  border-radius: 6px;
  line-height: 1;
}
.dp-hide-btn:hover {
  background: #f1f5f9;
  color: #475569;
}
.dp-hidden-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: #f8fafc;
  border: 1px dashed var(--border, #e5e7eb);
  border-radius: 999px;
  color: #475569;
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.15s;
}
.dp-hidden-chip:hover {
  background: #f0fdfa;
  border-color: #0d9488;
  color: #0d9488;
}

/* Plan view — adaptation suggestion banner */
.tp-feels-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tp-feels-soften {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.07) 0%, rgba(220, 38, 38, 0.02) 100%);
  border-left: 3px solid #dc2626;
}
.tp-feels-push {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.08) 0%, rgba(13, 148, 136, 0.02) 100%);
  border-left: 3px solid #0d9488;
}
.tp-feels-ico {
  font-size: 22px; flex-shrink: 0;
}
.tp-feels-body { flex: 1; min-width: 200px; }
.tp-feels-title {
  font-size: 13.5px; font-weight: 600; color: #0f172a;
  line-height: 1.5;
}
.tp-feels-sub {
  font-size: 11.5px; color: #94a3b8;
  margin-top: 3px;
  font-style: italic;
}
.tp-feels-actions { flex-shrink: 0; }

/* Phase 4: closest-past-run widget on race_time goal cards */
.goal-past-run {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(99, 102, 241, 0.01) 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  padding: 11px 14px;
  margin: 10px 0;
}
.goal-past-run-hdr {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.goal-past-run-icon { font-size: 13px; }
.goal-past-run-label {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: #6366f1;
}
.goal-past-run-match {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.12);
}
.goal-past-run-name {
  font-size: 13px; font-weight: 600; color: #0f172a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.goal-past-run-meta {
  display: flex; flex-wrap: wrap; gap: 5px;
  font-size: 11.5px; color: #475569;
  align-items: center;
  margin-bottom: 8px;
}
.goal-past-run-ask {
  background: transparent;
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #6366f1;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.goal-past-run-ask:hover {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
}

/* ════════════════════════════════════════════════════════════════════════
   Phase 2 — Race Week Tactical Brief (dashboard hero card)
   ════════════════════════════════════════════════════════════════════════ */
.rb-card {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: #fff;
  border-radius: 14px;
  padding: 22px 24px 16px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.2);
}
.rb-card.rb-urgent {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.3);
}
.rb-hero {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
.rb-hero-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.rb-hero-left { flex: 1; min-width: 200px; }
.rb-hero-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 6px;
}
.rb-hero-title {
  font-size: 22px; font-weight: 700; line-height: 1.2;
  margin-bottom: 4px;
}
.rb-hero-sub { font-size: 12.5px; opacity: 0.85; }
.rb-hero-countdown {
  text-align: right;
  flex-shrink: 0;
}
.rb-hero-days {
  font-size: 28px; font-weight: 800; line-height: 1.0;
}
.rb-hero-days-lbl {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  opacity: 0.75; margin-top: 2px;
}
.rb-target {
  margin-top: 10px;
  font-size: 13px; font-weight: 500;
}
.rb-target-pace { opacity: 0.85; }
.rb-section {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.rb-section-title {
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0.9;
}
.rb-pacing { display: flex; flex-direction: column; gap: 8px; }
.rb-pace-row {
  display: flex; gap: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 8px;
}
.rb-pace-range {
  font-size: 11px; font-weight: 700;
  white-space: nowrap; flex-shrink: 0; min-width: 65px;
  align-self: center;
  opacity: 0.95;
}
.rb-pace-body { flex: 1; min-width: 0; }
.rb-pace-top {
  display: flex; align-items: center; gap: 8px;
  justify-content: space-between; margin-bottom: 2px;
  flex-wrap: wrap;
}
.rb-pace-name { font-size: 13px; font-weight: 600; }
.rb-pace-target {
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 8px; border-radius: 999px;
}
.rb-pace-note { font-size: 12px; line-height: 1.5; opacity: 0.92; }
.rb-fc-stats {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 6px;
}
.rb-fc-stat {
  font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, 0.15);
  padding: 3px 10px; border-radius: 999px;
}
.rb-gear-summary {
  font-size: 13px; line-height: 1.5;
  margin: 4px 0 8px;
}
.rb-gear-layers {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 6px;
}
.rb-gear-chip {
  font-size: 11px; font-weight: 500;
  background: rgba(255, 255, 255, 0.13);
  padding: 3px 9px; border-radius: 999px;
}
.rb-gear-shoes {
  font-size: 12.5px; opacity: 0.88;
  font-style: italic;
}
.rb-fueling {
  font-size: 13px; line-height: 1.5;
}
.rb-course-notes {
  font-size: 12.5px; line-height: 1.55;
  opacity: 0.9;
}
.rb-training {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 12.5px;
}
.rb-tr-stat {
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 10px; border-radius: 999px;
}
.rb-tr-stat strong { font-weight: 700; }
.rb-footer {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 12px;
}
.rb-cta {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.rb-cta:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Phase 5: Place-to-place quick-log CTA on Activities page */
.acts-quick-log {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.06) 0%, rgba(13, 148, 136, 0.01) 100%);
  border: 1px solid rgba(13, 148, 136, 0.2);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.acts-quick-log-text {
  font-size: 13px; color: #475569; line-height: 1.5;
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 200px;
}
.acts-quick-log-ico { font-size: 18px; flex-shrink: 0; }
.acts-quick-log-text strong { color: #0f172a; }
.acts-quick-log-btn {
  background: #0d9488; color: #fff;
  border: none; border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
  transition: background 0.15s;
}
.acts-quick-log-btn:hover { background: #0f766e; }

/* ════════════════════════════════════════════════════════════════════════
   Chat — collapsible long messages + better structure for walls of text
   ════════════════════════════════════════════════════════════════════════ */
.bubble-collapsible {
  position: relative;
  /* No padding override — keep the same base bubble feel */
}
.bubble-collapsed {
  max-height: 280px;
  overflow: hidden;
  position: relative;
  padding-bottom: 10px;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
}
.bubble-expanded {
  max-height: none;
  overflow: visible;
  /* Animate the expansion via height transition */
  transition: max-height 0.3s ease;
}
.bubble-toggle {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.2);
  color: #0d9488;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}
.bubble-toggle:hover {
  background: rgba(13, 148, 136, 0.14);
  border-color: rgba(13, 148, 136, 0.4);
}

/* ── Mock B: lead + body collapsible bubble ───────────────────────────── */
.bubble-leadbody { padding-top: 12px; }   /* room for copy button */
.bubble-leadbody .bubble-lead {
  margin: 0;
}
.bubble-leadbody .bubble-lead p:first-child { margin-top: 0; }
.bubble-leadbody .bubble-lead p:last-child  { margin-bottom: 0; }
.bubble-body {
  margin-top: 8px;
}
.bubble-body p:first-child { margin-top: 0; }
.bubble-body-collapsed {
  display: none;
}
.bubble-body-expanded {
  display: block;
  animation: bubbleFadeIn 0.18s ease;
}
@keyframes bubbleFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* "Continue reading / Show less" thin divider — quieter than a full button */
.bubble-divider-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 14px 0 0;
  padding: 4px 0;
  background: transparent;
  border: none;
  color: var(--text2, #6b7280);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.15s ease;
}
.bubble-divider-btn:hover {
  color: #0d9488;
}
.bubble-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border, #e5e7eb);
  transition: background 0.15s ease;
}
.bubble-divider-btn:hover .bubble-divider-line {
  background: rgba(13, 148, 136, 0.35);
}
.bubble-divider-text {
  white-space: nowrap;
  text-transform: uppercase;
}
.bubble-divider-chev {
  font-size: 9px;
  display: inline-block;
  transition: transform 0.15s ease;
}

/* ── Copy-to-clipboard button on AI bubbles ───────────────────────────── */
.bubble {
  position: relative;
}
.bubble-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border, #e5e7eb);
  color: var(--text3, #9ca3af);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  z-index: 2;
}
.msg-row.ai:hover .bubble-copy-btn,
.bubble-copy-btn:focus-visible {
  opacity: 1;
}
.bubble-copy-btn:hover {
  color: #0d9488;
  border-color: rgba(13, 148, 136, 0.4);
  background: #fff;
}
.bubble-copy-btn.bubble-copy-done {
  opacity: 1;
  color: #16a34a;
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.bubble-copy-check {
  font-size: 14px;
  line-height: 1;
}
/* On touch devices (no hover), keep the copy button at low-opacity
   visible so users know it's there. */
@media (hover: none) {
  .bubble-copy-btn { opacity: 0.55; }
}

/* ── Screenshot upload preview (user bubble) ─────────────────────────
   Shown when a user uploads a fitness-app screenshot via the + menu.
   The image sits inside a normal user bubble with a small caption. */
.screenshot-bubble {
  padding: 6px !important;
  max-width: 280px;
}
.screenshot-preview {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  border-radius: 10px;
  object-fit: cover;
}
.screenshot-bubble-cap {
  font-size: 11px;
  color: var(--text3, #94a3b8);
  text-align: right;
  margin-top: 4px;
  padding-right: 4px;
  font-weight: 500;
}

/* Legacy bubble typography overrides removed — the new heading scale,
   bold colour, list spacing, and paragraph rhythm now live inside the
   desktop media query (.bubble block). The old rules collapsed H1/H2/H3
   to a flat 14px and forced em into bold teal, both of which we now
   want differently (proper hierarchy + italic em + metric chips for
   numeric pops). */

/* Loose end #5 — race-day card variant (v1 dashboard) */
.dp-state-race-day {
  border: 2px solid #ef4444;
  background: linear-gradient(160deg, #fee2e2 0%, #fef2f2 100%);
}
.dp-state-race-day .dp-title {
  color: #991b1b;
}
.dp-today-race {
  background: linear-gradient(135deg, rgba(239,68,68,0.04) 0%, rgba(239,68,68,0.01) 100%);
  border-left: 3px solid #ef4444;
}
.dp-today-race .dp-today-session {
  color: #7f1d1d;
  font-size: 18px;
}

/* ── Morning check-in — prominent top-of-dashboard prompt ─────────────────── */
.morning-checkin {
  background: linear-gradient(135deg, var(--glow), rgba(13,148,136,0.03));
  border: 1px solid rgba(13,148,136,0.22);
  border-radius: 16px;
  padding: 16px 18px;
  margin: 0 0 16px;
}
.mci-q {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.mci-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.mci-chip {
  flex: 1 1 0;
  min-width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 8px;
  background: var(--surface);
  border: 1.5px solid var(--surface3);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  transition: border-color .15s, background .15s, transform .1s;
}
.mci-chip:hover  { border-color: var(--accent); }
.mci-chip:active { transform: scale(0.97); }
.mci-chip.sel {
  border-color: var(--accent);
  background: rgba(13,148,136,0.10);
  color: var(--accent);
}
.mci-ico { font-size: 22px; line-height: 1; }
.morning-checkin-done { padding: 13px 16px; }
.mci-done-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mci-done { font-size: 14px; color: var(--text); }
.mci-edit {
  background: transparent;
  border: 1px solid var(--surface3);
  border-radius: 8px;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.mci-edit:hover { background: rgba(13,148,136,0.08); border-color: var(--accent); }
.mci-note {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text2);
  background: rgba(217,119,6,0.10);
  border-radius: 8px;
  padding: 8px 11px;
}

/* ── Accessibility: keyboard focus ring ──────────────────────────────────────
   :focus-visible targets keyboard navigation only (not mouse clicks), so this
   gives keyboard users a clear focus indicator without adding outlines on tap. */
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible,
select:focus-visible, [role="button"]:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}


/* ═══════════════════════════════════════════════════════════════════════
 * Native-app auth screens (mobile/Capacitor only) — concept B / D / E
 * from the approved mockup. The web layouts (.auth-web-only) stay
 * untouched; .auth-app-only is shown ONLY when body.native-app is
 * present. See /static/landing-app-mockup.html for the source mockup.
 * ═══════════════════════════════════════════════════════════════════ */

/* Default: hide app-only on web, hide web-only nowhere (web sees web).
 * Inside .native-app: flip — hide web, show app. */
.auth-app-only { display: none; }
body.native-app .auth-web-only { display: none; }
body.native-app .auth-app-only { display: block; }

body.native-app .auth-app-only {
  --app-teal:        #0d9488;
  --app-teal-deep:   #0f766e;
  --app-teal-light:  #2dd4bf;
  --app-ink:         #0f172a;
  --app-ink-2:       #334155;
  --app-ink-3:       #64748b;
  --app-ink-4:       #94a3b8;
  --app-bg:          #f8fafc;
  --app-line:        #e2e8f0;
}

body.native-app .auth-app-only .app-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 460px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 24px
           calc(24px + env(safe-area-inset-bottom, 0px));
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--app-ink);
}

/* Brand row */
body.native-app .auth-app-only .app-brand-row {
  display: flex; align-items: center; gap: 13px; margin-bottom: 64px;
}
body.native-app .auth-app-only .app-brand-mark {
  /* Bigger silhouette + every available trick for sharpness. The Y glyph
     is rendered as Inter-800 inside the rounded square; antialiased font-
     smoothing + geometricPrecision text-rendering + GPU layer promotion
     via translateZ(0) keep both the gradient and the character crisp at
     any zoom on high-DPI Android screens. */
  width: 56px; height: 56px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--app-teal-light), var(--app-teal-deep));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 30px; letter-spacing: -0.04em;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.18) inset,
    0 8px 22px rgba(13,148,136,0.28);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
}
body.native-app .auth-app-only .app-brand-name {
  font-weight: 800; font-size: 22px;
  letter-spacing: -0.025em;
  color: var(--app-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}
body.native-app .auth-app-only .app-brand-name {
  font-size: 16px; font-weight: 700; color: var(--app-ink);
}

/* Pitch */
body.native-app .auth-app-only .app-pitch { margin-bottom: 10px; }
/* Trackers credibility line — sits directly under the H1 (moved up from the
 * bottom of the screen so it reads as a subtitle of the headline). App-only. */
body.native-app .auth-app-only .app-trackers-top {
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--app-ink-3); margin: 0 0 24px;
}
body.native-app .auth-app-only .app-h1 {
  font-size: 30px; line-height: 1.18; font-weight: 800;
  color: var(--app-ink); letter-spacing: -0.025em;
}
body.native-app .auth-app-only .app-h1-small {
  font-size: 26px; line-height: 1.2; font-weight: 800;
  color: var(--app-ink); letter-spacing: -0.025em; margin-bottom: 10px;
}
body.native-app .auth-app-only .accent { color: var(--app-teal); }
body.native-app .auth-app-only .app-sub {
  font-size: 14px; color: var(--app-ink-3); margin: 0;
}

/* Brief header (landing) */
body.native-app .auth-app-only .app-brief-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 4px 14px;
  border-bottom: 1px solid var(--app-line);
  margin-bottom: 14px;
}
body.native-app .auth-app-only .app-brief-title {
  font-size: 15px; font-weight: 700; color: var(--app-ink);
}
body.native-app .auth-app-only .app-brief-sub {
  font-size: 12px; color: var(--app-ink-3); font-weight: 500;
}

/* Card stack */
body.native-app .auth-app-only .app-stack-cards {
  display: flex; flex-direction: column; gap: 12px;
  margin: 0 0 32px;
}
body.native-app .auth-app-only .app-scard {
  display: flex; align-items: flex-start; gap: 14px;
  background: #fff; border: 1px solid var(--app-line);
  border-radius: 14px; padding: 18px;
  box-shadow: 0 1px 0 rgba(15,23,42,0.04);
}
body.native-app .auth-app-only .app-scard-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(13,148,136,0.10); color: var(--app-teal-deep);
  display: grid; place-items: center; font-size: 19px;
  flex: none;
}
body.native-app .auth-app-only .app-scard-body { min-width: 0; flex: 1; }
body.native-app .auth-app-only .app-scard-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.10em;
  text-transform: uppercase; color: var(--app-ink-4);
  margin-bottom: 4px;
}
body.native-app .auth-app-only .app-scard-headline {
  font-size: 15px; font-weight: 700; color: var(--app-ink);
  margin-bottom: 3px;
}
body.native-app .auth-app-only .app-scard-sub {
  font-size: 13px; color: var(--app-ink-3);
}
body.native-app .auth-app-only .app-scard-num {
  font-size: 21px; font-weight: 800; color: var(--app-teal-deep);
  letter-spacing: -0.02em;
}

/* Mini ring on the readiness card */
body.native-app .auth-app-only .app-scard-ring {
  position: relative; width: 56px; height: 56px; flex: none;
}
body.native-app .auth-app-only .app-scard-ring svg {
  width: 100%; height: 100%; transform: rotate(-90deg);
}
body.native-app .auth-app-only .app-scard-ring-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; color: var(--app-ink);
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
@keyframes appRingFill {
  from { stroke-dasharray: 0 138; }
  to   { stroke-dasharray: 108 138; }
}
body.native-app .auth-app-only .app-scard-ring-fill {
  stroke-dasharray: 108 138;
  animation: appRingFill 1.3s cubic-bezier(0.22, 0.61, 0.36, 1) 0.3s both;
}

/* Form fields (sign-in / signup / forgot) */
body.native-app .auth-app-only .app-form { margin-top: 4px; }
body.native-app .auth-app-only .app-field { margin-bottom: 18px; }
body.native-app .auth-app-only .app-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--app-ink-2); margin-bottom: 8px;
}
body.native-app .auth-app-only .app-input {
  width: 100%; font: inherit; font-size: 16px;
  color: var(--app-ink); background: var(--app-bg);
  border: 1.5px solid var(--app-line); border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
body.native-app .auth-app-only .app-input::placeholder { color: var(--app-ink-4); }
body.native-app .auth-app-only .app-input:focus {
  outline: none; background: #fff;
  border-color: var(--app-teal);
  box-shadow: 0 0 0 4px rgba(13,148,136,0.12);
}
body.native-app .auth-app-only .app-form-meta {
  display: flex; justify-content: flex-end; margin-top: 8px;
}
body.native-app .auth-app-only .app-form-meta a {
  font-size: 13px; font-weight: 600;
  color: var(--app-teal-deep); text-decoration: none; cursor: pointer;
}

/* CTAs */
body.native-app .auth-app-only .app-ctas {
  margin-top: auto; padding-top: 28px;
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
body.native-app .auth-app-only .app-cta {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%;
  padding: 17px 22px; border: none; cursor: pointer;
  background: linear-gradient(180deg, var(--app-teal), var(--app-teal-deep));
  color: #fff; font-family: inherit; font-size: 16px; font-weight: 700;
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 8px 22px rgba(13,148,136,0.28);
  transition: transform 0.1s, box-shadow 0.2s;
}
body.native-app .auth-app-only .app-cta:active { transform: translateY(1px); }
body.native-app .auth-app-only .app-cta svg { transition: transform 0.2s; }
/* Secondary "Sign in" — same footprint as the primary CTA but outline-styled,
 * so returning users get an obvious, tappable button (was a faint text link). */
body.native-app .auth-app-only .app-cta.app-cta-outline {
  background: #fff; color: var(--app-teal-deep);
  border: 1.5px solid var(--app-teal);
  box-shadow: 0 2px 8px rgba(13,148,136,0.10);
}

body.native-app .auth-app-only .app-signin-link {
  font-size: 14px; color: var(--app-ink-3); padding: 4px 0;
}
body.native-app .auth-app-only .app-signin-link a {
  color: var(--app-teal-deep); font-weight: 600;
  text-decoration: none; cursor: pointer;
}

/* Legal footer */
body.native-app .auth-app-only .app-footer-links {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 0;
  margin-top: 28px; padding-top: 22px;
  border-top: 1px solid var(--app-line);
}
body.native-app .auth-app-only .app-footer-links a {
  color: var(--app-ink-3); text-decoration: none;
  font-size: 12px; font-weight: 500; padding: 6px 0;
}
body.native-app .auth-app-only .app-footer-links .sep {
  color: var(--app-ink-4); font-size: 10px; padding: 0 12px;
}
body.native-app .auth-app-only .app-footer-legal {
  text-align: center; font-size: 11px;
  color: var(--app-ink-4); margin-top: 10px;
}

/* The web preview column should never render in native; the layout
 * uses our own .app-wrap which already excludes it. Defensive: hide
 * any preview that snuck through. */
body.native-app .auth-app-only .l-right,
body.native-app .auth-app-only .l-preview { display: none !important; }


/* ═══════════════════════════════════════════════════════════════════════
 * Native-app de-duplication of auth chrome.
 *
 * The web auth layout carries THREE pieces of chrome around the auth
 * views, all of which would stack on top of (or below) the
 * .auth-app-only native layouts and produce visible duplicates
 * (confirmed by user screenshots):
 *
 *   • .l-nav            — top bar with "yuha" wordmark + Sign in +
 *                         Get started buttons (views-init.js NAV_HTML)
 *   • .auth-logo-fixed  — persistent Y / YUHA logo inside the auth
 *                         left panel (index.html:889)
 *   • .l-foot           — © + email + 5 legal links at the bottom of
 *                         #auth-overlay (views-init.js FOOT_HTML)
 *
 * The native B / D / E layouts render their own .app-brand-row at the
 * top and .app-footer-links + .app-footer-legal at the bottom. Hide
 * all three web pieces when body.native-app is present.
 * ═══════════════════════════════════════════════════════════════════ */
body.native-app #auth-overlay .l-nav,
body.native-app #auth-overlay .auth-logo-fixed,
body.native-app #auth-overlay .auth-logo-row,
body.native-app #auth-overlay .l-foot {
  display: none !important;
}

/* The onboarding overlay (z-index 5000) sits above everything anyway,
 * but kill #topNav and #appHeader behind it just in case any future
 * change makes them visible while onboarding is mounted. */
body.native-app #viewOnboarding.ob-show ~ #topNav,
body.native-app #viewOnboarding.ob-show ~ #appHeader {
  display: none !important;
}


/* ═══════════════════════════════════════════════════════════════════════
 * YUHA Chat FAB — small floating action button bottom-right that opens
 * the chat view with the input focused. Native shell only (the web has
 * its own chat affordance via the sidebar). Sits above the mobile
 * bottom-nav, below modals.
 *
 * Hidden on the Chat view itself (would be redundant) and during the
 * onboarding overlay. Stays out of the way during goal-create flows by
 * tapping into the same modal-overlay check used by pull-to-refresh.
 * ═══════════════════════════════════════════════════════════════════ */
.yuha-chat-fab {
  display: none;
  position: fixed;
  right: 14px;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  /* Pill shape with logo + "Ask Coach" text. Auto width hugs content. */
  padding: 0 16px 0 4px;
  height: 48px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #2dd4bf, #0f766e);
  color: #fff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  line-height: 1;
  gap: 9px;
  z-index: 140;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.18) inset,
    0 10px 24px rgba(13,148,136,0.34),
    0 4px 10px rgba(15,23,42,0.10);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  transform: translateZ(0);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  align-items: center; justify-content: center;
}
.yuha-chat-fab .ycf-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.04em;
  flex: none;
}
.yuha-chat-fab .ycf-label {
  font-weight: 700;
  white-space: nowrap;
}
.yuha-chat-fab:active {
  transform: translateZ(0) translateY(1px) scale(0.97);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.15) inset,
    0 6px 16px rgba(13,148,136,0.28),
    0 2px 6px rgba(15,23,42,0.08);
}
/* Native shell — visible ONLY once the user is in the authenticated app
 * (body.yuha-app-ready is added by enterYUHA() / removed by
 * showAuthOverlay()). Hides on landing, signin, forgot-password. */
body.native-app.yuha-app-ready .yuha-chat-fab { display: flex; }

/* Hide on the Chat view itself — tapping a FAB to open Chat while
 * already on Chat would be meaningless. */
body.native-app #viewChat:not([style*="display:none"]) ~ .yuha-chat-fab,
body.native-app #viewChat:not([style*="display: none"]) ~ .yuha-chat-fab {
  display: none;
}
/* The structure puts the FAB OUTSIDE #desktopApp at body level, so
 * sibling selectors don't reach. Fallback: a body class set by sbNav
 * when chat is active. */
body.native-app.yuha-view-chat .yuha-chat-fab { display: none; }
/* Hide while onboarding overlay is mounted. */
body.native-app #viewOnboarding.ob-show ~ .yuha-chat-fab { display: none; }
