/* Parent Portal – mobile-first styles (mirrors teacher portal patterns) */

body.parent-portal-page {
  margin: 0;
  min-height: 100vh;
  background: var(--gray-50);
  font-family: var(--font, 'DM Sans', sans-serif);
  color: var(--gray-800);
}

.pp-login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
}

@media (min-width: 900px) {
  .pp-login-shell { flex-direction: row; }
}

.pp-brand-panel {
  flex: 1;
  background: linear-gradient(160deg, #1a3a5c 0%, #2d5a87 45%, #3b76c4 100%);
  color: var(--white);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.pp-brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display, 'Fraunces', serif);
  font-weight: 700;
  font-size: 26px;
  color: var(--navy-900);
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  margin-bottom: 24px;
}

.pp-brand-title {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 12px;
}

.pp-brand-title span { color: var(--gold-400); }

.pp-brand-desc {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, .6);
  max-width: 400px;
  margin: 0;
}

.pp-brand-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}

.pp-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, .75);
}

.pp-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-400);
}

.pp-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

.pp-login-card {
  width: 100%;
  max-width: 420px;
}

.pp-panel { display: none; }
.pp-panel.active { display: block; }

.pp-login-card h1 {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: 26px;
  margin: 0 0 8px;
  color: var(--navy-900);
}

.pp-login-card p {
  font-size: 14px;
  color: var(--gray-500);
  margin: 0 0 20px;
}

.pp-input-wrap {
  position: relative;
}

.pp-toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
}

.pp-alert {
  display: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.pp-alert.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.pp-alert.success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

.pp-lifecycle-notice {
  display: none;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
}

.pp-lifecycle-notice.pp-lifecycle-restricted {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.pp-lifecycle-notice .pp-lifecycle-icon {
  font-size: 18px;
  line-height: 1;
  margin-top: 2px;
}

.pp-lifecycle-notice p {
  margin: 4px 0 0;
  line-height: 1.5;
}

.pp-link-btn {
  background: none;
  border: none;
  color: var(--navy-600);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.pp-login-footer {
  margin-top: 24px;
  font-size: 13px;
  color: var(--gray-500);
  text-align: center;
  line-height: 1.8;
}

.pp-login-footer a { color: var(--navy-600); }

.pp-otp-input {
  letter-spacing: 8px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
}

.pp-resend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--gray-500);
}

/* Portal shell */
.pp-portal-shell,
.pp-picker-shell {
  display: none;
  min-height: 100vh;
  flex-direction: column;
}

.pp-portal-shell.active,
.pp-picker-shell[style*="block"] {
  display: flex;
}

.pp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 10;
}

.pp-topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pp-topbar-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--navy-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-topbar-sub {
  font-size: 12px;
  color: var(--gray-500);
}

.pp-topbar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.pp-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  overflow-x: auto;
}

.pp-tab {
  flex: 1;
  min-width: 72px;
  border: none;
  background: transparent;
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--gray-500);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pp-tab.active {
  background: var(--navy-50);
  color: var(--navy-700);
  font-weight: 600;
}

.pp-main {
  flex: 1;
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.pp-tab-panel { display: none; }
.pp-tab-panel.active { display: block; }

.pp-loading {
  text-align: center;
  padding: 24px;
  color: var(--gray-500);
}

/* Child picker */
.pp-picker-main {
  padding: 24px 16px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.pp-picker-main h2 {
  font-family: var(--font-display, 'Fraunces', serif);
  margin: 0 0 8px;
  color: var(--navy-900);
}

.pp-picker-sub {
  color: var(--gray-500);
  font-size: 14px;
  margin: 0 0 24px;
}

.pp-child-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.pp-child-card {
  border: 2px solid var(--gray-200);
  border-radius: 16px;
  padding: 20px 12px;
  background: var(--white);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, box-shadow .15s;
}

.pp-child-card:hover {
  border-color: var(--navy-400);
  box-shadow: 0 8px 24px rgba(26, 58, 92, .08);
}

.pp-child-name {
  font-weight: 600;
  font-size: 14px;
  margin-top: 10px;
  color: var(--navy-900);
}

.pp-child-meta,
.pp-child-adm {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.ava-pink { background: #fce7f3; color: #be185d; }
.ava-blue { background: #dbeafe; color: #1d4ed8; }

/* Dashboard widgets */
.pp-hero-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.pp-stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--gray-200);
  text-align: center;
}

.pp-stat-label {
  font-size: 11px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pp-stat-value {
  font-size: 14px;
  font-weight: 600;
  margin-top: 6px;
  color: var(--navy-900);
}

.pp-section {
  margin-bottom: 24px;
}

.pp-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pp-section-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--navy-900);
}

.pp-hint {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0 0 12px;
}

.pp-empty {
  font-size: 14px;
  color: var(--gray-500);
  padding: 16px;
  background: var(--white);
  border-radius: 12px;
  border: 1px dashed var(--gray-300);
  text-align: center;
}

.pp-attendance-card {
  background: var(--white);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--gray-200);
}

.pp-attendance-status {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pp-attendance-sub {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 8px;
}

.pp-status-present { color: var(--emerald); }
.pp-status-absent { color: var(--rose); }
.pp-status-late { color: var(--amber); }
.pp-status-excused { color: var(--navy-600); }
.pp-status-unknown { color: var(--gray-500); }

.pp-diary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pp-diary-item {
  background: var(--white);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--gray-200);
}

.pp-diary-item.pp-diary-action {
  border-left: 3px solid var(--amber);
}

.pp-diary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.pp-diary-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 3px 9px;
  border-radius: 999px;
}

