/* EdHelfy — Parent/Student app shell (Phase 1) chrome.
   Everything is scoped under body.ps-shell, which is added ONLY for a pure
   parent/student login (isReadOnlyRoleSet) and removed on logout — so the admin
   layout is never affected. Reuses brand tokens. The shell paints chrome only;
   the per-tab content still renders into #mainContent. */

/* ── Hide the admin chrome for parent/student ── */
body.ps-shell #sidebar,
body.ps-shell #sidebarOverlay { display: none; }
/* The admin bottom-nav gets an inline `display` from updateBottomNav(), so hiding it
   under the shell needs a scoped !important (safe — body.ps-shell is parent/student only). */
body.ps-shell #bottomNav { display: none !important; }

/* Trim the admin topbar down to title + bell + profile (the bell's #notifPanel and
   the #profileDD live inside .topbar, so we reuse it rather than rebuild that infra).
   .mobile-toggle carries an admin mobile `display:flex !important`, so overriding it
   needs a body.ps-shell-scoped !important — safe (only applies under the shell). */
body.ps-shell .topbar .mobile-toggle { display: none !important; }
body.ps-shell .topbar .global-search,
body.ps-shell .topbar [data-action="html-print-report"],
body.ps-shell .topbar [data-action="html-export-date-range"] { display: none; }
/* Keep the sync pill + bell + profile (the sync indicator mirrors the prototype). */

/* ── The shell's own chrome (off unless body.ps-shell) ── */
.ps-sidebar, .ps-bottomnav { display: none; }

