/* Guardian child switcher + shared card rhythm */
:root {
  --guardian-section-gap: 1.25rem;
  --guardian-card-gap: 1rem;
}

.guardian-child-panel {
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--m-border, #e2e8f0);
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
  padding: 14px 16px;
}

.dark-mode .guardian-child-panel,
[data-bs-theme="dark"] .guardian-child-panel {
  background: #18181b;
  border-color: rgba(255, 255, 255, 0.1);
}

.guardian-child-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.guardian-child-panel-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--m-text-muted, #64748b);
}

.guardian-child-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--m-text-muted, #64748b);
}

.guardian-child-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.guardian-child-card {
  flex: 0 0 auto;
  min-width: 240px;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1.5px solid var(--m-border, #e2e8f0);
  border-radius: 14px;
  background: var(--m-surface-2, #f8fafc);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.guardian-child-card:hover {
  border-color: rgba(1, 56, 216, .35);
  background: rgba(1, 56, 216, .04);
}

.guardian-child-card.active {
  border-color: #0138d8;
  background: rgba(1, 56, 216, .07);
  box-shadow: 0 5px 16px rgba(1, 56, 216, .12);
}

.guardian-child-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.guardian-child-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.guardian-child-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--m-text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guardian-child-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.guardian-child-badge {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(1, 56, 216, .08);
  color: #0138d8;
  border: 1px solid rgba(1, 56, 216, .16);
}

.guardian-child-status {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.guardian-child-check {
  margin-left: auto;
  color: #0138d8;
  font-size: 14px;
  flex-shrink: 0;
}

.guardian-child-loading,
.guardian-child-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--m-text-muted, #64748b);
}

.guardian-kpi-row .card,
.guardian-kpi-row .pf-card,
.guardian-kpi-row .ga-card {
  height: 100%;
}

/* Keep the guardian pages on one vertical rhythm. */
#guardianChildPicker { margin-bottom: var(--guardian-section-gap) !important; }

#gaRoot > .mb-4,
#pfRoot > .mb-4,
#oppRoot > .mb-4,
#asg-my-assessments .container-fluid > .mb-4,
html[data-content-persona="parent"] .section__content > .container-fluid > .d-flex.mb-4 {
  margin-bottom: var(--guardian-section-gap) !important;
}

#gaRoot > .row.g-3,
#pfRoot > .row.g-3,
#oppRoot > .row.g-3,
#asg-my-assessments .container-fluid > .row.g-3,
.guardian-shell > .row.g-3,
.prn-shell > .row.g-3,
html[data-content-persona="parent"] #annLearnerKpis,
html[data-content-persona="parent"] #frmLearnerKpis {
  margin-top: 0 !important;
  margin-bottom: var(--guardian-section-gap) !important;
  row-gap: var(--guardian-card-gap);
}

#gaRoot > .row.g-3 > *,
#pfRoot > .row.g-3 > *,
#oppRoot > .row.g-3 > *,
#asg-my-assessments .container-fluid > .row.g-3 > *,
.guardian-shell > .row.g-3 > *,
.prn-shell > .row.g-3 > *,
html[data-content-persona="parent"] #annLearnerKpis > *,
html[data-content-persona="parent"] #frmLearnerKpis > * {
  margin-top: 0 !important;
}

.guardian-shell > .row.g-3,
.prn-shell > .row.g-3 {
  margin-bottom: 0 !important;
}

#gaRoot > .ga-card.mb-3,
#oppRoot > .d-flex.mb-3 {
  margin-top: 0 !important;
  margin-bottom: var(--guardian-section-gap) !important;
}

