/* ==========================================================================
   Parent Portal — design tokens
   Swap these to reskin the whole app in one place.
   ========================================================================== */
:root {
  --ink:        #16302B;
  --ink-soft:   #4A5D57;
  --brand:      #1F6F5C;
  --brand-dark: #144A3D;
  --accent:     #E2A33D;
  --accent-ink: #5C3B0E;
  --bg:         #F6F5F1;
  --card:       #FFFFFF;
  --line:       #E7E3D8;
  --danger:     #C4432B;
  --danger-bg:  #FBE9E4;
  --ok:         #2C7A5B;
  --ok-bg:      #E7F3EC;
  --radius-lg:  22px;
  --radius-md:  16px;
  --radius-sm:  10px;
  --shadow:     0 10px 30px rgba(22,48,43,0.10);
  --font-head:  'Fraunces', Georgia, serif;
  --font-body:  'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 48px;
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  background: linear-gradient(165deg, var(--brand-dark), var(--brand) 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  color: #fff;
  text-align: center;
}
.login-mark {
  width: 84px; height: 84px;
  border-radius: 22px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head);
  font-size: 40px; font-weight: 600;
  color: var(--brand-dark);
  margin-bottom: 20px;
}
.login-screen h1 {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 28px;
  margin: 0 0 4px;
}
.login-screen p.sub { margin: 0 0 32px; color: rgba(255,255,255,0.78); font-size: 15px; }
.login-form { width: 100%; max-width: 340px; }
.login-form input {
  width: 100%;
  padding: 15px 16px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 15px;
}
.login-form input::placeholder { color: rgba(255,255,255,0.7); }
.login-form input:focus { outline: 2px solid var(--accent); background: rgba(255,255,255,0.18); }
.btn-primary {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.btn-primary:focus-visible, .btn-secondary:focus-visible, .icon-btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.login-error {
  background: rgba(196,67,43,0.18);
  border: 1px solid rgba(196,67,43,0.4);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}
.divider-label {
  margin: 26px 0 14px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.6);
}
.btn-secondary {
  width: 100%;
  max-width: 340px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.35);
  background: transparent;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- Header (Today / Features) ---------- */