body.ps-shell .ps-sidebar {
  display: flex; flex-direction: column; gap: 4px;
  position: fixed; left: 0; top: 0; bottom: 0; width: 240px; z-index: 95;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 14px; overflow-y: auto;
}
body.ps-shell .ps-brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 14px; }
body.ps-shell .ps-logo { width: 26px; height: 26px; display: inline-flex; flex: none; }
body.ps-shell .ps-wordmark { font-family: 'DM Sans', var(--font-display), sans-serif; font-size: 19px; font-weight: 700; letter-spacing: .3px; }
body.ps-shell .ps-wordmark .pp { background: linear-gradient(135deg,#6A0DAD,#8A2BE2); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
body.ps-shell .ps-wordmark .pk { background: linear-gradient(135deg,#FF2D95,#FF5DA2); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

body.ps-shell .ps-childsw { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 4px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
body.ps-shell .ps-kid { font-family: var(--font-display, sans-serif); font-size: 12px; font-weight: 600; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text3); cursor: pointer; }
body.ps-shell .ps-kid.on { background: linear-gradient(135deg,#8A2BE2,#FF2D95); color: #fff; border-color: transparent; }

body.ps-shell .ps-nav { display: flex; flex-direction: column; gap: 2px; }
body.ps-shell .ps-nav-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: none; background: transparent; border-radius: 10px; color: var(--text2); font-family: var(--font-display, sans-serif); font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
body.ps-shell .ps-nav-btn svg { flex: none; stroke: var(--text3); }
body.ps-shell .ps-nav-btn:hover { background: var(--sidebar-hover, rgba(138,43,226,.06)); color: var(--sidebar-accent, var(--accent)); }
body.ps-shell .ps-nav-btn:hover svg { stroke: var(--sidebar-accent, var(--accent)); }
body.ps-shell .ps-nav-btn.active { background: var(--sidebar-active, rgba(138,43,226,.1)); color: var(--sidebar-accent-dark, var(--accent)); }
body.ps-shell .ps-nav-btn.active svg { stroke: var(--sidebar-accent-dark, var(--accent)); }

/* Content offset: take full control under the shell (overrides the admin .main 72px
   AND the admin tablet `.content { margin-left:200px }` at 769–1024). */
body.ps-shell .main { margin-left: 240px; }
body.ps-shell .content { margin-left: 0; }

/* ── Mobile: sidebar → bottom-nav (the app's 768px breakpoint) ── */
@media (max-width: 768px) {
  body.ps-shell .ps-sidebar { display: none; }
  body.ps-shell .main { margin-left: 0; }
  body.ps-shell .ps-bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    background: var(--surface); border-top: 1px solid var(--border);
    height: 60px; padding: 4px 6px;
  }
  body.ps-shell .ps-bottomnav .ps-nav-btn { flex: 1; flex-direction: column; gap: 3px; justify-content: center; align-items: center; padding: 6px 2px; border-radius: 8px; }
  body.ps-shell .ps-bottomnav .ps-nav-label { font-size: 10px; font-weight: 600; }
  /* admin mobile already sets .content padding-bottom:72px — keep room for the bottom-nav */
  body.ps-shell .content { padding-bottom: 74px; }
}

/* ── Parent/Student dashboard hero + rings (.psd-*) ──
   Class-scoped: these classes are emitted ONLY by the read-only dashboard render
   block (dashboard-render.js), so admin is unaffected — no body.ps-shell gate needed.
   Conic-gradient rings reuse the prototype look + brand tokens. */
.psd-rings { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.psd-ringcard { flex: 1; min-width: 116px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; background: var(--bg1, var(--surface)); border: 1px solid var(--border); border-radius: 12px; }
.psd-ring { width: 82px; height: 82px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.psd-ring-inner { width: 62px; height: 62px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.psd-ring-val { font-family: var(--font-display, sans-serif); font-size: 17px; font-weight: 700; color: var(--text); }
.psd-ring-sub { font-size: 9px; color: var(--text3); }
.psd-ring-label { font-size: 11px; font-weight: 600; color: var(--text2); }
.psd-kidswitch { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.psd-kid { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--border); background: transparent; cursor: pointer; text-align: left; }
.psd-kid.on { border-color: var(--accent); background: var(--soft, rgba(138,43,226,.08)); }
.psd-kid-name { font-family: var(--font-display, sans-serif); font-size: 12px; font-weight: 600; color: var(--text); }
.psd-kid-sub { font-size: 10px; color: var(--text3); }

/* ── Parent/Student fees screen (.psf-*) ──
   Class-scoped — emitted ONLY by fees.js _renderParentStudentFees() for the
   read-only roles, so the admin Fees page is untouched (no body.ps-shell gate
   needed, same convention as .psd-*). Tints via color-mix so light/dark/ocean
   all read correctly off the theme tokens. */
.psf-wrap { display: flex; flex-direction: column; gap: 12px; }
.psf-childsw { display: flex; flex-wrap: wrap; gap: 6px; }
.psf-kid { padding: 6px 12px; border-radius: 10px; border: 1px solid var(--border); background: transparent; cursor: pointer; font-size: 13px; color: var(--text2); }
.psf-kid.on { border-color: var(--accent); color: var(--accent); font-weight: 700; background: var(--accent-light); }
.psf-hero { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #000)); color: #fff; border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.psf-hero.cleared { background: linear-gradient(135deg, #16a35b, #0f9b8e); }
.psf-hero-l { font-size: 12px; opacity: 0.85; }
.psf-hero-amt { font-family: var(--font-display, sans-serif); font-size: 30px; font-weight: 800; letter-spacing: -0.01em; }
.psf-hero-sub { font-size: 12px; opacity: 0.9; }
.psf-pay { margin-top: 10px; align-self: flex-start; background: #fff; color: var(--accent); border: none; border-radius: 10px; padding: 9px 16px; font-weight: 700; font-size: 14px; cursor: pointer; }
.psf-group-title { font-size: 12px; font-weight: 700; color: var(--text2); margin: 2px 0 -4px; }
.psf-group { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.psf-row { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.psf-row:last-child { border-bottom: none; }
.psf-ic { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.psf-ic.due { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.psf-ic.paid { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.psf-row-main { flex: 1; min-width: 0; }
.psf-row-nm { font-size: 14px; font-weight: 600; color: var(--text); }
.psf-row-sub { font-size: 11px; color: var(--text3); }
.psf-row-amt { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; }
.psf-row-amt b { font-size: 14px; color: var(--text); }
.psf-pill { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.psf-pill.pending { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.psf-pill.partial { background: var(--accent-light); color: var(--accent); }
.psf-pill.paid { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.psf-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.psf-ghost { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--text2); cursor: pointer; }

/* ── In-content child-switchers: mobile-only ──
   .psf-childsw (fees screen) and .psd-kidswitch (dashboard) exist for MOBILE, where
   the shell sidebar — and its .ps-childsw switcher — is hidden (@media max-width:768
   above). On desktop the sidebar switcher is present, so the in-content copy is
   redundant; hide it at the shell's 769px desktop breakpoint. Mobile keeps it (the
   only way to switch children when the sidebar is gone). */
@media (min-width: 769px) {
  .psf-childsw, .psd-kidswitch { display: none; }
}