.guardian-shell > .d-flex.mt-1 {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.dark-mode .guardian-child-card,
[data-bs-theme="dark"] .guardian-child-card {
  background: #1e1e24;
  border-color: rgba(255, 255, 255, 0.12);
}

.dark-mode .guardian-child-card.active,
[data-bs-theme="dark"] .guardian-child-card.active {
  background: rgba(1, 56, 216, 0.18);
  border-color: #3b82f6;
}

/* Tighten the gap between top navigation and content */
body.app main .section__content--p30,
body.app .main-content > .section__content--p30 {
  padding-top: 14px !important;
}

@media (max-width: 991.98px) {
  .section__content--p30,
  body.app main .section__content--p30,
  body.app .main-content > .section__content--p30 {
    padding-top: 8px !important;
    padding-bottom: 24px !important;
  }
}

@media (max-width: 768px) {
  /* Section Padding reduction on phone — snug gap below nav */
  .section__content--p30,
  body.app main .section__content--p30,
  body.app .main-content > .section__content--p30 {
    padding: 6px 0 24px 0 !important;
  }
  .container-fluid {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Guardian Shell Rhythms */
  .guardian-shell,
  .prn-shell {
    gap: 1rem !important;
  }

  /* 1. Hero Cockpit on Phones */
  .guardian-hero {
    padding: 1.25rem 1rem !important;
    border-radius: 18px !important;
  }

  .guardian-hero h1,
  .guardian-hero #prnHeroGreeting {
    font-size: 1.45rem !important;
    line-height: 1.25 !important;
    margin-bottom: 0.5rem !important;
  }

  .guardian-hero p.fs-15 {
    font-size: 13px !important;
    line-height: 1.45 !important;
    margin-bottom: 0.85rem !important;
  }

  .guardian-hero-badge {
    font-size: 11px !important;
    padding: 4px 10px !important;
  }

  /* Transform Quick Action buttons to 2x2 grid */
  .guardian-hero .d-flex.align-items-center.gap-2.flex-wrap {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .guardian-hero .d-flex.align-items-center.gap-2.flex-wrap > .btn {
    width: 100% !important;
    min-height: 42px !important;
    padding: 8px 6px !important;
    font-size: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    border-radius: 10px !important;
    white-space: nowrap !important;
  }

  /* Active Ward Status Cockpit on Phones */
  .guardian-ward-card {
    padding: 12px !important;
    border-radius: 16px !important;
    margin-top: 10px !important;
  }

  .ward-stat-tile {
    padding: 8px 10px !important;
    border-radius: 12px !important;
  }

  .ward-stat-label {
    font-size: 10px !important;
    margin-bottom: 2px !important;
  }

  .ward-stat-val {
    font-size: 1.15rem !important;
  }

  /* Core Hub Modules */
  .guardian-card {
    padding: 1.25rem 1rem !important;
    border-radius: 16px !important;
  }

  .guardian-card h5 {
    font-size: 1rem !important;
  }

  .guardian-card p.small {
    font-size: 12.5px !important;
    margin-bottom: 0.75rem !important;
  }

  .guardian-card .btn {
    min-height: 42px !important;
    font-size: 13px !important;
  }

  /* 2. Timetable / Schedule on Phones */
  #prnScheduleDayBtns {
    display: flex !important;
    width: 100% !important;
    gap: 6px !important;
  }

  .prn-day-btn {
    flex: 1 1 0 !important;
    text-align: center !important;
    padding: 8px 0 !important;
    font-size: 12.5px !important;
    border-radius: 9px !important;
  }

  .prn-period-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 12px 14px !important;
  }

  .prn-period-row > div:last-child {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-top: 8px !important;
    border-top: 1px dashed rgba(148, 163, 184, 0.25) !important;
    text-align: left !important;
  }

  /* 3. Fees & Invoices on Phones */
  .fee-kpi-card {
    padding: 12px 14px !important;
    border-radius: 14px !important;
  }

  .fee-kpi-value {
    font-size: 1.25rem !important;
  }

  .prn-card {
    padding: 14px !important;
    border-radius: 16px !important;
  }

  /* 4. Results & Academic Records on Phones */
  .prn-kpi-card {
    padding: 12px 14px !important;
    border-radius: 14px !important;
  }

  .prn-kpi-card h3 {
    font-size: 1.35rem !important;
  }

  /* Page title headers */
  .prn-shell .d-flex.justify-content-between.align-items-md-center,
  .prn-shell .d-flex.flex-column.flex-md-row.justify-content-between {
    gap: 10px !important;
  }

  .prn-shell .d-flex.align-items-center.gap-2 {
    width: 100% !important;
    flex-wrap: wrap !important;
  }

  .prn-shell .d-flex.align-items-center.gap-2 .btn {
    flex: 1 1 auto !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

@media (max-width: 575.98px) {
  .guardian-child-card { min-width: 220px; }
  .guardian-child-panel { padding: 12px; }

  /* Make Results 4 KPI tiles a clean 2x2 grid instead of 4 giant stacked cards */
  #parentResultsRoot .row.g-3 > .col-12.col-sm-6.col-xl-3 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
    width: 50% !important;
  }

  #parentResultsRoot .prn-kpi-card {
    padding: 10px 12px !important;
  }

  #parentResultsRoot .prn-kpi-card h3 {
    font-size: 1.2rem !important;
  }

  #parentResultsRoot .prn-kpi-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 12px !important;
  }

  /* Table horizontally smooth scroll with touch swipe */
  .table-responsive {
    -webkit-overflow-scrolling: touch !important;
    border-radius: 12px !important;
  }

  .table-responsive table {
    min-width: 540px !important;
  }
}

/* ============================================================================
   Equal Height Ward Status Tiles (Parent Cockpit)
   ============================================================================ */
.ward-stat-tile {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.13) !important;
  border-radius: 14px !important;
  padding: 10px 14px !important;
  height: 100% !important;
  min-height: 84px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  box-sizing: border-box !important;
  transition: background 0.15s ease, border-color 0.15s ease !important;
}

