/* ==========================================================================
   Study Planner (planner.html). Lives inside the minimal skin — every colour
   is a --m-* token from css/minimal.css, so it follows light/dark with the
   rest of the app.

   Direction: like the chat, the list *is* the page. Tasks are plain rows on
   the background with hairline dividers, not cards. The one deliberate
   object is the focus dial (minute ticks, big numerals). The accent is only
   used for progress: the dial, the goal ring, the day line, done ticks.
   ========================================================================== */

.pl-page { max-width: 1120px; margin: 0 auto; padding: 84px 24px 110px; color: var(--m-text); }

/* ── Header: date + one sentence about the day ───────────────────────── */
.pl-head { margin-bottom: 30px; max-width: 640px; }
.pl-title {
  font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
  font-size: clamp(2rem, 4.2vw, 2.75rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; margin: 0;
}
.pl-summary { margin: 10px 0 0; color: var(--m-muted); font-size: 1rem; line-height: 1.55; }
.pl-summary b { color: var(--m-text); font-weight: 600; background: none; padding: 0; }
.pl-dayline { height: 3px; border-radius: 999px; background: var(--m-faint); margin-top: 18px; max-width: 360px; overflow: hidden; }
.pl-dayline i { display: block; height: 100%; width: 0; background: var(--m-accent); border-radius: inherit; transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1); }

.pl-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: start; }
.pl-aside { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }

