/* styles/plan.css — Plan (Week + Campaign) and Training (calm refinement,
 * ADR-0031, 2026-09-07). Shared tokens and components live in styles.css; this
 * file only adds what those two destinations need. Nothing here scrolls
 * horizontally: the only overflow-x scroller allowed on either screen is a
 * chart's own .chart-wrap. */

/* ================= Plan: the Week | Campaign switch ================= */
.pl-seg { margin: 0 0 12px; }
.pl-seg .segrow { display: flex; width: 100%; max-width: 320px; }

/* A fold that sits inside #plan-body still reads as a page-level card row
 * (styles.css only gives that to `main > .fold`). */
#plan-body > .fold {
  border-top: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0 18px; margin-top: 12px;
}
#plan-body > .fold > .fold-b { padding-bottom: 14px; }

/* ================= Plan: the Week view ================= */
.pw { padding-bottom: 10px; }
.pw-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 2px; }
.pw-title {
  font-size: 17px; font-weight: 600; margin: 0; line-height: 1.3;
  flex: 1 1 auto; min-width: 0; text-align: center;
}
.pw-arw {
  background: transparent; border: 0; color: var(--dim); cursor: pointer;
  min-width: 44px; min-height: 44px; border-radius: var(--radius-s);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.pw-arw:hover { background: var(--panel2); color: var(--txt); }
.pw-now { flex: 0 0 auto; margin-left: auto; }
.pw-sub { margin: 0 0 6px; }
.pw-empty { padding: 12px 0 4px; }

.pw-days { display: block; }
.pw-day {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px;
  align-items: start; padding: 9px 0; border-top: 1px solid var(--line);
}
.pw-day:first-child { border-top: 0; }
.pw-day.past { opacity: .82; }
.pw-dh { display: flex; align-items: baseline; gap: 6px; padding-top: 3px; }
.pw-dow { font-size: 13px; color: var(--faint); }
.pw-dn { font-size: 16px; font-weight: 600; }
.pw-day.today .pw-dow, .pw-day.today .pw-dn { color: var(--violet-bright); }
.pw-day.today .pw-dh {
  border-left: 3px solid var(--violet); margin-left: -9px; padding-left: 6px;
}
.pw-dc { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pw-none { color: var(--faint); font-size: 14px; padding-top: 3px; }
.pw-ms { display: flex; align-items: center; gap: 6px; color: var(--amber); font-size: 14px; font-weight: 600; }
.pw-ms .ic { width: 16px; height: 16px; flex: 0 0 auto; }
/* the one-line prescription in a session's summary row — clamped to one line
 * by line-clamp, never by nowrap: an unbreakable line would set the flex
 * item's min-content width and push the whole page sideways. */
.pw-det {
  flex: 1 1 100%; min-width: 0; max-width: 100%; color: var(--dim); font-size: 13.5px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
}
.pw .bd-s { background: var(--panel2); min-width: 0; }
.pw .bd-s > summary { min-width: 0; flex: 1 1 auto; max-width: 100%; }
.pw .bd-t { overflow-wrap: anywhere; }
.pw .bd-s .det { color: var(--dim); font-size: 14px; margin-top: 6px; }

/* Desktop: the same seven rows become seven columns. No horizontal scroll at
 * any width — the columns share the row and wrap their own content. */
@media (min-width: 900px) {
  .pw-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .pw-day {
    display: block; border-top: 0; padding: 8px 9px; min-height: 96px;
    background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-s);
  }
  .pw-day.today { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet) inset; }
  .pw-day.today .pw-dh { border-left: 0; margin-left: 0; padding-left: 0; }
  .pw-dh { margin-bottom: 6px; padding-top: 0; }
  .pw-dn { font-size: 15px; }
  .pw .bd-s { background: var(--panel); }
  .pw-det { -webkit-line-clamp: 3; }
  .pw-title { text-align: left; flex: 0 1 auto; }
}

/* ================= Plan: the Campaign view ================= */
.cb-head { display: flex; flex-direction: column; }
.cb-goal { font-size: 17px; font-weight: 600; line-height: 1.35; }
.cb-head .qline { margin-top: 8px; }
.cb-head-a { margin-top: 10px; }
.cb-head-a .btn { padding-left: 0; }

