/* KADER MIS — the student portal (update 30). Phone first. */
.portal-body { background: var(--paper); min-height: 100vh; }
.portal-body #root { display: block; height: auto; min-height: 100vh; }

.p-brand { display: flex; flex-direction: column; gap: 2px; }
.p-brand .wordmark { color: var(--on-ink); font-size: 22px; }
.p-brand .wordmark--sub { color: var(--on-ink-2); font-size: 10px; letter-spacing: .14em; }

/* sign-in, first password, registration */
.p-auth { max-width: 440px; margin: 0 auto; padding: 28px 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.p-auth--wide { max-width: 680px; }
.p-auth > .p-brand { background: var(--ink); border-radius: var(--radius); padding: 18px; }
.p-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-soft); margin-bottom: 12px; }
.p-card h1 { font-size: 20px; margin: 0 0 6px; }
.p-wide { width: 100%; justify-content: center; margin-top: 8px; }
.p-hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }
.center { text-align: center; }
.p-reg-subject { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* the portal */
.p-preview { background: var(--due-bg); color: var(--due); padding: 8px 16px; font-size: 13px; text-align: center; }
.p-head { background: var(--ink); color: var(--on-ink); padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.p-who { text-align: end; min-width: 0; }
.p-who__name { font-weight: 600; overflow-wrap: anywhere; }
.p-who__code { font-family: Consolas, monospace; color: var(--on-ink-2); font-size: 12px; }
.p-tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 2px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 8px; scrollbar-width: none; }
.p-tabs::-webkit-scrollbar { display: none; }
.p-tabs a { flex: 1 0 auto; text-align: center; padding: 12px 8px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; border-bottom: 3px solid transparent; }
@media (max-width: 420px) { .p-tabs { padding: 0 2px; } .p-tabs a { padding: 11px 6px; font-size: 13px; } }
.p-tabs a.is-active { color: var(--text); border-bottom-color: var(--signal-dim); }
.p-main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.p-title { font-size: 22px; margin: 4px 0 12px; }
.p-titlebar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.p-h2 { font-size: 16px; margin: 18px 0 8px; }
.p-label { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.p-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 8px; }
.p-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.p-stat__v { font-size: 20px; font-weight: 700; }
.is-paid { color: var(--settled); }
.is-due { color: var(--due); }
.p-updated { font-size: 12px; color: var(--text-3); margin: 6px 0 12px; }
.p-next { border-color: var(--signal-dim); }

.p-class { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.p-class:last-child { border-bottom: 0; }
.p-class.is-cancelled { opacity: .5; text-decoration: line-through; }
.p-class__when { min-width: 96px; }
.p-class__date { font-size: 12px; color: var(--text-2); }
.p-class__time { font-weight: 700; color: var(--text); }
.p-class__what { flex: 1; min-width: 0; }
.p-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px; margin-bottom: 10px; }
.p-day__head { font-weight: 700; padding: 8px 0 4px; color: var(--text); border-bottom: 1px solid var(--line-soft); }
.p-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.p-chip { border: 1px solid var(--line); background: var(--field-bg); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.p-chip.is-on { background: var(--signal-dim); color: #fff; border-color: var(--signal-dim); }
.p-past { margin-top: 12px; }
.p-past summary { cursor: pointer; color: var(--text-2); padding: 8px 0; }

.p-subject__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.p-subject__people { font-size: 14px; display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.p-subject__packs { margin-bottom: 8px; color: var(--text-2); }
.p-subject__money { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; padding-top: 8px; border-top: 1px solid var(--line-soft); align-items: center; }

.p-rows { display: flex; flex-direction: column; }
.p-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.p-row:last-child { border-bottom: 0; }
.p-row__main { min-width: 0; }
.p-row__side { text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.p-howto ol { margin: 6px 0; padding-inline-start: 20px; }

#print-report { display: none; }
@media print {
  body.print-report > *:not(#print-report) { display: none !important; }
  body.print-report #print-report { display: block; color: #000; background: #fff; font-size: 12px; }
  #print-report h3 { font-size: 14px; margin: 16px 0 6px; }
  #print-report .ps__head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #0b1f3a; padding-bottom: 8px; margin-bottom: 8px; }
  #print-report .ps__brand { font-weight: 700; font-size: 18px; }
  #print-report .ps__who { text-align: end; }
  #print-report .ps__table { width: 100%; border-collapse: collapse; }
  #print-report .ps__table th, #print-report .ps__table td { border-bottom: 1px solid #ccc; padding: 5px 4px; text-align: start; }
  #print-report .ps__totals { display: flex; gap: 20px; justify-content: flex-end; margin-top: 6px; }
  #print-report .ps__note, #print-report .ps__sub { color: #666; font-size: 10px; }
}
@media (max-width: 560px) {
  .p-reg-subject { grid-template-columns: 1fr; }
  .p-auth .grid3, .p-auth .grid2 { grid-template-columns: 1fr; }
  .p-class { flex-wrap: wrap; }
}

/* Update 31: passwords on a phone */
.p-pw { display: flex; gap: 6px; align-items: stretch; }
.p-pw input { flex: 1; min-width: 0; }
.p-show { flex-shrink: 0; }
.p-rules { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; color: var(--text-2); display: grid; gap: 2px; }
.p-rules li::before { content: '○ '; }
.p-rules li.is-ok { color: var(--settled); }
.p-rules li.is-ok::before { content: '✓ '; }

/* Update 31: guidance and requests */
.p-guidance.is-new { border-color: var(--signal-dim); box-shadow: 0 0 0 2px rgba(78,192,242,.25); }
.p-guidance__head { margin-bottom: 6px; }
.p-guidance__body { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 8px; line-height: 1.6; }
.p-dot { display: inline-block; margin-inline-start: 8px; background: var(--alert); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 8px; vertical-align: middle; }
.p-answer { border-inline-start: 3px solid var(--signal-dim); padding-inline-start: 10px; margin-top: 8px; white-space: pre-wrap; }
.p-ask { all: unset; cursor: pointer; font-size: 12px; color: var(--signal-dim); text-decoration: underline; }

/* Update 32: on the Home Screen */
.p-install { border-color: var(--signal-dim); }
.p-install h2 { font-size: 17px; margin: 0; }
.p-install__head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.p-install__head img { border-radius: 10px; flex-shrink: 0; }
.p-ar-line { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.p-ar { color: var(--text-2); font-size: 13px; }
.p-perks { margin: 0 0 12px; padding-inline-start: 18px; font-size: 14px; display: grid; gap: 4px; }
.p-steps { list-style: none; margin: 8px 0 4px; padding: 0; display: grid; gap: 10px; font-size: 14px; }
.p-step { display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; }
.p-step__n { flex-shrink: 0; width: 24px; height: 24px; border-radius: 999px; background: var(--signal-dim); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.p-key { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; border: 1px solid var(--line); border-radius: 6px; padding: 1px 4px; background: var(--field-bg); color: var(--signal-dim); }
.p-step svg { vertical-align: middle; }
.p-install__later { justify-content: flex-end; margin-top: 6px; }
.p-install .p-wide { margin: 4px 0 8px; }

/* Update 33: the registration form */
.p-req { color: #D12C2C; font-weight: 700; }
.p-phone { display: flex; align-items: stretch; }
.p-phone__cc { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-inline-end: 0;
  border-radius: var(--radius) 0 0 var(--radius); background: var(--line-soft); color: var(--text); font-weight: 600; white-space: nowrap; }
.p-phone input { flex: 1; min-width: 0; border-start-start-radius: 0; border-end-start-radius: 0; }
.p-flag { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); flex-shrink: 0; }
.p-reg-subject-card { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 12px 6px; margin-bottom: 10px; }
.p-reg-subject__foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 22px; margin-bottom: 4px; }
.p-lang { font-size: 13px; color: var(--text-2); }
.p-lang.is-track { color: var(--signal-dim); font-weight: 600; }
label.p-main { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; cursor: pointer; }
.p-track { display: flex; gap: 10px; }
.p-track__opt { flex: 1; display: flex; gap: 8px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; cursor: pointer; font-weight: 600; background: var(--field-bg); }
.p-track__opt:has(input:checked) { border-color: var(--signal-dim); box-shadow: 0 0 0 2px rgba(78,192,242,.25); }
[hidden] { display: none !important; }
.p-reg-subject__foot .p-main { margin: 0; padding: 6px 0; justify-content: flex-start; }
.p-reg-subject__foot { margin-top: -4px; }

/* Update 34: the policies, the trial lesson, the package saving */
.p-policies { margin: 6px 0 10px; padding: 0; list-style: none; display: grid; gap: 0; border: 1px solid var(--line); border-radius: 10px; }
.p-policies li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 12px; flex-wrap: wrap; }
.p-policies li + li { border-top: 1px solid var(--line); }
.p-pol-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); margin-top: 6px; }
.p-pledge { background: var(--field-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; font-size: 14px; line-height: 1.7; margin-bottom: 10px; }
.p-agree { display: flex; gap: 10px; align-items: center; font-weight: 600; margin: 8px 0; cursor: pointer; }
.p-agree input { width: 20px; height: 20px; }
.p-trial { border-color: var(--line); }
.p-trial.is-open { border-color: var(--due); box-shadow: 0 0 0 2px rgba(235,81,93,.12); }
.p-trial__title { font-size: 17px; margin: 2px 0 10px; }
.p-trial__links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.p-trial__decide { border-top: 1px solid var(--line-soft); padding-top: 10px; display: grid; gap: 6px; }
.p-trial__decide p { margin: 0; }
.p-trial__left { color: var(--due); }
.p-trial__buttons { gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.p-trial__buttons .btn { flex: 1; justify-content: center; }
.p-saving { background: var(--info-bg, #EAF6FD); color: var(--info-text, #0B4F6C); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; margin-bottom: 10px; display: grid; gap: 4px; }

/* Update 35: Arabic / English and light / dark */
.p-prefs { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.p-pref { font: inherit; font-size: 13px; font-weight: 600; min-width: 36px; height: 34px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.p-pref:hover { border-color: var(--signal-dim); }
.p-head__side { display: flex; align-items: center; gap: 12px; min-width: 0; }
.p-head .p-pref { background: transparent; color: var(--on-ink); border-color: rgba(255,255,255,.25); }
.p-card .p-prefs { justify-content: flex-start; }
.p-pol-head { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.p-policies li { justify-content: flex-start; }
@media (max-width: 420px) { .p-head__side .p-pref--lang { padding: 0 8px; } }

/* Update 36: recordings only, and each chapter's recording and summary */
.p-rec { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; font-weight: 600; margin: 2px 0 8px; cursor: pointer; }
.p-rec input { width: 18px; height: 18px; }
.p-rec__hint { flex-basis: 100%; font-weight: 400; font-size: 12.5px; color: var(--text-2); }
.p-chapters__part { margin: 12px 0 4px; }
.p-tick { display: inline-block; width: 1.4em; color: var(--text-2); font-weight: 700; }
.p-chapter.is-done .p-tick { color: var(--settled); }
.p-chapter__links { gap: 8px; margin-top: 6px; flex-wrap: wrap; align-items: center; }

/* ── update 37: Home cards, Telegram, offers, how the student studies ── */
.p-install--hot { border: 2px solid var(--signal); box-shadow: 0 0 0 4px rgba(78,192,242,.14); }
.p-notify .p-perks { margin: 6px 0 10px; }
.p-notify .row { gap: 8px; flex-wrap: wrap; }
.p-tg { display: inline-flex; align-items: center; gap: 6px; background: #229ED9; color: #fff; border-color: #229ED9; margin: 6px 0 8px; white-space: normal; text-align: start; }
.p-tg:hover { background: #1C8BC0; color: #fff; }
.p-tgcard .p-tg { margin-bottom: 0; }
.p-offer-news { display: grid; gap: 4px; text-decoration: none; color: inherit; border: 2px solid var(--due); background: var(--due-bg); }
.p-offer-news .small { color: var(--due); font-weight: 600; }
.p-offer { display: grid; gap: 6px; }
.p-offer.is-new { border-color: var(--due); box-shadow: 0 0 0 2px rgba(181,116,20,.18); }
.p-offer--standing { background: var(--settled-bg); border-color: var(--settled); }
.p-offer--standing strong { color: var(--settled); font-size: 16px; }
.p-offer--standing p { margin: 0; }
.p-modes { display: grid; gap: 10px; margin-top: 8px; }
.p-mode { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.p-mode__code { min-width: 70px; }
.p-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.p-seg__opt { border: 0; background: transparent; color: var(--text-2); padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.p-seg__opt.is-on { background: var(--signal-dim); color: #fff; font-weight: 600; }
.p-seg__opt:disabled { cursor: default; }
.p-seg__opt + .p-seg__opt { border-inline-start: 1px solid var(--line); }
.p-yourno { margin: 8px 0; }
.p-yourno strong { font-size: 18px; letter-spacing: .03em; }
.p-yourno__row { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; }
.p-yourno .p-yourno__code { font-size: 26px; letter-spacing: .06em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.p-tabs a .p-dot { margin-inline-start: 4px; font-size: 11px; padding: 0 6px; }
.p-tg, .p-tg:hover { text-decoration: none; }
.p-tgcard .p-h2, .p-notify h2 { margin-top: 0; }

/* ── update 38: paying by card, packages, credit, Master Class ── */
.p-pack { display: grid; gap: 2px; padding: 6px 0; border-top: 1px dashed var(--line-soft); }
.p-pack:first-child { border-top: 0; }
.p-packb { display: grid; gap: 4px; margin-top: 6px; padding: 8px 10px; border-radius: var(--radius); background: var(--due-bg); }
.p-days.is-due { color: var(--alert); }
.p-pay { margin-top: 8px; justify-self: start; }
.p-cardnote { display: grid; gap: 6px; margin-top: 4px; padding: 10px 12px; border-radius: var(--radius); background: var(--info-bg); color: var(--info-text); }
.p-cardnote p { margin: 0; }
.p-cardnote .btn { justify-self: start; }
.p-paychoice { display: grid; gap: 6px; }
.p-mc { display: inline-block; padding: 0 6px; margin-inline-end: 6px; border-radius: 4px; font-size: 11px; font-weight: 700;
  background: #FFF1D6; color: #8A5300; border: 1px solid #F0C877; vertical-align: middle; }
.p-offer-pack h2 { margin: 2px 0 4px; }
.p-offer-pack .p-pay { margin-top: 10px; }
.p-cardnote a.btn, .p-cardnote a.btn:hover { text-decoration: none; }
.is-preview-off { opacity: .55; cursor: not-allowed; }
/* A subject the student stopped (update 39) */
.p-stopped { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #FDECEE; color: #C33642; }
.p-subject.is-stopped { border-color: #E9A3AA; }
:root[data-theme="dark"] .p-stopped { background: #3A1A1E; color: #F0858F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .p-stopped { background: #3A1A1E; color: #F0858F; } }

/* The summary viewer and the bar back to the portal (update 40). */
.portal-back { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: #0B1F3A; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.portal-back a { color: #fff; text-decoration: none; font-weight: 600; font-size: 15px; }
.portal-back .portal-back__open { font-weight: 400; font-size: 13px; opacity: .85; text-decoration: underline; }
body.summary-view { margin: 0; height: 100vh; display: flex; flex-direction: column; background: #525659; }
.summary-view__pdf { flex: 1; width: 100%; border: 0; background: #fff; }

/* Credit, block by block (update 40). */
.p-blocks { display: grid; gap: 10px; margin: 10px 0; }
.p-block { border: 1px solid var(--line, #d9dee7); border-radius: 12px; padding: 10px 12px; }
.p-block.is-closed { opacity: .85; }
.p-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; text-align: center; }
.p-three > div { background: var(--muted-bg, rgba(127,127,127,.08)); border-radius: 10px; padding: 8px 4px; }
.p-three strong { font-size: 16px; display: block; margin-top: 2px; }
.p-sources summary { cursor: pointer; margin: 6px 0; }
.p-help { margin: 6px 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.p-creditpol { margin: 10px 0; }
.p-sums { margin: 2px 0 8px; line-height: 1.6; }
/* The bell (update 41) */
.p-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; text-decoration: none; color: inherit; }
.p-bell:hover { background: rgba(255,255,255,.08); }
.p-bell__n { position: absolute; top: -2px; inset-inline-end: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #D64545; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.p-notice { align-items: flex-start; gap: 8px; }
.p-notice.is-new { border-inline-start: 3px solid var(--accent, #2C7BE5); padding-inline-start: 8px;
  background: color-mix(in srgb, var(--accent, #2C7BE5) 12%, transparent); border-radius: 6px; }
.p-notice.is-new strong { font-weight: 700; }
.p-notice__x { background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; padding: 2px 6px; }
.p-notice__x:hover { opacity: 1; }
.p-topup { margin: 4px 0 8px; }
.p-saving strong.is-paid { font-weight: 700; }

/* What the student owes, and why (update 42) */
a.p-stat--link { display: block; color: inherit; text-decoration: none; cursor: pointer; }
a.p-stat--link:hover, a.p-stat--link:focus-visible { border-color: var(--signal-dim); }
a.p-owedlink { color: inherit; text-decoration: none; display: inline-block; }
a.p-owedlink strong { text-decoration: underline; text-underline-offset: 3px; }
.p-owed { display: grid; gap: 10px; }
.p-owed__block { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 6px; }
.p-owed__head { display: flex; justify-content: space-between; gap: 8px; }
.p-owedpage { width: 100%; }
a.p-brand--home { text-decoration: none; color: inherit; cursor: pointer; }
a.p-brand--home:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 4px; }

/* «مسارك» — the way the subject is paid (update 42.6). */
.p-paytrack { margin: 4px 0 2px; }

/* Home, light (update 42.7): one figure first, the rest a tap away. */
.p-hero { display: grid; gap: 12px; }
.p-hero__main { display: block; text-decoration: none; color: inherit; }
.p-hero__v { font-size: 32px; font-weight: 800; line-height: 1.1; }
.p-hero__two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.p-hero__two strong { font-size: 18px; }
.p-hero__act { gap: 8px; }
.p-how summary { cursor: pointer; color: var(--text-2); }
.p-how__body { display: grid; gap: 6px; padding-top: 8px; }
.p-how__body .p-updated { margin: 0; }
.p-alerts { display: grid; gap: 8px; margin-bottom: 12px; }
.p-alert { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--due-bg); color: var(--due); font-weight: 600; text-decoration: none; border: 1px solid var(--due); }
.p-subrows { display: grid; gap: 0; }
.p-subrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: inherit; margin-bottom: 8px; }
.p-subrow.is-stopped { opacity: .7; }
.p-subrow__main { min-width: 0; display: grid; gap: 2px; }
.p-subrow__side { display: flex; align-items: center; gap: 10px; text-align: end; flex-shrink: 0; }
.p-chev { font-size: 22px; color: var(--text-3); line-height: 1; }
.p-morelinks { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 8px; }
.p-block__sum { cursor: pointer; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; padding: 4px 0; list-style-position: inside; }
details.p-block[open] > .p-block__sum { margin-bottom: 8px; }

/* The guide in the portal (update 43): on paper, the guide alone. */
.p-guide-link { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25); color: var(--on-ink); text-decoration: none; font-weight: 700; font-size: 16px; }
.p-guide-link:hover { background: rgba(255,255,255,.08); }
@media print {
  body:not(.print-report) .p-head, body:not(.print-report) .p-tabs, body:not(.print-report) .p-preview { display: none !important; }
  body:not(.print-report) .p-main { max-width: none; padding: 0; }
}

/* «Rate your experience» (update 49) */
.p-review { border-inline-start: 4px solid var(--signal); }
.p-review h2 { margin-top: 0; }
.p-review .row { gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.p-review__alt { margin: 8px 0 0; }

/* A subject's stages, folded (update 50) */
.p-stage { border-top: 1px solid var(--line); }
.p-stage:first-of-type { border-top: 0; }
.p-stage__head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 12px 2px; cursor: pointer; list-style: none; }
.p-stage__head::-webkit-details-marker { display: none; }
.p-stage__head::before { content: '›'; display: inline-block; width: 12px; transition: transform .15s; color: var(--text-2); }
html[dir=rtl] .p-stage__head::before { content: '‹'; }
.p-stage[open] > .p-stage__head::before { transform: rotate(90deg); }
html[dir=rtl] .p-stage[open] > .p-stage__head::before { transform: rotate(-90deg); }
.p-stage__name { font-weight: 600; }
.p-stage__tick { color: var(--settled); font-weight: 700; }
.p-stage__count { font-variant-numeric: tabular-nums; font-weight: 600; }
.p-stage__bar { flex: 0 0 80px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.p-stage__bar > span { display: block; height: 100%; background: var(--signal); }
.p-stage.is-complete .p-stage__bar > span { background: var(--settled); }
.p-stage__flag { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.p-stage__flag.is-new { background: var(--info-bg); color: var(--info-text); }
.p-stage__flag.is-due { background: var(--due-bg); color: var(--due); }
.p-stage__left { margin-inline-start: auto; }

/* certificates of completion (update 53) */
.p-cert__row { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
.p-cert__row:first-of-type { border-top: 0; }
.p-cert__icon { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #0B1F3A; color: #4EC0F2; font-size: 18px; }
.p-cert__main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.p-result summary { cursor: pointer; list-style: none; }
.p-result summary::-webkit-details-marker { display: none; }
.p-result__form { display: grid; gap: 10px; margin-top: 12px; }
.p-result__form input { width: 100%; }

/* The official logo (update 53). */
.p-logo { display: block; width: 210px; max-width: 70vw; height: auto; }
.p-logo--compact { width: 108px; }
.p-brand--home { flex: none; }
/* An e-mail to confirm (update 58): a reminder, not an alarm. */
.p-alert.p-alert--soft { background: var(--info-bg); color: var(--info-text); border-color: transparent; }
/* A class closed to the student (update 58): what opens it, and how to pay. */
.p-locked { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--due-bg); color: var(--due); font-size: 13px; font-weight: 600; }
.p-locked .btn { margin-inline-start: auto; }

/* ── update 60: progress, the exam countdown, rating, the calendar, Able ── */
.p-progress { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.p-progress__bar { width: 70px; height: 5px; border-radius: 3px; background: var(--muted-bg); overflow: hidden; flex: none; }
.p-progress__bar span { display: block; height: 100%; background: var(--settled); }
.p-progress__todo { color: var(--info-text); }

.p-class__acts { display: flex; align-items: center; gap: 6px; }
.p-cal { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--line); color: var(--signal-dim); background: var(--surface); }
.p-cal:hover { background: var(--hover-bg); }
.p-calcard { display: flex; align-items: center; gap: 12px; }
.p-calcard__i { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--info-bg); color: var(--info-text); flex: none; }
.p-calcard__t { flex: 1; min-width: 0; display: grid; gap: 2px; }

/* The countdown: the number is the card. */
.p-exam { border-inline-start: 4px solid var(--signal-dim); }
.p-exam.is-near { border-inline-start-color: var(--alert); }
.p-exam__head { display: flex; gap: 14px; align-items: center; }
.p-exam__count { flex: none; width: 80px; min-height: 84px; border-radius: 12px; background: var(--ink); color: var(--on-ink); display: grid; place-content: center; text-align: center; padding: 6px; }
.p-exam__count strong { font-size: 30px; line-height: 1.05; font-variant-numeric: tabular-nums; color: #fff; }
.p-exam__count span { font-size: 11px; color: var(--on-ink-2); }
.p-exam.is-near .p-exam__count { background: var(--alert); }
.p-exam.is-near .p-exam__count span { color: #fff; }
.p-exam__what { min-width: 0; }
.p-exam__what h2 { font-size: 17px; margin: 2px 0; }
.p-exam__mc { margin-top: 10px; font-size: 14px; }
.p-exam__plan { margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.p-exam__plan summary { cursor: pointer; font-weight: 600; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0; }
.p-rev { margin: 8px 0 12px; padding-inline-start: 22px; display: grid; gap: 6px; }
.p-rev li { padding-inline-start: 4px; }
.p-rev li > * { vertical-align: middle; }
.p-rev__t { margin-inline-end: 8px; }
.p-rev__s { padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.p-rev--done .p-rev__s { background: var(--settled-bg); color: var(--settled); }
.p-rev--todo .p-rev__s { background: var(--info-bg); color: var(--info-text); }
.p-rev--miss .p-rev__s { background: var(--due-bg); color: var(--due); }
.p-rev--soon .p-rev__s { background: var(--muted-bg); color: var(--text-2); }

/* Five stars, big enough for a thumb. */
.p-rate h2 { margin: 0 0 4px; font-size: 18px; }
.p-stars { display: flex; gap: 4px; margin: 8px 0; direction: ltr; justify-content: flex-start; }
[dir="rtl"] .p-stars { justify-content: flex-end; }
.p-star { all: unset; cursor: pointer; line-height: 1; color: var(--line); transition: transform .12s ease, color .12s ease; border-radius: 6px; }
.p-stars--lg .p-star { font-size: 38px; padding: 2px 4px; }
.p-star.is-on { color: #E9A23B; }
.p-star:focus-visible { outline: 2px solid var(--signal-dim); outline-offset: 2px; }
.p-star:active { transform: scale(1.15); }
@media (prefers-reduced-motion: reduce) { .p-star { transition: none; } }
.p-rate__after { margin-top: 6px; }
.p-rated { margin-inline-end: 8px; }

/* Able, in the portal */
.able { position: fixed; inset-inline-end: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40; }
.able__fab { display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--text); border: 2px solid #E9A23B; border-radius: 999px;
  padding: 4px 16px 4px 4px; font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-pop); }
[dir="rtl"] .able__fab { padding: 4px 4px 4px 16px; }
.able__fab img { width: 46px; height: 46px; border-radius: 50%; background: var(--paper); }
.able__fab[aria-expanded="true"] { display: none; }
.able__panel { position: fixed; inset-inline-end: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100dvh - 40px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden; }
.able__panel[hidden] { display: none; }
.able__head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--ink); color: var(--on-ink); }
.able__head div { display: grid; flex: 1; line-height: 1.3; }
.able__head strong { color: #fff; }
.able__head span { font-size: 13px; color: var(--on-ink-2); }
.able__face { width: 40px; height: 40px; border-radius: 50%; background: #fff; }
.able__x { background: none; border: 0; color: var(--on-ink); font-size: 28px; line-height: 1; cursor: pointer; width: 40px; height: 40px; border-radius: 8px; }
.able__log { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.able__msg { margin: 0; padding: 10px 13px; border-radius: 14px; max-width: 88%; font-size: 15px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.able__msg--bot { background: var(--surface); color: var(--text); align-self: flex-start; border-end-start-radius: 4px; }
.able__msg--me { background: var(--ink-2); color: #fff; align-self: flex-end; border-end-end-radius: 4px; }
.able__msg--wait { color: var(--text-2); display: flex; gap: 8px; align-items: center; }
.able__msg--wait img, .able__msg--hand img { width: 44px; height: 44px; }
.able__msg--hand { display: grid; gap: 8px; border: 2px solid #E9A23B; }
.able__msg--hand .btn { justify-self: start; }
.able__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.able__chip { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--signal-dim); background: var(--surface); color: var(--signal-dim); cursor: pointer; text-align: start; }
.able__chip:hover { background: var(--hover-bg); }
.able__form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface); align-items: flex-end; }
.able__form textarea { flex: 1; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; resize: none; max-height: 120px; min-height: 44px; background: var(--field-bg); color: var(--text); }
.able__note { margin: 0; padding: 0 12px 10px; font-size: 12px; color: var(--text-2); background: var(--surface); }
.p-main { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
@media (max-width: 520px) {
  .able__fab span { display: none; } .able__fab { padding: 4px !important; }
  .able__panel { inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; }
  body.able-open { overflow: hidden; }
}
@media print { .able, .p-cal, .p-calcard, .p-rate, .p-exam { display: none !important; } }
