/* =====================================================
   Everest Cricket Academy — Admin & Portal UI
   Palette: navy #0a1428 · white · emerald #149b6c/#2ecc8f · gold #d4af37
   ===================================================== */
:root {
  --navy-900: #070f20;
  --navy-800: #0a1428;
  --navy-700: #0e1d3b;
  --emerald: #149b6c;
  --emerald-light: #2ecc8f;
  --gold: #d4af37;
  --bg: #f1f4f9;
  --card: #ffffff;
  --text: #1d2a3f;
  --muted: #64748b;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(10, 20, 40, .07);
}

* { box-sizing: border-box; }
body.app-body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, "Segoe UI", sans-serif;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  background: linear-gradient(175deg, var(--navy-900), var(--navy-700));
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .3s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 1.2rem 1.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.logo-ball {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
  font-size: 1.2rem;
  flex-shrink: 0;
}
.sidebar-brand strong { display: block; color: #fff; letter-spacing: .12em; line-height: 1.1; }
.sidebar-brand small { color: var(--gold); font-size: .62rem; letter-spacing: .22em; }

.sidebar-nav {
  padding: 1rem .8rem;
  flex: 1 1 auto;
  min-height: 0;                      /* let the flex child shrink below its content height */
  overflow-y: auto;                   /* menu scrolls independently when it exceeds the viewport */
  overscroll-behavior: contain;       /* don't chain-scroll the page behind the fixed sidebar */
  -webkit-overflow-scrolling: touch;  /* momentum scrolling on iOS */
  scrollbar-width: thin;              /* Firefox */
  scrollbar-color: rgba(255, 255, 255, .22) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .35); }
.sidebar-nav a, .sidebar-foot a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .68rem .9rem;
  border-radius: 10px;
  color: #aebacf;
  text-decoration: none;
  font-size: .92rem;
  margin-bottom: .2rem;
  transition: all .2s ease;
}
.sidebar-nav a:hover, .sidebar-foot a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(20, 155, 108, .9), rgba(46, 204, 143, .75));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(20, 155, 108, .35);
}
.ni { width: 22px; text-align: center; }
.sidebar-foot { padding: .8rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.text-danger-soft { color: #f0a9a9 !important; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 15, 32, .55);
  z-index: 1035;
}

/* ---------- Main / topbar ---------- */
.main { margin-left: 250px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  padding: .8rem 1.4rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1020;
}
.topbar-title { font-size: 1.15rem; font-weight: 700; margin: 0; flex: 1; }
.burger { display: none; border: none; background: none; font-size: 1.3rem; cursor: pointer; }
.topbar-user { display: flex; align-items: center; gap: .6rem; }
.topbar-user strong { display: block; font-size: .88rem; line-height: 1.1; }
.topbar-user small { color: var(--muted); font-size: .72rem; }

.avatar {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-800));
  color: var(--gold);
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.avatar-sm { width: 34px; height: 34px; font-size: .72rem; }

.content { padding: 1.5rem; flex: 1; }
.app-footer { padding: 1rem 1.5rem; color: var(--muted); font-size: .8rem; text-align: center; }

/* ---------- Stat cards ---------- */
.stat-card {
  display: flex;
  align-items: center;
  gap: .9rem;
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  height: 100%;
  border-bottom: 3px solid transparent;
  transition: transform .2s ease;
}
.stat-card:hover { transform: translateY(-3px); border-bottom-color: var(--emerald-light); }
.stat-icon {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 12px;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.bg-emerald-soft { background: rgba(46, 204, 143, .14); }
.bg-navy-soft { background: rgba(14, 29, 59, .1); }
.bg-gold-soft { background: rgba(212, 175, 55, .16); }
.bg-red-soft { background: rgba(220, 76, 76, .12); }
.stat-label { display: block; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }

/* ---------- Panels ---------- */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: .8rem;
}
.panel-head h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.panel-kpis { display: flex; gap: .8rem; flex-wrap: wrap; }
.kpi { font-size: .78rem; color: var(--muted); }
.kpi-green strong { color: var(--emerald); }
.kpi-red strong { color: #d64545; }

.badge-soft {
  background: rgba(14, 29, 59, .07);
  border-radius: 50px;
  padding: .2rem .7rem;
  font-size: .75rem;
  font-weight: 600;
}

/* ---------- Lists ---------- */
.match-item, .list-row, .activity-row {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .65rem 0;
  border-bottom: 1px solid #eef1f6;
}
.match-item:last-child, .list-row:last-child, .activity-row:last-child { border-bottom: none; }
.match-date {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  color: #fff;
  border-radius: 10px;
  line-height: 1;
  flex-shrink: 0;
}
.match-date strong { font-size: 1rem; }
.match-date span { font-size: .6rem; color: var(--gold); text-transform: uppercase; }
.activity-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--emerald-light);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(46, 204, 143, .15);
}

