/* planner.css: `#/planner`. Swiss booklet: hairline rules, hanging numerals, no card shadows.
   Tokens come from base.css; view-local ones live on .planner-wrap / .pl-sheet-root. */
.planner-wrap, .pl-sheet-root {
  --pl-ink: var(--text, #0e0e0e); --pl-mute: var(--muted, #6b6b66); --pl-line: var(--line, #dcdcd6);
  --pl-paper: var(--panel, #fff); --pl-ground: var(--panel2, #f5f5f2); --pl-accent: var(--accent, #2447f9);
  --pl-ease: var(--ease-out, cubic-bezier(.22,1,.36,1));
  --pl-warn: var(--warn, #b7791f); --pl-good: var(--good, #0f9d58); --pl-bad: var(--bad, #e5322d);
  --c-eco: #0f8f8f; --c-bus: #b7791f; --c-mgt: #0e0e0e; --c-isa: #2447f9; --c-psy: #2447f9; --c-personal: transparent;
}
[data-theme="dark"] .planner-wrap, [data-theme="dark"] .pl-sheet-root { --c-eco: #35c4c4; --c-bus: #e6a93d; --c-mgt: #f2f2ee; --c-isa: #6b86ff; --c-psy: #6b86ff; }

.planner-wrap { max-width: 1120px; font-variant-numeric: tabular-nums; color: var(--pl-ink); }
.planner-wrap button, .pl-sheet-root button, .planner-wrap a, .pl-sheet-root input, .pl-sheet-root label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.planner-wrap :focus-visible, .pl-sheet-root :focus-visible { outline: 2px solid var(--pl-accent); outline-offset: 2px; }
.pl-ico { flex: none; }
.pl-muted { color: var(--pl-mute); }
.pl-sub { color: var(--pl-mute); font-size: 13px; }
.planner-wrap h1 { font-size: clamp(34px, 7vw, 64px); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; text-wrap: balance; margin: 4px 0 0; }
.planner-wrap h2 { font-size: 20px; line-height: 1.2; font-weight: 600; margin: 0; }
.planner-wrap h3 { font-size: 17px; line-height: 1.25; font-weight: 600; margin: 0; }
.planner-wrap p { margin: 0; }

/* dots: shape + code text always accompany colour */
.pl-dot { display: inline-block; width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--dc, currentColor); }
.c-eco { --dc: var(--c-eco); }
.c-bus { --dc: var(--c-bus); border-radius: 2px; }
.c-mgt { --dc: var(--c-mgt); border-radius: 1px; transform: rotate(45deg) scale(.85); box-shadow: 0 0 0 2px #ffd84a; }
.c-isa, .c-psy { --dc: var(--c-isa); }
.c-personal { background: transparent; box-shadow: inset 0 0 0 1.75px var(--pl-mute); }

/* header */
.pl-head { display: flex; flex-wrap: wrap; gap: 16px 24px; justify-content: space-between; align-items: flex-end; padding-bottom: 24px; }
.pl-status { color: var(--pl-mute); font-size: 13px; margin-top: 12px; }
.pl-head-actions { display: flex; gap: 8px; }
.planner-wrap .btn, .pl-sheet-root .btn { min-height: 44px; border-radius: 10px; gap: 8px; transition: transform .12s var(--pl-ease); }
.planner-wrap .btn:active, .pl-sheet-root .btn:active, .pl-icon-btn:active, .pl-pill-btn:active, .pl-chip:active { transform: scale(.97); }
@media (pointer: coarse) { .planner-wrap .btn, .pl-sheet-root .btn { min-height: 48px; } }

/* sections */
.pl-sec { border-top: 1px solid var(--pl-line); padding: 32px 0 40px; }
.pl-sec-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 20px; }
.pl-sec-h .pl-sub { margin-right: auto; }
.pl-sec-h h2 + .pl-sub { margin-left: 0; }

/* next assessment */
.pl-next { border-top: 1px solid var(--pl-ink); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; padding: 28px 0 40px; align-items: end; }
.pl-next-empty { grid-column: 1 / -1; display: grid; gap: 12px; justify-items: start; }
.pl-kicker { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--pl-mute); }
.pl-course { display: inline-flex; align-items: center; gap: 8px; color: var(--pl-ink); }
.pl-next-title { font-size: clamp(26px, 5vw, 44px) !important; font-weight: 800 !important; line-height: 1.05 !important; letter-spacing: -.015em; margin: 12px 0 8px !important; text-wrap: balance; }
.pl-next-date { font-size: 17px; font-weight: 500; margin-bottom: 12px; }
.pl-next-scope { color: var(--pl-mute); max-width: 62ch; font-size: 15px; line-height: 1.5; margin-bottom: 20px !important; overflow-wrap: anywhere; }
.pl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pl-next-scope + .pl-actions { margin-top: 0; }
.pl-cd { display: flex; align-items: flex-start; gap: clamp(16px, 3vw, 32px); }
.pl-cd-g { display: grid; justify-items: start; gap: 4px; }
.pl-cd-n { font-size: clamp(56px, 10vw, 112px); font-weight: 800; line-height: .9; letter-spacing: -.04em; font-stretch: 104%; }
.pl-cd-u { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--pl-mute); }
.pl-cd-note { align-self: end; font-size: 13px; }
.pl-cd-live { font-size: 20px; font-weight: 600; }

/* week */
.pl-nav { display: flex; gap: 8px; align-items: center; }
.pl-icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 1px solid var(--pl-line); background: var(--pl-paper); color: var(--pl-ink); border-radius: 10px; padding: 0; transition: transform .12s var(--pl-ease), border-color .12s; }
.pl-pill-btn { min-height: 44px; padding: 0 18px; border: 1px solid var(--pl-line); background: var(--pl-paper); color: var(--pl-ink); border-radius: 999px; font-size: 15px; font-weight: 600; transition: transform .12s var(--pl-ease); }
@media (pointer: coarse) { .pl-icon-btn { width: 48px; height: 48px; } .pl-pill-btn { min-height: 48px; } }
@media (hover: hover) { .pl-icon-btn:hover, .pl-pill-btn:hover { border-color: var(--pl-ink); } }
.pl-filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 14px; margin: 0 -2px; scrollbar-width: none; overscroll-behavior-x: contain; }
.pl-filters::-webkit-scrollbar { display: none; }
.pl-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--pl-line); background: var(--pl-paper); color: var(--pl-ink); font-size: 15px; font-weight: 500; white-space: nowrap; transition: transform .12s var(--pl-ease), background-color .12s, color .12s; }
.pl-chip[aria-pressed="true"] { background: var(--pl-ink); color: var(--pl-paper); border-color: var(--pl-ink); }
.pl-chip[aria-pressed="true"] .c-mgt { --dc: var(--pl-paper); }
@media (pointer: coarse) { .pl-chip { min-height: 48px; } }
@media (hover: hover) { .pl-chip:hover { border-color: var(--pl-ink); } }