.ward-stat-tile:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

/* ============================================================================
   Responsive Topbar: Child Switcher + Parent Avatar on Mobile Viewports
   ============================================================================ */
@media (max-width: 991.98px) {
  /* Keep header-button tightly packed on one row inside Column 3 of the grid */
  body.app .header-desktop .header-wrap > .header-button {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
  }

  /* Child switcher button on mobile */
  .alg-csw {
    margin-right: 2px !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
  }

  .alg-csw__btn {
    height: 36px !important;
    padding: 0 8px !important;
    gap: 6px !important;
    max-width: 160px !important;
    border-radius: 999px !important;
    font-size: 12px !important;
  }

  .alg-csw__avatar {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    font-size: 10px !important;
  }

  .alg-csw__label {
    max-width: 85px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Hide the class pill on phones so the topbar never overflows */
  .alg-csw__class {
    display: none !important;
  }

  .alg-csw__caret {
    font-size: 9px !important;
  }

  /* Dropdown sheet on mobile */
  .alg-csw__menu {
    position: fixed !important;
    top: 64px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: calc(100vw - 20px) !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35) !important;
    z-index: 1090 !important;
  }

  /* Theme toggle button on mobile */
  body.app .header-desktop #algThemeToggle {
    margin-right: 2px !important;
    margin-left: 0 !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  /* Parent / User Avatar Chip on mobile */
  body.app .header-desktop .account-wrap {
    display: inline-flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    margin-left: 2px !important;
  }

  body.app .header-desktop .account-item {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
  }

  body.app .header-desktop .account-item > .content {
    display: none !important;
  }

  body.app .header-desktop .account-item .image,
  body.app .header-desktop #headerUserAvatar {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
}

@media (max-width: 390px) {
  .alg-csw__btn {
    max-width: 125px !important;
    padding: 0 6px !important;
    gap: 4px !important;
  }

  .alg-csw__label {
    max-width: 60px !important;
    font-size: 11.5px !important;
  }
}

@media (max-width: 350px) {
  .alg-csw__btn {
    max-width: 105px !important;
  }

  .alg-csw__label {
    max-width: 48px !important;
  }
}



/* ============================================================================
   Student portal - shared card rhythm and page alignment
   20px between sections - 16px between cards - 20px card body padding
   ============================================================================ */

/* Match the standard .section__content gutter so every student page lines up. */
html[data-content-persona="student"] .stu-portal-wrap {
  padding: 14px 40px 60px !important;
}

html[data-content-persona="student"] #gaRoot,
html[data-content-persona="student"] #pfRoot,
html[data-content-persona="student"] #oppRoot {
  padding: 14px 40px 60px !important;
}

/* Shared page header rhythm */
html[data-content-persona="student"] .section__content > .container-fluid > .d-flex.mb-4 {
  margin-bottom: 20px !important;
}

/* --------------------------------------------------------------------------
   Student dashboard
   -------------------------------------------------------------------------- */
html[data-content-persona="student"] .stu-portal-wrap > .stu-hero-banner {
  margin-bottom: 20px !important;
}

html[data-content-persona="student"] .stu-portal-wrap .row.g-3 {
  margin-top: 0 !important;
  row-gap: 16px;
}

html[data-content-persona="student"] .stu-portal-wrap .row.g-3.mb-4 {
  margin-bottom: 20px !important;
}

html[data-content-persona="student"] .stu-portal-wrap > .stu-tabs-wrap {
  margin-bottom: 20px !important;
}

html[data-content-persona="student"] .stu-portal-wrap .stu-kpi-card,
html[data-content-persona="student"] .stu-portal-wrap .stu-card.p-4,
html[data-content-persona="student"] .stu-portal-wrap .stu-asg-card {
  padding: 20px !important;
}

/* Keep the hero copy inside the card on phones. */
html[data-content-persona="student"] .stu-hero-banner .min-w-0 {
  flex: 1 1 0;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   My School Day
   -------------------------------------------------------------------------- */
html[data-content-persona="student"] #msdPage .row.g-3 {
  margin-top: 0 !important;
  row-gap: 16px;
}

html[data-content-persona="student"] #msdPage .container-fluid > .row.g-3 {
  margin-bottom: 20px !important;
}

html[data-content-persona="student"] #msdPage .container-fluid > .m-card.mt-3 {
  margin-top: 0 !important;
  margin-bottom: 20px !important;
}

html[data-content-persona="student"] #msdPage .container-fluid > .m-card.mt-3:last-child {
  margin-bottom: 0 !important;
}

html[data-content-persona="student"] #msdPage .m-card.p-4,
html[data-content-persona="student"] #msdPage .msd-kpi {
  padding: 20px !important;
}