/* ---------- Tables & pills ---------- */
.app-table { font-size: .9rem; }
.app-table thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  border-bottom-width: 1px;
}
.status-pill {
  padding: .22rem .7rem;
  border-radius: 50px;
  font-size: .74rem;
  font-weight: 600;
}
.status-pill.on { background: rgba(46, 204, 143, .15); color: #0e7a52; }
.status-pill.off { background: rgba(220, 76, 76, .13); color: #b23434; }
.status-pill.warn { background: rgba(212, 175, 55, .18); color: #8a6d14; }

.role-pill {
  padding: .22rem .7rem;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 600;
  background: rgba(14, 29, 59, .08);
}
.role-super_admin { background: rgba(212, 175, 55, .2); color: #7c6210; }
.role-admin { background: rgba(14, 29, 59, .12); color: var(--navy-700); }
.role-coach { background: rgba(46, 204, 143, .15); color: #0e7a52; }
.role-student { background: rgba(59, 130, 246, .12); color: #1d4ed8; }
.role-parent { background: rgba(168, 85, 247, .12); color: #7e22ce; }
.role-accountant { background: rgba(234, 88, 12, .12); color: #c2410c; }
.role-scorer { background: rgba(13, 148, 136, .12); color: #0f766e; }

/* ---------- Buttons ---------- */
.btn-emerald {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
  border: none;
  color: #fff;
  font-weight: 600;
}
.btn-emerald:hover, .btn-emerald:focus { filter: brightness(1.07); color: #fff; }

/* ---------- Misc ---------- */
.sysinfo li {
  display: flex;
  justify-content: space-between;
  padding: .5rem 0;
  border-bottom: 1px solid #eef1f6;
}
.sysinfo li:last-child { border-bottom: none; }
.att-chip {
  border-radius: 10px;
  padding: .45rem .7rem;
  font-size: .72rem;
  text-align: center;
  line-height: 1.3;
}
.att-chip strong { display: block; }
.att-present { background: rgba(46, 204, 143, .14); color: #0e7a52; }
.att-late { background: rgba(212, 175, 55, .18); color: #8a6d14; }
.att-absent { background: rgba(220, 76, 76, .13); color: #b23434; }
.mini-stat {
  background: var(--bg);
  border-radius: 10px;
  padding: .7rem .4rem;
  height: 100%;
}
.mini-stat strong { display: block; font-size: 1rem; }
.mini-stat span { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mini-stat.danger strong { color: #b23434; }

/* ---------- Portal topbar ---------- */
.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  padding: .9rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.portal-brand { display: flex; align-items: center; gap: .7rem; }
.portal-brand strong { display: block; letter-spacing: .12em; line-height: 1.1; }
.portal-brand small { color: var(--gold); font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; }
.portal-body .content { max-width: 1200px; margin: 0 auto; width: 100%; }
.portal-topbar .topbar-user small { color: #9fb0c8; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-105%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .main { margin-left: 0; }
  .burger { display: block; }
}
@media (max-width: 575px) {
  .content { padding: 1rem; }
  .stat-value { font-size: 1.25rem; }
}

/* ---------- Student / admission / trial status pills ---------- */
.st-active    { background: rgba(46, 204, 143, .15); color: #0e7a52; }
.st-pending   { background: rgba(212, 175, 55, .18); color: #8a6d14; }
.st-inactive  { background: rgba(100, 116, 139, .15); color: #475569; }
.st-suspended { background: rgba(220, 76, 76, .13); color: #b23434; }
.st-graduated { background: rgba(59, 130, 246, .13); color: #1d4ed8; }
.ap-pending        { background: rgba(212, 175, 55, .18); color: #8a6d14; }
.ap-info_requested { background: rgba(234, 88, 12, .13); color: #c2410c; }
.ap-approved       { background: rgba(46, 204, 143, .15); color: #0e7a52; }
.ap-rejected       { background: rgba(220, 76, 76, .13); color: #b23434; }
.ap-converted      { background: rgba(59, 130, 246, .13); color: #1d4ed8; }
.tr-pending   { background: rgba(212, 175, 55, .18); color: #8a6d14; }
.tr-approved  { background: rgba(46, 204, 143, .15); color: #0e7a52; }
.tr-completed { background: rgba(59, 130, 246, .13); color: #1d4ed8; }
.tr-rejected  { background: rgba(220, 76, 76, .13); color: #b23434; }
.tr-converted { background: rgba(14, 29, 59, .12); color: #0e1d3b; }

/* ---------- Student photos ---------- */
.stu-photo-sm { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid #e8ecf3; }
.stu-photo-lg { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; border: 3px solid #e8ecf3; box-shadow: var(--shadow); }

/* ---------- Admin form section headings ---------- */
.fsec-admin {
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .16em;
  color: var(--emerald); border-bottom: 2px solid rgba(46, 204, 143, .18);
  padding-bottom: .35rem; margin: 1.6rem 0 1rem;
}

/* ---------- Portal quick-nav (mobile-first) ---------- */
.qnav {
  display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
}
.qnav a {
  flex-shrink: 0; background: var(--card); border-radius: 50px; padding: .5rem 1rem;
  font-size: .88rem; font-weight: 600; color: var(--text); text-decoration: none;
  box-shadow: var(--shadow); border: 1px solid #e8ecf3;
}
.qnav a:hover { color: var(--emerald); border-color: var(--emerald-light); }

/* ---------- Phase 3: coaching, schedule & attendance ---------- */
.att-excused { background: rgba(110, 125, 150, .13); color: #4a5a72; }
.qnav a.active { background: var(--navy, #0d2137); color: #fff; border-color: var(--navy, #0d2137); }

.notif-bell {
  position: relative; text-decoration: none; font-size: 1.15rem;
  margin-left: auto; margin-right: .75rem; line-height: 1;
}
.topbar .notif-bell { margin-left: auto; }
.portal-topbar .notif-bell { margin-right: .4rem; }
.notif-badge {
  position: absolute; top: -7px; right: -9px; background: #dc4c4c; color: #fff;
  border-radius: 50px; font-size: .6rem; font-weight: 700; padding: 1px 5px; line-height: 1.3;
}
.notif-unread { background: rgba(46, 204, 143, .06); border-left: 3px solid var(--emerald, #2ecc8f); }

.day-check { cursor: pointer; }
.day-check input { display: none; }
.day-check span {
  display: inline-block; padding: .4rem .85rem; border-radius: 50px;
  border: 1.5px solid #d8dfe9; font-size: .82rem; font-weight: 600; color: var(--muted);
}
.day-check input:checked + span { background: var(--emerald, #2ecc8f); border-color: var(--emerald, #2ecc8f); color: #fff; }

.sched-grid td, .sched-grid th { vertical-align: middle; }
.sched-today { background: rgba(212, 175, 55, .08); }
.sched-cell {
  display: inline-block; border-radius: 8px; padding: .3rem .45rem;
  font-size: .68rem; font-weight: 600; line-height: 1.25; margin: 1px 0;
}
.sched-on { background: rgba(46, 204, 143, .14); color: #0e7a52; }
.sched-cancel { background: rgba(220, 76, 76, .13); color: #b23434; }
.sched-change { background: rgba(212, 175, 55, .2); color: #8a6d14; }
.sched-extra { background: rgba(13, 110, 253, .1); color: #0d55b8; }

.att-cal {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 760px;
}
.att-cal-head { text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: .2rem 0; }
.att-cal-cell {
  border: 1px solid #e8ecf3; border-radius: 8px; min-height: 62px;
  padding: .3rem .4rem; font-size: .72rem; background: var(--card, #fff);
}
.att-cal-cell.empty { border: none; background: transparent; }
.att-cal-cell.good { background: rgba(46, 204, 143, .13); border-color: rgba(46, 204, 143, .35); }
.att-cal-cell.ok { background: rgba(212, 175, 55, .15); border-color: rgba(212, 175, 55, .4); }
.att-cal-cell.bad { background: rgba(220, 76, 76, .12); border-color: rgba(220, 76, 76, .35); }
.att-cal-day { display: block; font-weight: 700; }
.att-cal-val { display: block; font-weight: 600; }

/* ---------- Phase 4: fees, invoices & printable documents ---------- */
.inv-pending { background: rgba(212, 175, 55, .18); color: #8a6d14; }
.inv-partial { background: rgba(13, 110, 253, .12); color: #0d55b8; }
.inv-paid { background: rgba(46, 204, 143, .14); color: #0e7a52; }
.inv-overdue { background: rgba(220, 76, 76, .13); color: #b23434; }
.inv-cancelled { background: rgba(110, 125, 150, .14); color: #4a5a72; text-decoration: line-through; }

.doc-body { background: #e9edf3; margin: 0; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; color: #15233a; }
.doc-page { max-width: 820px; margin: 24px auto; background: #fff; padding: 40px 48px; box-shadow: 0 2px 18px rgba(10, 20, 40, .12); border-radius: 8px; }
.doc-toolbar { display: flex; gap: 10px; margin-bottom: 22px; }
.doc-btn { background: #0e7a52; color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-weight: 600; cursor: pointer; text-decoration: none; font-size: .9rem; }
.doc-btn-light { background: #e9edf3; color: #15233a; }
.doc-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; border-bottom: 3px solid #0a1428; padding-bottom: 16px; }
.doc-brand { display: flex; gap: 10px; align-items: flex-start; }
.doc-logo { font-size: 1.9rem; }
.doc-brand small { color: #5c6b82; }
.doc-title h1 { margin: 0 0 6px; font-size: 1.5rem; letter-spacing: .12em; color: #0a1428; text-align: right; }
.doc-meta td { padding: 1px 0 1px 18px; font-size: .84rem; text-align: right; }
.doc-meta td:first-child { color: #5c6b82; }
.doc-status { font-weight: 700; letter-spacing: .06em; }
.doc-paid, .doc-partial { color: #0e7a52; }
.doc-pending { color: #8a6d14; }
.doc-overdue, .doc-cancelled { color: #b23434; }
.doc-billto { margin: 18px 0; font-size: .92rem; line-height: 1.5; }
.doc-billto small, .doc-payments small, .doc-instructions small { display: block; color: #8c99ad; font-weight: 700; letter-spacing: .1em; font-size: .68rem; margin-bottom: 4px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 10px 0 18px; }
.doc-table th { text-align: left; background: #0a1428; color: #fff; padding: 8px 12px; font-size: .78rem; letter-spacing: .05em; }
.doc-table td { padding: 8px 12px; border-bottom: 1px solid #e4e9f0; }
.doc-table .t-r, .doc-table th.t-r { text-align: right; }
.doc-table tfoot td { border-bottom: none; padding: 4px 12px; font-size: .88rem; }
.doc-total td { font-weight: 800; font-size: 1rem !important; border-top: 2px solid #0a1428 !important; }
.doc-green { color: #0e7a52; }
.doc-red { color: #b23434; }
.doc-table-sm td, .doc-table-sm th { padding: 5px 10px; font-size: .8rem; }
.doc-instructions { background: #f4f7fa; border-radius: 8px; padding: 14px 16px; font-size: .85rem; margin: 14px 0; }
.doc-instructions p { margin: 0; }
.doc-warn { background: #fdf0f0; border: 1px solid #f2c4c4; }
.doc-foot { margin-top: 26px; border-top: 1px solid #e4e9f0; padding-top: 10px; color: #8c99ad; font-size: .75rem; }
.doc-receipt .doc-table td:first-child { color: #5c6b82; }

@media print {
  .no-print { display: none !important; }
  .doc-body { background: #fff; }
  .doc-page { box-shadow: none; margin: 0; max-width: none; border-radius: 0; padding: 10px 6px; }
}

/* ===== Phase 5: match management & live scoring ===== */
.badge-soft.mt-live{background:rgba(220,53,69,.15);color:#ff6b7a;animation:pulse-live 1.6s infinite}
.badge-soft.mt-break{background:rgba(255,193,7,.15);color:#e8b64c}
.badge-soft.mt-sched{background:rgba(13,110,253,.12);color:#6ea8fe}
.badge-soft.mt-done{background:rgba(16,185,129,.14);color:#34d399}
.badge-soft.mt-aband{background:rgba(148,163,184,.15);color:#94a3b8}
@keyframes pulse-live{0%,100%{opacity:1}50%{opacity:.55}}

.sc-board .sc-scoreline{font-size:1.35rem;font-weight:700;color:#e2e8f0}
.sc-board .sc-team{color:#fbbf24}
.sc-board .sc-score{color:#fff}
.sc-board .sc-overs{font-size:1rem;color:#94a3b8;font-weight:500}
.sc-chase{color:#34d399;font-weight:600;font-size:.95rem;min-height:1.2rem}

.sc-balls{display:inline-flex;gap:.3rem;flex-wrap:wrap}
.sc-chip{display:inline-flex;align-items:center;justify-content:center;min-width:1.7rem;height:1.7rem;padding:0 .35rem;
  border-radius:50rem;background:rgba(148,163,184,.15);color:#cbd5e1;font-size:.75rem;font-weight:700}
.sc-chip.chip-4{background:rgba(16,185,129,.25);color:#34d399}
.sc-chip.chip-6{background:rgba(251,191,36,.25);color:#fbbf24}
.sc-chip.chip-w{background:rgba(220,53,69,.3);color:#ff6b7a}
.sc-chip.chip-x{background:rgba(13,110,253,.18);color:#6ea8fe}

.sc-pad{display:grid;grid-template-columns:repeat(7,1fr);gap:.5rem;max-width:520px}
.sc-run{height:3.2rem;border:none;border-radius:.6rem;background:#132f4c;color:#e2e8f0;font-size:1.2rem;font-weight:700;transition:.15s}
.sc-run:hover{background:#10b981;color:#06231c}
.sc-pad-modes .mode-btn.active{background:#10b981;border-color:#10b981;color:#06231c;font-weight:700}
.sc-subpanel{margin-top:1rem;padding:1rem;border:1px solid rgba(220,53,69,.35);border-radius:.6rem;background:rgba(220,53,69,.06)}

.sc-commentary{max-height:340px;overflow:auto}
.sc-ball-row{padding:.35rem .4rem;border-bottom:1px solid rgba(148,163,184,.08);font-size:.82rem;color:#cbd5e1}
.sc-ball-row .sc-ov{color:#64748b;font-weight:700;margin-right:.3rem;white-space:nowrap}
.sc-ball-row.wkt{background:rgba(220,53,69,.08);border-left:3px solid #dc3545}
.sc-ball-row.bdy{border-left:3px solid #10b981}

.sc-tabs .nav-link{color:#94a3b8;background:transparent;border:1px solid rgba(148,163,184,.2);margin-right:.4rem;padding:.3rem .9rem;font-size:.85rem}
.sc-tabs .nav-link.active{background:#10b981;color:#06231c;border-color:#10b981;font-weight:700}

.sc-match-card{display:block;padding:.7rem .4rem;border-bottom:1px solid rgba(148,163,184,.1);text-decoration:none;color:#e2e8f0;border-radius:.4rem}
.sc-match-card:hover{background:rgba(16,185,129,.07);color:#fff}
.text-emerald{color:#34d399}
@media (max-width:576px){.sc-pad{grid-template-columns:repeat(4,1fr)}.sc-board .sc-scoreline{font-size:1.1rem}}

/* ================================================================
   UX overhaul — grouped sidebar, quick actions, tasks, big controls
   ================================================================ */

/* ---- Sidebar group headings ---- */
.nav-group-label {
  display: block;
  padding: 1.05rem .9rem .35rem;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .38);
  user-select: none;
}
.sidebar-nav .nav-group-label:first-child { padding-top: .2rem; }

/* ---- Quick action tiles (dashboards) ---- */
.qa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.qa-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: .35rem;
  padding: .9rem 1rem; min-height: 86px;
  background: linear-gradient(170deg, var(--navy-800, #0a1428), var(--navy-700, #0e1d3b));
  border: 1px solid rgba(46, 204, 143, .25);
  border-radius: 14px;
  color: #e7ecf5; text-decoration: none;
  font-weight: 600; font-size: .92rem; line-height: 1.25;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.qa-tile:hover { color: #fff; border-color: var(--emerald-light, #2ecc8f); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(7, 15, 32, .35); }
.qa-tile .qa-ico { font-size: 1.35rem; line-height: 1; }
.qa-tile small { font-weight: 400; color: #9fb0c8; font-size: .74rem; }

/* ---- Pending tasks ---- */
.task-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .65rem .35rem; border-bottom: 1px solid rgba(128, 144, 170, .14);
  color: inherit; text-decoration: none; border-radius: 8px;
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: rgba(46, 204, 143, .07); }
.task-count {
  min-width: 2.1rem; height: 2.1rem; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(212, 175, 55, .14); color: #b8860b;
  border-radius: 10px; font-weight: 700;
}
.task-count.urgent { background: rgba(220, 70, 70, .12); color: #c0392b; }
.task-row .task-go { margin-left: auto; color: var(--emerald, #149b6c); font-weight: 600; white-space: nowrap; }
.task-done { text-align: center; padding: 1.2rem 0; color: #5f7087; }
.task-done strong { display: block; font-size: 1.05rem; color: var(--emerald, #149b6c); margin-top: .3rem; }

/* ---- "Today" session rows ---- */
.today-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: .7rem;
  padding: .7rem .2rem; border-bottom: 1px solid rgba(128, 144, 170, .14);
}
.today-row:last-child { border-bottom: 0; }
.today-time {
  min-width: 86px; text-align: center; padding: .35rem .5rem;
  background: rgba(20, 155, 108, .1); color: var(--emerald, #149b6c);
  border-radius: 10px; font-weight: 700; font-size: .85rem;
}

/* ---- Touch-friendly attendance segmented control ---- */
.att-opt { display: inline-flex; cursor: pointer; margin: 0; }
.att-opt input { position: absolute; opacity: 0; pointer-events: none; }
.att-opt span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 46px; min-height: 42px; padding: .35rem .6rem;
  border: 1.5px solid rgba(128, 144, 170, .35); border-radius: 10px;
  font-size: .82rem; font-weight: 600; color: #5f7087;
  transition: all .12s ease; user-select: none;
}
.att-opt:hover span { border-color: #8aa0b8; }
.att-opt input:checked + span { color: #fff; }
.att-opt input:focus-visible + span { outline: 2px solid var(--emerald, #149b6c); outline-offset: 2px; }
.att-opt-present input:checked + span { background: #149b6c; border-color: #149b6c; }
.att-opt-absent  input:checked + span { background: #c0392b; border-color: #c0392b; }
.att-opt-late    input:checked + span { background: #b8860b; border-color: #b8860b; }
.att-opt-excused input:checked + span { background: #5f7087; border-color: #5f7087; }

/* ---- Portal big-card navigation ---- */
.big-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.big-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  min-height: 78px; padding: .7rem .4rem;
  background: var(--card, #fff); border: 1px solid rgba(128, 144, 170, .22);
  border-radius: 14px; text-decoration: none; text-align: center;
  color: #22364f; font-weight: 600; font-size: .85rem;
  box-shadow: 0 2px 8px rgba(7, 15, 32, .05);
  transition: transform .14s ease, border-color .14s ease;
}
.big-nav a:hover { transform: translateY(-2px); border-color: var(--emerald-light, #2ecc8f); color: var(--emerald, #149b6c); }
.big-nav .bn-ico { font-size: 1.45rem; line-height: 1; }

/* ---- Next-session hero (student/parent) ---- */
.next-session {
  display: flex; align-items: center; flex-wrap: wrap; gap: 1rem;
  background: linear-gradient(135deg, var(--navy-800, #0a1428), var(--navy-700, #0e1d3b));
  border: 1px solid rgba(46, 204, 143, .35);
  border-radius: 16px; padding: 1rem 1.2rem; margin-bottom: 1rem; color: #e7ecf5;
}
.next-session .ns-when { font-size: 1.25rem; font-weight: 800; color: var(--emerald-light, #2ecc8f); }
.next-session .ns-label { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold, #d4af37); font-weight: 700; }
.next-session .ns-meta { color: #9fb0c8; font-size: .85rem; }

/* ---- Bigger tap targets on phones ---- */
@media (max-width: 575px) {
  .btn-sm { padding: .45rem .8rem; font-size: .85rem; }
  .qnav a { padding: .55rem .9rem; }
  .form-control, .form-select { min-height: 44px; }
  .form-control-sm, .form-select-sm { min-height: 40px; }
  .qa-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Collapsible optional form sections ---- */
.form-extra { border: 1px dashed rgba(128, 144, 170, .4); border-radius: 12px; padding: .8rem 1rem; }
.form-extra[open] { border-style: solid; }
.form-extra summary { cursor: pointer; font-weight: 600; color: #22364f; user-select: none; }
.form-extra summary:hover { color: var(--emerald, #149b6c); }