.pl-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--pl-line); border-bottom: 1px solid var(--pl-line); min-height: 240px; }
.pl-day { padding: 12px 10px 16px; border-left: 1px solid var(--pl-line); min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pl-day:first-child { border-left: 0; padding-left: 0; }
.pl-day-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.pl-wd { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--pl-mute); width: 100%; }
.pl-dn { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.pl-mo { display: none; font-size: 13px; color: var(--pl-mute); }
.pl-today-l { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.pl-day.is-today .pl-dn { background: var(--pl-ink); color: var(--pl-paper); padding: 2px 8px; border-radius: 8px; margin-left: -2px; }
.pl-evs { display: flex; flex-direction: column; gap: 4px; }
.pl-ev { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: baseline; text-align: left; width: 100%; padding: 8px 6px; margin: 0 -6px; border: 0; border-top: 1px solid var(--pl-line); border-radius: 0; background: none; color: var(--pl-ink); width: calc(100% + 12px); }
.pl-ev:first-child { border-top: 0; }
.pl-ev .pl-dot { margin-top: 4px; grid-row: span 2; }
.pl-ev-t { font-size: 13px; color: var(--pl-mute); font-weight: 600; }
.pl-ev-m { grid-column: 2; display: grid; gap: 2px; min-width: 0; }
.pl-ev-m b { font-size: 15px; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; display: flex; gap: 4px; align-items: baseline; }
.pl-ev-m small { font-size: 13px; color: var(--pl-mute); }
@media (hover: hover) { .pl-ev:hover { background: var(--pl-ground); } }
.pl-free { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 8px; margin-left: -8px; border: 0; background: none; color: var(--pl-mute); font-size: 13px; border-radius: 8px; opacity: .8; align-self: flex-start; }
@media (hover: hover) { .pl-free:hover { background: var(--pl-ground); color: var(--pl-ink); } }

@media (max-width: 699.98px) {
  .pl-week { display: block; min-height: 0; }
  .pl-day { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 0 12px; padding: 14px 0; border-left: 0; border-top: 1px solid var(--pl-line); }
  .pl-day:first-child { border-top: 0; padding-left: 0; }
  .pl-day-h { display: grid; align-content: start; gap: 2px; }
  .pl-wd { width: auto; }
  .pl-dn { font-size: 32px; }
  .pl-mo { display: block; }
  .pl-today-l { font-size: 12px; }
  .pl-day.is-today .pl-dn { justify-self: start; }
  .pl-ev { padding: 12px 6px; min-height: 48px; }
  .pl-free { min-height: 48px; }
  .pl-day.is-empty:not(.is-today) .pl-dn { color: var(--pl-mute); font-weight: 500; }
}

/* assessments + generic rows */
.pl-as { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 4px 16px; padding: 20px 0; border-top: 1px solid var(--pl-line); }
.pl-as:first-child { border-top: 0; padding-top: 0; }
.pl-as-date { display: grid; align-content: start; justify-items: start; }
.pl-as-n { font-size: 40px; font-weight: 800; line-height: .95; letter-spacing: -.03em; }
.pl-as-mo { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--pl-mute); margin-top: 4px; }
.pl-as-body { display: grid; gap: 6px; min-width: 0; }
.pl-as-course { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.pl-as-course .pl-muted { font-weight: 400; }
.pl-as-t { all: unset; cursor: pointer; font-size: 20px; font-weight: 600; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
.pl-as-t { position: relative; }
.pl-as-t::after { content: ""; position: absolute; inset: -12px -6px; }
.pl-as-t:focus-visible { outline: 2px solid var(--pl-accent); outline-offset: 3px; border-radius: 4px; }
@media (hover: hover) { .pl-as-t:hover { text-decoration: underline; text-underline-offset: 3px; } }
.pl-as-when { font-size: 15px; font-weight: 500; }
.pl-as-scope { font-size: 15px; line-height: 1.5; color: var(--pl-mute); max-width: 68ch; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pl-as-side { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 4px; }
.pl-as.is-past { opacity: .72; }
@media (min-width: 700px) {
  .pl-as { grid-template-columns: 96px minmax(0, 1fr) 200px; gap: 4px 24px; }
  .pl-as-side { grid-column: 3; flex-direction: column; align-items: flex-start; margin-top: 0; }
}
.pl-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px 4px 8px; border-radius: 999px; border: 1px solid var(--pl-line); color: var(--pl-ink); white-space: nowrap; }
.pl-tag.s-uncertain, .pl-tag.s-overdue { color: var(--pl-bad); border-color: currentColor; }
.pl-tag.s-provisional { color: var(--pl-warn); border-color: currentColor; }
.pl-tag.s-confirmed { color: var(--pl-good); border-color: currentColor; }
.pl-textlink { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 15px; font-weight: 600; color: var(--pl-accent); }
@media (hover: hover) { .pl-textlink:hover { text-decoration: underline; text-underline-offset: 3px; } }
.pl-subh { margin: 32px 0 16px !important; font-size: 15px !important; color: var(--pl-mute); }

.pl-empty { display: grid; gap: 12px; justify-items: start; padding: 4px 0; color: var(--pl-mute); max-width: 56ch; }

/* your timetable */
.pl-plan { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--pl-line); min-height: 64px; }
.pl-plan:first-child { border-top: 0; }
.pl-plan-t { display: grid; gap: 2px; min-width: 0; }
.pl-plan-t b { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.pl-plan-t small { font-size: 13px; color: var(--pl-mute); }
.pl-plan.is-done .pl-plan-t b { text-decoration: line-through; color: var(--pl-mute); }
.pl-check { width: 48px; height: 48px; display: grid; place-items: center; padding: 0; background: none; border: 0; color: transparent; position: relative; }
.pl-check::before { content: ""; position: absolute; width: 24px; height: 24px; border: 1.75px solid var(--pl-ink); border-radius: 6px; transition: background-color .12s, transform .12s var(--pl-ease); }
.pl-check .pl-ico { position: relative; color: var(--pl-paper); }
.pl-check[aria-checked="true"]::before { background: var(--pl-ink); }
.pl-check:active::before { transform: scale(.92); }
.pl-plan .pl-icon-btn { border-color: transparent; background: none; color: var(--pl-mute); }
@media (hover: hover) { .pl-plan .pl-icon-btn:hover { color: var(--pl-bad); border-color: var(--pl-line); } }

/* rows (prep, materials, archive, sources) */
.pl-list { display: grid; }
.pl-row { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 12px 0; border-top: 1px solid var(--pl-line); color: var(--pl-ink); }
.pl-list > .pl-row:first-child { border-top: 0; }
.pl-row-t { display: grid; gap: 2px; flex: 1; min-width: 0; }
.pl-row-t b { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.pl-row-t small { font-size: 13px; color: var(--pl-mute); line-height: 1.4; }
.pl-row .pl-ico { color: var(--pl-mute); }
@media (hover: hover) { .pl-row:hover .pl-row-t b { text-decoration: underline; text-underline-offset: 3px; } .pl-row:hover .pl-ico { color: var(--pl-ink); } }
.pl-fmt { flex: none; min-width: 48px; text-align: center; font-size: 13px; font-weight: 600; letter-spacing: .04em; padding: 4px 8px; border: 1px solid var(--pl-line); border-radius: 6px; color: var(--pl-mute); }
.pl-sublinks { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 15px; padding-top: 4px; }
.pl-sublinks a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

.pl-disc { border-top: 1px solid var(--pl-line); }
.pl-disc:last-of-type { border-bottom: 1px solid var(--pl-line); }
.pl-disc > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; cursor: pointer; list-style: none; font-size: 20px; font-weight: 600; }
.pl-disc > summary::-webkit-details-marker { display: none; }
.pl-disc > summary::after { content: ""; width: 10px; height: 10px; border-right: 1.75px solid var(--pl-ink); border-bottom: 1.75px solid var(--pl-ink); transform: rotate(45deg); transition: transform .22s var(--pl-ease); flex: none; margin: -4px 4px 0 0; }
.pl-disc[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.pl-disc > summary .pl-sub { margin-left: auto; }
.pl-disc > div { padding: 4px 0 28px; display: grid; gap: 12px; }
.pl-disc > div > p { max-width: 68ch; font-size: 15px; line-height: 1.55; }

/* sheet: bottom sheet on phones, centred panel on desktop */
.pl-sheet-root { position: fixed; inset: 0; z-index: 90; }
.pl-scrim { position: absolute; inset: 0; background: rgba(14,14,14,.5); opacity: 0; transition: opacity .22s var(--pl-ease); }
.pl-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--pl-paper); color: var(--pl-ink); border-radius: 14px 14px 0 0; border-top: 1px solid var(--pl-line); transform: translateY(100%); transition: transform .36s var(--pl-ease); outline: none; font-variant-numeric: tabular-nums; }
.pl-sheet-root.open .pl-scrim { opacity: 1; }
.pl-sheet-root.open .pl-sheet { transform: none; }
.pl-grab { position: sticky; top: 0; height: 28px; display: grid; place-items: center; touch-action: none; cursor: grab; background: var(--pl-paper); z-index: 2; }
.pl-grab::before { content: ""; width: 40px; height: 4px; border-radius: 4px; background: var(--pl-line); }
.pl-sheet-x { position: absolute; top: 4px; right: 8px; z-index: 3; border-color: transparent; background: none; }
.pl-sheet-body { padding: 4px 20px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.pl-sheet-body p { margin: 0; }
.pl-sheet-h { font-size: 26px; line-height: 1.1; font-weight: 800; letter-spacing: -.015em; margin: 0; padding-right: 48px; text-wrap: balance; }
.pl-sheet-p { font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.pl-sheet-body .pl-tag { justify-self: start; }
.pl-sheet-body details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 15px; }
@media (min-width: 700px) {
  .pl-sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(520px, calc(100vw - 48px)); max-height: min(720px, 88dvh); border-radius: 14px; border: 1px solid var(--pl-line); transform: translate(-50%, calc(-50% + 12px)); opacity: 0; transition: transform .36s var(--pl-ease), opacity .22s var(--pl-ease); }
  .pl-sheet-root.open .pl-sheet { transform: translate(-50%, -50%); opacity: 1; }
  .pl-grab { height: 16px; cursor: default; }
  .pl-grab::before { display: none; }
  .pl-sheet-x { top: 12px; }
  .pl-sheet-body { padding: 8px 28px 28px; }
}

/* form */
.pl-form { display: grid; gap: 16px; margin-top: 4px; }
.pl-f { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--pl-mute); min-width: 0; }
.pl-f input, .pl-sheet-root .pl-f input { width: 100%; min-height: 48px; padding: 0 12px; font: inherit; font-size: 16px; font-weight: 500; color: var(--pl-ink); background: var(--pl-paper); border: 1px solid var(--pl-line); border-radius: 10px; appearance: none; -webkit-appearance: none; }
.pl-f input:focus { border-color: var(--pl-ink); }
.pl-f input[type="date"], .pl-f input[type="time"] { min-width: 0; }
.pl-f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .pl-f2 { grid-template-columns: 1fr; } }
.pl-seg { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-radius: 10px; }
.pl-seg legend { padding: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--pl-mute); }
.pl-seg label { position: relative; }
.pl-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pl-seg span { display: grid; place-items: center; min-height: 48px; border: 1px solid var(--pl-line); font-size: 15px; font-weight: 600; transition: background-color .12s, color .12s; }
.pl-seg label:first-child span { border-radius: 10px 0 0 10px; }
.pl-seg label:last-child span { border-radius: 0 10px 10px 0; border-left: 0; }
.pl-seg input:checked + span { background: var(--pl-ink); color: var(--pl-paper); border-color: var(--pl-ink); }
.pl-seg input:focus-visible + span { outline: 2px solid var(--pl-accent); outline-offset: 2px; }
.pl-form-foot { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 2fr; gap: 8px; padding: 12px 0 0; background: var(--pl-paper); }

