/* ================================================================
   KIN — Design System
   ================================================================ */

/* ── 1. THEME TOKENS ──────────────────────────────────────────── */
:root {
  /* Visual viewport geometry, kept in sync by base.html for the chat sheet */
  --kin-vvh: 100dvh;
  --kin-vvt: 0px;

  /* KIN ICE palette (edit here to retheme KIN) */
  --kin-bg:            #070B12;
  --kin-bg-elevated:   #0A111C;
  --kin-surface:       #101824;
  --kin-surface-hover: #142133;
  --kin-border:        #233248;

  --kin-text:           #F4F8FC;
  --kin-text-secondary: #A8B4C4;
  --kin-text-muted:     #7B889A; /* ≥4.5:1 on card surfaces (#101824) */

  --kin-blue-deep:   #12315A;
  --kin-blue:        #4169FF;
  --kin-blue-medium: #218DF3;
  --kin-cyan:        #00CFF5;
  --kin-ice:         #72F1FF;

  --kin-success:     #00CFF5;
  --kin-achievement: #72F1FF;
  --kin-danger:      #EF4444;
  --kin-warning:     #F59E0B;
  --kin-button-text: #02060D;

  /* Reusable ICE gradients */
  --kin-gradient: linear-gradient(90deg, #4169FF 0%, #00CFF5 55%, #72F1FF 100%);
  --kin-gradient-button: linear-gradient(135deg, #4169FF 0%, #218DF3 50%, #00CFF5 100%);
  --kin-gradient-headline: var(--kin-gradient);
  --kin-gradient-feature: linear-gradient(135deg, #315FEF 0%, #287FEF 50%, #00BFD9 100%);
  --kin-gradient-genie: linear-gradient(135deg, #4169FF 0%, #00CFF5 62%, #72F1FF 100%);

  --kin-feature-surface: var(--kin-gradient-feature);
  --kin-feature-border: rgba(114,241,255,0.24);

  /* Shared ICE effects */
  --kin-glow:        0 8px 30px rgba(0,207,245,0.14);
  --kin-glow-strong: 0 12px 32px rgba(65,105,255,0.22);
  --kin-nav-active:  rgba(65,105,255,0.16);
  --kin-focus-ring:  0 0 0 3px rgba(0,207,245,0.12);

  /* Channel accent tiers */
  --kin-channel-1: var(--kin-ice);
  --kin-channel-2: var(--kin-cyan);
  --kin-channel-3: var(--kin-blue-medium);

  /* Dark theme (default) */
  --bg-primary:    var(--kin-bg);
  --bg-elevated:   var(--kin-bg-elevated);
  --surface:       var(--kin-surface);
  --surface-2:     var(--kin-surface-hover);
  --surface-hover: rgba(114,241,255,0.06);

  --text-primary:   var(--kin-text);
  --text-secondary: var(--kin-text-secondary);
  --text-dim:       var(--kin-text-muted);

  --border:        var(--kin-border);
  --border-strong: #31445F;

  /* Active channel accent */
  --accent:       var(--kin-cyan);
  --accent-hover: var(--kin-ice);
  --accent-glow:  rgba(0,207,245,0.18);
  --accent-soft:  rgba(65,105,255,0.14);

  /* Filled buttons — darker so white labels stay readable */
  --accent-solid:       var(--kin-blue);
  --accent-solid-hover: var(--kin-blue-medium);

  /* Semantic */
  --success:      var(--kin-success);
  --success-dim:  rgba(0,207,245,0.12);
  --warning:      var(--kin-warning);
  --danger:       var(--kin-danger);
  --danger-border:rgba(239,68,68,0.35);
  --danger-dim:   rgba(239,68,68,0.10);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 36px rgba(0,0,0,0.65);

  /* Channel accent colors */
  --ch-dashboard: var(--kin-channel-1);
  --ch-engage:  var(--kin-channel-2);
  --ch-lift:    var(--kin-channel-2);
  --ch-run:     var(--kin-channel-3);
  --ch-ride:    var(--kin-channel-3);
  --ch-flow:    var(--kin-channel-2);
  --ch-wod:     var(--kin-channel-3);
  --ch-fuel:    var(--kin-channel-1);
  --ch-recover: var(--kin-channel-3);
  --ch-live:    var(--kin-channel-1);

  /* Layout */
  --sidebar-w: 240px;

  /* Legacy compat aliases */
  --bg: var(--bg-primary);
  --surface-soft: var(--surface-2);
  --surface-strong: var(--surface-2);
  --text: var(--text-primary);
  --heading: var(--text-primary);
  --muted: var(--text-secondary);
  --ghost-border: var(--border-strong);
  --shadow-soft: var(--shadow-sm);
  --hover: var(--surface-hover);
}

html[data-theme="light"] {
  --bg-primary:    #F4F7FB;
  --bg-elevated:   #FFFFFF;
  --surface:       #FFFFFF;
  --surface-2:     #EDF3FA;
  --surface-hover: rgba(65,105,255,0.05);

  --text-primary:   #111827;
  --text-secondary: #506078;
  --text-dim:       #5B6B84; /* ≥4.5:1 on white for AA at small sizes */

  --border:        rgba(18,49,90,0.11);
  --border-strong: rgba(18,49,90,0.20);

  /* Deeper ICE accents keep controls readable on light surfaces */
  --kin-channel-1: #315FEF;
  --kin-channel-2: #087FAF;
  --kin-channel-3: #218DF3;

  --kin-gradient-headline: linear-gradient(90deg, #315FEF 0%, #087FAF 58%, #218DF3 100%);

  --kin-feature-surface: var(--kin-gradient-feature);
  --kin-feature-border: rgba(65,105,255,0.24);

  --accent:       #087FAF;
  --accent-hover: #315FEF;
  --accent-glow:  rgba(65,105,255,0.15);
  --accent-soft:  rgba(65,105,255,0.09);

  --accent-solid:       #315FEF;
  --accent-solid-hover: #218DF3;

  --kin-nav-active: rgba(65,105,255,0.11);

  --success:     #087FAF;
  --success-dim: rgba(0,207,245,0.10);
  --warning:     #D97706;
  --danger:      #DC2626;
  --danger-border: rgba(220,38,38,0.3);
  --danger-dim:  rgba(220,38,38,0.06);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 36px rgba(0,0,0,0.14);

  --bg: var(--bg-primary);
  --surface-soft: var(--surface-2);
  --surface-strong: var(--surface-2);
  --text: var(--text-primary);
  --heading: var(--text-primary);
  --muted: var(--text-secondary);
  --ghost-border: var(--border-strong);
  --shadow-soft: var(--shadow-sm);
  --hover: var(--surface-hover);
}

/* ── 2. RESET & BASE ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv01" 1, "cv02" 1, "cv03" 1, "cv04" 1;
}

/* ── 3. APP SHELL ─────────────────────────────────────────────── */
body.feed-page {
  max-width: none;
  padding: 0;
  margin: 0;
  height: 100vh;
  overflow: hidden;
}

body.feed-page::before { display: none; }

.feed-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

body.has-right-sidebar .feed-layout {
  grid-template-columns: var(--sidebar-w) 1fr 300px;
}

.feed-sidebar-right {
  display: none;
  overflow-y: auto;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  padding: 28px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

body.has-right-sidebar .feed-sidebar-right {
  display: block;
}

.feed-sidebar-right::-webkit-scrollbar { width: 4px; }
.feed-sidebar-right::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.feed-center {
  background: var(--bg-primary);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 26px 36px 56px;
  min-width: 0;
}

/* ── 4. KIN SIDEBAR ───────────────────────────────────────────── */
.feed-sidebar-left {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: 0;
  scrollbar-width: none;
  z-index: 200;
  transition: transform 0.25s ease;
}

.feed-sidebar-left::-webkit-scrollbar { display: none; }

/* KIN Logo */
.kin-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  text-decoration: none;
}

.kin-brand-art { display: block; width: 100%; }
.kin-brand-art img { display: block; width: 100%; height: auto; object-fit: contain; }
.kin-sidebar-close { display: none; }

/* Legacy brand hidden */
.feed-brand, .brand-icon, .brand-name { display: none; }

/* ── 5. CHANNEL NAVIGATION ────────────────────────────────────── */
.feed-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 12px 8px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}

.feed-nav::-webkit-scrollbar { display: none; }

.feed-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  transition: background 0.15s, color 0.15s;
  position: relative;
  white-space: nowrap;
}

.feed-nav-link:hover {
  background: rgba(255,255,255,0.035);
  color: var(--text-primary);
  text-decoration: none;
}

.channel-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 1.5;
}

.ch-dashboard .channel-icon { color: var(--ch-dashboard); }
.ch-engage .channel-icon { color: var(--ch-engage); }
.ch-lift .channel-icon { color: var(--ch-lift); }
.ch-run .channel-icon { color: var(--ch-run); }
.ch-ride .channel-icon { color: var(--ch-ride); }
.ch-flow .channel-icon { color: var(--ch-flow); }
.ch-wod .channel-icon { color: var(--ch-wod); }
.ch-fuel .channel-icon { color: var(--ch-fuel); }
.ch-recover .channel-icon { color: var(--ch-recover); }
.ch-live .channel-icon { color: var(--ch-live); }

.feed-nav-link-active {
  color: var(--text-primary);
  background: var(--accent-soft);
  font-weight: 600;
}

.feed-nav-link-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--kin-gradient);
  border-radius: 0 2px 2px 0;
}

.ch-engage.feed-nav-link-active  { color: var(--ch-engage); background: var(--kin-nav-active); }
.ch-dashboard.feed-nav-link-active { color: var(--ch-dashboard); background: var(--kin-nav-active); }
.ch-lift.feed-nav-link-active    { color: var(--ch-lift);   background: var(--kin-nav-active); }
.ch-run.feed-nav-link-active     { color: var(--ch-run);    background: var(--kin-nav-active); }
.ch-ride.feed-nav-link-active    { color: var(--ch-ride);   background: var(--kin-nav-active); }
.ch-flow.feed-nav-link-active    { color: var(--ch-flow);   background: var(--kin-nav-active); }
.ch-wod.feed-nav-link-active     { color: var(--ch-wod);    background: var(--kin-nav-active); }
.ch-fuel.feed-nav-link-active    { color: var(--ch-fuel);   background: var(--kin-nav-active); }
.ch-recover.feed-nav-link-active { color: var(--ch-recover);background: var(--kin-nav-active); }
.ch-live.feed-nav-link-active    { color: var(--ch-live);   background: var(--kin-nav-active); }

.feed-nav-link-muted {
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin-top: 2px;
}