.cb-blocks { list-style: none; margin: 0; padding: 0; }
.cb-block { padding: 10px 0; border-top: 1px solid var(--line); }
.cb-block:first-child { border-top: 0; }
.cb-block.past { opacity: .72; }
.cb-block.now { border-left: 3px solid var(--violet); padding-left: 10px; margin-left: -10px; }
.cb-bh { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cb-bl { font-weight: 600; font-size: 15px; }
.cb-br { color: var(--dim); font-size: 14px; margin-top: 2px; }
.cb-bm { display: flex; align-items: center; gap: 6px; color: var(--amber); font-size: 14px; margin-top: 4px; }
.cb-bm .ic { width: 16px; height: 16px; flex: 0 0 auto; }

.cb-wklist { display: flex; flex-direction: column; }
.cb-wk {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  width: 100%; text-align: left; min-height: 48px; padding: 9px 6px 9px 0;
  background: transparent; border: 0; border-top: 1px solid var(--line);
  color: var(--txt); font: inherit; cursor: pointer;
}
.cb-wklist .cb-wk:first-child { border-top: 0; }
.cb-wk:hover { background: var(--panel2); }
.cb-wk.past { opacity: .78; }
.cb-wk.cur { border-left: 3px solid var(--violet); padding-left: 8px; }
.cb-wd { font-weight: 600; font-size: 14.5px; min-width: 92px; }
.cb-wb { font-size: 13.5px; color: var(--faint); }
.cb-wt { font-size: 14px; color: var(--dim); }
.cb-wa { font-size: 14px; color: var(--blue); }

.cb-dates { list-style: none; margin: 0; padding: 0; }
.cb-dates li {
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.cb-dates li:first-child { border-top: 0; }
.cb-dl { font-weight: 600; font-size: 14.5px; flex: 1 1 auto; min-width: 0; }
.cb-dd { color: var(--dim); font-size: 14px; }

.cb-chgs { margin-top: 8px; }
.cb-chg { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.cb-chg:first-child { border-top: 0; }
.cb-card h3 { font-size: 14.5px; margin-bottom: 4px; }
.cb-card + .cb-card { margin-top: 10px; }

/* One card level: a fold on Plan or Training flattens the cards inside it. */
.cb-fold .fold-b .card, .tr-fold .fold-b .card {
  background: transparent; border: 0; border-radius: 0; padding: 0;
}
.cb-fold .fold-b .card + .card { margin-top: 16px; }
/* a fold nested inside a fold is a plain row again, never a second card */
.cb-subfold { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 0; margin-top: 6px; }

/* ================= Training ================= */
.tr-nums { font-size: 17px; font-weight: 600; line-height: 1.4; }
.tr-cmp { margin-top: 6px; }
.tr-stale { margin-top: 4px; }

.tr-search { position: relative; margin: 10px 0; }
.tr-search .sh-input { margin-top: 0; padding-left: 40px; }
.tr-si {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--faint); pointer-events: none;
}
.tr-minenote { margin: -4px 0 10px; }
.tr-filterbar { margin: 0 0 10px; }
.tr-filterbar .btn { padding-left: 0; }
.hist-daterange[hidden] { display: none; }

.tr-src { color: var(--faint); margin-top: 8px; }
.tr-list .evt { flex-wrap: wrap; }
.tr-list .evt .ed { flex: 0 0 auto; min-width: 74px; }
.tr-list .evt .en { font-weight: 600; flex: 0 1 auto; min-width: 0; }
.tr-list .evt .em { flex: 1 1 130px; min-width: 0; }
.tr-list .evt .chev { display: inline-flex; }
.tr-list .evt .chev .ic { width: 18px; height: 18px; }
/* Nothing on Training scrolls sideways: a wide set list wraps instead. */
.tr-list .evtd > .details { overflow-x: visible; }
.tr-list .evtd > .details table { max-width: 100%; }
.tr-list .evtd > .details .num { text-align: left; font-family: var(--font); overflow-wrap: anywhere; white-space: normal; }
.tr-fold .fold-b h3 { margin-top: 4px; }
@media (max-width: 759px) {
  .tr-fold .fold-b .grid.g2 > div + div { margin-top: 16px; }
}
