/* ============================================================
   FitBridge — Home screen
   ============================================================ */
.home { width: 100%; display: flex; flex-direction: column; min-width: 0; padding: 22px 30px 14px; gap: 12px; }
.home-body { display: flex; gap: 20px; min-width: 0; flex: 1; align-items: stretch; }
.home-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 13px;
}
.home-rail {
  width: 360px; flex: 0 0 360px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow-soft);
  padding: 24px 22px;
  display: flex; flex-direction: column; gap: 18px;
  align-self: stretch;
}

/* top bar */
.home-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.home-topbar .greet h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.home-topbar .greet .sub { margin: 5px 0 0; color: var(--dim); font-size: 14.5px; }
.home-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 999px; padding: 11px 16px 11px 14px; min-width: 230px; color: var(--dim);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-box svg { width: 17px; height: 17px; flex: 0 0 17px; }
.search-box input { border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--ink); width: 100%; }
.search-box input::placeholder { color: var(--dim-2); }

/* stat tiles */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-md); padding: 15px 18px;
  display: flex; flex-direction: column; position: relative;
  transition: transform .15s, box-shadow .15s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--card-shadow); }
.stat .stat-icon {
  position: absolute; top: 13px; right: 15px;
  width: 30px; height: 30px; object-fit: contain;
}
.stat .value { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .value .u { font-size: 17px; color: var(--dim); font-weight: 700; margin-left: 1px; }
.stat .label { margin-top: 8px; font-size: 13px; color: var(--dim); }

/* today's tasks */
.tasks-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-md); padding: 22px 24px 16px;
}
.tasks-card .th { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.tasks-card .th h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.tasks-card .th .date { font-size: 13px; color: var(--dim); margin-top: 3px; }
.timeline {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(132px, 1fr);
  overflow-x: auto; border-top: 1px solid var(--hairline);
  scrollbar-width: thin;
}
.timeline::-webkit-scrollbar { height: 8px; }
.timeline::-webkit-scrollbar-thumb { background: #D8D0C2; border-radius: 4px; }
.tl-col {
  padding: 13px 14px; border-right: 1px solid var(--hairline);
  position: relative; min-height: 120px;
}
.tl-col:last-child { border-right: 0; }
.tl-col .tl-time { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); margin-bottom: 12px; }
.tl-col.k-event .tl-time { color: var(--crit); }
.tl-col.k-event.is-soft .tl-time { color: var(--ev-personal, #4F66E3); }
.tl-col.k-training .tl-time { color: var(--accent-strong); }
.tl-col .tl-title { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.tl-col.k-life .tl-title { color: var(--ink-2); font-weight: 500; }
.tl-col .tl-meta { margin-top: 4px; font-size: 12.5px; color: var(--dim); font-style: italic; }
.tl-col .tl-note { margin-top: 12px; font-size: 12.5px; font-weight: 600; line-height: 1.35; color: var(--crit); font-style: italic; }
/* training block: pale-orange backing layer */
.tl-col.k-training::before {
  content: ""; position: absolute; inset: 6px 4px; border-radius: 10px;
  background: var(--accent-soft); z-index: 0;
}
.tl-col.k-training > * { position: relative; z-index: 1; }
/* vertical accent rules for event/training (match mockup colored bars) */
.tl-col.k-event::after, .tl-col.k-training::after {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 14px; width: 3px; border-radius: 3px;
}
.tl-col.k-event::after { background: var(--crit); }
.tl-col.k-event.is-soft::after { background: #4F66E3; }
.tl-col.k-training::after { background: var(--accent); }
/* timeline session status — done (✓) / overdue (?); cancelled rows dropped server-side */
.tl-col .tl-badge { display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 7px; vertical-align: -3px; border-radius: 50%;
  font-size: 11px; font-weight: 800; line-height: 1; }
.tl-col.is-done .tl-badge.tl-done { background: var(--good); color: #fff; }
.tl-col.is-done .tl-badge.tl-done svg { width: 11px; height: 11px; stroke: #fff; stroke-width: 3; }
.tl-col.is-done .tl-title { color: var(--good); }
.tl-col.is-done.k-training::after { background: var(--good); }   /* bottom accent bar turns green */
.tl-col.is-overdue { opacity: .58; }                              /* de-emphasised, not alarming */
.tl-col.is-overdue .tl-time, .tl-col.is-overdue .tl-title { color: var(--dim-2); }
/* D8: "past" = the session's time has gone by (virtual clock passed it) — same grey
   de-emphasis as overdue, but NO "?" badge (it's a time-passed visual, not a missed verdict). */
.tl-col.is-past { opacity: .58; }
.tl-col.is-past .tl-time, .tl-col.is-past .tl-title { color: var(--dim-2); }
.tl-col.is-overdue .tl-badge.tl-overdue { color: var(--dim-2); border: 1.5px solid var(--dim-2); }
/* P3.2d4: a training row clashing with a work/life event today — red outline + "冲突" tag */
.tl-col.is-conflict.k-training::before { box-shadow: inset 0 0 0 2px var(--crit); background: rgba(214, 58, 106, .07); }
.tl-col.is-conflict .tl-title { color: var(--crit); }
.tl-col .tl-badge.tl-conflict { width: auto; padding: 1px 7px; border-radius: 7px;
  background: var(--crit); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .03em; }
.tasks-notes { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.tasks-notes .note { font-size: 13px; color: var(--dim); }
.tasks-notes .note b { color: var(--accent-strong); }

/* bottom row */
/* grid-template-rows: minmax(0,1fr) caps the single row to the flex-bounded height (a default
   `auto` row sizes to the tallest cell's CONTENT and overflows, which defeated the .uc-list
   scroll — the card grew to fit all events instead of being capped). */
.home-bottom { display: grid; grid-template-columns: 1.35fr 1fr; grid-template-rows: minmax(0, 1fr); gap: 14px; flex: 1; min-height: 0; }

/* 课表 card — white shell; sport block(s) flush to the left/top/bottom edges */
.kebab-card {
  background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius-md);
  padding: 0; display: grid; grid-template-columns: 1.9fr 1fr;
  position: relative; overflow: hidden; align-items: stretch;
}
/* left container bleeds 1px over the card border so blocks sit flush to the shell */
.kebab-card .kc-left {
  margin: -1px 0 -1px -1px;
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.kebab-card .kc-plan {
  flex: 1; min-height: 0;
  background: var(--plan-bg); border-radius: var(--radius-md);
  padding: 18px 20px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
/* rest day — no structured workout today (replaces the colored session block) */
.kebab-card .kc-rest {
  flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: center; text-align: center;
  color: var(--dim); padding: 24px;
}
.kebab-card .kc-rest svg { width: 40px; height: 40px; opacity: .5; }
.kebab-card .kc-rest span { font-size: 14px; font-weight: 600; max-width: 220px; line-height: 1.45; }
.kebab-card .kc-more {
  margin: 2px 14px 12px; padding: 8px 14px; align-self: flex-start;
  border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  background: var(--card-bg); color: var(--ink-2); font-size: 12.5px; font-weight: 700;
  cursor: pointer;
}
.kebab-card .kc-more:hover { background: var(--bg-deep); }
.kebab-card .kc-planhead { display: flex; flex-direction: column; gap: 4px; }
.kebab-card h3 { margin: 0; font-size: 19px; font-weight: 800; color: var(--plan-ink); line-height: 1.2; }
.kebab-card .kc-sub { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--plan-ink); opacity: .72; display: flex; align-items: center; gap: 8px; }
.kebab-card .kc-flag { color: var(--crit); display: inline-flex; opacity: 1; }
.kebab-card .kc-flag svg { width: 14px; height: 14px; }
.kebab-card .kc-done { color: var(--good); display: inline-flex; align-items: center; gap: 3px; font-weight: 800; opacity: 1; }
.kebab-card .kc-done svg { width: 13px; height: 13px; }
/* charts sit directly on the colored block — bars grow to fill height */
.kebab-card .kc-charts { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; justify-content: center; }
.kebab-card .kc-charts .kebab.is-tall { flex: 1; }
.kebab-card .kc-charts .kebab.is-tall .kebab-plot { height: auto; flex: 1; min-height: 150px; border-bottom-color: rgba(30,40,60,.18); }
.kebab-card .kc-charts .kebab.is-mini .kebab-plot { height: 92px; border-bottom-color: rgba(30,40,60,.18); }
.kebab-card .kc-charts .zone-legend .zone-chip { color: var(--plan-ink); opacity: .78; }
.kebab-card .kc-charts .zone-legend .zone-chip b { color: var(--plan-ink); opacity: 1; }
.kebab-card .seg { align-self: flex-start; margin-top: 2px; background: rgba(255,255,255,.6); border-color: rgba(30,40,60,.12); }
.kebab-card .kc-plan + .kc-plan .seg { display: none; }

/* notice — bottom-aligned in the white space, asterisk bullets */
.kc-notice { display: flex; flex-direction: column; gap: 12px; justify-content: flex-end; padding: 18px 18px 18px 14px; }
.kc-notice .nt-title { font-size: 19px; font-weight: 700; font-style: italic; color: var(--ink); letter-spacing: -0.01em; }
.kc-notice .nt-list { display: flex; flex-direction: column; gap: 12px; }
.kc-notice .nt-item { display: flex; gap: 8px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.kc-notice .nt-item .nt-star { color: var(--ink-2); flex: 0 0 auto; font-weight: 600; }

/* upcoming events card — bold header, More pill, colored stacked blocks */
.urgent-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-md); padding: 22px 22px 18px;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 0;   /* allow the flex column to shrink so .uc-list can scroll within the capped row */
}
.urgent-card .uc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.urgent-card .uc-head h3 { margin: 0; font-size: 25px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.08; color: var(--ink); }
.urgent-card .uc-more {
  flex: 0 0 auto; font-size: 14px; font-weight: 700; color: #fff;
  padding: 8px 20px; border-radius: 999px;
  background: linear-gradient(120deg, #7CE0A6 0%, #45C8C6 100%);
  box-shadow: 0 6px 16px rgba(69,200,198,.35); transition: transform .12s, filter .12s;
}
.urgent-card .uc-more:hover { transform: translateY(-1px); filter: brightness(1.04); }
.urgent-card .uc-date { font-size: 16px; font-weight: 600; font-style: italic; color: var(--ink-2); margin-bottom: 2px; }
/* flex:1 + min-height:0 lets the list absorb leftover height then scroll INTERNALLY
   (default min-height:auto would instead grow the card and shove the lower panels off the
   fixed 1440x1080 frame). Header (.uc-head/.uc-date) stays put; only the events scroll. */
/* flex:1 + min-height:0 lets the list absorb leftover height and scroll, BUT the app
   shell (#frame is a fixed 1440×1080 with overflow:hidden; .screen has min-height:auto)
   doesn't always hand this chain a bounded height — so many tall events (long titles that
   wrap) grew the list and spilled past the frame edge. An explicit max-height is the hard
   cap that keeps the panel inside the frame and scrolls the overflow INTERNALLY regardless
   of the ancestor chain (U2). 460px ≈ the design's bottom-row room in the 1080 frame — the
   normal capped 5 events show in full; only an unusually tall set (long wrapping titles)
   scrolls. */
.urgent-card .uc-list { display: flex; flex-direction: column; flex: 1; min-height: 0; max-height: 460px; overflow-y: auto; scrollbar-width: thin; padding-right: 2px; }
.urgent-card .uc-list::-webkit-scrollbar { width: 7px; }
.urgent-card .uc-list::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }
.urgent-card .uc-event {
  position: relative; display: grid; grid-template-columns: minmax(120px, 0.9fr) 1fr; gap: 8px;
  border-radius: 20px; padding: 16px 20px; color: #fff;
  box-shadow: 0 10px 22px -8px rgba(20,30,50,.3);
}
.urgent-card .uc-event + .uc-event { margin-top: -14px; padding-top: 26px; }
.urgent-card .uc-event.k-urgent   { background: linear-gradient(135deg, #F2493D 0%, #E22F2C 100%); }
.urgent-card .uc-event.k-important { background: linear-gradient(135deg, #5B70F0 0%, #4658E0 100%); }
/* FitBridge-generated recurring reminder (medication / care) — a "virtual urgent" */
.urgent-card .uc-event.k-reminder { background: linear-gradient(135deg, #14B8A6 0%, #0D9488 100%); }
.urgent-card .ue-left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.urgent-card .ue-arrow { width: 26px; height: 26px; opacity: .92; }
.urgent-card .ue-arrow svg { width: 26px; height: 26px; display: block; }
.urgent-card .ue-time { font-size: 27px; font-weight: 800; font-style: italic; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.urgent-card .ue-right { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.urgent-card .ue-title { font-size: 19px; font-weight: 800; line-height: 1.15; }
.urgent-card .ue-meta { margin-top: 5px; font-size: 13px; font-weight: 500; color: rgba(255,255,255,.85); text-transform: capitalize; }
.urgent-empty { display: grid; place-items: center; flex: 1; text-align: center; color: var(--dim); font-size: 14px; gap: 6px; }
.urgent-empty .big { width: 40px; height: 40px; opacity: .4; }

/* ---------- right rail ---------- */
.profile { display: flex; align-items: center; gap: 14px; }
.profile .pf-av { width: 58px; height: 58px; border-radius: 50%; flex: 0 0 58px; font-size: 19px; position: relative; }
.profile .pf-av::after { content: ""; position: absolute; bottom: 2px; right: 2px; width: 13px; height: 13px; background: var(--good); border-radius: 50%; border: 2px solid #fff; }
.profile h3 { margin: 0; font-size: 18px; font-weight: 800; white-space: nowrap; }
.profile p { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.profile-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
  padding: 14px 0;
}
.profile-stats > div { padding: 0 8px; }
.profile-stats > div + div { border-left: 1px solid var(--hairline); }
.profile-stats .k { font-size: 11.5px; color: var(--dim); }
.profile-stats .v { font-size: 15px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }

.rail-block { display: flex; flex-direction: column; gap: 10px; }
.rail-block .rb-head { display: flex; align-items: baseline; justify-content: space-between; }
.rail-block .rb-head h4 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.rail-block .rb-head .rb-sub { font-size: 14px; color: var(--ink-2); font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.rail-block .rb-head .rb-caret { color: var(--dim-2); font-size: 13px; }

/* mini-calendar block (month ↔ rolling) */
.cal-block { position: relative; }
.rb-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  padding: 4px 8px; margin: -4px -8px; border-radius: 9px;
  transition: background .12s;
}
.rb-trigger:hover { background: var(--hover-tint); }
.rb-trigger .rb-caret { color: var(--dim-2); font-size: 13px; }
.cal-body { min-height: 254px; }
.act-roll { max-height: 254px; overflow-y: auto; scrollbar-width: thin; }
.act-roll::-webkit-scrollbar { width: 7px; }
.act-roll::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }
.act-roll-grid { gap: 6px 0; }

/* popover */
.cal-pop {
  position: absolute; top: 38px; right: 0; z-index: 30;
  width: 244px; background: var(--card-bg);
  border: 1px solid var(--card-border); border-radius: var(--radius-md);
  box-shadow: 0 18px 44px -14px rgba(20,30,50,.32), 0 2px 8px rgba(20,30,50,.08);
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.cal-toggle {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 11px 12px; border-radius: 11px; background: var(--accent-soft);
  font-size: 13.5px; font-weight: 700; color: var(--accent-strong);
  transition: filter .12s;
}
.cal-toggle:hover { filter: brightness(.97); }
.cal-toggle .ct-ic { display: inline-flex; }
.cal-toggle .ct-ic svg { width: 17px; height: 17px; }
.cal-pop-sep { height: 1px; background: var(--hairline); }
.cal-pop-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); padding: 0 4px; }
.cal-monthlist { max-height: 196px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; scroll-snap-type: y proximity; }
.cal-monthlist::-webkit-scrollbar { width: 7px; }
.cal-monthlist::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }
.cal-month-row {
  text-align: left; padding: 9px 12px; border-radius: 9px; scroll-snap-align: center;
  font-size: 14px; font-weight: 600; color: var(--ink-2); transition: background .12s;
}
.cal-month-row:hover { background: var(--hover-tint); }
.cal-month-row.is-sel { background: var(--accent); color: #fff; font-weight: 700; }

/* month calendar — colored disc behind the date number, stacked sticker dots */
.act-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px 0; }
.act-dow { text-align: center; font-size: 13px; font-weight: 500; color: var(--dim); padding-bottom: 6px; }
.act-cell { height: 38px; display: flex; align-items: center; justify-content: center; position: relative; }
.act-cell.is-empty { height: 38px; }
.act-cell.dim .ac-num { color: var(--dim-2); }
.act-cell.dim { opacity: .55; }
.ac-discs { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ac-disc { position: absolute; width: 36px; height: 36px; border-radius: 50%; }
.ac-disc.pri { z-index: 1; box-shadow: 0 1px 3px rgba(20,30,50,.12); }
.ac-disc.sec { z-index: 0; box-shadow: 0 1px 2px rgba(20,30,50,.12); }
.ac-disc.sec-0 { transform: translate(11px, -3px); }
.ac-disc.sec-1 { transform: translate(-10px, 5px); }
.ac-num { position: relative; z-index: 2; font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.act-cell.is-today .ac-disc.pri { background: var(--accent); }
.act-cell.is-today .ac-num { color: #fff; font-weight: 700; }

/* week adherence */
.adh-list { display: flex; flex-direction: column; gap: 6px; }
.adh-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 12px; border-radius: 999px; overflow: hidden; background: var(--bg); }
.adh-row .adh-fill { position: absolute; inset: 0; border-radius: 999px; opacity: .5; }
.adh-row .adh-name { position: relative; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; }
.adh-row .adh-val { position: relative; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.adh-row .adh-val.muted { color: var(--dim); font-weight: 600; }
.adh-row .imp-tag { background: var(--crit); color: #fff; font-size: 9px; font-weight: 800; padding: 2px 7px; border-radius: 999px; letter-spacing: 0.05em; }
.adh-hi { margin-top: 4px; }

/* compose / chat entry (sidebar bottom opens this) is global toast-free input at rail bottom */