/* Lift sub-nav */
.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 4px 14px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.nav-sub-link {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-sub-link:hover { background: var(--surface-hover); color: var(--text-primary); }
.nav-sub-link-active { color: var(--ch-lift); font-weight: 600; background: var(--accent-soft); }

/* Sidebar footer */
.kin-sidebar-footer {
  flex-shrink: 0;
  padding: 8px 8px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.kin-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.kin-theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.kin-theme-toggle .channel-icon { stroke-width: 1.75; }

html[data-theme="dark"]  .kin-theme-toggle .icon-moon { display: none; }
html[data-theme="dark"]  .kin-theme-toggle .icon-sun  { display: block; }
html[data-theme="light"] .kin-theme-toggle .icon-sun  { display: none; }
html[data-theme="light"] .kin-theme-toggle .icon-moon { display: block; }

.kin-theme-label-dark  { display: block; }
.kin-theme-label-light { display: none; }
html[data-theme="light"] .kin-theme-label-dark  { display: none; }
html[data-theme="light"] .kin-theme-label-light { display: block; }

/* Mobile hamburger */
.kin-hamburger {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 400;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  padding: 0;
}

.kin-hamburger svg { width: 20px; height: 20px; }
.kin-hamburger-mark { display: block; width: 28px; height: 28px; object-fit: contain; }
.kin-mobile-bar { display: none; }

.kin-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 190;
}

body.sidebar-open .kin-overlay { display: block; }

/* ── 6. BREADCRUMB ────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}

.breadcrumb a,
.breadcrumb > span:last-child {
  max-width: min(100%, 48vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.12s;
}

.breadcrumb a:hover { color: var(--accent); }
.breadcrumb > span:last-child { color: var(--text-primary); font-weight: 600; }
.bc-sep { color: var(--text-dim); opacity: 0.5; }

/* ── 7. TYPOGRAPHY & PAGE HEADERS ─────────────────────────────── */
h1, h2, h3, h4 {
  margin: 0 0 14px;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

h1 { font-size: clamp(1.45rem, 2.5vw, 1.9rem); letter-spacing: -0.035em; font-weight: 800; }
h2 { font-size: clamp(1.05rem, 1.8vw, 1.3rem); margin-top: 20px; letter-spacing: -0.02em; font-weight: 700; }
h3 { font-size: clamp(0.9rem, 1.5vw, 1.05rem); margin-top: 14px; letter-spacing: -0.01em; font-weight: 600; }

.kin-page-shell {
  width: min(100%, 1120px);
  margin-inline: auto;
}

.page-gradient-title,
.day-title,
.lift-dash-greeting,
.dashboard-header h1 {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  font-size: clamp(1.55rem, 2.5vw, 2rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.035em;
  background: var(--kin-gradient-headline);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

p { margin: 0 0 12px; }
p, ul, form, div { margin-top: 0; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.12s;
}

a:hover { color: var(--accent-hover); text-decoration: underline; }

label {
  display: block;
  margin: 0 0 5px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ── 8. FORM CONTROLS ─────────────────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
textarea,
select {
  width: min(100%, 440px);
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input[type="file"] { padding: 8px 10px; }
textarea { resize: vertical; min-height: 88px; }
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23A8B4C4' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 12px;
}
select::-ms-expand { display: none; }
option {
  color: var(--text-primary);
  background: var(--bg-elevated);
}
input::placeholder { color: var(--text-dim); }

input:focus,
textarea:focus,
select:focus {
  border-color: var(--kin-cyan);
  box-shadow: var(--kin-focus-ring);
  background: var(--surface);
}

/* ── 9. BUTTONS ───────────────────────────────────────────────── */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 5px 11px;
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 580;
  font-family: inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
}

button:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

button:active { transform: scale(0.98); }

form:not(.inline-form):not(.inline-rename-form) > button[type="submit"] {
  border-color: transparent;
  background: var(--kin-gradient-button);
  color: var(--kin-button-text);
  font-weight: 640;
  box-shadow: 0 2px 8px var(--accent-glow);
}

form:not(.inline-form):not(.inline-rename-form) > button[type="submit"]:hover {
  background: var(--kin-gradient-button);
  filter: brightness(1.08);
  box-shadow: 0 4px 14px var(--accent-glow);
}

form[action*="/delete"] button,
.plan-delete-x {
  border-color: var(--danger-border);
  background: transparent;
  color: var(--danger);
  font-weight: 600;
}

form[action*="/delete"] button:hover,
.plan-delete-x:hover {
  background: var(--danger-dim);
  border-color: var(--danger);
  box-shadow: none;
}

button[type="button"],
.inline-actions button,
.inline-form button,
.inline-rename-form button {
  padding: 5px 10px;
  font-size: 0.78rem;
}

/* ── 9b. PRIMITIVES (shared components) ───────────────────────── */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  button:hover, button:active, .btn:hover, .btn:active { transform: none !important; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 650;
  font-family: inherit;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, filter 0.15s;
}
.btn:hover { text-decoration: none; background: var(--surface-hover); transform: none; box-shadow: var(--shadow-sm); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 0.78rem; border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-primary { border-color: transparent; background: var(--kin-gradient-button); color: #fff; box-shadow: 0 2px 8px var(--accent-glow); }
.btn-primary:hover { background: var(--kin-gradient-button); filter: brightness(1.08); box-shadow: 0 4px 14px var(--accent-glow); }
.btn-secondary { background: transparent; color: var(--text-primary); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--surface-2); box-shadow: none; }
.btn-danger { border-color: var(--danger-border); background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-dim); border-color: var(--danger); box-shadow: none; }
.btn-icon { width: 40px; padding: 0; }
.btn:disabled, button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

/* Loading state (kin.js swaps the submit label) */
.kin-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: kin-spin 0.7s linear infinite;
}
@keyframes kin-spin { to { transform: rotate(360deg); } }
button.is-loading { cursor: progress; opacity: 0.85; }

/* Alerts */
.kin-alerts { display: grid; gap: 8px; margin-bottom: 16px; }
.kin-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.88rem;
  line-height: 1.4;
}
.kin-alert > svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.kin-alert strong { display: block; margin-bottom: 2px; }
.kin-alert-error { color: var(--danger); background: var(--danger-dim); border-color: var(--danger-border); }
.kin-alert-warning { color: var(--warning); background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.35); }
.kin-alert-success { color: var(--success); background: var(--success-dim); border-color: rgba(0,207,245,0.3); }
.kin-alert-info { color: var(--text-secondary); }

/* Empty state */
.kin-empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 6px;
  padding: 28px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
}
.kin-empty > svg { width: 34px; height: 34px; stroke-width: 1.4; color: var(--accent); margin-bottom: 4px; }
.kin-empty h1, .kin-empty h2 { margin: 0; font-size: 1.15rem; }
.kin-empty p { margin: 0; max-width: 42ch; color: var(--text-secondary); }
.kin-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.kin-empty-page { margin: 48px auto; max-width: 520px; }

/* Dialog */
.kin-dialog {
  width: min(92vw, 420px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
}
.kin-dialog::backdrop { background: rgba(3, 5, 9, 0.72); backdrop-filter: blur(3px); }
.kin-dialog-body { padding: 24px 24px 8px; display: grid; justify-items: center; text-align: center; gap: 8px; }
.kin-dialog-icon { width: 30px; height: 30px; color: var(--warning); }
.kin-dialog-body h2 { margin: 0; font-size: 1.1rem; }
.kin-dialog-body p { margin: 0; color: var(--text-secondary); font-size: 0.9rem; }
.kin-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px 20px; }

/* Page header */
.page-header { margin-bottom: 14px; }
.page-eyebrow {
  display: block;
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.page-title {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  margin: 4px 0 2px;
  font-size: clamp(1.55rem, 2.5vw, 2rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.035em;
  background: var(--kin-gradient-headline);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-subtitle { margin: 0; color: var(--text-secondary); }
/* User-entered eyebrow text (e.g. a plan name) keeps its typed casing. */
.page-eyebrow-plain { text-transform: none; letter-spacing: 0; font-size: 0.76rem; font-weight: 600; color: var(--text-secondary); }
.page-header-row { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-header-row .page-header { margin-bottom: 0; }

.chat-widget-close svg, .chat-widget-expand svg { width: 14px; height: 14px; }

/* ── 10. FEEDBACK ─────────────────────────────────────────────── */
.error-message {
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid var(--danger-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-bottom: 12px;
}

.feed-empty {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 8px 0;
}

/* ── 11. DAY CARDS ────────────────────────────────────────────── */
.page-gradient-title {
  margin-bottom: 16px;
}

.day-cards-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 12px;
}

.day-card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.04);
  padding: 11px 14px;
  transition: box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
}
.day-card-item.exercise-card-dragging { opacity: 0.48; border-color: var(--accent); }
.day-drag-handle { flex: 0 0 30px; }
.day-order-status { margin: 8px 0 0; min-height: 1.2em; font-size: 0.78rem; color: var(--success); }
.day-order-status.is-error { color: var(--danger); }
.day-card-preview strong { color: var(--text-primary); font-weight: 650; }

.day-card-item:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.day-card-main {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.day-card-name-row,
.plan-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.day-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}

.day-card-title:hover { color: var(--accent-hover); text-decoration: none; }

.day-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.day-card-preview {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 12. PLAN CARDS ───────────────────────────────────────────── */
.plan-cards-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.plan-card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.04);
  padding: 12px 14px;
  transition: box-shadow 0.15s;
  position: relative;
}

.plan-card-item:hover { box-shadow: var(--shadow-md); }
.plan-card-item.plan-is-active { border-color: var(--success); }

.plan-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Two-row card: name row on top, actions underneath (never compete for width). */
.plan-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.plan-name-row { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.plan-card-top .plan-card-link { min-width: 0; font-size: 1.08rem; }
.page-header-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-delete-form { margin-left: auto; }

.plan-card-link {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.3;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.plan-card-link:hover { color: var(--accent); }

.entity-icon-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.entity-icon-btn svg { width: 13px; height: 13px; }
.entity-edit-btn { border-color: transparent; }
.entity-edit-btn:hover { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.entity-delete-btn { font-size: 1.15rem; line-height: 1; }
.entity-delete-btn:hover { color: var(--danger); background: var(--danger-dim); border-color: var(--danger-border); }

.plan-active-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--success-dim);
  color: var(--success);
  border-radius: 99px;
  padding: 3px 9px;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.plan-active-badge svg { width: 11px; height: 11px; }

.plan-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.plan-sched-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.plan-sched-info svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-dim); }
.plan-sched-info-warn { color: var(--warning); }
.plan-sched-info-warn svg { color: inherit; }

.plan-sched-toggle {
  font-size: 0.72rem;
  font-weight: 600;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color 0.12s, color 0.12s;
}

.plan-sched-toggle:hover { border-color: var(--accent); color: var(--accent); }

.plan-sched-section {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.plan-sched-section[hidden] { display: none; }

.sched-form { display: flex; flex-direction: column; gap: 12px; }
.sched-row { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; border: 0; min-width: 0; }
.sched-row[hidden], [data-weekday-fields][hidden], .sched-mode-note[hidden] { display: none; }
.sched-goal-row { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 0.85rem; }
.sched-goal-row input { width: 72px; margin: 0; }

.sched-mode-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.sched-mode-option { cursor: pointer; }
.sched-mode-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.sched-mode-option span {
  display: inline-block;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-secondary);
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.sched-mode-option:has(input:checked) span {
  background: var(--accent-solid);
  border-color: var(--accent);
  color: #fff;
}
.sched-mode-note {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.4;
}

.sched-label {
  display: block;
  padding: 0;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.sched-date {
  width: 160px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text-primary);
  margin-bottom: 0;
}

.weekday-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.wd-pill { cursor: pointer; }
.wd-pill input { position: absolute; opacity: 0; width: 0; height: 0; }

.wd-pill span {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  user-select: none;
  background: var(--surface-2);
  color: var(--text-secondary);
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.wd-pill:has(input:checked) span {
  background: var(--accent-solid);
  border-color: var(--accent);
  color: #fff;
}

.btn-save-sched {
  align-self: flex-start;
  background: var(--accent-solid);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 620;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-save-sched:hover { background: var(--accent-solid-hover); }

.btn-set-active {
  font-size: 0.7rem;
  font-weight: 620;
  background: var(--accent-solid);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
}

.btn-set-active:hover { background: var(--accent-solid-hover); }

.plan-delete-x {
  background: none;
  border: none;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 6px;
  min-height: unset;
  transition: color 0.12s, background 0.12s;
}

.plan-delete-x:hover { color: var(--danger); background: var(--danger-dim); box-shadow: none; transform: none; }

.entity-add-row { margin: 18px 0 12px; }

.entity-add-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.entity-add-btn:hover { background: var(--accent-soft); }
.entity-add-btn svg { width: 16px; height: 16px; }

.entity-add-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.entity-add-form[hidden] { display: none; }
.entity-add-form input { flex: 1; margin: 0; }

.entity-add-save,
.entity-add-cancel { flex: 0 0 auto; }

.entity-add-cancel {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

.import-plan-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 600;
}

.import-plan-link svg { width: 15px; height: 15px; }

.import-text-form { max-width: 820px; }
.import-text-form textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  font: inherit;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.import-text-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── 13. FORMS (INLINE / RENAME) ──────────────────────────────── */
form { margin-bottom: 14px; }
.inline-form { display: inline; margin-bottom: 0; }

.inline-rename-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}
.inline-rename-form[hidden] { display: none; }

.inline-rename-form input[type="text"] {
  margin-bottom: 0;
  width: min(100%, 280px);
}

/* ── 14. FEED PAGE ────────────────────────────────────────────── */
.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
  flex-wrap: wrap;
}

.feed-header h1 { margin: 0; }

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.btn-secondary:hover { color: var(--text-primary); }

.feed-video-list { display: flex; flex-direction: column; gap: 12px; }

.feed-video-card {
  gap: 14px;
  padding: 12px 14px;
  cursor: pointer;
}

.feed-video-card .video-thumbnail {
  width: 148px;
  height: 83px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.feed-video-card.video-card-expanded { flex-direction: column; cursor: default; }

.feed-video-info { flex: 1; min-width: 0; }

.feed-video-channel { font-size: 0.76rem; color: var(--text-dim); margin-top: 3px; }

.feed-video-iframe { height: 300px; }

.feed-news-card {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  transition: background 0.12s, box-shadow 0.12s;
}

.feed-news-card:hover { background: var(--surface-hover); box-shadow: var(--shadow-sm); text-decoration: none; }

.feed-news-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-solid);
  color: #fff;
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 8px;
}

.feed-news-headline {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-news-meta { font-size: 0.76rem; color: var(--text-dim); }

/* Right sidebar */
.news-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.news-card {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  transition: background 0.12s;
}

.news-card:hover { background: var(--surface-hover); text-decoration: none; }

.news-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-meta { font-size: 0.72rem; color: var(--text-dim); }

/* ── 15. LIFT DASHBOARD ───────────────────────────────────────── */
.lift-dash {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lift-dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.lift-dash-date {
  font-size: 0.74rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 3px;
}

.lift-dash-greeting { margin: 0; }

.lift-manage-link {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 6px 13px;
  text-decoration: none;
  transition: background 0.12s;
  white-space: nowrap;
}

.lift-manage-link:hover { background: var(--accent-soft); text-decoration: none; }

.lift-empty {
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.lift-empty-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--surface-2);
}

.lift-empty-icon svg {
  width: 30px;
  height: 30px;
  stroke-width: 1.5;
}
.lift-empty h2 { margin: 0 0 8px; font-size: 1.2rem; }
.lift-empty p { color: var(--text-secondary); margin: 0 0 20px; }

.lift-cta {
  display: inline-block;
  background: var(--accent-solid);
  color: #fff;
  padding: 10px 22px;
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: background 0.12s;
}

.lift-cta:hover { background: var(--accent-solid-hover); text-decoration: none; }

.today-card {
  background: var(--kin-gradient-feature);
  color: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--kin-feature-border);
  box-shadow: var(--kin-glow);
}

.today-card-eyebrow {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  opacity: 0.75;
  text-transform: uppercase;
}

.today-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.today-card-day { margin: 0; font-size: 1.4rem; font-weight: 800; color: inherit; text-transform: none; letter-spacing: 0; }
.today-start-btn svg { width: 16px; height: 16px; }
.today-card-plan { font-size: 0.82rem; opacity: 0.7; margin-top: 2px; }

.today-start-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: 7px 13px;
  font-weight: 620;
  font-size: 0.84rem;
  text-decoration: none;
  transition: background 0.12s;
  min-height: 34px;
}