/* ── View switcher ───────────────────────────────────────────────────── */
.pl-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 26px; }
.pl-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--m-surface); }
.pl-tab {
  border: none; background: transparent; color: var(--m-muted); cursor: pointer;
  padding: 7px 16px; border-radius: 9px; font-size: 0.86rem; font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.pl-tab:hover { color: var(--m-text); }
.pl-tab[aria-selected="true"] { background: var(--m-bg); color: var(--m-text); box-shadow: 0 1px 2px rgba(0,0,0,0.12), 0 0 0 1px var(--m-faint); }
body[data-theme="dark"] .pl-tab[aria-selected="true"] { background: var(--m-surface-2); }
.pl-tab:focus-visible, .pl-btn:focus-visible, .pl-icon-btn:focus-visible, .pl-check:focus-visible, .pl-mode:focus-visible, .pl-play:focus-visible { outline: 2px solid var(--m-accent); outline-offset: 2px; }
.pl-kbd-hint { color: var(--m-muted); font-size: 0.74rem; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.pl-kbd-hint kbd { font: 500 0.7rem/1 'Inter', sans-serif; padding: 3px 6px; border-radius: 5px; background: var(--m-surface); color: var(--m-text); margin-left: 6px; }
.pl-kbd-hint kbd:first-child { margin-left: 0; }
@keyframes plFade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ── Section headings: sentence case, quiet ──────────────────────────── */
.pl-h { display: flex; align-items: baseline; gap: 10px; margin: 34px 0 6px; font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; }
.pl-h:first-child { margin-top: 0; }
.pl-h .pl-count { color: var(--m-muted); font-weight: 400; font-size: 0.85rem; }
.pl-h .pl-h-act { margin-left: auto; }

/* ── Quick add ───────────────────────────────────────────────────────── */
.pl-add-row {
  display: flex; align-items: center; gap: 10px; background: var(--m-surface); border-radius: 16px;
  padding: 6px 6px 6px 16px; border: 1px solid transparent; transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.pl-add-row:focus-within { border-color: var(--m-faint); background: var(--m-bg); box-shadow: 0 4px 18px rgba(0,0,0,0.06); }
.pl-add-row > svg { width: 18px; height: 18px; color: var(--m-muted); flex-shrink: 0; }
.pl-add-input { flex: 1; min-width: 0; border: none; background: transparent; color: var(--m-text); font-size: 0.98rem; padding: 10px 0; outline: none; }
.pl-add-input::placeholder { color: var(--m-muted); opacity: 0.85; }
/* The site-wide green :focus-visible ring (animations.css) doubles the pill's own focus state */
.pl-add-input:focus, .pl-add-input:focus-visible { outline: none !important; box-shadow: none !important; }
.pl-preview { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0 16px; }
.pl-preview:empty { display: none; }
.pl-tip-line { color: var(--m-muted); font-size: 0.78rem; margin: 10px 0 0 16px; }
.pl-tip-line code { font-family: inherit; font-size: inherit; color: var(--m-text); background: var(--m-surface); padding: 1px 6px; border-radius: 5px; }

/* ── Buttons & chips ─────────────────────────────────────────────────── */
.pl-btn { border: none; cursor: pointer; border-radius: 10px; padding: 9px 16px; font-size: 0.85rem; font-weight: 600; background: var(--m-text); color: var(--m-bg); transition: opacity 0.2s ease, transform 0.2s ease; }
.pl-btn:hover { opacity: 0.88; }
.pl-btn:active { transform: scale(0.97); }
.pl-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pl-btn-ghost { background: transparent; color: var(--m-text); box-shadow: inset 0 0 0 1px var(--m-faint); font-weight: 500; }
.pl-btn-ghost:hover { background: var(--m-faint); opacity: 1; }
.pl-btn-sm { padding: 6px 11px; font-size: 0.78rem; border-radius: 8px; }
.pl-btn-link { background: none; border: none; color: var(--m-muted); font-size: 0.8rem; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.pl-btn-link:hover { color: var(--m-text); }
.pl-icon-btn { border: none; background: transparent; color: var(--m-muted); cursor: pointer; width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; transition: background 0.2s ease, color 0.2s ease; flex-shrink: 0; }
.pl-icon-btn:hover { background: var(--m-faint); color: var(--m-text); }
.pl-icon-btn svg { width: 15px; height: 15px; }
.pl-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.76rem; color: var(--m-muted); white-space: nowrap; }
.pl-chip svg { width: 12px; height: 12px; opacity: 0.8; }
.pl-chip-strong { color: var(--m-text); }
.pl-chip-late { color: #b45309; }
body[data-theme="dark"] .pl-chip-late { color: #fbbf24; }
.pl-preview .pl-chip { background: var(--m-surface); padding: 3px 9px; border-radius: 999px; color: var(--m-text); }

/* ── Task rows ───────────────────────────────────────────────────────── */
.pl-list, .pl-agenda-tasks { position: relative; z-index: 0; display: flex; flex-direction: column; }
.pl-task {
  position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 13px 8px 13px 4px;
  border-bottom: 1px solid var(--m-faint);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.pl-task:last-child { border-bottom: none; }
.pl-task::before { content: ''; position: absolute; inset: 0 -10px; border-radius: 12px; background: var(--m-surface); opacity: 0; transition: opacity 0.2s ease; z-index: -1; }
.pl-task:hover::before { opacity: 1; }
.pl-task.is-focus::before { opacity: 1; background: var(--m-accent-soft); }
.pl-task.dragging { opacity: 0.35; }
.pl-task.leaving { opacity: 0; transform: translateX(10px); }

.pl-check {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; cursor: pointer;
  border: 1.5px solid var(--m-muted); background: transparent; display: grid; place-items: center; padding: 0;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.pl-check svg { width: 12px; height: 12px; opacity: 0; transform: scale(0.5); transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1); }
.pl-check:hover svg { opacity: 0.45; transform: scale(1); color: var(--m-muted); }
.pl-task[data-prio="2"] .pl-check, .pl-mini[data-prio="2"] .pl-check { border-color: #c2410c; border-width: 2px; }
.pl-task[data-prio="1"] .pl-check, .pl-mini[data-prio="1"] .pl-check { border-color: #b45309; }
body[data-theme="dark"] .pl-task[data-prio="2"] .pl-check, body[data-theme="dark"] .pl-mini[data-prio="2"] .pl-check { border-color: #fb923c; }
body[data-theme="dark"] .pl-task[data-prio="1"] .pl-check, body[data-theme="dark"] .pl-mini[data-prio="1"] .pl-check { border-color: #fbbf24; }
.done > .pl-check { background: var(--m-accent) !important; border-color: var(--m-accent) !important; }
.done > .pl-check svg { opacity: 1; transform: scale(1); color: #fff; }

.pl-task-body { flex: 1; min-width: 0; }
.pl-task-title { font-size: 0.96rem; line-height: 1.45; overflow-wrap: break-word; outline: none; border-radius: 4px; }
.pl-task.done .pl-task-title { color: var(--m-muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.pl-task-title[contenteditable="true"] { background: var(--m-bg); box-shadow: 0 0 0 1px var(--m-muted); padding: 2px 6px; margin: -2px -6px; }
.pl-task-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; }
.pl-task-meta:empty { display: none; }
.pl-task-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.2s ease; margin-top: -4px; }
.pl-task:hover .pl-task-actions, .pl-task:focus-within .pl-task-actions { opacity: 1; }
@media (hover: none) { .pl-task-actions { opacity: 1; } }
/* "Practice": always visible but quiet — Teengro turns the task into a quiz */
.pl-practice {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; margin-top: -2px;
  padding: 5px 10px; border: none; border-radius: 999px; cursor: pointer;
  background: var(--m-surface); color: var(--m-muted); font: inherit; font-size: 0.76rem; font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.pl-practice svg { width: 13px; height: 13px; }
.pl-practice:hover { background: var(--m-faint); color: var(--m-text); }
.pl-task:hover .pl-practice { background: var(--m-bg); }
.pl-task:hover .pl-practice:hover { background: var(--m-faint); }
.pl-practice:active { transform: scale(0.96); }
.pl-practice:focus-visible { outline: 2px solid var(--m-accent); outline-offset: 2px; }

.pl-empty { padding: 26px 4px 8px; color: var(--m-muted); font-size: 0.92rem; line-height: 1.6; max-width: 46ch; }
.pl-empty-h { display: block; color: var(--m-text); font-weight: 600; font-size: 1rem; margin-bottom: 2px; }
.pl-done-toggle { border: none; background: none; color: var(--m-muted); cursor: pointer; font-size: 0.85rem; font-weight: 500; padding: 0; display: inline-flex; align-items: center; gap: 6px; }
.pl-done-toggle:hover { color: var(--m-text); }
.pl-done-toggle svg { width: 12px; height: 12px; transition: transform 0.25s ease; }
.pl-done-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }

/* ── Habits: one row each, last 7 days as lettered circles ──────────── */
.pl-habits { display: flex; flex-direction: column; }
.pl-habit { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--m-faint); }
.pl-habit:last-child { border-bottom: none; }
.pl-habit-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pl-habit-name { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-habit-meta { font-size: 0.74rem; color: var(--m-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-habit-meta.hot { color: var(--m-text); }
.pl-habit-days { display: flex; gap: 6px; flex-shrink: 0; }
.pl-hday {
  width: 28px; height: 28px; border-radius: 50%; border: none; padding: 0; cursor: pointer;
  display: grid; place-items: center; font: inherit; font-size: 0.66rem; font-weight: 500;
  color: var(--m-muted); background: var(--m-surface); box-shadow: none;
}
.pl-hday:hover { background: var(--m-faint); color: var(--m-text); }
.pl-hday.today { box-shadow: inset 0 0 0 1.5px var(--m-muted); color: var(--m-text); font-weight: 600; }
.pl-hday.on { background: var(--m-accent); color: var(--m-bg); box-shadow: none; font-weight: 600; }
.pl-hday:active { transform: scale(0.88); }
.pl-hday:focus-visible { outline: 2px solid var(--m-accent); outline-offset: 2px; }
.pl-habit-del { opacity: 0; transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease; }
.pl-habit:hover .pl-habit-del, .pl-habit-del:focus-visible { opacity: 1; }
@media (hover: none) { .pl-habit-del { opacity: 0.7; } }

/* Add a habit: same quiet pill as the task quick-add */
.pl-habit-add {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  background: var(--m-surface); border-radius: 14px; padding: 4px 4px 4px 14px;
  border: 1px solid transparent; transition: border-color 0.2s ease, background 0.2s ease;
}
.pl-habit-add:focus-within { border-color: var(--m-faint); background: var(--m-bg); }
.pl-habit-add > svg { width: 16px; height: 16px; color: var(--m-muted); flex-shrink: 0; }
body .pl-habit-add input, body .pl-habit-add input:focus {
  flex: 1; min-width: 0; border: none !important; outline: none !important; box-shadow: none !important;
  background: transparent; color: var(--m-text); padding: 9px 0; font-size: 0.88rem;
}
.pl-habit-add input::placeholder { color: var(--m-muted); opacity: 0.85; }
.pl-habit-add .pl-btn { opacity: 0; pointer-events: none; transform: scale(0.96); transition: opacity 0.2s ease, transform 0.2s ease; }
.pl-habit-add.has-text .pl-btn { opacity: 1; pointer-events: auto; transform: none; }

/* ── Focus dial (the one bold object on the page) ────────────────────── */
.pl-timer { background: var(--m-surface); border-radius: 22px; padding: 14px 16px 16px; }
.pl-mode-break { --dial: var(--m-muted); }
.pl-timer-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pl-modes { display: flex; gap: 2px; }
.pl-mode { border: none; background: transparent; color: var(--m-muted); font-size: 0.8rem; font-weight: 500; padding: 6px 10px; border-radius: 8px; cursor: pointer; transition: background 0.2s ease, color 0.2s ease; }
.pl-mode:hover { color: var(--m-text); }
.pl-mode[aria-pressed="true"] { background: var(--m-bg); color: var(--m-text); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
body[data-theme="dark"] .pl-mode[aria-pressed="true"] { background: var(--m-surface-2); }
.pl-dial { position: relative; width: 220px; height: 220px; margin: 10px auto 6px; }
.pl-dial svg { width: 100%; height: 100%; overflow: visible; }
.pl-tick { stroke: var(--m-muted); stroke-width: 1.2; stroke-linecap: round; opacity: 0.28; transition: opacity 0.6s ease, stroke 0.6s ease; }
.pl-tick.major { stroke-width: 1.8; opacity: 0.5; }
.pl-tick.lit { stroke: var(--dial, var(--m-accent)); opacity: 1; }
.pl-ring-track { fill: none; stroke: var(--m-faint); stroke-width: 3; }
.pl-ring-fill { fill: none; stroke: var(--dial, var(--m-accent)); stroke-width: 3; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 110px 110px; transition: stroke-dashoffset 1s linear, stroke 0.4s ease; }
.pl-dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pl-time { font-family: 'Bricolage Grotesque', 'Inter', sans-serif; font-size: 3.4rem; font-weight: 500; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; line-height: 1; }
.pl-round { font-size: 0.76rem; color: var(--m-muted); margin-top: 8px; }
.pl-timer-ctrls { display: flex; justify-content: center; align-items: center; gap: 18px; }
.pl-play { width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer; display: grid; place-items: center; background: var(--m-text); color: var(--m-bg); transition: transform 0.2s ease, opacity 0.2s ease; }
.pl-play:hover { opacity: 0.9; }
.pl-play:active { transform: scale(0.94); }
.pl-play svg { width: 20px; height: 20px; }
.pl-working { display: block; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--m-faint); }
.pl-working > span { display: block; font-size: 0.74rem; color: var(--m-muted); margin-bottom: 4px; }
.pl-select { width: 100%; border: none; background: transparent; color: var(--m-text); font-size: 0.9rem; font-weight: 500; padding: 2px 0; outline: none; cursor: pointer; text-overflow: ellipsis; }
.pl-select:focus-visible { outline: 2px solid var(--m-accent); outline-offset: 2px; border-radius: 4px; }
.pl-select option { background: var(--m-bg); color: var(--m-text); }

/* Today card: goal ring + small facts */
.pl-today-card { padding: 6px 4px; }
.pl-goal { display: flex; align-items: center; gap: 14px; }
.pl-goal-ring { width: 50px; height: 50px; flex-shrink: 0; transform: rotate(-90deg); }
.pl-goal-ring circle { fill: none; stroke-width: 5; }
.pl-goal-ring .t { stroke: var(--m-faint); }
.pl-goal-ring .f { stroke: var(--m-accent); stroke-linecap: round; transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1); }
.pl-goal-num { font-family: 'Bricolage Grotesque', 'Inter', sans-serif; font-size: 1.45rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pl-goal-sub { font-size: 0.8rem; color: var(--m-muted); }
.pl-facts { margin: 16px 0 0; display: flex; flex-direction: column; }
.pl-facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--m-faint); font-size: 0.85rem; }
.pl-facts > div[hidden] { display: none; }
.pl-facts dt { color: var(--m-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Week: an agenda, one row per day ────────────────────────────────── */
.pl-week-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.pl-week-label { font-weight: 600; font-size: 0.95rem; margin-right: auto; }
.pl-agenda { display: flex; flex-direction: column; }
.pl-agenda-day {
  display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 18px; padding: 16px 12px;
  border-top: 1px solid var(--m-faint); border-radius: 14px; transition: background 0.2s ease;
}
.pl-agenda-day.is-today { background: var(--m-surface); border-top-color: transparent; }
.pl-agenda-day.is-today + .pl-agenda-day { border-top-color: transparent; }
.pl-agenda-day.is-past .pl-agenda-date { opacity: 0.5; }
.pl-agenda-day.is-empty { padding-top: 10px; padding-bottom: 10px; }
.pl-agenda-day.is-empty .pl-agenda-date { flex-direction: row; align-items: baseline; gap: 8px; }
.pl-agenda-day.is-empty .pl-agenda-num { font-size: 1.1rem; }
.pl-agenda-day.drop-over { background: var(--m-accent-soft); }
.pl-agenda-date { display: flex; flex-direction: column; gap: 1px; }
.pl-agenda-dow { font-size: 0.78rem; color: var(--m-muted); }
.pl-agenda-num { font-family: 'Bricolage Grotesque', 'Inter', sans-serif; font-size: 1.7rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; }
.pl-agenda-day.is-today .pl-agenda-num { color: var(--m-accent); }
.pl-agenda-load { font-size: 0.72rem; color: var(--m-muted); margin-top: 4px; }
.pl-agenda-tasks { gap: 2px; min-height: 32px; justify-content: center; }
.pl-mini { display: flex; align-items: flex-start; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: 9px; cursor: grab; transition: background 0.2s ease, opacity 0.25s ease; }
.pl-mini:hover { background: var(--m-surface); }
.pl-agenda-day.is-today .pl-mini:hover { background: var(--m-bg); }
.pl-mini:active { cursor: grabbing; }
.pl-mini.dragging { opacity: 0.35; }
.pl-mini .pl-check { width: 17px; height: 17px; margin-top: 1px; }
.pl-mini .pl-check svg { width: 10px; height: 10px; }
.pl-mini-title { flex: 1; min-width: 0; font-size: 0.9rem; line-height: 1.4; overflow-wrap: break-word; }
.pl-mini.done .pl-mini-title { color: var(--m-muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.pl-mini-sub { font-size: 0.76rem; color: var(--m-muted); white-space: nowrap; margin-top: 2px; }
.pl-exam-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; font-weight: 600; padding: 4px 0 6px; }
.pl-exam-flag svg { width: 14px; height: 14px; color: var(--m-accent); }
.pl-day-add { align-self: flex-start; border: none; background: transparent; color: var(--m-muted); font-size: 0.8rem; padding: 5px 8px; margin: 2px -8px 0; border-radius: 8px; cursor: pointer; opacity: 0; transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease; }
.pl-agenda-day:hover .pl-day-add, .pl-day-add:focus-visible, .pl-day-add.solo { opacity: 1; }
@media (hover: none) { .pl-day-add { opacity: 1; } }
.pl-day-add:hover { color: var(--m-text); background: var(--m-faint); }
.pl-day-input { width: 100%; border: none; border-bottom: 1px solid var(--m-muted); background: transparent; color: var(--m-text); padding: 6px 0; font-size: 0.9rem; outline: none; }
.pl-someday { margin-top: 30px; }

/* ── Exams ───────────────────────────────────────────────────────────── */
.pl-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; background: var(--m-surface); border-radius: 16px; padding: 14px; }
.pl-field { display: flex; flex-direction: column; gap: 6px; }
.pl-field label { font-size: 0.78rem; font-weight: 500; color: var(--m-muted); }
.pl-field input, .pl-field select, .pl-field textarea {
  border: 1px solid var(--m-faint); background: var(--m-bg); color: var(--m-text); border-radius: 10px;
  padding: 9px 11px; font-size: 0.9rem; outline: none; width: 100%; transition: border-color 0.2s ease;
}
.pl-field input:focus, .pl-field select:focus, .pl-field textarea:focus { border-color: var(--m-muted); }
.pl-field textarea { resize: vertical; min-height: 150px; line-height: 1.55; }
.pl-exams { display: flex; flex-direction: column; margin-top: 18px; }
.pl-exam { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--m-faint); }
.pl-exam:last-child { border-bottom: none; }
.pl-exam-days b { display: block; font-family: 'Bricolage Grotesque', 'Inter', sans-serif; font-size: 2.1rem; font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; background: none; padding: 0; color: inherit; }
.pl-exam-days span { font-size: 0.74rem; color: var(--m-muted); }
.pl-exam-name { font-weight: 600; font-size: 1rem; }
.pl-exam-sub { font-size: 0.82rem; color: var(--m-muted); margin-top: 3px; }
.pl-exam-bar { height: 3px; border-radius: 999px; background: var(--m-faint); margin-top: 10px; overflow: hidden; max-width: 260px; }
.pl-exam-bar i { display: block; height: 100%; background: var(--m-accent); border-radius: inherit; transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.pl-exam.past { opacity: 0.5; }

.pl-plan { margin-top: 26px; padding: 18px; border-radius: 18px; background: var(--m-surface); }
.pl-plan .pl-h { margin: 0; }
.pl-plan-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; margin-top: 14px; }
.pl-plan-side { display: flex; flex-direction: column; gap: 14px; }
.pl-plan-preview { margin-top: 18px; display: flex; flex-direction: column; }
.pl-plan-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 12px; font-size: 0.86rem; padding: 9px 2px; border-top: 1px solid var(--m-faint); }
.pl-plan-row time, .pl-plan-row .m { color: var(--m-muted); font-variant-numeric: tabular-nums; }
.pl-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ── Insights ────────────────────────────────────────────────────────── */
.pl-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 34px; }
.pl-fig { padding: 0 18px; border-left: 1px solid var(--m-faint); }
.pl-fig:first-child { padding-left: 0; border-left: none; }
.pl-fig-val { font-family: 'Bricolage Grotesque', 'Inter', sans-serif; font-size: 1.9rem; font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pl-fig-label { font-size: 0.8rem; color: var(--m-muted); margin-top: 4px; }
.pl-panel-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.95rem; font-weight: 600; margin-bottom: 14px; }
.pl-chart { position: relative; }
.pl-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.pl-chart .axis { fill: var(--m-muted); font-size: 11px; font-family: 'Inter', sans-serif; }
.pl-chart .grid { stroke: var(--m-faint); stroke-width: 1; }
.pl-chart .bar { fill: var(--m-text); opacity: 0.16; transition: opacity 0.2s ease; }
.pl-chart .bar.today { fill: var(--m-accent); opacity: 1; }
.pl-chart .hit { fill: transparent; }
.pl-chart .bar.hover { opacity: 0.4; }
.pl-chart .bar.today.hover { opacity: 0.85; }
.pl-chart .goal-line { stroke: var(--m-text); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.4; }
.pl-chart .goal-label { fill: var(--m-muted); font-size: 10.5px; font-family: 'Inter', sans-serif; }
.pl-tip { position: absolute; pointer-events: none; background: var(--m-text); color: var(--m-bg); font-size: 0.76rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); opacity: 0; transition: opacity 0.18s ease, left 0.22s cubic-bezier(0.22, 1, 0.36, 1), top 0.22s cubic-bezier(0.22, 1, 0.36, 1); z-index: 3; }
.pl-tip:not(.show) { transition: opacity 0.18s ease; }
.pl-tip.show { opacity: 1; }
.pl-tip b { font-weight: 600; background: none; padding: 0; color: inherit; }
.pl-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; margin-top: 38px; }
.pl-hbar { display: grid; grid-template-columns: 92px minmax(0, 1fr) 56px; gap: 12px; align-items: center; font-size: 0.85rem; padding: 6px 0; }
.pl-hbar-track { height: 6px; border-radius: 999px; background: var(--m-faint); overflow: hidden; }
.pl-hbar-track i { display: block; height: 100%; border-radius: inherit; background: var(--m-text); opacity: 0.55; transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.pl-hbar-val { text-align: right; color: var(--m-muted); font-variant-numeric: tabular-nums; }
.pl-heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 4px; justify-content: start; overflow-x: auto; padding-bottom: 2px; }
.pl-heat i { width: 13px; height: 13px; border-radius: 4px; background: var(--m-faint); }
.pl-heat i[data-l="1"] { background: color-mix(in srgb, var(--m-accent) 30%, transparent); }
.pl-heat i[data-l="2"] { background: color-mix(in srgb, var(--m-accent) 55%, transparent); }
.pl-heat i[data-l="3"] { background: color-mix(in srgb, var(--m-accent) 80%, transparent); }
.pl-heat i[data-l="4"] { background: var(--m-accent); }
.pl-heat i.future { visibility: hidden; }
.pl-heat-legend { display: flex; align-items: center; gap: 4px; font-size: 0.72rem; color: var(--m-muted); margin-top: 10px; }
.pl-heat-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.pl-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin-top: 10px; }
.pl-table th, .pl-table td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--m-faint); }
.pl-table th { color: var(--m-muted); font-weight: 500; }
.pl-table td:last-child, .pl-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Toast & dialog ──────────────────────────────────────────────────── */
.pl-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 18px); opacity: 0; z-index: 800;
  background: var(--m-text); color: var(--m-bg); border-radius: 12px; padding: 9px 10px 9px 16px;
  display: flex; align-items: center; gap: 14px; font-size: 0.86rem; box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1); pointer-events: none; max-width: calc(100vw - 32px);
}
.pl-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.pl-toast button { border: none; background: transparent; color: inherit; font-weight: 600; cursor: pointer; padding: 5px 9px; border-radius: 7px; }
.pl-toast button:hover { background: rgba(127,127,127,0.22); }

.pl-dialog { position: fixed; inset: 0; margin: auto; height: fit-content; max-height: calc(100vh - 32px); overflow: auto; border: none; padding: 0; border-radius: 20px; background: var(--m-bg); color: var(--m-text); width: min(420px, calc(100vw - 32px)); box-shadow: 0 24px 70px rgba(0,0,0,0.25); }
.pl-dialog::backdrop { background: rgba(0,0,0,0.32); backdrop-filter: blur(3px); }
.pl-dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.pl-dialog h3 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.pl-dialog-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pl-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.pl-switch { display: flex; align-items: center; justify-content: space-between; font-size: 0.88rem; gap: 12px; }
.pl-switch input { width: 16px; height: 16px; accent-color: var(--m-accent); }
.pl-help { font-size: 0.82rem; color: var(--m-muted); line-height: 1.6; margin: 0; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .pl-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .pl-aside { position: static; order: -1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; gap: 24px; }
  .pl-kbd-hint { display: none; }
}
@media (max-width: 640px) {
  .pl-practice span { display: none; }
  .pl-practice { padding: 7px; }
  .pl-page { padding: 72px 16px 96px; }
  .pl-head { margin-bottom: 22px; }
  .pl-aside { grid-template-columns: minmax(0, 1fr); }
  .pl-dial { width: 200px; height: 200px; }
  .pl-tabs { display: flex; width: 100%; }
  .pl-tab { flex: 1; padding: 8px 4px; }
  .pl-agenda-day { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; padding: 14px 8px; }
  .pl-agenda-num { font-size: 1.4rem; }
  .pl-figs { grid-template-columns: 1fr 1fr; row-gap: 20px; }
  .pl-fig:nth-child(3) { padding-left: 0; border-left: none; }
  .pl-two, .pl-plan-grid { grid-template-columns: minmax(0, 1fr); }
  .pl-form { grid-template-columns: 1fr 1fr; }
  .pl-form .pl-field:first-child { grid-column: 1 / -1; }
  .pl-exam { grid-template-columns: 60px minmax(0, 1fr) auto; }
  .pl-exam .pl-btn { grid-column: 2; justify-self: start; }
  .pl-plan-row { grid-template-columns: 96px minmax(0, 1fr) auto; }
  .pl-habit { gap: 10px; }
  .pl-hday { width: 24px; height: 24px; font-size: 0.6rem; }
  .pl-habit-days { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .pl-dialog, .pl-dialog::backdrop, .pl-pill { transition: none !important; }
  .pl-ring-fill, .pl-dayline i, .pl-goal-ring .f { transition: none; }
}

/* ── Motion ──────────────────────────────────────────────────────────── */
/* Sliding highlight for the tabs and timer modes */
.pl-tabs, .pl-modes { position: relative; }
.pl-pill {
  position: absolute; top: 3px; bottom: 3px; left: 0; border-radius: 9px; pointer-events: none; z-index: 0;
  background: var(--m-bg); box-shadow: 0 1px 2px rgba(0,0,0,0.12), 0 0 0 1px var(--m-faint);
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), width 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}
body[data-theme="dark"] .pl-pill { background: var(--m-surface-2); }
.pl-modes .pl-pill { top: 0; bottom: 0; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.has-pill > .pl-tab, .has-pill > .pl-mode { position: relative; z-index: 1; }
.has-pill > .pl-tab[aria-selected="true"], .has-pill > .pl-mode[aria-pressed="true"] { background: transparent !important; box-shadow: none !important; }

/* Rows: completing/deleting fades out before the list closes the gap */
.pl-task, .pl-mini { will-change: auto; }
.pl-mini.leaving { opacity: 0; transform: translateX(10px); transition: opacity 0.24s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }

/* Charts grow from their baseline */
.pl-chart .bar { transform-box: fill-box; transform-origin: 50% 100%; }
.pl-hbar-track i, .pl-exam-bar i { transform-origin: 0 50%; }

/* Progress starts empty so the first paint fills in */
.pl-goal-ring .f { stroke-dasharray: 157.08; stroke-dashoffset: 157.08; }
.pl-ring-fill { stroke-dasharray: 552.92; stroke-dashoffset: 552.92; }

/* Dialog: fade + lift in, fade out on close */
.pl-dialog {
  opacity: 0; transform: translateY(10px) scale(0.98);
  transition: opacity 0.26s ease, transform 0.36s cubic-bezier(0.22, 1, 0.36, 1), overlay 0.36s allow-discrete, display 0.36s allow-discrete;
}
.pl-dialog[open] { opacity: 1; transform: none; }
@starting-style { .pl-dialog[open] { opacity: 0; transform: translateY(10px) scale(0.98); } }
.pl-dialog::backdrop { opacity: 0; transition: opacity 0.3s ease, overlay 0.36s allow-discrete, display 0.36s allow-discrete; }
.pl-dialog[open]::backdrop { opacity: 1; }
@starting-style { .pl-dialog[open]::backdrop { opacity: 0; } }

/* Done list toggle, check marks, habit dots: eased state changes */
.pl-hday { transition: background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease, transform 0.2s ease; }
.pl-day-line, .pl-dayline i { will-change: width; }

/* ── Android app only ───────────────────────────────────────────────────── */
.pl-app-only { display: none; }
html.tg-native .pl-app-only { display: block; margin-top: 18px; }
.pl-ask { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 14px 16px; border-radius: 16px; background: var(--m-surface); }
.pl-ask > div:first-child { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pl-ask b { font-size: 0.9rem; font-weight: 600; }
.pl-ask span { font-size: 0.78rem; color: var(--m-muted); line-height: 1.4; }
.pl-ask-btns { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 640px) { .pl-ask { flex-direction: column; align-items: stretch; } .pl-ask-btns { justify-content: flex-end; } }

/* ── Timer alarm: rings until Stop ──────────────────────────────────────── */
.pl-alarm { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 20px;
  background: rgba(0, 0, 0, 0.45); animation: plFadeIn 0.22s ease both; }
.pl-alarm.out { animation: plFadeOut 0.2s ease both; }
.pl-alarm-card { width: min(340px, 100%); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 28px 22px 22px; border-radius: 22px; background: var(--m-bg); border: 1px solid var(--m-faint);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); animation: plRise 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
.pl-alarm-card b { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
.pl-alarm-card span { font-size: 0.88rem; color: var(--m-muted); line-height: 1.45; }
.pl-alarm-pulse { width: 54px; height: 54px; border-radius: 50%; margin-bottom: 6px; background: var(--m-surface);
  box-shadow: 0 0 0 0 var(--m-faint); animation: plPulse 1.7s ease-out infinite; }
.pl-alarm-stop { width: 100%; margin-top: 12px; padding: 13px 16px; font-size: 0.95rem; border-radius: 14px; }
@keyframes plFadeIn { from { opacity: 0; } }
@keyframes plFadeOut { to { opacity: 0; } }
@keyframes plRise { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
@keyframes plPulse { 0% { box-shadow: 0 0 0 0 var(--m-faint); } 70% { box-shadow: 0 0 0 18px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .pl-alarm, .pl-alarm-card, .pl-alarm-pulse { animation: none; } }
.pl-exact { margin: 6px 0 0; font-size: 0.78rem; color: var(--m-muted); line-height: 1.45; }
.pl-exact .pl-btn-link { padding: 0; font-size: inherit; text-decoration: underline; }

/* ── Task reminders ─────────────────────────────────────────────────────── */
.pl-chip-remind { border: none; background: transparent; padding: 0; cursor: pointer; font: inherit; font-size: 0.76rem; color: var(--m-muted); border-radius: 6px; }
.pl-chip-remind:hover { color: var(--m-text); }
.pl-chip-remind.past { opacity: 0.55; }
.pl-remind-task { margin: -4px 0 12px; font-size: 0.88rem; color: var(--m-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-remind-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pl-remind-quick .pl-chip { border: none; cursor: pointer; font: inherit; font-size: 0.8rem; padding: 7px 12px; border-radius: 999px; background: var(--m-surface); color: var(--m-text); }
.pl-remind-quick .pl-chip:hover { background: var(--m-faint); color: var(--m-text); }
.pl-remind-remove { margin-right: auto; color: #e5484d; }
html.tg-native .pl-web-only { display: none; }

/* ── Settings dialog: grouped, steppers, real switches ─────────────────── */
.pl-settings .pl-dialog-body { gap: 16px; }
.pl-set-group { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; background: var(--m-surface); }
.pl-set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pl-set-h { margin: 6px 0 10px; font-size: 0.8rem; font-weight: 600; color: var(--m-muted); }
.pl-settings .pl-field label { font-size: 0.76rem; }

/* Stepper: − 25 min + */
.pl-step { display: flex; align-items: center; height: 44px; border-radius: 12px; background: var(--m-bg);
  border: 1px solid transparent; transition: border-color 0.2s ease; }
.pl-step:focus-within { border-color: var(--m-faint); }
.pl-step-btn { width: 40px; height: 100%; flex-shrink: 0; display: grid; place-items: center; border: none; background: transparent;
  color: var(--m-muted); cursor: pointer; border-radius: 12px; touch-action: manipulation;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease; }
.pl-step-btn svg { width: 15px; height: 15px; }
.pl-step-btn:hover:not(:disabled) { color: var(--m-text); background: var(--m-faint); }
.pl-step-btn:active:not(:disabled) { transform: scale(0.9); }
.pl-step-btn:disabled { opacity: 0.3; cursor: default; }
.pl-step-btn:focus-visible { outline: none; box-shadow: none; color: var(--m-text); background: var(--m-faint); }
.pl-step-mid { flex: 1; min-width: 0; display: flex; align-items: baseline; justify-content: center; gap: 4px; overflow: hidden; }
body .pl-step input[type="number"], body .pl-step input[type="number"]:focus {
  border: none !important; background: transparent !important; box-shadow: none !important; outline: none !important;
  padding: 0; margin: 0; min-width: 2ch; text-align: right; font: inherit; font-size: 1rem; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--m-text); -moz-appearance: textfield; appearance: textfield; }
.pl-step input::-webkit-outer-spin-button, .pl-step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pl-step-unit { font-size: 0.78rem; color: var(--m-muted); }

/* Switch rows */
.pl-set-list { gap: 0; padding: 4px 14px; }
.pl-set-list .pl-switch { min-height: 46px; border-bottom: 1px solid var(--m-faint); cursor: pointer; }
.pl-set-list .pl-switch:last-child { border-bottom: none; }
.pl-switch input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex-shrink: 0; margin: 0; cursor: pointer;
  width: 40px; height: 24px; border-radius: 999px; position: relative;
  background: var(--m-faint); transition: background 0.25s ease; }
.pl-switch input[type="checkbox"]::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--m-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease; }
.pl-switch input[type="checkbox"]:checked { background: var(--m-accent); }
.pl-switch input[type="checkbox"]:checked::after { transform: translateX(16px); background: #fff; }
.pl-switch input[type="checkbox"]:active::after { width: 22px; }
.pl-switch input[type="checkbox"]:checked:active::after { transform: translateX(12px); }
.pl-switch input[type="checkbox"]:focus-visible { outline: 2px solid var(--m-muted); outline-offset: 2px; box-shadow: none; }
body .pl-switch-time input[type="time"], body .pl-switch-time input[type="time"]:focus {
  border: none !important; outline: none !important; box-shadow: none !important; border-radius: 10px; padding: 6px 10px;
  background: var(--m-bg); color: var(--m-text); font: inherit; font-size: 0.88rem; color-scheme: light dark; }

/* Quiet focus in every Planner dialog — no site-wide green ring */
.pl-dialog input:focus-visible, .pl-dialog select:focus-visible { box-shadow: none !important; outline: none; }
@media (max-width: 400px) { .pl-set-grid { gap: 8px; } .pl-step-btn { width: 34px; } }
@media (prefers-reduced-motion: reduce) { .pl-switch input[type="checkbox"], .pl-switch input[type="checkbox"]::after { transition: none; } }
