/* Study Planner (all classes prefixed p-) */
.p-root [hidden] { display: none !important; }

/* ---------- start screen ---------- */
.p-root .tool-head h1 svg { width: 26px; height: 26px; color: var(--accent); flex: none; }
.p-form h2 { margin-bottom: 14px; }
.p-form input[type="date"] { display: block; min-width: 0; min-height: 44px; }
.p-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.p-fields:disabled { opacity: .6; }
.p-seg { display: flex; width: 100%; }
.p-seg button { flex: 1 1 0; padding: 7px 6px; white-space: nowrap; }
.p-skip { display: flex; flex-wrap: wrap; gap: 6px; }
.p-skip .chip { min-width: 46px; justify-content: center; padding: 6px 10px; }
.p-skip .chip.on { color: color-mix(in srgb, var(--bad) 70%, var(--text)); border-color: color-mix(in srgb, var(--bad) 55%, var(--line-2)); background: color-mix(in srgb, var(--bad) 10%, var(--panel)); text-decoration: line-through; text-decoration-thickness: 2px; }
.p-topics-input { min-height: 96px; }
.p-days-note { margin: 14px 0 0; font-size: 13.5px; color: var(--muted); }
.p-days-note.p-warn { color: color-mix(in srgb, var(--warn) 55%, var(--text)); font-weight: 600; }
.p-msg { margin-top: 14px; }
.p-msg-acts { margin-top: 10px; }
.p-go-row { display: flex; flex-direction: row-reverse; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; margin-top: 16px; }
.p-go-btns { display: flex; gap: 8px; }
.p-aside { flex: 1 1 220px; min-width: 0; }
.p-gen { display: flex; flex-direction: column; gap: 7px; }
.p-gen .working { flex-wrap: wrap; gap: 6px 10px; }
.p-gen .progress { height: 6px; }

.p-saved { margin-bottom: 14px; }
.p-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.p-item { display: flex; align-items: center; gap: 4px; padding: 3px 6px 3px 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); transition: border-color .15s; }
.p-item:hover, .p-item:focus-within { border-color: var(--line-2); }
.p-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 9px; color: var(--text); text-decoration: none; }
.p-open:hover .p-item-title { color: var(--accent); }
.p-item-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.p-item-title { min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .15s; }
.p-item-top .badge { flex: none; }
.p-item-meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.p-item-meta b { color: var(--text); font-weight: 600; }
.p-item .progress { display: block; height: 6px; }