.today-start-btn:hover { background: rgba(255,255,255,0.25); text-decoration: none; }

/* Completed state: drop the call-to-action gradient so a logged day reads as done. */
.today-card-done { background: var(--surface); color: var(--text-primary); border-color: var(--success); box-shadow: none; }
.today-card-done .today-card-eyebrow { color: var(--success); opacity: 1; }
.today-card-done .today-card-plan { color: var(--text-secondary); opacity: 1; }
.today-card-done .today-start-btn { color: var(--text-primary); background: var(--surface-2); border-color: var(--border-strong); }
.dashboard-today-done .dashboard-today-label { color: var(--success) !important; }

.today-ex-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.today-ex-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 12px;
}

.today-ex-name { font-weight: 600; flex: 1; font-size: 0.9rem; }
.today-ex-meta { font-size: 0.78rem; opacity: 0.75; }

.today-ex-pr {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255,255,255,0.2);
  border-radius: 99px;
  padding: 2px 8px;
}

.rest-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.rest-card-emoji { font-size: 2.2rem; flex-shrink: 0; }
.rest-card-icon { width: 28px; height: 28px; flex-shrink: 0; color: var(--warning); }
.rest-card-icon-neutral { color: var(--accent); }
.rest-card-title { font-size: 1.05rem; font-weight: 700; }
.rest-card-sub { font-size: 0.82rem; color: var(--text-secondary); margin-top: 3px; }

.schedule-adjust-wrap { margin-top: 12px; }

.schedule-adjust-toggle {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.schedule-adjust-toggle:hover { color: var(--text-primary); box-shadow: none; transform: none; }

.schedule-adjust-chevron {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  transition: transform 0.14s ease;
}

.schedule-adjust-wrap.is-open .schedule-adjust-chevron { transform: rotate(180deg); }

.schedule-adjust-card {
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.schedule-adjust-title {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.schedule-adjust-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.schedule-adjust-grid-single { grid-template-columns: 1fr; }

.schedule-adjust-section {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-adjust-grid:not(.schedule-adjust-grid-single) .schedule-adjust-section + .schedule-adjust-section {
  border-left: 1px solid var(--border);
  padding-left: 12px;
}

.schedule-adjust-label { margin: 0; font-size: 0.84rem; font-weight: 650; color: var(--text-primary); }
.schedule-adjust-sub { font-size: 0.76rem; color: var(--text-secondary); }

.schedule-adjust-form {
  margin-top: 2px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.schedule-adjust-form select {
  min-height: 34px;
  min-width: 170px;
  border-radius: 8px;
}

.lift-section { display: flex; flex-direction: column; gap: 10px; }

.lift-overview-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(460px, 1.18fr);
  align-items: start;
  gap: 18px;
}

.lift-overview-grid-single { grid-template-columns: 1fr; }

.lift-section-label {
  margin: 0 0 8px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.upcoming-list { display: flex; flex-direction: column; gap: 6px; }

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  transition: border-color 0.12s;
}

.upcoming-item:hover { border-color: var(--accent); text-decoration: none; }
.upcoming-date { font-size: 0.77rem; color: var(--text-dim); min-width: 80px; }
.upcoming-day { font-weight: 600; font-size: 0.9rem; text-transform: none; letter-spacing: 0; }

/* ── 16. CALENDAR ─────────────────────────────────────────────── */
.lift-cal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.lc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.lc-label { font-weight: 700; font-size: 0.9rem; }

.lc-nav {
  background: none;
  border: none;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  border-radius: 6px;
  line-height: 1;
}
.lc-nav svg { width: 16px; height: 16px; }

.lc-nav:hover { background: var(--surface-hover); color: var(--text-primary); }

.lc-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 10px 8px 12px;
  gap: 3px;
}

.lc-dow {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-dim);
  padding-bottom: 6px;
  letter-spacing: 0.06em;
}

.lc-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border-radius: 8px;
  position: relative;
  color: var(--text-secondary);
  text-decoration: none;
}
a.lc-day:hover { text-decoration: none; filter: brightness(1.12); }
a.lc-day:focus-visible { outline-offset: -2px; }

.lc-today { background: var(--accent-solid); color: #fff; font-weight: 700; }
.lc-upcoming { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lc-done { background: var(--surface-2); color: var(--text-dim); }

.lc-dot {
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.recent-list { display: flex; flex-direction: column; gap: 6px; }

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
}

.recent-item-left { display: flex; flex-direction: column; gap: 2px; }
.recent-date { font-size: 0.74rem; color: var(--text-dim); }
.recent-day { font-weight: 600; font-size: 0.9rem; }
.recent-item-right { font-size: 0.82rem; color: var(--text-dim); display: flex; gap: 8px; align-items: center; }

.recent-pr {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(245,158,11,0.15);
  color: var(--warning);
  border-radius: 99px;
  padding: 2px 8px;
}

/* ── 17. EXERCISE CARDS (DAY DETAIL) ──────────────────────────── */
.exercise-card-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.exercise-card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.04);
  padding: 8px 10px;
  transition: border-color 0.15s, opacity 0.15s, transform 0.15s;
}

.exercise-card-item.exercise-card-dragging { opacity: 0.48; border-color: var(--accent); }

.exercise-card-header { min-width: 0; min-height: 36px; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 6px; }
/* Collapse hides everything in the card except its header. */
.exercise-card-collapsed > :not(.exercise-card-header) { display: none; }
.exercise-card-title { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }

.exercise-card-name {
  margin: 0;
  color: var(--accent);
  font-size: 1.05rem;
  line-height: 1.3;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.exercise-pr-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--success-dim);
  color: var(--success);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.exercise-pr-chip svg { width: 11px; height: 11px; }

.exercise-drag-handle,
.exercise-collapse-btn,
.set-delete-btn {
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.exercise-drag-handle { width: 32px; height: 32px; cursor: grab; touch-action: none; }
.exercise-drag-handle:active { cursor: grabbing; }
.exercise-order-buttons { display: flex; gap: 2px; }
.exercise-collapse-btn { width: 32px; height: 32px; }
.exercise-drag-handle:hover,
.exercise-collapse-btn:hover { color: var(--text-primary); background: var(--surface-2); border-color: var(--border); }
.exercise-drag-handle svg,
.exercise-collapse-btn svg { width: 15px; height: 15px; }
.exercise-collapse-plus { display: none; }
.exercise-card-collapsed .exercise-collapse-minus { display: none; }
.exercise-card-collapsed .exercise-collapse-plus { display: block; }

.exercise-card-notes { color: var(--text-secondary); margin: 2px 0 4px; font-size: 0.82rem; line-height: 1.35; }

/* ── 18. SETS TABLE ───────────────────────────────────────────── */
.set-card-list { list-style: none; margin: 4px 0 0; padding: 0; border-top: 1px solid var(--border); }

/* Row: done | weight | reps | timer | edit | delete — controls are direct grid children. */
.set-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr) 54px 32px 36px;
  grid-template-areas: "done weight reps rest edit delete";
  align-items: center;
  column-gap: 4px;
  height: 45px;
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s, opacity 0.15s;
}
.set-card-warmup { background: color-mix(in srgb, var(--surface-2) 42%, transparent); }
.set-card.is-done { background: var(--success-dim); }
.set-card.is-done .set-w-input,
.set-card.is-done .set-r-input { color: var(--text-secondary); }