.top-header {
  background: linear-gradient(165deg, var(--brand-dark), var(--brand) 75%);
  color: #fff;
  padding: 18px 20px 56px;
  position: relative;
}
.top-header .row {
  display: flex; align-items: center; gap: 12px;
}
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 18px;
  flex-shrink: 0;
}
.student-id { flex: 1; min-width: 0; }
.student-id h2 {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 19px;
  margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.student-id p {
  margin: 2px 0 0;
  font-size: 13px;
  color: rgba(255,255,255,0.78);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-dot {
  position: absolute;
  top: -3px; right: -3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--brand);
}
.icon-wrap { position: relative; }

/* Tab switcher pill, overlapping the header like the reference app */
.tab-switcher {
  margin: -38px 20px 0;
  background: var(--card);
  border-radius: 999px;
  box-shadow: var(--shadow);
  display: flex;
  padding: 5px;
  position: relative;
  z-index: 2;
}
.tab-switcher a {
  flex: 1;
  text-align: center;
  padding: 11px 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tab-switcher a.active {
  background: var(--brand-dark);
  color: #fff;
}

/* ---------- Section labels / cards ---------- */
.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 26px 20px 10px;
}
.card {
  margin: 0 20px 14px;
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 16px;
}
.needs-you-card {
  margin: 0 20px 14px;
  background: var(--danger-bg);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.needs-you-card .glyph {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--danger);
}
.needs-you-card .txt { flex: 1; min-width: 0; }
.needs-you-card .txt strong { display: block; font-size: 15px; }
.needs-you-card .txt span { font-size: 13px; color: var(--ink-soft); }
.pay-btn {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--ink-soft);
}
.status-chip.present { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.status-chip.absent { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.list-card {
  margin: 0 20px 14px;
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.list-card .glyph {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(31,111,92,0.10);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.list-card .txt { flex: 1; min-width: 0; }
.list-card .txt strong { display: block; font-size: 14.5px; }
.list-card .txt span { font-size: 12.5px; color: var(--ink-soft); }
.list-card .chev { color: var(--ink-soft); }

.empty-note {
  margin: 0 20px 14px;
  padding: 22px 16px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

/* ---------- Search ---------- */
.search-wrap { margin: 18px 20px 6px; }
.search-wrap input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14.5px;
  color: var(--ink);
}
.search-wrap input:focus { outline: 2px solid var(--brand); }

/* ---------- Feature grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 8px;
  margin: 0 16px 8px;
}
.feature-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink);
  position: relative;
  padding: 2px;
}
.feature-tile .glyph {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-dark);
  position: relative;
}
.feature-tile .badge {
  position: absolute;
  top: -6px; right: 2px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  min-width: 17px; height: 17px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  font-weight: 700;
}
.feature-tile span.label {
  line-height: 1.2;
  max-width: 68px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.school-card {
  margin: 24px 20px 8px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 18px;
}
.school-card .head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.school-card .mark {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 600; font-size: 18px;
}
.school-card h3 { margin: 0; font-size: 15px; font-family: var(--font-head); font-weight: 600; }
.school-card .session {
  display: inline-block;
  margin-top: 3px;
  font-size: 11px;
  background: rgba(31,111,92,0.1);
  color: var(--brand);
  padding: 2px 8px;
  border-radius: 999px;
}
.school-card .detail { font-size: 13px; color: var(--ink-soft); margin: 6px 0; display: flex; gap: 8px; align-items: center; }

/* ---------- Sidebar (hamburger drawer) ---------- */
.sidebar-scrim {
  position: fixed; inset: 0;
  background: rgba(16,32,29,0.45);
  z-index: 40;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.sidebar-scrim.open { opacity: 1; pointer-events: auto; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 78%; max-width: 320px;
  background: var(--card);
  z-index: 41;
  transform: translateX(-105%);
  transition: transform .25s ease;
  overflow-y: auto;
  box-shadow: 20px 0 40px rgba(0,0,0,0.15);
}
.sidebar.open { transform: translateX(0); }
.sidebar-head {
  background: linear-gradient(165deg, var(--brand-dark), var(--brand) 75%);
  color: #fff;
  padding: 26px 20px;
}
.sidebar-head .avatar { background: var(--accent); color: var(--brand-dark); margin-bottom: 10px; }
.sidebar-head h3 { margin: 0; font-family: var(--font-head); font-weight: 500; font-size: 17px; }
.sidebar-head p { margin: 2px 0 0; font-size: 13px; color: rgba(255,255,255,0.8); }
.sidebar nav { padding: 8px 0; }
.sidebar nav a {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 20px;
  font-size: 14.5px;
  color: var(--ink);
}
.sidebar nav a:active, .sidebar nav a:hover { background: var(--bg); }
.sidebar nav .glyph { color: var(--brand); width: 20px; display: flex; justify-content: center; }
.sidebar .divider { border-top: 1px solid var(--line); margin: 8px 0; }
.sidebar .group-label {
  padding: 12px 20px 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.sidebar .logout { color: var(--danger); font-weight: 600; }
.sidebar .toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 20px; }
.switch {
  width: 40px; height: 22px; border-radius: 999px; background: var(--line);
  position: relative; flex-shrink: 0;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
}

/* ---------- Generic module placeholder ---------- */
.module-header {
  background: linear-gradient(165deg, var(--brand-dark), var(--brand) 75%);
  color: #fff; padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
}
.module-header h1 { font-family: var(--font-head); font-weight: 500; font-size: 19px; margin: 0; }
.coming-soon {
  margin: 60px 30px;
  text-align: center;
  color: var(--ink-soft);
}
.coming-soon .glyph {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 18px;
  background: rgba(31,111,92,0.10);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
.coming-soon h2 { color: var(--ink); font-family: var(--font-head); font-weight: 500; margin: 0 0 6px; }

@media (min-width: 481px) {
  .app-shell { box-shadow: 0 0 60px rgba(0,0,0,0.06); }
}

/* ---------- Round 2: Fees / Attendance / Notice Board ---------- */
.summary-card {
  margin: 16px 20px 18px;
  background: linear-gradient(165deg, var(--brand-dark), var(--brand) 80%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.summary-card .amount-label { font-size: 12.5px; color: rgba(255,255,255,0.75); margin-bottom: 4px; }
.summary-card .amount { font-family: var(--font-head); font-size: 30px; font-weight: 600; }
.summary-card .amount small { font-size: 15px; font-weight: 500; opacity: 0.85; }
.summary-card .pay-now-btn {
  margin-top: 14px;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.summary-card.all-clear { background: linear-gradient(165deg, var(--ok), #1f5c44 80%); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 16px 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 6px;
  text-align: center;
}
.stat-card .n { font-family: var(--font-head); font-size: 20px; font-weight: 600; }
.stat-card .l { font-size: 10.5px; color: var(--ink-soft); margin-top: 2px; }
.stat-card.present .n { color: var(--ok); }
.stat-card.absent .n { color: var(--danger); }
.stat-card.late .n { color: var(--accent-ink); }

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: capitalize;
}
.status-badge.paid, .status-badge.present { background: var(--ok-bg); color: var(--ok); }
.status-badge.unpaid, .status-badge.absent { background: var(--danger-bg); color: var(--danger); }
.status-badge.partial, .status-badge.late { background: rgba(226,163,61,0.18); color: var(--accent-ink); }
.status-badge.leave { background: rgba(31,111,92,0.10); color: var(--brand); }

.fee-item, .att-item {
  margin: 0 20px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.fee-item .row1, .att-item .row1 {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.fee-item .row1 strong { font-size: 14.5px; }
.fee-item .row2 {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 8px; font-size: 12.5px; color: var(--ink-soft);
}
.fee-item .row2 .rem { font-size: 15px; font-weight: 600; color: var(--ink); }
.att-item .row1 .date { font-size: 14px; font-weight: 600; }
.att-item .row1 .dow { font-size: 12px; color: var(--ink-soft); margin-left: 6px; }

.notice-date-header {
  margin: 22px 20px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.notice-card {
  margin: 0 20px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow);
}
.notice-card h3 { margin: 0 0 6px; font-size: 15px; font-family: var(--font-head); font-weight: 600; color: var(--brand-dark); }
.notice-card p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.notice-card .audience-tag {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--brand);
  background: rgba(31,111,92,0.10);
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.month-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 20px 4px;
}
.month-nav .label { font-family: var(--font-head); font-size: 16px; font-weight: 600; }
.month-nav a.icon-btn { background: rgba(31,111,92,0.08); color: var(--brand-dark); }

/* ---------- Switch child ---------- */
.child-card {
  width: calc(100% - 40px);
  margin: 0 20px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow);
}
.child-card.active {
  border-color: var(--brand);
  background: rgba(31,111,92,0.06);
}
.child-card .avatar { background: var(--accent); color: var(--brand-dark); flex-shrink: 0; }
.child-card .txt { flex: 1; min-width: 0; }
.child-card .txt strong { display: block; font-size: 14.5px; color: var(--ink); }
.child-card .txt span { font-size: 12.5px; color: var(--ink-soft); }
.child-card .chev { color: var(--ink-soft); }
.child-card .active-tag {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; color: var(--brand);
  white-space: nowrap;
}

/* ---------- Profile ---------- */
.profile-hero {
  text-align: center;
  padding: 28px 20px 8px;
}
.profile-hero .avatar-lg {
  width: 84px; height: 84px;
  border-radius: 24px;
  margin: 0 auto 14px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 32px;
  overflow: hidden;
}
.profile-hero .avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero h2 { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 20px; }
.profile-hero p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13.5px; }

.profile-card {
  margin: 16px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.profile-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-head);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--brand-dark);
}
.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.profile-row:last-child { border-bottom: none; }
.profile-row .label { color: var(--ink-soft); flex-shrink: 0; }
.profile-row .value { color: var(--ink); font-weight: 500; text-align: right; }