/* ---------- plan view ---------- */
.p-topnav { margin: -6px 0 10px -8px; }
.p-hero { position: relative; overflow: hidden; }
.p-hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--grad); }
.p-hero-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.p-hero-text { min-width: 0; }
.p-kicker { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.p-kicker svg { width: 15px; height: 15px; }
.p-title { margin: 0 0 4px; font-size: 25px; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: anywhere; }
.p-sub { margin: 0; font-size: 14px; color: var(--muted); }
.p-count { flex: none; min-width: 112px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); text-align: center; }
.p-count b { display: block; font-size: 30px; line-height: 1.1; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.p-count span { display: block; font-size: 12.5px; line-height: 1.35; color: var(--muted); font-weight: 600; }
.p-prog { display: flex; align-items: center; gap: 12px; margin: 16px 0 14px; }
.p-prog .progress { flex: 1; }
.p-prog-text { font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.p-hero-acts { gap: 8px; }

.p-topics { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.p-topics .label { margin-right: 4px; }
.p-note { margin-top: 14px; }

.p-days { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.p-day { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); transition: opacity .15s, border-color .15s; }
.p-day.p-today { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.p-day.p-past:not(.p-today) { opacity: .6; }
.p-day.p-past:hover, .p-day.p-past:focus-within { opacity: 1; }
.p-day.p-testday { border-style: dashed; border-color: color-mix(in srgb, var(--good) 55%, var(--line)); }

.p-check { display: block; padding-top: 1px; cursor: pointer; }
.p-check input { appearance: none; -webkit-appearance: none; display: grid; place-content: center; width: 26px; height: 26px; margin: 0; border: 2px solid var(--faint); border-radius: 8px; background: var(--bg-2); cursor: pointer; transition: background .15s, border-color .15s; }
.p-check input::before { content: ""; width: 7px; height: 13px; margin-top: -3px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); transition: transform .12s; }
.p-check input:hover { border-color: var(--accent); }
.p-check input:checked { background: var(--grad); border-color: transparent; }
.p-check input:checked::before { transform: rotate(45deg) scale(1); }
.p-check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.p-test-ico { display: grid; place-items: center; width: 26px; height: 26px; margin-top: 1px; border-radius: 8px; background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.p-test-ico svg { width: 15px; height: 15px; }

.p-body { min-width: 0; }
.p-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--muted); }
.p-date { font-weight: 700; color: var(--text); }
.p-min { margin-left: auto; font-weight: 600; color: var(--faint); white-space: nowrap; }
.badge.p-badge-today { background: var(--grad); color: #fff; }
.p-root .p-stitle { margin: 6px 0 2px; font-size: 16.5px; line-height: 1.35; overflow-wrap: anywhere; }
.p-task { margin: 0; font-size: 14.5px; color: var(--muted); overflow-wrap: anywhere; }
.p-root .p-done .p-stitle { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text) 45%, transparent); }
.p-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.p-acts .btn svg { width: 15px; height: 15px; }
.p-edit { gap: 10px; margin-top: 8px; }
.p-edit .textarea { min-height: 84px; }
.p-foot { margin: 18px 0 0; text-align: center; }

/* ---------- phones ---------- */
@media (max-width: 560px) {
  .p-go-btns, .p-aside { width: 100%; flex-basis: 100%; }
  .p-go-btns .btn { flex: 1; }
  .p-aside { text-align: center; }
  .p-skip { gap: 5px; flex-wrap: nowrap; }
  .p-skip .chip { flex: 1 1 0; min-width: 0; padding: 6px 0; }
  .p-hero-main { flex-direction: column; gap: 12px; }
  .p-count { display: flex; align-items: baseline; gap: 8px; width: 100%; min-width: 0; text-align: left; }
  .p-count b { display: inline; font-size: 26px; }
  .p-count span { display: inline; }
  .p-title { font-size: 21px; }
  .p-prog { flex-wrap: wrap; gap: 6px 12px; }
  .p-prog .progress { flex-basis: 100%; }
  .p-day { gap: 11px; padding: 12px; }
  .p-acts .btn { flex: 1 1 auto; }
  .p-hero-acts .btn { flex: 1 1 auto; }
}

/* ---------- print (only while a plan is on screen) ---------- */
@media print {
  :root:has(.p-sheet) {
    --bg: #fff; --bg-2: #fff; --panel: #fff; --panel-2: #f4f4f7; --panel-3: #e3e3ea;
    --line: #cfd0d8; --line-2: #b5b7c3; --text: #111; --muted: #3f4250; --faint: #646775;
    color-scheme: light;
  }
  :root:has(.p-sheet), :root:has(.p-sheet) body { height: auto; overflow: visible; background: #fff !important; }
  :root:has(.p-sheet) .sidebar,
  :root:has(.p-sheet) .topbar,
  :root:has(.p-sheet) .scrim,
  :root:has(.p-sheet) #toasts,
  :root:has(.p-sheet) #modal-root,
  .p-sheet .p-noprint { display: none !important; }
  :root:has(.p-sheet) .app,
  :root:has(.p-sheet) .main,
  :root:has(.p-sheet) .view { display: block; height: auto; overflow: visible; }
  .p-root { max-width: none; padding: 0; }
  .p-sheet { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .p-sheet .p-day { break-inside: avoid; opacity: 1 !important; box-shadow: none; }
  .p-sheet .p-day.p-today { background: #fff; }
  .p-sheet .p-count b { background: none; color: var(--text); }
}