.set-done-toggle {
  grid-area: done;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  position: relative;
  border: 2px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.set-done-toggle:hover { transform: none; border-color: var(--accent); box-shadow: none; }
.set-done-toggle svg { display: none; width: 20px; height: 20px; stroke-width: 3; }
.set-card-warmup .set-done-toggle { color: var(--ch-run); border-style: dashed; }
.set-card.is-done .set-done-toggle { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; }
.set-card.is-done .set-done-toggle .set-card-number { display: none; }
.set-card.is-done .set-done-toggle svg { display: block; }

.set-card .set-w-input { grid-area: weight; }
.set-card .set-r-input { grid-area: reps; }
.set-card .set-w-input,
.set-card .set-r-input {
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 0 6px;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0;
}
.set-card .set-w-input::placeholder,
.set-card .set-r-input::placeholder { color: var(--text-dim); font-weight: 500; font-size: 0.8rem; }
.set-card .set-w-input { -moz-appearance: textfield; appearance: textfield; }
.set-card .set-w-input::-webkit-inner-spin-button,
.set-card .set-w-input::-webkit-outer-spin-button { display: none; margin: 0; }
.set-card .set-w-input:hover, .set-card .set-r-input:hover { border-color: var(--border-strong); }
.set-card .set-w-input:focus, .set-card .set-r-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }

.set-card .set-delete-btn { grid-area: delete; width: 36px; height: 44px; min-height: 44px; margin: 0; justify-self: end; }
.set-card .timer-btn { grid-area: rest; width: 100%; height: 44px; min-height: 44px; min-width: 0; padding: 0 4px; }
.set-card .rest-edit-btn { grid-area: edit; width: 32px; height: 44px; min-height: 44px; }
.set-card .rest-edit-input { grid-area: rest; width: 100%; height: 44px; min-height: 44px; }

.cardio-duration-control { display: flex; align-items: center; gap: 14px; margin: 4px 0; }
.cardio-field { display: flex; align-items: center; gap: 6px; margin: 0; }
.cardio-duration-control input { width: 72px; min-height: 40px; margin: 0; padding: 6px 8px; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; font-size: 1rem; font-weight: 600; text-align: center; }
.cardio-duration-control input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.cardio-duration-control span { color: var(--text-secondary); font-size: 0.8rem; font-weight: 650; }

.set-delete-btn { width: 28px; height: 28px; margin: 0 auto; }
.set-delete-btn svg { width: 14px; height: 14px; }
.set-delete-btn:hover { color: var(--danger); background: var(--danger-dim); border-color: var(--danger-border); }
.set-delete-btn:disabled { opacity: 0.4; cursor: wait; }

.quick-set-actions { min-height: 32px; margin-top: 4px; display: flex; align-items: center; gap: 2px; }
.quick-set-btn { height: 32px; min-height: 32px; padding: 0 8px; display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); background: transparent; border: 0; border-radius: 6px; font-size: 0.78rem; font-weight: 650; cursor: pointer; }
.quick-set-btn:hover { color: var(--text-primary); background: var(--surface-2); transform: none; }
.quick-set-btn svg { width: 13px; height: 13px; }
.exercise-edit-status { margin-left: auto; color: var(--success); font-size: 0.72rem; }
.exercise-edit-status-error { color: var(--danger); }

.set-w-input, .set-r-input {
  width: 68px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.9rem;
  text-align: center;
  transition: border-color 0.12s, background 0.12s;
}

.set-w-input:hover, .set-r-input:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.set-w-input:focus, .set-r-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.timer-btn {
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  min-width: 46px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.timer-btn:hover { background: var(--surface-hover); color: var(--text-primary); transform: none; }
.timer-btn.timer-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.timer-btn.timer-done  { background: var(--success-dim); border-color: var(--success); color: var(--success); }

.rest-edit-btn {
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.rest-edit-btn svg { width: 12px; height: 12px; }
.rest-edit-btn:hover,
.rest-edit-btn:focus-visible { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); transform: none; box-shadow: none; }
.rest-edit-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.rest-edit-input {
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  min-width: 42px;
  width: 56px;
  padding: 4px 6px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  margin-bottom: 0;
}

/* ── 19. FINISH WORKOUT ───────────────────────────────────────── */
.day-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.day-title {
  margin: 0;
  background: var(--kin-gradient-headline);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.finish-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.finish-row .btn { min-height: 40px; padding: 0 14px; font-size: 0.84rem; }

.finish-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(34,197,94,0.25);
}

.finish-btn svg { width: 16px; height: 16px; }

.finish-btn:hover { filter: brightness(1.08); }
.finish-btn:disabled { opacity: 0.45; cursor: default; }
.finish-msg { font-size: 0.85rem; color: var(--text-secondary); }
.finish-msg-ok { color: var(--success); font-weight: 600; }

/* ── 20. NEXT-TIME PANEL ──────────────────────────────────────── */
.nt-dialog {
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 20px;
  padding: 30px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
}
.nt-dialog:not([open]) { display: none; }

.nt-dialog::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--kin-gradient);
  border-radius: 20px 20px 0 0;
}

.nt-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nt-mark { width: 46px; height: 46px; object-fit: contain; margin-bottom: 4px; }

.nt-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--kin-gradient-headline);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nt-sub { margin: 0; font-size: 0.88rem; color: var(--text-secondary); }

.nt-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.nt-close svg { width: 18px; height: 18px; }
.nt-close:hover { color: var(--text-primary); transform: none; box-shadow: none; }

.nt-body { display: flex; flex-direction: column; gap: 12px; }

