/* Guidance — airy, warm, minimal. */
:root {
  /* Black & white on beige. Color is semantic only, always muted:
     green = goals/progress/ahead, red = behind pace. */
  --bg: #F5EEE1;
  --surface: #FFFDF9;
  --surface-warm: #EBE2D0;
  --ink: #262320;
  --muted: #877E72;
  --faint: #B7AC9C;
  --line: #E3D8C5;
  --terra: #262320;      /* UI accent = near-black (buttons, FAB, flags, tabs) */
  --terra-soft: #D8CDBB;
  --sand: #D8C6A8;
  --ahead: #6E8760;      /* muted green — goals, progress, ahead of pace */
  --behind: #AC5A50;     /* muted red — behind pace */
  --shadow: 0 1px 2px rgba(38,35,32,.05), 0 8px 30px rgba(38,35,32,.07);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-weight: 400;
  -webkit-font-smoothing: antialiased; letter-spacing: .01em;
  display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden;
}
.serif { font-family: Fraunces, Georgia, serif; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---- Screens (loading / login) ---- */
.screen { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 22rem; text-align: center; }
.login-card h1 { font-family: Fraunces, serif; font-weight: 500; font-size: 30px; }
.login-card h1 .dot { color: var(--terra); }
.login-card p.tag { color: var(--muted); margin: 6px 0 20px; }
#login-form { display: flex; flex-direction: column; gap: 10px; }
#login-form input { font: inherit; font-size: 15px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); color: var(--ink); text-align: center; }
#login-form input:focus { outline: none; border-color: var(--terra); }
#login-form button { font: inherit; font-size: 15px; font-weight: 500; padding: 13px; border: none;
  border-radius: 12px; background: var(--terra); color: #fff; cursor: pointer; }
#login-msg { color: var(--muted); font-size: 13px; margin-top: 12px; min-height: 18px; }
.warning { color: var(--behind); font-size: 13px; margin-top: 14px; }
code { background: rgba(150,130,100,.15); padding: 0 .3em; border-radius: 5px; font-size: .9em; }

/* ---- Top bar ---- */
header.top { display: flex; align-items: baseline; justify-content: space-between;
  padding: 22px 26px 10px; max-width: 1040px; width: 100%; margin: 0 auto; }
.wordmark { font-family: Fraunces, serif; font-weight: 500; font-size: 20px; letter-spacing: .02em; }
.wordmark .dot { color: var(--terra); }
.top-right { display: flex; align-items: center; gap: 14px; }
.today-date { font-size: 12.5px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.menu-btn { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; padding: 2px 6px; }
.menu-btn:hover { color: var(--terra); }
.menu { position: absolute; right: 22px; top: 58px; z-index: 45; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; min-width: 160px; }
.menu button { display: block; width: 100%; text-align: left; font: inherit; font-size: 14px; padding: 11px 16px;
  background: none; border: none; color: var(--ink); cursor: pointer; }
.menu button:hover { background: var(--surface-warm); }

/* ---- Breadcrumb ---- */
.crumbs { max-width: 1040px; width: 100%; margin: 0 auto; padding: 4px 26px 0;
  display: flex; align-items: center; gap: 8px; min-height: 26px; }
.crumb { background: none; border: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; padding: 3px 0; }
.crumb:hover { color: var(--terra); }
.crumb.here { color: var(--ink); }
.crumb-sep { color: var(--faint); font-size: 12px; }

/* ---- Stage / views ---- */
main.stage { flex: 1; max-width: 1040px; width: 100%; margin: 0 auto; padding: 0 20px 150px; position: relative; }
.view { display: none; animation: fade .5s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: scale(.985) translateY(6px); } to { opacity: 1; transform: none; } }
.view-intro { text-align: center; padding: 18px 0 6px; }
.view-intro h1 { font-family: Fraunces, serif; font-weight: 400; font-size: 27px; letter-spacing: .01em; }
.view-intro p { color: var(--muted); font-size: 14px; margin-top: 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.empty button { margin-top: 14px; font: inherit; font-size: 14px; padding: 10px 18px; border-radius: 22px;
  background: var(--terra); color: #fff; border: none; cursor: pointer; }

/* ---- Range SVG ---- */
.range-wrap { width: 100%; }
svg.range { width: 100%; height: auto; display: block; overflow: visible; }
.peak-hit { cursor: pointer; }
.peak-fill { fill: #CFC0A2; transition: fill .3s; }   /* shaded left face */
.peak-hit:hover .peak-fill { fill: #C8B896; }
.peak-light { fill: #E7DECB; }                        /* lighter right face */
.trail { stroke: var(--faint); stroke-width: 1.4; stroke-dasharray: 2 5; stroke-linecap: round; fill: none; }
.pace-ring { fill: var(--bg); stroke: var(--muted); stroke-width: 1.6; }
.prog-dot { fill: var(--terra); }
.prog-dot.ahead { fill: var(--ahead); }
.prog-dot.behind { fill: var(--behind); }
.summit-flag { fill: var(--terra); }
.flag-pole { stroke: var(--terra); stroke-width: 1.8; stroke-linecap: round; }
.dname { font-family: Fraunces, serif; font-size: 17px; fill: var(--ink); text-anchor: middle; }
.dnote { font-family: Inter, sans-serif; font-size: 11.5px; text-anchor: middle; letter-spacing: .02em; }
.dnote.ahead { fill: var(--ahead); }
.dnote.behind { fill: var(--behind); }
.dpct { font-family: Inter, sans-serif; font-size: 11px; fill: var(--muted); text-anchor: middle; }
.legend { display: flex; gap: 22px; justify-content: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--terra); display: inline-block; }
.lg-ring { width: 9px; height: 9px; border-radius: 50%; border: 1.6px solid var(--muted); display: inline-block; }

/* ---- Domain (zoomed) view ---- */
.domain-head { text-align: center; padding: 10px 0 2px; }
.domain-head h2 { font-family: Fraunces, serif; font-weight: 400; font-size: 25px; }
.domain-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
svg.climb { width: 100%; height: auto; display: block; overflow: visible; max-height: 62vh; }
.waypoint-hit { cursor: pointer; }
.wp-node { fill: var(--surface); stroke: var(--line); stroke-width: 1.4; transition: stroke .25s; }
.waypoint-hit:hover .wp-node { stroke: var(--terra); }
.wp-prog { fill: none; stroke: var(--ahead); stroke-width: 3.2; stroke-linecap: round; }
.wp-tier { font-family: Inter, sans-serif; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; fill: var(--faint); }
.wp-label { font-family: Inter, sans-serif; font-size: 12.5px; fill: var(--ink); }
.wp-sub { font-family: Inter, sans-serif; font-size: 11px; fill: var(--muted); }
.climb-trail { fill: none; stroke: var(--faint); stroke-width: 1.6; stroke-dasharray: 2 6; stroke-linecap: round; }
.you-marker { fill: var(--ahead); }
.add-sub-btn { display: block; margin: 8px auto 0; font: inherit; font-size: 13px; padding: 9px 18px;
  border-radius: 22px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); cursor: pointer; }
.add-sub-btn:hover { border-color: var(--terra); color: var(--terra); }

/* ---- Detail view ---- */
.detail-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; box-shadow: var(--shadow); margin-top: 14px; }
.detail-card h2 { font-family: Fraunces, serif; font-weight: 400; font-size: 22px; padding-right: 60px; }
.edit-btn { background: none; border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 12px;
  padding: 4px 12px; border-radius: 20px; cursor: pointer; transition: color .15s, border-color .15s; }
.edit-btn:hover { color: var(--ink); border-color: var(--faint); }
.domain-head .edit-btn { margin-top: 10px; }
.detail-card .edit-btn { position: absolute; top: 18px; right: 18px; }
.btn.danger { color: var(--behind); }
.btn.danger:hover { border-color: var(--behind); }
.range-add { text-align: center; margin-top: 14px; }
.detail-tier { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 3px; }
.pace-bar-wrap { margin: 16px 0 6px; }
.pace-bar { position: relative; height: 10px; background: var(--surface-warm); border-radius: 20px; }
.pace-fill { position: absolute; inset: 0 auto 0 0; background: var(--ahead); border-radius: 20px; }
.pace-tick { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--muted); border-radius: 2px; }
.pace-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.detail-progress { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.detail-progress input[type=range] { flex: 1; accent-color: var(--ahead); }
.daytracker { margin-top: 16px; }
.daygrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 6px; max-width: 360px; }
.daycell { aspect-ratio: 1; border-radius: 4px; background: #E7DECB; min-width: 0; }
.daycell.blank { background: transparent; }
.daycell.future { background: #F0E9DB; }
.daycell.l0 { background: #E7DECB; }
.daycell.l1 { background: #C3D0B4; }
.daycell.l2 { background: #94AE82; }
.daycell.l3 { background: #6E8760; }
.daycell.is-today { outline: 1.7px solid var(--ink); outline-offset: -1.7px; }
.day-legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.day-legend .daycell { width: 11px; height: 11px; aspect-ratio: auto; }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 22px 0 8px; }
.sg, .task-row { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.sg .sg-title { flex: 1; font-size: 14.5px; }
.sg .mini-bar { width: 82px; height: 5px; background: var(--surface-warm); border-radius: 20px; overflow: hidden; }
.sg .mini-fill { height: 100%; background: var(--ahead); }
.sg .sg-pct { font-size: 11.5px; color: var(--muted); width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.sg .chev { color: var(--faint); font-size: 15px; cursor: pointer; }
.task-row .cbox { width: 18px; height: 18px; border-radius: 50%; border: 1.6px solid var(--faint); flex: none;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.task-row .cbox.on { background: var(--ahead); border-color: var(--ahead); }
.task-row .cbox svg { width: 10px; height: 10px; stroke: #fff; opacity: 0; }
.task-row .cbox.on svg { opacity: 1; }
.task-row .tt { flex: 1; font-size: 14.5px; }
.task-row.done .tt { text-decoration: line-through; color: var(--muted); }
.task-row .q { font-size: 10px; color: var(--muted); background: var(--surface-warm); border-radius: 20px; padding: 2px 8px; }

/* ---- Today strip ---- */
.today { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(245,238,225,.9); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.today-inner { max-width: 1040px; margin: 0 auto; padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 16px; }
.today-label { font-family: Fraunces, serif; font-size: 14px; color: var(--terra); white-space: nowrap;
  display: flex; align-items: center; gap: 8px; }
.today-label .badge { font-family: Inter, sans-serif; font-size: 10.5px; color: var(--muted);
  background: var(--surface-warm); border-radius: 20px; padding: 2px 8px; }
.today-tasks { display: flex; gap: 10px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.today-tasks::-webkit-scrollbar { display: none; }
.today-empty { color: var(--muted); font-size: 13px; }
.tchip { display: flex; align-items: center; gap: 9px; white-space: nowrap; background: var(--surface);
  border: 1px solid var(--line); border-radius: 22px; padding: 8px 14px 8px 10px; font-size: 13px; cursor: pointer;
  transition: opacity .4s, transform .4s; }
.tchip .box { width: 17px; height: 17px; border-radius: 50%; border: 1.6px solid var(--faint); flex: none;
  display: inline-flex; align-items: center; justify-content: center; transition: all .3s; }
.tchip .box svg { width: 10px; height: 10px; opacity: 0; transform: scale(.4); transition: all .3s; stroke: #fff; }
.tchip .dom-tag { font-size: 10px; color: var(--muted); background: var(--surface-warm); border-radius: 20px; padding: 1px 7px; }
.tchip.done { opacity: .45; }
.tchip.done .box { background: var(--ahead); border-color: var(--ahead); }
.tchip.done .box svg { opacity: 1; transform: scale(1); }
.tchip.done .tt { text-decoration: line-through; }
.tchip.pop { animation: pop .45s ease; }
@keyframes pop { 30% { transform: scale(1.06); } 100% { transform: scale(1); } }
.fab { position: fixed; right: 22px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 31;
  width: 54px; height: 54px; border-radius: 50%; background: var(--terra); color: #fff; border: none;
  font-size: 26px; font-weight: 300; cursor: pointer; box-shadow: 0 6px 20px rgba(38,35,32,.26);
  display: flex; align-items: center; justify-content: center; transition: transform .2s; }
.fab:hover { transform: scale(1.06) rotate(90deg); }

/* ---- Sheets (guided add + sub-goal) ---- */
.sheet-scrim { position: fixed; inset: 0; background: rgba(46,42,37,.28); z-index: 40; opacity: 0;
  pointer-events: none; transition: opacity .3s; backdrop-filter: blur(2px); }
.sheet-scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 100%); width: 100%; max-width: 480px;
  background: var(--surface); border-radius: 22px 22px 0 0; z-index: 41; padding: 8px 22px 30px;
  transition: transform .34s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -10px 40px rgba(60,45,30,.14);
  max-height: 90vh; overflow-y: auto; }
.sheet.open { transform: translate(-50%, 0); }
.grip { width: 38px; height: 4px; background: var(--line); border-radius: 4px; margin: 8px auto 16px; }
.sheet h3 { font-family: Fraunces, serif; font-weight: 400; font-size: 20px; margin-bottom: 4px; }
.sheet .hint { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 7px; }
.field input[type=text], .field input[type=date] { width: 100%; font: inherit; font-size: 15px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); }
.field input:focus { outline: none; border-color: var(--terra); }
.field textarea { width: 100%; font: inherit; font-size: 15px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--bg); color: var(--ink); resize: vertical; min-height: 68px; line-height: 1.45; }
.field textarea:focus { outline: none; border-color: var(--terra); }
.field textarea::placeholder { color: var(--faint); }
.field-note { font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opt { font: inherit; font-size: 13px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 20px;
  background: var(--bg); color: var(--ink); cursor: pointer; transition: all .18s; text-align: center; }
.chip-opt[aria-pressed=true] { background: var(--terra); color: #fff; border-color: var(--terra); }
.chip-opt small { display: block; font-size: 10px; opacity: .7; }
.sheet-actions { display: flex; gap: 12px; margin-top: 22px; }
.btn { flex: 1; font: inherit; font-size: 15px; padding: 13px; border-radius: 12px; cursor: pointer; border: 1px solid var(--line); }
.btn.ghost { background: var(--bg); color: var(--muted); }
.btn.primary { background: var(--terra); color: #fff; border-color: var(--terra); font-weight: 500; }

/* ---- List views (delegate / archive) ---- */
.list-view h2 { font-family: Fraunces, serif; font-weight: 400; font-size: 24px; margin: 10px 0 4px; }
.list-view .desc { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* ---- Toast ---- */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px);
  background: var(--ink); color: var(--bg); font-size: 13px; padding: 10px 18px; border-radius: 22px; z-index: 50;
  opacity: 0; pointer-events: none; transition: all .4s; display: flex; align-items: center; gap: 9px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .spark { color: var(--sand); }
#sync { font-size: 11px; color: var(--faint); }
@media (max-width: 560px) {
  .view-intro h1 { font-size: 23px; }
  .today-label span.txt { display: none; }
}

/* ---- AI breakdown ---- */
.ai-btn { display: block; margin: 14px auto 0; font: inherit; font-size: 13px; font-weight: 500;
  padding: 10px 20px; border: 1px solid var(--ink); border-radius: 22px; background: var(--ink);
  color: var(--bg); cursor: pointer; letter-spacing: .01em; }
.ai-btn:hover { opacity: .9; }
.ai-btn:disabled { opacity: .5; cursor: default; }

.ai-sheet { max-width: 520px; }
#aiBody { max-height: 56vh; overflow-y: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.ai-summary { font-size: 14px; color: var(--ink); line-height: 1.5; margin: 2px 0 6px;
  padding: 12px 14px; background: var(--surface-warm); border-radius: 12px; }
.ai-loading { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; padding: 30px 4px; }
.ai-spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--ink);
  border-radius: 50%; animation: aispin .8s linear infinite; }
@keyframes aispin { to { transform: rotate(360deg); } }

.ai-ms-card { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
.ai-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.ai-item input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--ahead); flex: none; margin: 0; }
.ai-ms { padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ai-task { padding: 5px 0 5px 6px; }
.ai-tier { font-size: 10px; letter-spacing: .07em; color: var(--muted); flex: none; font-weight: 600; }
.ai-edit { flex: 1; font: inherit; font-size: 14px; color: var(--ink); background: none;
  border: none; border-bottom: 1px solid transparent; padding: 3px 2px; min-width: 0; }
.ai-edit:focus { outline: none; border-bottom-color: var(--line); }
.ai-edit.strong { font-weight: 500; }
.ai-quad { flex: none; font: inherit; font-size: 10.5px; font-weight: 600; letter-spacing: .03em;
  padding: 3px 9px; border-radius: 20px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.ai-quad.q-now { color: var(--behind); border-color: var(--behind); }
.ai-quad.q-plan { color: var(--ahead); border-color: var(--ahead); }
.ai-quad.q-delegate { color: var(--muted); border-color: var(--muted); }
.ai-quad.q-drop { color: var(--faint); border-color: var(--faint); }
.ai-date { flex: none; width: 124px; font: inherit; font-size: 12px; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 7px; }
.ai-date:focus { outline: none; border-color: var(--ink); color: var(--ink); }

/* ---- The Big Picture backdrop ---- */
.bp-sun { fill: var(--sand); opacity: .26; }
.bp-ridge { stroke: none; }
.bp-ridge.far { fill: var(--terra-soft); opacity: .34; }
.bp-ridge.near { fill: var(--sand); opacity: .48; }
.bp-ground { fill: var(--bg); }

/* ---- Calendar ---- */
.cal-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 2px 3px; display: flex; align-items: center; }
.cal-btn:hover { color: var(--terra); }
.cal-head { margin-bottom: 16px; }
.cal-toggle { display: flex; gap: 4px; background: var(--surface-warm); border-radius: 12px; padding: 4px; }
.cal-tab { flex: 1; font: inherit; font-size: 13px; padding: 8px 0; border: none; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.cal-tab.on { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: var(--shadow); }
.cal-head-row { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-arrow { background: none; border: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 6px; }
.cal-arrow:hover { color: var(--terra); }
.cal-title { font-family: Fraunces, serif; font-size: 18px; min-width: 150px; text-align: center; }
.cal-today { background: none; border: 1px solid var(--line); border-radius: 20px; font: inherit; font-size: 12px; color: var(--muted); padding: 6px 14px; cursor: pointer; }
.cal-today:hover { border-color: var(--terra); color: var(--terra); }

.cal-dow { display: grid; grid-template-columns: repeat(7,1fr); text-align: center; font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.cal-grid.month { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-cell { min-height: 56px; border: 1px solid var(--line); border-radius: 9px; padding: 4px 5px; cursor: pointer; background: var(--surface); display: flex; flex-direction: column; gap: 3px; }
.cal-cell.blank { border: none; background: none; cursor: default; }
.cal-cell.is-today { border-color: var(--ink); }
.cal-cell:not(.blank):hover { border-color: var(--terra); }
.cal-daynum { font-size: 11px; color: var(--muted); }
.cal-cell.is-today .cal-daynum { color: var(--ink); font-weight: 600; }
.cal-marks { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.cal-dot.q-now { background: var(--behind); }
.cal-dot.q-plan { background: var(--ahead); }
.cal-dot.q-delegate { background: var(--muted); }
.cal-dot.done { opacity: .35; }
.cal-mile { width: 8px; height: 8px; background: var(--ink); transform: rotate(45deg); border-radius: 1px; }
.cal-more { font-size: 9px; color: var(--faint); }

.cal-week .cal-wday { margin-bottom: 4px; }
.cal-wday-head { display: flex; align-items: baseline; gap: 10px; padding: 12px 2px 3px; cursor: pointer; border-bottom: 1px solid var(--line); }
.cal-wday-head .wd-name { font-family: Fraunces, serif; font-size: 15px; }
.cal-wday.is-today .wd-name { color: var(--ahead); }
.cal-wday-head .wd-num { font-size: 12px; color: var(--muted); }
.cal-empty { font-size: 12.5px; color: var(--faint); padding: 9px 2px; }
.cal-mile-row { cursor: pointer; }
.cal-mile-row .mile-ico { flex: none; font-size: 11px; color: var(--ink); }

.cal-year { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.cal-mini-title { font-size: 12.5px; font-weight: 500; margin-bottom: 6px; cursor: pointer; }
.cal-mini-title:hover { color: var(--terra); }
.cal-mini-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.mini-d { aspect-ratio: 1; border-radius: 2px; background: var(--surface-warm); }
.mini-d.blank { background: none; }
.mini-d.has { background: var(--ahead); opacity: .65; }
.mini-d.mile { background: var(--ink); opacity: .8; }
.mini-d.is-today { outline: 1.5px solid var(--ink); outline-offset: -1px; }

.cal-tray { margin-top: 24px; }

/* ---- Calendar follow-ups: badge, tappable rows, milestone pace colors ---- */
.cal-btn { position: relative; }
.cal-badge { position: absolute; top: -4px; right: -4px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 8px; background: var(--behind); color: #fff; font-size: 9.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; line-height: 1; }
.task-row.tappable { cursor: pointer; }
.task-row.tappable:hover { background: var(--surface-warm); border-radius: 8px; }
.cal-mile.ahead { background: var(--ahead); }
.cal-mile.behind { background: var(--behind); }
.cal-mile-row .mile-ico.ahead { color: var(--ahead); }
.cal-mile-row .mile-ico.behind { color: var(--behind); }
.cal-mile-row .q.ahead { color: var(--ahead); background: none; }
.cal-mile-row .q.behind { color: var(--behind); background: none; }
.mini-d:not(.blank) { cursor: pointer; }
.mini-d:not(.blank):hover { outline: 1px solid var(--faint); outline-offset: -1px; }

/* ---- Undo bar (after Break-this-down populate) ---- */
.undobar { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px); z-index: 45; display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: var(--bg); padding: 11px 12px 11px 18px; border-radius: 28px;
  box-shadow: var(--shadow); font-size: 13.5px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; max-width: calc(100% - 28px); }
.undobar.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.undobar #undoText { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.undobar button { background: none; border: 1px solid rgba(245,238,225,.35); color: var(--bg); font: inherit;
  font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 5px 13px; border-radius: 20px; flex: none; }
.undobar button:hover { background: rgba(245,238,225,.14); }