/* first-paint stagger (transform + opacity only) */
@media (prefers-reduced-motion: no-preference) {
  .pl-first .pl-as, .pl-first .pl-plan, .pl-first .pl-row { animation: pl-rise .36s var(--pl-ease) both; animation-delay: calc(min(var(--i, 0), 8) * 30ms); }
  .pl-first .pl-next { animation: pl-rise .36s var(--pl-ease) both; }
  @keyframes pl-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  .pl-sheet, .pl-scrim, .pl-disc > summary::after, .planner-wrap *, .pl-sheet-root * { transition-duration: 0s !important; animation: none !important; }
}
@media (max-width: 699.98px) {
  .pl-next { grid-template-columns: 1fr; gap: 24px; padding: 20px 0 32px; }
  .pl-cd { order: -1; }
  .pl-head { align-items: flex-start; }
  .pl-sec { padding: 24px 0 32px; }
}
.pl-sublinks { align-items: center; }
.pl-sublinks .pl-muted { display: inline-flex; align-items: center; min-height: 44px; }
.pl-disc > summary .pl-sub { white-space: nowrap; }
@media (max-width: 479.98px) { .pl-disc > summary .pl-sub { display: none; } .pl-disc > summary { font-size: 17px; } }
.pl-ev-m b { overflow-wrap: break-word; hyphens: auto; }
@media (min-width: 700px) {
  .pl-ev { grid-template-columns: auto 1fr; gap: 4px 6px; align-items: center; }
  .pl-ev .pl-dot { grid-row: auto; margin-top: 0; }
  .pl-ev-m { grid-column: 1 / -1; }
}