.nt-ex {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.nt-ex-name { margin: 0; font-weight: 700; font-size: 0.95rem; }
.nt-sets { display: flex; flex-direction: column; gap: 6px; }

.nt-set-row { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }
.nt-set-lbl { min-width: 44px; color: var(--text-dim); font-size: 0.76rem; }

.nt-w, .nt-r, .nt-hours, .nt-minutes {
  padding: 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  font-size: 0.88rem;
  text-align: center;
  background: var(--surface-2);
  color: var(--text-primary);
  margin-bottom: 0;
}

.nt-w { width: 72px; }
.nt-r { width: 60px; }
.nt-cardio-row .nt-set-lbl { min-width: 58px; }
.nt-cardio-row .nt-hours,
.nt-cardio-row .nt-minutes { width: 54px; }
.nt-w:focus, .nt-r:focus, .nt-hours:focus, .nt-minutes:focus { outline: none; border-color: var(--success); }

.nt-unit, .nt-x { color: var(--text-dim); font-size: 0.8rem; }
.nt-actions { display: flex; gap: 10px; align-items: center; justify-content: center; }

.btn-nt-save {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-nt-save:hover { filter: brightness(1.08); }
.btn-nt-save:disabled { opacity: 0.45; cursor: default; }

.btn-nt-skip {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.btn-nt-skip:hover { color: var(--text-primary); }
.nt-msg { font-size: 0.82rem; color: var(--text-secondary); text-align: center; }
.nt-msg-ok { color: var(--success); font-weight: 600; }

/* ── 20b. ADD LIFT ─────────────────────────────────── */
.add-lift-row { margin: 14px 0 22px; }

.add-lift-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: 12px;
  padding: 13px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.add-lift-btn:hover { background: var(--accent-soft); }
.add-lift-btn svg { width: 16px; height: 16px; }

.add-lift-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.add-lift-form[hidden] { display: none; }

.add-lift-form input {
  flex: 1 1 220px;
  margin-bottom: 0;
}

.add-lift-save {
  background: var(--accent-solid);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.add-lift-save:hover { background: var(--accent-solid-hover); }

.add-lift-cancel {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.add-lift-cancel:hover { color: var(--text-primary); }
.add-lift-msg { font-size: 0.82rem; color: var(--danger, #ef4444); }

/* ── 21. CHAT WIDGET ──────────────────────────────────────────── */
.chat-widget-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 0;
  background: var(--kin-gradient-genie);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--kin-glow);
  z-index: 1300;
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 0;
}

.chat-widget-toggle:hover {
  transform: scale(1.06);
  box-shadow: var(--kin-glow-strong);
}

.chat-widget-toggle svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
  stroke-width: 1.75;
}

.chat-widget-panel {
  position: fixed;
  right: 24px;
  bottom: 88px;
  width: min(440px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 130px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1350;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.chat-widget-panel.chat-panel-expanded {
  width: min(680px, calc(100vw - 32px));
  height: min(88vh, calc(100vh - 108px));
}

.chat-widget-panel.chat-panel-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-widget-header h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chat-widget-header h2::before {
  content: '';
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--kin-gradient-genie);
  flex-shrink: 0;
}

.chat-widget-close,
.chat-widget-expand {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  min-height: unset;
}

.chat-widget-close:hover,
.chat-widget-expand:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
  transform: none;
  box-shadow: none;
}

.chat-widget-header-actions { display: flex; gap: 5px; align-items: center; }

/* The panel body is the same Genie shell as /ai (see _chat_shell.html), just embedded. */
.chat-widget-panel .chat-widget-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: none;
  margin: 0;
}
.chat-widget-expand { text-decoration: none; }
.ai-shell-embedded .ai-messages { padding: 20px 14px 10px; gap: 8px; }
.ai-shell-embedded::before { background-size: min(160px, 50%); }
.ai-shell-embedded .ai-bubble { max-width: 90%; font-size: 0.9rem; }
.ai-shell-embedded .ai-events { max-width: 92%; }
.ai-shell-embedded .ai-composer-wrap { padding: 8px 12px 12px; background: var(--surface); }

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

.chat-chip {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  min-height: unset;
  cursor: pointer;
}

.chat-chip:hover {
  color: var(--text-primary);
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: none;
  box-shadow: none;
}

/* ── 22. IMPORT PAGES ─────────────────────────────────────────── */
.import-preview-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 12px;
}
.import-preview-day { margin: 0 0 10px; font-size: 1.05rem; color: var(--accent); }
.import-preview-exercises { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.import-preview-exercise {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.import-preview-exercise-main { min-width: 0; display: grid; gap: 2px; }
.import-preview-exercise-main small { color: var(--text-secondary); }
.import-preview-prescription { flex-shrink: 0; font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text-secondary); }
.import-preview-skipped { color: var(--text-dim); font-style: italic; }
.import-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.import-actions form { margin: 0; }

.import-example { margin-bottom: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.import-example summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; font-weight: 600; color: var(--text-secondary); list-style: none; }
.import-example summary::-webkit-details-marker { display: none; }
.import-example summary svg { width: 16px; height: 16px; }
.import-example[open] summary { border-bottom: 1px solid var(--border); color: var(--text-primary); }
.import-example-body { padding: 12px 14px 14px; }
.import-example-body p { margin: 0 0 10px; color: var(--text-secondary); font-size: 0.88rem; }
.import-example-body pre { margin: 0; padding: 12px 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.82rem; line-height: 1.5; overflow-x: auto; }
.import-example-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ── 23. SETTINGS ─────────────────────────────────────────────── */
.settings-note { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 16px; }
.interest-add-form { margin-bottom: 20px; }

.interest-input-row { display: flex; gap: 10px; align-items: center; }
.interest-input-row input[type="text"] { flex: 1; max-width: 360px; margin-bottom: 0; }

.interest-pills { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 14px 0 0; padding: 0; }

.settings-shell { display: flex; flex-direction: column; gap: 14px; }
.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.settings-section .dashboard-section-heading { padding: 14px 18px 0; }
.settings-body { padding: 14px 18px 18px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-row strong { display: block; font-size: 0.95rem; }
.settings-row .settings-note { margin: 3px 0 0; font-size: 0.82rem; }
.settings-value { padding: 6px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; }
.settings-body > .settings-note { margin-bottom: 12px; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 18px; }
.profile-field label { display: block; margin-bottom: 5px; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.profile-field input, .profile-field select { width: 100%; margin: 0; }
.profile-height-row { display: flex; align-items: center; gap: 6px; }
.profile-height-row input { flex: 1; min-width: 0; }
.profile-height-row span { font-size: 0.8rem; color: var(--text-dim); }
.profile-actions { margin-top: 16px; display: flex; justify-content: flex-end; }

.interest-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  border: 1px solid rgba(0,207,245,0.24);
  border-radius: 999px;
  padding: 3px 4px 3px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
}

.interest-pill-remove {
  width: 30px;
  height: 30px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  line-height: 1;
}

.interest-pill-remove:hover { transform: none; background: var(--accent-soft); box-shadow: none; }
.interest-pill-remove svg { width: 14px; height: 14px; }

/* ── 24. AUTH PAGES ───────────────────────────────────────────── */
body.kin-auth {
  background: var(--bg-primary);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.kin-auth-card {
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.kin-auth-header {
  padding: 28px 32px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.kin-auth-logo { width: min(100%, 300px); }
.kin-auth-wordmark-image { display: block; width: 100%; height: auto; object-fit: contain; }

.kin-auth-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 4px 0 0;
}

.kin-auth-body { padding: 24px 32px 28px; }
.kin-auth-body label { color: var(--text-secondary); margin-bottom: 5px; }

.kin-auth-body input[type="text"],
.kin-auth-body input[type="password"] {
  width: 100%;
  max-width: 100%;
  background: var(--bg-elevated);
}
.kin-auth-body .kin-alert { margin-bottom: 14px; }
.kin-auth-password { position: relative; }
.kin-auth-password input { padding-right: 46px; }
.kin-auth-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.kin-auth-eye:hover { color: var(--text-primary); background: var(--surface-2); transform: translateY(-50%); box-shadow: none; }
.kin-auth-eye svg { width: 18px; height: 18px; }
.kin-auth-hint { margin: -6px 0 14px; color: var(--text-dim); font-size: 0.78rem; }

.kin-auth-body .kin-auth-remember {
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
}

.kin-auth-remember input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--kin-blue);
}

.kin-auth-submit {
  width: 100%;
  background: var(--kin-gradient-button);
  border: none;
  border-radius: 10px;
  padding: 12px;
  color: var(--kin-button-text);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: opacity 0.12s, transform 0.1s;
}

.kin-auth-submit:hover { opacity: 0.92; transform: translateY(-1px); }

.kin-auth-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.kin-auth-footer a { color: var(--accent); font-weight: 600; }

/* ── 25. CHANNEL COMING SOON ──────────────────────────────────── */
.channel-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 32px 60px;
  max-width: 480px;
  margin: 0 auto;
}

.channel-soon-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  background: var(--accent-soft);
}

.channel-soon-icon svg { width: 32px; height: 32px; stroke: var(--accent); stroke-width: 1.5; }
.channel-soon h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.channel-soon-subtitle { font-size: 1rem; color: var(--text-secondary); margin-bottom: 0; }

.channel-soon-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 14px;
  margin-top: 20px;
}

/* ── 26. DASHBOARD ────────────────────────────────────────────── */
.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dashboard-page .feed-sidebar-right { display: none; }

.dashboard-header { padding: 8px 0 2px; }
.dashboard-eyebrow,
.dashboard-today-label {
  display: block;
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.dashboard-header h1 { margin: 4px 0 2px; }
.dashboard-header p { margin: 0; color: var(--text-secondary); }
.dashboard-shell .page-header { margin-bottom: 0; padding: 4px 0 0; }

.dashboard-progress {
  width: min(100%, 260px);
  height: 6px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  overflow: hidden;
}
.dashboard-progress > span { display: block; height: 100%; width: var(--progress, 0%); background: #fff; border-radius: inherit; transition: width 0.3s ease; }
.dashboard-stat strong small { font-size: 0.55em; font-weight: 600; color: var(--text-secondary); margin-left: 2px; }

.dashboard-today {
  overflow: hidden;
  background: var(--kin-feature-surface);
  border: 1px solid var(--kin-feature-border);
  border-radius: 12px;
  box-shadow: var(--kin-glow);
}

.dashboard-today .dashboard-section-heading {
  color: rgba(255,255,255,0.82);
  border-bottom-color: rgba(255,255,255,0.16);
}

.dashboard-today .dashboard-section-heading h2,
.dashboard-today .dashboard-section-heading svg,
.dashboard-today .dashboard-today-content h2 { color: #fff; }

.dashboard-today .dashboard-today-content p { color: rgba(255,255,255,0.82); }
.dashboard-today .dashboard-today-label { color: rgba(255,255,255,0.72); }

.dashboard-today .dashboard-secondary-action {
  color: #fff;
  background: rgba(7,11,18,0.22);
  border-color: rgba(255,255,255,0.24);
}

.dashboard-section-heading {
  min-height: 38px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-section-heading h2 { margin: 0; color: var(--text-primary); font-size: 0.85rem; letter-spacing: 0; text-transform: none; }
.dashboard-today .dashboard-section-heading > span:last-child { letter-spacing: 0; text-transform: none; }
.dashboard-section-heading svg { width: 16px; height: 16px; color: var(--warning); stroke-width: 1.5; }
.dashboard-customize-button {
  min-height: 30px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 650;
  cursor: pointer;
}
.dashboard-customize-button:hover { color: var(--text-primary); background: var(--surface-hover); }
.dashboard-customize-button svg { width: 13px; height: 13px; color: currentColor; }

.dashboard-today-content {
  position: relative;
  min-height: 128px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.dashboard-today-content::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--kin-gradient);
}
.dashboard-today-content h2 { margin: 5px 0 2px; max-width: 680px; font-size: 1.5rem; line-height: 1.2; letter-spacing: 0; text-transform: none; }
.dashboard-today-content p { margin: 0; color: var(--text-secondary); }

.dashboard-primary-action,
.dashboard-secondary-action {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 7px;
  color: #fff;
  font-weight: 620;
  text-decoration: none;
}
.dashboard-primary-action { color: var(--kin-button-text); background: var(--kin-gradient-button); box-shadow: 0 6px 18px var(--accent-glow); }
.dashboard-secondary-action { color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border-strong); }
.dashboard-primary-action:hover,
.dashboard-secondary-action:hover { text-decoration: none; transform: translateY(-1px); }
.dashboard-primary-action svg,
.dashboard-secondary-action svg { width: 17px; height: 17px; }

.dashboard-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.dashboard-stat { position: relative; min-height: 104px; padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; align-content: center; column-gap: 12px; background: var(--surface); }
.dashboard-stat + .dashboard-stat { border-left: 1px solid var(--border); }
.dashboard-stat > svg { grid-row: 1 / span 3; width: 21px; height: 21px; margin-top: 5px; color: var(--accent); stroke-width: 1.5; }
.dashboard-stat strong { font-size: 1.5rem; line-height: 1.15; }
.dashboard-stat span { color: var(--text-secondary); font-size: 0.8rem; }
.dashboard-stat small { color: var(--text-dim); font-size: 0.7rem; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr); gap: 16px; align-items: start; }
.dashboard-panel { overflow: hidden; min-height: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.dashboard-pr-list { display: flex; flex-direction: column; }
.dashboard-pr-row { min-height: 64px; padding: 10px 16px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.dashboard-pr-row + .dashboard-pr-row { border-top: 1px solid var(--border); }
.dashboard-pr-mark { width: 32px; height: 32px; display: grid; place-items: center; color: var(--success); background: var(--success-dim); border-radius: 50%; }
.dashboard-pr-mark svg { width: 15px; height: 15px; }
.dashboard-pr-copy { min-width: 0; display: flex; flex-direction: column; }
.dashboard-pr-copy strong { overflow-wrap: anywhere; }
.dashboard-pr-copy span,
.dashboard-pr-result span { color: var(--text-dim); font-size: 0.72rem; }
.dashboard-pr-result { display: flex; flex-direction: column; align-items: flex-end; }
.dashboard-pr-result strong { color: var(--success); }
.dashboard-pr-unlogged { padding: 3px 7px; background: var(--surface-2); border-radius: 4px; }
.dashboard-empty-state { min-height: 255px; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--text-dim); }
.dashboard-empty-state svg { width: 28px; height: 28px; stroke-width: 1.25; }
.dashboard-empty-state p { margin: 0; }
.dashboard-empty-state button,
.dashboard-empty-state a { color: var(--accent); background: transparent; border: 0; font-weight: 650; cursor: pointer; text-decoration: none; }

.dashboard-side-stack { display: flex; flex-direction: column; gap: 14px; }
.dashboard-genie-cta { padding: 16px; display: grid; grid-template-columns: 38px 1fr; gap: 5px 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; }
.dashboard-genie-icon { grid-row: 1; width: 38px; height: 38px; display: grid; place-items: center; color: #fff; background: var(--kin-gradient-genie); border-radius: 7px; }
.dashboard-genie-icon svg { width: 18px; height: 18px; }
.dashboard-genie-cta h2 { margin: 0; font-size: 1rem; }
.dashboard-genie-cta p { margin: 2px 0 14px; color: var(--text-secondary); font-size: 0.78rem; line-height: 1.45; }
.dashboard-genie-actions { grid-column: 1 / -1; display: grid; gap: 8px; }
.dashboard-genie-cta button,
.dashboard-genie-actions a {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}
.dashboard-genie-cta button:hover,
.dashboard-genie-actions a:hover { text-decoration: none; background: var(--surface-hover); }
.dashboard-genie-cta button svg { width: 15px; height: 15px; }
.dashboard-genie-actions a svg { width: 15px; height: 15px; }
.dashboard-inline-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.dashboard-inline-link:hover { text-decoration: underline; }

.dashboard-quick-links { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.dashboard-quick-links a { min-height: 48px; padding: 0 15px; display: grid; grid-template-columns: 18px 1fr 15px; align-items: center; gap: 10px; color: var(--text-secondary); text-decoration: none; }
.dashboard-quick-links a + a { border-top: 1px solid var(--border); }
.dashboard-quick-links a:hover { color: var(--text-primary); background: var(--surface-hover); text-decoration: none; }
.dashboard-quick-links svg { width: 16px; height: 16px; stroke-width: 1.5; }
.dashboard-quick-links a svg:last-child { color: var(--text-dim); }

.dashboard-lift-picker {
  width: min(92vw, 620px);
  max-height: min(84vh, 720px);
  padding: 0;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}
.dashboard-lift-picker::backdrop { background: rgba(3, 5, 9, 0.72); backdrop-filter: blur(3px); }
.dashboard-lift-picker form { max-height: min(84vh, 720px); display: flex; flex-direction: column; }
.dashboard-lift-picker-header { padding: 20px 22px 16px; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--border); }
.dashboard-lift-picker-header h2 { margin: 3px 0 2px; font-size: 1.2rem; }
.dashboard-lift-picker-header p { margin: 0; color: var(--text-secondary); font-size: 0.8rem; }
.dashboard-picker-close { flex: 0 0 auto; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; color: var(--text-secondary); background: transparent; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.dashboard-picker-close:hover { color: var(--text-primary); background: var(--surface-hover); }
.dashboard-picker-close svg { width: 16px; height: 16px; }

.dashboard-lift-search { margin: 16px 22px 10px; min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 9px; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: 7px; }
.dashboard-lift-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dashboard-lift-search svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-dim); }
.dashboard-lift-search input { width: 100%; min-width: 0; padding: 0; color: var(--text-primary); background: transparent; border: 0; outline: 0; }
.dashboard-lift-search input::placeholder { color: var(--text-dim); }

.dashboard-lift-options { margin: 0 22px; min-height: 130px; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 6px; scrollbar-width: thin; }
.dashboard-lift-option { position: relative; min-width: 0; min-height: 42px; padding: 0 10px; display: grid; grid-template-columns: 18px minmax(0, 1fr) 16px; align-items: center; gap: 8px; color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.dashboard-lift-option[hidden] { display: none; }
.dashboard-lift-option:hover { color: var(--text-primary); border-color: var(--border-strong); }
.dashboard-lift-option:has(input:checked) { color: var(--text-primary); background: var(--accent-soft); border-color: rgba(0,207,245,0.32); }
.dashboard-lift-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.dashboard-lift-option span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; }
.dashboard-lift-option > svg { width: 14px; height: 14px; color: var(--accent); opacity: 0; }
.dashboard-lift-option:has(input:checked) > svg { opacity: 1; }
.dashboard-lift-no-results { display: none; grid-column: 1 / -1; padding: 30px 0; color: var(--text-dim); text-align: center; }
.dashboard-lift-no-results:not([hidden]) { display: block; }

.dashboard-lift-picker-footer { margin-top: 16px; padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--border); }
.dashboard-lift-picker-footer > span { color: var(--text-secondary); font-size: 0.78rem; }
.dashboard-lift-picker-footer > div { display: flex; gap: 8px; }
.dashboard-picker-cancel,
.dashboard-picker-save { min-height: 38px; padding: 0 14px; border-radius: 6px; font-weight: 650; cursor: pointer; }
.dashboard-picker-cancel { color: var(--text-secondary); background: transparent; border: 1px solid var(--border); }
.dashboard-picker-save { color: #fff; background: var(--accent-solid); border: 1px solid var(--accent); }
.dashboard-picker-empty { min-height: 260px; padding: 30px; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--text-secondary); text-align: center; }
.dashboard-picker-empty svg { width: 28px; height: 28px; color: var(--text-dim); }
.dashboard-picker-empty p { margin: 0; }
.dashboard-picker-empty a { color: var(--accent); font-weight: 650; }

/* ── 27. FUEL ─────────────────────────────────────────────────── */
.fuel-page .feed-sidebar-right { display: none; }
.fuel-shell { display: flex; flex-direction: column; gap: 14px; }
.fuel-header h1 { margin: 6px 0 4px; }
.fuel-header p { margin: 0; color: var(--text-secondary); }

.fuel-totals {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 20px;
}
.fuel-total-main span { display: block; color: var(--text-dim); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; }
.fuel-total-main strong { font-size: 1.8rem; line-height: 1.1; }
.fuel-total-macros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; color: var(--text-secondary); font-weight: 600; }

.fuel-date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

.fuel-date-arrow {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-primary);
  background: var(--surface-2);
  text-decoration: none;
}
.fuel-date-arrow svg { width: 18px; height: 18px; }