.pp-diary-badge.pp-diary-homework { background: #fef3c7; color: #92400e; }
.pp-diary-badge.pp-diary-materialsbadge { background: #dcfce7; color: #166534; }
.pp-diary-badge.pp-diary-announcement { background: #e0e7ff; color: #3730a3; }

.pp-diary-due {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  white-space: nowrap;
}

.pp-diary-due-urgent {
  color: #b91c1c;
}

.pp-diary-attach {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--gray-100, #f1f5f9);
  color: var(--navy-700, #1e3a8a);
  text-decoration: none;
}

.pp-diary-attach:hover {
  background: var(--gray-200, #e2e8f0);
}

.pp-diary-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--navy-900);
}

.pp-diary-body {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 6px;
  line-height: 1.5;
}

.pp-diary-materials {
  font-size: 12px;
  color: var(--amber);
  margin-top: 8px;
  font-weight: 500;
}

.pp-diary-meta {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 8px;
}

.pp-report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
}

.pp-muted { font-size: 12px; color: var(--gray-500); }

.pp-portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.pp-portfolio-item {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.pp-portfolio-thumb {
  height: 100px;
  background-size: cover;
  background-position: center;
  background-color: var(--gray-100);
}

.pp-portfolio-doc {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--gray-400);
}

.pp-portfolio-caption {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px 0;
  color: var(--navy-900);
}

.pp-portfolio-meta {
  font-size: 11px;
  color: var(--gray-500);
  padding: 4px 10px 10px;
}

.pp-fee-card {
  background: var(--white);
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--gray-200);
}

.pp-fee-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
}

.pp-pay-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pp-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.pp-cal-month {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-700, #374151);
}

.pp-cal-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600, #4b5563);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pp-cal-nav-btn:hover:not(:disabled) { background: var(--gray-50, #f9fafb); }
.pp-cal-nav-btn:disabled { opacity: .4; cursor: not-allowed; }

.pp-cal-loading { opacity: .55; pointer-events: none; }

.pp-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: var(--white);
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--gray-200);
}

.pp-cal-head {
  font-size: 10px;
  text-align: center;
  color: var(--gray-500);
  font-weight: 600;
  padding: 4px 0;
}

.pp-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 8px;
  background: var(--gray-50);
}

.pp-cal-day.has-present { background: #d1fae5; color: #047857; font-weight: 600; }
.pp-cal-day.has-absent { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.pp-cal-day.has-late { background: #fef3c7; color: #b45309; font-weight: 600; }
.pp-cal-day.has-excused { background: #dbeafe; color: #1d4ed8; font-weight: 600; }
.pp-cal-day.empty { background: transparent; }
.pp-cal-day.is-future { opacity: .35; }
.pp-cal-day.is-today { box-shadow: 0 0 0 2px var(--navy-500, #1e3a8a); }

.pp-cal-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 12px;
  color: var(--gray-600, #4b5563);
}

.pp-cal-summary strong { color: var(--gray-800, #1f2937); }

.pp-cal-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  flex-wrap: wrap;
}

.pp-cal-legend span::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
}

.pp-cal-legend .has-present::before { background: #d1fae5; }
.pp-cal-legend .has-absent::before { background: #fee2e2; }
.pp-cal-legend .has-late::before { background: #fef3c7; }
.pp-cal-legend .has-excused::before { background: #dbeafe; }

@media (max-width: 480px) {
  .pp-hero-cards { grid-template-columns: 1fr; }
  .pp-topbar-actions .btn span { display: none; }
}

.pp-mpesa-panel { margin-top: 14px; }
.pp-mpesa-form { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px; }
.pp-mpesa-form h4 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; color: #0f172a; }
.pp-mpesa-form label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin: 10px 0 4px; }
.pp-mpesa-actions { display: flex; gap: 8px; margin-top: 14px; }
.pp-mpesa-status { margin-top: 12px; font-size: 13px; color: #334155; min-height: 18px; }
.pp-mpesa-status .pp-err { color: #dc2626; }
.pp-mpesa-status .pp-ok { color: #16a34a; font-weight: 600; }
.pp-fee-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }

/* Itemised fee statement */
.pp-fee-statement { margin-top: 4px; }
.pp-statement-block { margin-top: 14px; }
.pp-statement-block h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: #334155; text-transform: uppercase; letter-spacing: .4px; }
.pp-statement-scroll { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 12px; }
.pp-statement-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pp-statement-table thead th { text-align: left; background: #f8fafc; color: #64748b; font-weight: 600; font-size: 12px; padding: 9px 12px; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.pp-statement-table tbody td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; color: #1e293b; }
.pp-statement-table tbody tr:last-child td { border-bottom: none; }
.pp-statement-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Fee structure breakdown */
.pp-fee-breakdown { margin-top: 16px; padding-top: 14px; border-top: 1px solid #e2e8f0; }
.pp-fee-breakdown-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.pp-fee-breakdown-head h4 { margin: 0; font-size: 13px; font-weight: 700; color: #334155; text-transform: uppercase; letter-spacing: .4px; }
.pp-fee-breakdown-head h4 span { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: none; letter-spacing: 0; }
.pp-fee-breakdown-row { padding: 6px 0; border-bottom: 1px dashed #eef2f7; font-size: 14px; }
.pp-fee-breakdown-row:last-of-type { border-bottom: none; }
.pp-fee-optional { font-style: normal; font-size: 11px; color: #94a3b8; }
.pp-fee-breakdown-total { margin-top: 8px; padding-top: 10px; border-top: 2px solid #e2e8f0; font-weight: 700; color: var(--navy-700, #1e3a5f); }