/* --------------------------------------------------------------------------
   My Assessments
   -------------------------------------------------------------------------- */
html[data-content-persona="student"] #asg-my-assessments .nav.my-assessments-tabs {
  margin-bottom: 20px !important;
}

html[data-content-persona="student"] #asg-my-assessments .tab-content .row.g-3 {
  margin-top: 0 !important;
  row-gap: 16px;
}

html[data-content-persona="student"] #asg-my-assessments .tab-content .row.g-3 > * {
  margin-top: 0 !important;
}

html[data-content-persona="student"] #asg-my-assessments .row.g-3 > * > .mya-card {
  height: 100%;
}

html[data-content-persona="student"] #asg-my-assessments .mya-card {
  padding: 20px !important;
}

html[data-content-persona="student"] #asg-my-assessments #myaContextBar {
  padding: 8px 12px !important;
}

/* --------------------------------------------------------------------------
   Achievements / Portfolio / Opportunities
   -------------------------------------------------------------------------- */
html[data-content-persona="student"] #gaRoot .ga-card-body,
html[data-content-persona="student"] #pfRoot .pf-card-body {
  padding: 20px !important;
}

html[data-content-persona="student"] #pfRoot .row.g-3 > * > .pf-card {
  height: 100%;
  min-height: 120px;
}

html[data-content-persona="student"] #pfRoot .row.g-3 > * > .pf-card > .pf-card-body {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

html[data-content-persona="student"] #pfRoot .pf-card-body {
  height: 100%;
}

html[data-content-persona="student"] #pfRoot .pf-grid,
html[data-content-persona="student"] #oppRoot .opp-grid {
  gap: 16px;
}

html[data-content-persona="student"] #oppRoot .opp-card {
  padding: 20px !important;
}

/* --------------------------------------------------------------------------
   Communication Hub - learner KPI rows
   -------------------------------------------------------------------------- */
html[data-content-persona="student"] #annLearnerKpis,
html[data-content-persona="student"] #frmLearnerKpis {
  margin-top: 0 !important;
  margin-bottom: 20px !important;
  row-gap: 16px;
}

html[data-content-persona="student"] #annLearnerKpis > *,
html[data-content-persona="student"] #frmLearnerKpis > * {
  margin-top: 0 !important;
}

html[data-content-persona="student"] #annLearnerKpis .m-card,
html[data-content-persona="student"] #frmLearnerKpis .m-card {
  padding: 20px !important;
}

/* Main Communication Hub cards */
html[data-content-persona="student"] .section__content > .container-fluid > .m-card.p-4 {
  padding: 20px !important;
}

/* --------------------------------------------------------------------------
   My Tech Career content workspace stats
   -------------------------------------------------------------------------- */
html[data-content-persona="student"] .cw-stat {
  padding: 20px !important;
}

/* --------------------------------------------------------------------------
   Responsive gutter alignment
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  html[data-content-persona="student"] .stu-portal-wrap,
  html[data-content-persona="student"] #gaRoot,
  html[data-content-persona="student"] #pfRoot,
  html[data-content-persona="student"] #oppRoot {
    padding: 8px 12px 24px !important;
  }
}

@media (max-width: 768px) {
  html[data-content-persona="student"] .stu-portal-wrap,
  html[data-content-persona="student"] #gaRoot,
  html[data-content-persona="student"] #pfRoot,
  html[data-content-persona="student"] #oppRoot {
    padding: 6px 12px 24px !important;
  }

  /* A column flex item must not inherit a 260px row flex-basis as its height. */
  html[data-content-persona="student"] #gaRoot > .d-flex > div:first-child,
  html[data-content-persona="student"] #pfRoot > .d-flex > div:first-child,
  html[data-content-persona="student"] #oppRoot > .d-flex > div:first-child {
    flex: 0 0 auto !important;
  }
}

@media (max-width: 575.98px) {
  html[data-content-persona="student"] .stu-hero-banner {
    padding: 20px !important;
  }

  html[data-content-persona="student"] .stu-hero-banner h2 {
    font-size: 1.45rem !important;
  }

  html[data-content-persona="student"] .stu-avatar-img {
    width: 56px !important;
    height: 56px !important;
    font-size: 22px !important;
  }
}

/* Mobile app shell: clear the fixed 60px topbar, then keep page breathing room tight. */
@media (max-width: 991.98px) {
  body.app .page-container {
    top: 0 !important;
  }

  body.app .page-wrapper {
    padding-bottom: 16px !important;
  }

  body.app .main-content {
    padding-top: 60px !important;
    padding-bottom: 12px !important;
  }
}

@media (max-width: 575.98px) {
  body.app .page-wrapper {
    padding-bottom: 8px !important;
  }

  body.app .main-content {
    padding-top: 120px !important;
    padding-bottom: 8px !important;
  }
}