.fuel-date-arrow:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.fuel-date-arrow-disabled { opacity: 0.38; pointer-events: none; }

.fuel-date-center { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.fuel-date-center strong { font-size: 0.92rem; }
.fuel-jump-today { font-size: 0.74rem; color: var(--text-dim); }


.fuel-log-form,
.fuel-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.fuel-form-grid {
  padding: 14px 16px;
}

.fuel-log-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}
.fuel-form-grid label,
.fuel-log-row > div > label {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  display: block;
}
.fuel-meal-type-field,
.fuel-description-field,
.fuel-submit-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* Button sits on the input baseline without a phantom label. */
.fuel-submit-field { justify-content: flex-end; }
.fuel-submit-field .btn { min-height: 44px; }
.fuel-form-hint { margin: 10px 0 0; color: var(--text-dim); font-size: 0.78rem; }
.fuel-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fuel-form-footer .fuel-form-hint { margin-top: 8px; }
.fuel-add-meal-btn {
  min-height: 32px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.fuel-add-meal-btn svg { width: 14px; height: 14px; }
.fuel-meals .kin-empty { margin: 14px 16px 16px; }
.fuel-form-grid select,
.fuel-form-grid input[type="text"] {
  margin-top: 0;
  width: 100%;
}
.fuel-form-grid input[type="text"],
.fuel-form-grid select {
  min-height: 44px;
}

.fuel-preview-body { padding-bottom: 2px; }
.fuel-preview-description { margin: 0; padding: 16px 18px 0; color: var(--text-secondary); }
.fuel-preview-actions { padding: 8px 18px 16px; display: flex; gap: 10px; }
.fuel-items-preview { margin: 8px 18px 0; border-top: 1px solid var(--border); }

.fuel-estimated { font-style: normal; letter-spacing: 0; text-transform: none; color: var(--text-dim); }

/* Meals: plain heading row, then one card per meal type. */
.fuel-meals { display: flex; flex-direction: column; gap: 10px; }
.fuel-meals-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.fuel-meals-head h2 { margin: 0; font-size: 1rem; }
.fuel-meals .kin-empty { margin: 0; }

.fuel-meal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.fuel-meal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px 5px;
  line-height: 1.3;
}

/* Header: two explicit lines — name | calories, then macros | clear. */
.fuel-meal-head { padding-bottom: 6px; }
.fuel-meal-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.fuel-meal-sub { margin-top: 2px; }
.fuel-meal-head h3 { margin: 0; min-width: 0; font-size: 0.98rem; font-weight: 700; overflow-wrap: anywhere; }
.fuel-meal-head strong { font-size: 0.98rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fuel-meal-sub span { min-width: 0; color: var(--text-dim); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fuel-meal-clear-form { flex: 0 0 auto; margin: 0; display: block; line-height: 1; }
.fuel-meal-clear-form .fuel-meal-clear {
  height: 16px;
  min-height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-dim);
  font-size: 0.74rem;
  line-height: 1;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.fuel-meal-clear-form .fuel-meal-clear:hover { color: var(--danger); background: transparent; text-decoration: underline; transform: none; box-shadow: none; }

.fuel-items { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }

/* Row: name + calories + × on line one, quantity (capped to the name column) on line two. */
.fuel-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 26px;
  grid-template-areas: "name cal x" "qty . x";
  align-items: center;
  column-gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.fuel-item:last-child { border-bottom: 0; }
.fuel-item-name { grid-area: name; min-width: 0; font-size: 0.92rem; font-weight: 600; overflow-wrap: anywhere; align-self: end; }
.fuel-item-cal { grid-area: cal; font-size: 0.88rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; align-self: end; }
.fuel-item-qty { grid-area: qty; min-width: 0; color: var(--text-dim); font-size: 0.76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: start; }
.fuel-items-preview .fuel-item { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name cal" "qty ."; }
/* The form is layout-transparent so the × itself sits in the grid cell. */
.fuel-item-remove { display: contents; }
.fuel-item-remove .fuel-item-x {
  grid-area: x;
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: var(--text-dim);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}
.fuel-item-remove .fuel-item-x:hover { color: var(--text-secondary); background: transparent; transform: none; box-shadow: none; }
.fuel-item-remove .fuel-item-x:active { color: var(--danger); background: var(--danger-dim); transform: none; }

/* ── 28. MOBILE RESPONSIVE ────────────────────────────────────── */
@media (max-width: 768px) {
  .dashboard-shell { gap: 12px; }
  .dashboard-header { padding-top: 2px; }
  .dashboard-header h1 { font-size: 1.55rem; }
  .dashboard-today-content { min-height: 0; padding: 18px 16px; flex-direction: column; align-items: stretch; gap: 14px; }
  .dashboard-today-content h2 { font-size: 1.3rem; }
  .dashboard-primary-action,
  .dashboard-secondary-action { width: 100%; }
  .schedule-adjust-grid { grid-template-columns: 1fr; }
  .schedule-adjust-grid:not(.schedule-adjust-grid-single) .schedule-adjust-section + .schedule-adjust-section {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 14px;
  }
  .dashboard-stats { grid-template-columns: 1fr; }
  .dashboard-stat { min-height: 80px; padding: 12px 16px; }
  .dashboard-stat + .dashboard-stat { border-left: 0; border-top: 1px solid var(--border); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-pr-row { padding: 13px 14px; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; }
  .dashboard-lift-picker { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .dashboard-lift-picker form { max-height: calc(100dvh - 24px); }
  .dashboard-lift-picker-header { padding: 17px 16px 14px; }
  .dashboard-lift-search { margin: 13px 16px 9px; }
  .dashboard-lift-options { margin: 0 16px; grid-template-columns: 1fr; }
  .dashboard-lift-picker-footer { padding: 12px 16px; }
  .dashboard-picker-cancel,
  .dashboard-picker-save { min-height: 40px; }

  .fuel-form-grid { grid-template-columns: 1fr; }
  .fuel-log-row { grid-template-columns: 1fr; }
  .fuel-submit-field > .today-start-btn { align-self: flex-start; }
  .fuel-preview-actions { flex-direction: column; }
  .fuel-form-footer { align-items: flex-start; }

  body.feed-page {
    height: auto;
    overflow: visible;
  }

  body.feed-page.sidebar-open { overflow: hidden; }

  .feed-layout,
  body.has-right-sidebar .feed-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    grid-template-columns: none;
  }

  .feed-sidebar-left {
    position: fixed;
    left: 12px;
    top: max(12px, env(safe-area-inset-top));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(72vw, 272px);
    height: auto;
    z-index: 300;
    border: 1px solid var(--border-strong);
    border-radius: 18px;
    transform: translateX(calc(-100% - 24px));
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  .kin-brand-art { width: 48px; }
  .kin-logo {
    min-height: 74px;
    justify-content: flex-start;
    padding: 12px 64px 12px 16px;
  }

  .kin-sidebar-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: 16px;
    right: 14px;
    z-index: 2;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
  }

  .kin-sidebar-close svg { width: 18px; height: 18px; }

  body.sidebar-open .feed-sidebar-left {
    transform: translateX(0);
    box-shadow: 0 24px 80px rgba(0,0,0,0.55);
  }
  body.sidebar-open .kin-overlay { display: block; }

  .kin-hamburger {
    display: flex;
    top: max(12px, calc(env(safe-area-inset-top) + 8px));
    left: 14px;
  }

  /* Opaque app bar behind the hamburger so scrolled content never shows under it. */
  .kin-mobile-bar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(env(safe-area-inset-top) + 60px);
    z-index: 180;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
  }

  body.sidebar-open .kin-hamburger {
    opacity: 0;
    pointer-events: none;
  }

  .kin-overlay {
    background: rgba(3,5,9,0.72);
    backdrop-filter: blur(4px);
  }

  .feed-center {
    padding: calc(env(safe-area-inset-top) + 76px) 16px calc(112px + env(safe-area-inset-bottom));
    overflow-y: visible;
  }

  /* Day detail: the finish button gets its own row between the title and the first exercise. */
  .day-page .page-header-row { align-items: flex-start; }
  .day-page .finish-row { flex-basis: 100%; margin: 2px 0 4px; }
  .day-page .finish-row .btn { width: auto; }
  .day-page .exercise-card-list { margin-top: 10px; }

  .lift-overview-grid { grid-template-columns: 1fr; }

  .plan-cards-list { gap: 10px; }

  .plan-card-item {
    padding: 11px 12px;
    overflow: hidden;
  }

  .plan-card-header {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .plan-name-row {
    width: auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
  }
  .plan-name-row .plan-card-link { flex-basis: 100%; }

  .plan-card-link {
    flex: 1 1 auto;
    line-height: 1.3;
  }

  .plan-card-actions {
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 5px;
    padding-top: 0;
    border-top: none;
  }

  .plan-card-actions .inline-form { flex: 0 0 auto; }

  .plan-card-actions .btn-set-active,
  .plan-card-actions .plan-sched-toggle {
    min-height: 30px;
    padding: 5px 8px;
  }

  .plan-card-actions .entity-delete-btn {
    width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
  }

  .plan-sched-info {
    margin-top: 7px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .plan-sched-section {
    margin-inline: 0;
    padding: 12px;
  }

  .weekday-picker { gap: 7px; }

  .wd-pill span { padding: 6px 9px; }

  .feed-sidebar-right,
  body.has-right-sidebar .feed-sidebar-right { display: none; }

  body.has-right-sidebar .feed-video-card { display: none; }
  body.has-right-sidebar .feed-video-list { gap: 10px; }

  button { min-height: 44px; }

  .today-start-btn,
  .dashboard-primary-action,
  .dashboard-secondary-action { min-height: 42px; }

  /* Compact controls that live inside dense rows keep their own sizing. */
  .plan-delete-x,
  .chat-widget-close,
  .chat-widget-expand,
  .exercise-drag-handle,
  .exercise-collapse-btn,
  .quick-set-btn,
  .fuel-meal-clear,
  .fuel-item-x { min-height: unset; }

  .day-cards-list,
  .day-card-item,
  .day-card-header,
  .day-card-main { min-width: 0; max-width: 100%; }
  .day-card-item { padding: 11px 12px; overflow: hidden; }
  .day-card-header { align-items: flex-start; }
  .day-card-main {
    display: block;
    min-width: 0;
  }
  .day-card-name-row { align-items: flex-start; padding-right: 4px; }
  .day-card-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.3;
  }
  .day-card-preview {
    margin-top: 5px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.3;
  }
  .entity-add-form { align-items: stretch; flex-wrap: wrap; }
  .entity-add-form input { flex-basis: 100%; }
  .import-text-form textarea { min-height: 300px; }

  .cardio-duration-control input { min-height: 44px; }
  .feed-video-iframe { height: 220px; }

  /* WCAG 2.5.8 / Apple HIG: 44px minimum touch targets */
  button,
  .btn,
  button.entity-icon-btn,
  button.set-delete-btn,
  button.timer-btn,
  button.rest-edit-btn,
  button.lc-nav { min-height: 44px; }
  button.entity-icon-btn,
  .plan-card-actions .entity-delete-btn { width: 44px; height: 44px; min-height: 44px; flex-basis: 44px; }

  .chat-widget-toggle { right: 16px; bottom: 16px; }
  .chat-widget:has(.chat-panel-open) .chat-widget-toggle { display: none; }
  body:has(.chat-panel-open) { overflow: hidden; }

  /* Full-screen sheet; --kin-vvh/--kin-vvt track the visual viewport so the
     composer stays above the on-screen keyboard on iOS. */
  .chat-widget-panel,
  .chat-widget-panel.chat-panel-expanded {
    top: var(--kin-vvt);
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    height: var(--kin-vvh);
    max-height: var(--kin-vvh);
    border: 0;
    border-radius: 0;
    transform: translateY(100%) scale(1);
  }

  .chat-widget-panel.chat-panel-open { transform: none; }

  .chat-widget-header {
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .ai-shell-embedded .ai-composer-wrap { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .chat-chip { font-size: 0.8rem; padding: 9px 14px; }
}

/* ── 27. FEED EXPERIENCE ──────────────────────────────────────── */
body.kin-feed-page.has-right-sidebar .feed-layout {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 268px;
}

body.kin-feed-page .feed-center { padding: 28px 30px 96px; }
body.kin-feed-page .feed-sidebar-right { padding: 28px 18px 72px; }

.kin-feed-shell { max-width: 1080px; }

.kin-feed-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.kin-feed-header h1 { margin: 2px 0 0; font-size: 1.85rem; }
.kin-feed-eyebrow {
  color: var(--text-dim);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.feed-refresh-form { margin: 0; }
.feed-refresh-form > .feed-refresh-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: none;
}
.feed-refresh-form > .feed-refresh-button:hover {
  color: var(--accent);
  background: var(--surface-hover);
  border-color: var(--border-strong);
  filter: none;
  box-shadow: none;
}
.feed-refresh-button svg { width: 15px; height: 15px; }

.feed-category-tabs {
  margin: 20px 0 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.feed-category-tabs::-webkit-scrollbar { display: none; }
.feed-category-tab {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  text-decoration: none;
}
.feed-category-tab:hover { color: var(--text-primary); background: var(--surface-hover); text-decoration: none; }
.feed-category-tab-active {
  color: var(--kin-ice);
  background: var(--kin-nav-active);
  border-color: rgba(0,207,245,0.28);
}

.feed-section + .feed-section { margin-top: 34px; }
.feed-section-header {
  min-height: 32px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.feed-section-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.feed-feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(220px, 0.85fr);
  gap: 12px;
}

.feed-feature-hero,
.feed-feature-secondary,
.feed-story-card {
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  overflow: hidden;
}
.feed-feature-hero:hover,
.feed-feature-secondary:hover,
.feed-story-card:hover { border-color: var(--border-strong); background: var(--surface-hover); text-decoration: none; }

.feed-feature-hero {
  position: relative;
  min-height: 350px;
  display: flex;
  align-items: flex-end;
  isolation: isolate;
}
.feed-feature-hero > img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.feed-feature-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(7,11,18,0.04) 10%, rgba(7,11,18,0.94) 100%);
}
.feed-feature-no-image {
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
}
.feed-feature-no-image::after { background: radial-gradient(circle at 90% 10%, var(--accent-soft), transparent 45%); }
.feed-feature-copy { width: 100%; padding: 26px; }
.feed-feature-copy h2 {
  max-width: 680px;
  margin: 8px 0 8px;
  color: #fff;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}
.feed-feature-copy p { max-width: 650px; margin: 12px 0 0; color: rgba(244,248,252,0.78); font-size: 0.82rem; line-height: 1.5; }
.feed-feature-no-image .feed-feature-copy h2 { color: var(--text-primary); }
.feed-feature-no-image .feed-feature-copy p { color: var(--text-secondary); }

.feed-feature-secondary-list { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 12px; }
.feed-feature-secondary-list:empty { display: none; }
.feed-feature-secondary {
  min-height: 0;
  display: grid;
  grid-template-rows: 92px minmax(0, 1fr);
}
.feed-feature-secondary > img { width: 100%; height: 92px; object-fit: cover; }
.feed-feature-secondary > div { min-width: 0; padding: 13px 14px; }
.feed-feature-secondary h3 { margin: 6px 0 7px; color: var(--text-primary); font-size: 0.9rem; line-height: 1.3; }

.feed-article-category {
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.feed-article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: var(--text-dim); font-size: 0.7rem; }
.feed-feature-hero:not(.feed-feature-no-image) .feed-article-meta { color: rgba(244,248,252,0.72); }

.feed-content-stream { display: flex; flex-direction: column; gap: 8px; }
.feed-story-card {
  min-height: 116px;
  padding: 11px;
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
}
.feed-story-text-only { grid-template-columns: minmax(0, 1fr); }
.feed-story-image { width: 156px; height: 94px; align-self: center; object-fit: cover; border-radius: 6px; }
.feed-story-copy { min-width: 0; align-self: center; }
.feed-story-copy h3 { margin: 4px 0 5px; color: var(--text-primary); font-size: 0.98rem; line-height: 1.35; }
.feed-story-copy p {
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-empty-state {
  min-height: 260px;
  padding: 32px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}
.feed-empty-state > svg { width: 28px; height: 28px; margin-bottom: 3px; color: var(--text-dim); }
.feed-empty-state h3 { margin: 0; color: var(--text-primary); font-size: 1rem; }
.feed-empty-state p { margin: 0; font-size: 0.8rem; }

.feed-trending-rail-header {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.feed-trending-rail-header svg { width: 15px; height: 15px; color: var(--accent); }
.feed-trending-rail-header h2 { margin: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.feed-trending-list { margin: 8px 0 0; padding: 0; list-style: none; }
.feed-trending-list li + li { border-top: 1px solid var(--border); }
.feed-trending-list a { padding: 13px 0; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; text-decoration: none; }
.feed-trending-list a:hover strong { color: var(--accent); }
.feed-trending-number { color: var(--text-dim); font-size: 0.65rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.feed-trending-copy { min-width: 0; }
.feed-trending-copy strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-trending-copy small { margin-top: 5px; display: block; color: var(--text-dim); font-size: 0.65rem; }
.feed-rail-empty { margin: 12px 0 0; color: var(--text-dim); font-size: 0.76rem; line-height: 1.5; }

/* Heat-ranked Trending mosaic */
.feed-heat-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: 164px;
  gap: 12px;
}
.feed-heat-card {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
}
.feed-heat-card:hover { border-color: rgba(0,207,245,0.42); text-decoration: none; box-shadow: var(--kin-glow); }
.feed-heat-card > img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.feed-heat-card::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(7,11,18,0.04), rgba(7,11,18,0.95)); }
.feed-heat-no-image { background: linear-gradient(145deg, var(--surface), var(--surface-2)); }
.feed-heat-no-image::after { background: radial-gradient(circle at 90% 10%, var(--accent-soft), transparent 50%); }
.feed-heat-rank-1 { grid-column: 1 / 8; grid-row: 1 / 3; border-color: rgba(0,207,245,0.38); box-shadow: var(--kin-glow); }
.feed-heat-rank-2 { grid-column: 8 / 13; grid-row: 1; }
.feed-heat-rank-3 { grid-column: 8 / 13; grid-row: 2; }
.feed-heat-rank-4 { grid-column: 1 / 5; grid-row: 3; }
.feed-heat-rank-5 { grid-column: 5 / 9; grid-row: 3; }
.feed-heat-rank-6 { grid-column: 9 / 13; grid-row: 3; }
.feed-heat-copy { width: 100%; min-width: 0; padding: 18px; }
.feed-heat-rank-1 .feed-heat-copy { padding: 26px; }
.feed-heat-kicker { display: flex; align-items: center; gap: 8px; }
.feed-hot-label { padding: 2px 6px; color: var(--kin-ice); background: var(--accent-soft); border: 1px solid rgba(0,207,245,0.24); border-radius: 4px; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.feed-heat-card h3 { margin: 7px 0 7px; color: #fff; font-size: 1rem; line-height: 1.25; overflow-wrap: break-word; word-break: normal; }
.feed-heat-no-image h3 { color: var(--text-primary); }
.feed-heat-rank-1 h3 { max-width: 720px; font-size: clamp(1.55rem, 3vw, 2.3rem); line-height: 1.1; }
.feed-heat-card p { margin: 10px 0 0; max-width: 640px; color: rgba(244,248,252,0.76); font-size: 0.78rem; line-height: 1.45; }
.feed-heat-no-image p { color: var(--text-secondary); }
.feed-heat-bar { position: absolute; inset: auto auto 0 0; width: var(--story-heat); height: 2px; background: linear-gradient(90deg, var(--kin-blue), var(--kin-cyan)); opacity: 0.86; }

@media (max-width: 1120px) {
  body.kin-feed-page .feed-layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  body.kin-feed-page .feed-sidebar-right { display: none; }
}

@media (max-width: 768px) {
  body.kin-feed-page .feed-layout { display: flex; }
  body.kin-feed-page .feed-center { padding: calc(env(safe-area-inset-top) + 76px) 16px calc(112px + env(safe-area-inset-bottom)); }
  .kin-feed-header { min-height: 42px; }
  .kin-feed-header h1 { font-size: 1.55rem; }
  .feed-category-tabs { margin: 16px -16px 26px; padding: 0 16px; scroll-padding-inline: 16px; }
  .feed-category-tab { min-height: 38px; padding-inline: 14px; }
  .feed-section + .feed-section { margin-top: 28px; }
  .feed-heat-grid { display: flex; flex-direction: column; gap: 9px; }
  .feed-heat-card { width: 100%; min-height: 126px; grid-column: auto; grid-row: auto; }
  .feed-heat-rank-1 { min-height: 280px; }
  .feed-heat-rank-2,
  .feed-heat-rank-3 { min-height: 0; }
  .feed-heat-rank-4,
  .feed-heat-rank-5,
  .feed-heat-rank-6 { min-height: 0; }
  .feed-heat-copy,
  .feed-heat-rank-1 .feed-heat-copy { min-width: 0; padding: 18px; }
  .feed-heat-rank-2 .feed-heat-copy,
  .feed-heat-rank-3 .feed-heat-copy { padding: 16px 17px; }
  .feed-heat-rank-4 .feed-heat-copy,
  .feed-heat-rank-5 .feed-heat-copy,
  .feed-heat-rank-6 .feed-heat-copy { padding: 12px 14px; }
  .feed-heat-card h3,
  .feed-heat-rank-1 h3 { max-width: none; font-size: 1.05rem; line-height: 1.28; overflow-wrap: break-word; word-break: normal; }
  .feed-heat-rank-1 h3 { font-size: 1.45rem; line-height: 1.14; }
  .feed-heat-rank-2 h3,
  .feed-heat-rank-3 h3 { font-size: 1.02rem; line-height: 1.24; }
  .feed-heat-rank-4 h3,
  .feed-heat-rank-5 h3,
  .feed-heat-rank-6 h3 { font-size: 0.94rem; line-height: 1.26; }
  .feed-heat-card p { display: none; }
  .feed-story-card { min-height: 104px; grid-template-columns: 112px minmax(0, 1fr); gap: 11px; padding: 9px; }
  .feed-story-text-only { grid-template-columns: minmax(0, 1fr); padding: 12px 13px; }
  .feed-story-image { width: 112px; height: 82px; }
  .feed-story-copy h3 { font-size: 0.9rem; overflow-wrap: break-word; word-break: normal; }
  .feed-story-copy p { display: none; }
}

@media (max-width: 430px) {
  .feed-story-card { grid-template-columns: 96px minmax(0, 1fr); }
  .feed-story-text-only { grid-template-columns: minmax(0, 1fr); }
  .feed-story-image { width: 96px; }
  .feed-heat-rank-1 { min-height: 260px; }
}

/* ── 28. SCROLLBAR POLISH ─────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── 29. AI MODE ──────────────────────────────────────────────── */
.ch-ai .channel-icon { color: var(--kin-cyan); }
.ch-ai.feed-nav-link-active { color: var(--kin-cyan); background: var(--kin-nav-active); }

/* The page is the chat: no header, no breadcrumb; the center column becomes a fixed-height flex column. */
body.ai-page .feed-center {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
body.ai-page .kin-alerts { margin: 12px 16px 0; }

.ai-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
/* Watermark: lives on the non-scrolling shell, so it stays put while .ai-messages scrolls over it.
   Opacity is capped so --text-dim on the page background keeps >= 4.5:1 (AA) in both themes. */
.ai-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('/static/kin-mark.png') center 42% / min(240px, 55%) no-repeat;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}
.ai-shell > * { position: relative; z-index: 1; }

.ai-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 40px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
/* Anchor the thread to the composer so short conversations sit at the bottom. */
.ai-messages > :first-child { margin-top: auto; }
/* Cards use overflow:hidden, which would let flexbox squash them instead of scrolling the list. */
.ai-messages > * { flex-shrink: 0; }

.ai-row { display: flex; width: 100%; }
.ai-row-user { justify-content: flex-end; }
.ai-row-assistant, .ai-row-error { justify-content: flex-start; }

.ai-bubble {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 0.93rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: normal;
}
.ai-row-user .ai-bubble {
  background: var(--accent-soft);
  border: 1px solid rgba(0,207,245,0.22);
  border-bottom-right-radius: 6px;
  color: var(--text-primary);
}
.ai-row-assistant .ai-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  color: var(--text-primary);
}
.ai-row-error .ai-bubble {
  background: var(--danger-dim);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.ai-typing { display: inline-flex; gap: 5px; align-items: center; min-height: 40px; }
.ai-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-dim);
  animation: ai-bounce 1.1s infinite ease-in-out;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }

/* Tool receipts under an assistant message */
.ai-events { display: flex; flex-direction: column; gap: 6px; max-width: 86%; }
.ai-event {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
}
.ai-event svg { width: 14px; height: 14px; flex-shrink: 0; }
.ai-event-done svg { color: var(--success); }
.ai-event-error { color: var(--danger); border-color: var(--danger-border); background: var(--danger-dim); }
.ai-event-notice { color: var(--text-dim); background: transparent; border-style: dashed; }
.ai-event-notice svg { color: var(--text-dim); }
.ai-event-read svg { color: var(--accent); }
.ai-event-undone { color: var(--text-secondary); border-style: dashed; }
.ai-event-undone svg { color: var(--text-dim); }
.ai-event-old { color: var(--text-dim); text-decoration: line-through; }
.ai-event > span { flex: 1; min-width: 0; }
.ai-undo-btn {
  flex-shrink: 0;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-strong);
}
.ai-undo-btn:hover { color: var(--text-primary); background: var(--surface-2); transform: none; box-shadow: none; }

/* Cards: approve-before-apply and estimated meal */
.ai-card {
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.ai-pending-card { border-color: rgba(245,158,11,0.32); }
.ai-card-title {
  padding: 12px 16px 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.ai-card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-right: 12px; }
.ai-card-title-row .ai-card-title { flex: 1; min-width: 0; }
.ai-card-actions { display: flex; gap: 10px; padding: 12px 16px 16px; }
.ai-card-actions .btn { flex: 1; }
.ai-card-hint { margin: 0; padding: 10px 16px 0; font-size: 0.78rem; color: var(--text-dim); }
.ai-card-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  vertical-align: middle;
}
/* Rows the latest correction touched (new or changed) */
.ai-changed { position: relative; color: var(--text-primary); }
.ai-changed::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.ai-plan-ex.ai-changed .ai-plan-ex-detail,
.fuel-item.ai-changed .fuel-item-cal { color: var(--accent); font-weight: 650; }
.ai-plan-day-name.ai-changed::before { top: 1px; bottom: 1px; }
select.ai-meal-type.ai-changed { border-color: var(--accent); }
.ai-card-removed { padding: 8px 16px 0; font-size: 0.78rem; color: var(--text-dim); }
.ai-card-removed-label { font-weight: 650; }

.ai-pending-list { list-style: none; margin: 8px 16px 0; padding: 0; display: grid; gap: 4px; font-size: 0.88rem; }
.ai-pending-list[hidden] { display: none; }
.ai-pending-list li { padding: 7px 0; border-top: 1px solid var(--border); }
.ai-pending-list-inline li:first-child { border-top: 0; }
.ai-plan-name { padding: 6px 16px 0; font-size: 1.1rem; font-weight: 800; }
.ai-plan-day { padding: 10px 16px 0; }
.ai-plan-day-name { font-weight: 700; font-size: 0.9rem; color: var(--accent); }
.ai-plan-ex-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: 0.86rem; }
.ai-plan-ex { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 3px 0; }
.ai-plan-ex-name { min-width: 0; color: var(--text-primary); overflow-wrap: anywhere; }
.ai-plan-ex-detail { flex-shrink: 0; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ai-plan-ex-empty { color: var(--text-dim); font-style: italic; }
.ai-details { padding: 10px 16px 0; }
.ai-details-toggle {
  min-height: 28px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 600;
}
.ai-details-toggle:hover { color: var(--text-secondary); background: transparent; transform: none; box-shadow: none; }
.ai-details .ai-pending-list { margin: 4px 0 0; font-size: 0.78rem; color: var(--text-dim); }

.ai-meal-card .fuel-items-preview { margin: 8px 16px 0; }
.ai-meal-card .fuel-preview-description { padding: 10px 16px 0; font-size: 0.88rem; }
.ai-meal-total { padding: 10px 16px 0; font-size: 0.84rem; font-weight: 650; color: var(--text-secondary); }
.ai-meal-type {
  width: auto;
  min-height: 32px;
  margin: 10px 0 0;
  padding: 4px 30px 4px 10px;
  font-size: 0.8rem;
  border-radius: 8px;
}

/* Composer pinned to the bottom; clears the iOS home indicator. */
.ai-composer-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
}
.ai-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.ai-chips[hidden] { display: none; }

.ai-composer {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ai-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ai-composer input[type="text"] {
  flex: 1;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 9px 4px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px; /* prevents iOS zoom on focus */
}
.ai-composer input[type="text"]:focus { outline: none; border: 0; box-shadow: none; background: transparent; }
.ai-icon-btn,
.ai-composer > .ai-send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
}
.ai-icon-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
}
.ai-icon-btn:hover { color: var(--text-primary); background: var(--surface-hover); transform: none; box-shadow: none; }
.ai-icon-btn svg { width: 20px; height: 20px; }
.ai-composer > .ai-send-btn {
  border: 0;
  background: var(--kin-gradient);
  color: #fff;
}
.ai-composer > .ai-send-btn:hover { transform: none; box-shadow: var(--kin-glow); filter: none; }
.ai-composer > .ai-send-btn:disabled { opacity: 0.45; box-shadow: none; }
.ai-composer > .ai-send-btn svg { width: 18px; height: 18px; stroke: #fff; stroke-width: 2.2; }

@media (max-width: 768px) {
  /* Lock the page to the viewport; only the message list scrolls. */
  body.ai-page.feed-page { height: 100dvh; overflow: hidden; }
  body.ai-page .feed-layout { height: 100dvh; overflow: hidden; }
  body.ai-page .feed-center {
    flex: 1;
    min-height: 0;
    padding: calc(env(safe-area-inset-top) + 60px) 0 0;
    overflow: hidden;
  }
  .ai-messages { padding: 28px 12px 10px; }
  .ai-bubble { max-width: 90%; }
  .ai-events { max-width: 92%; }
  .ai-composer-wrap { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .ai-icon-btn,
  .ai-composer > .ai-send-btn { width: 42px; height: 42px; min-height: 42px; }
  .ai-card-actions { flex-direction: column; }
}
