:root{
  --paper:#EEF3F8; --paper-2:#E4ECF6; --ink:#123A5C; --ink-soft:#5C7690; --line:#D6E2EE;
  --green:#16A085; --green-light:#D7F3EC; --brass:#2E7DD1; --brass-light:#DCEAFB;
  --brick:#E8752C; --brick-light:#FDE7D6; --purple:#8E5FD6; --purple-light:#EEE5FB;
  --white:#FFFFFF; --radius:6px; --sidebar-bg:#15477A; --sidebar-bg-2:#0F3A66;
}
*{box-sizing:border-box;}
body{ margin:0; background:var(--paper); color:var(--ink); font-family:'Inter',sans-serif; min-height:100vh; }
.app{display:flex; min-height:100vh;}
.sidebar{ width:230px; flex-shrink:0; background:var(--sidebar-bg); padding:20px 0; display:flex; flex-direction:column; }
.brand{ font-family:'Lora',serif; color:#fff; font-size:18px; font-weight:700; padding:0 20px 18px; border-bottom:1px solid rgba(255,255,255,0.15); margin-bottom:6px; }
.sidebar .brand{ display:flex; align-items:center; gap:10px; }
.brand-logo{ height:30px; width:auto; }
.login-logo{ text-align:center; margin-bottom:10px; }
.login-logo img{ height:64px; width:auto; }
.brand span{display:block; font-family:'Inter',sans-serif; font-size:11px; font-weight:400; color:#AFC8E3; margin-top:3px; letter-spacing:.04em;}
.nav-group{ margin-bottom:2px; }
.nav-group-header{
  display:flex; align-items:center; justify-content:space-between; gap:8px; padding:11px 20px;
  color:#CFE0F2; font-size:12.5px; font-weight:700; text-transform:uppercase; letter-spacing:.05em;
  cursor:pointer; user-select:none;
}
.nav-group-header:hover{ background:rgba(255,255,255,0.06); }
.nav-group-header .chevron{ width:14px; height:14px; transition:transform .15s ease; opacity:.8; }
.nav-group-header .chevron svg{ width:100%; height:100%; }
.nav-group.collapsed .chevron{ transform:rotate(-90deg); }
.nav-group.collapsed .navtab{ display:none; }
.navtab{ display:flex; align-items:center; gap:11px; padding:11px 20px 11px 30px; color:#D3E3F3; font-size:13.5px; font-weight:500; cursor:pointer; border-left:3px solid transparent; }
.navtab .num{ display:none; }
.navtab .nav-icon{ width:17px; height:17px; flex-shrink:0; color:#8FB9E6; }
.navtab .nav-icon svg{ width:100%; height:100%; }
.navtab:hover{background:rgba(255,255,255,0.08); color:#fff;}
.navtab.active{ background:rgba(255,255,255,0.14); color:#fff; border-left:3px solid #5BB6FF; }
.navtab.active .nav-icon{color:#5BB6FF;}
.navscroll{flex:1; overflow-y:auto;}
.nav-group-label{
  font-size:10px; text-transform:uppercase; letter-spacing:.06em; font-weight:600;
  color:#8FB9E6; padding:14px 20px 6px;
}
.sidefoot{margin-top:auto; padding:14px 20px 0; border-top:1px solid rgba(255,255,255,0.15);}
.acting-banner{ background:var(--brick); color:#fff; padding:10px 16px; font-size:12.5px; margin:0 0 8px; }
.acting-banner div{ font-weight:600; margin-bottom:6px; }
.acting-banner button{ background:rgba(0,0,0,0.2); border:none; color:#fff; font-weight:600; padding:5px 10px; border-radius:5px; font-size:11.5px; cursor:pointer; width:100%; }
.sidefoot .who{color:#fff; font-size:13px; font-weight:600;}
.sidefoot .role{color:#8FB9E6; font-size:11px; margin-bottom:8px;}
.sidefoot button{ width:100%; background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.25); color:#D3E3F3; padding:7px; border-radius:5px; font-size:12px; cursor:pointer; }
.sidefoot button:hover{background:rgba(255,255,255,0.16); color:var(--white);}
.main{flex:1; padding:32px 40px; max-width:1180px;}
.page-head{ display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:22px; padding-bottom:16px; border-bottom:2px solid var(--brass); }
.page-head h1{ font-family:'Lora',serif; font-size:24px; font-weight:700; margin:0; color:var(--ink); display:flex; align-items:center; gap:11px; }
.page-head .head-icon{ display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:9px; background:var(--brass-light); color:var(--brass); flex-shrink:0; }
.page-head .head-icon svg{ width:19px; height:19px; }
.page-head p{margin:4px 0 0; font-size:13px; color:var(--ink-soft);}
.btn{ font-family:'Inter',sans-serif; font-weight:600; font-size:13px; padding:9px 16px; border-radius:var(--radius); border:1.5px solid var(--brass); background:var(--brass); color:var(--white); cursor:pointer; }
.btn:hover{opacity:.88;}
.btn.ghost{background:transparent; color:var(--ink); border:1.5px solid var(--line);}
.btn.danger{background:var(--brick); border-color:var(--brick);}
.btn.small{padding:5px 10px; font-size:12px;}
.btn.wide{width:100%;}
.btn[disabled]{opacity:.6; cursor:not-allowed;}
.cards{display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px; margin-bottom:26px;}
.chart-row{ display:flex; gap:18px; margin-bottom:18px; flex-wrap:wrap; }
.chart-row .panel{ min-width:280px; margin-bottom:0; }
.card{ background:var(--white); border:1px solid var(--line); border-radius:8px; padding:16px 18px; position:relative; box-shadow:0 1px 2px rgba(32,40,31,0.04); transition:box-shadow .15s ease, transform .15s ease; }
.card:hover{ box-shadow:0 4px 14px rgba(32,40,31,0.09); transform:translateY(-1px); }
.dash-hero{ display:flex; align-items:center; gap:16px; background:linear-gradient(135deg, var(--sidebar-bg) 0%, var(--brass) 100%); border-radius:10px; padding:20px 24px; margin-bottom:22px; color:#E4ECF6; }
.dash-hero h1{ color:#fff; }
.dash-hero-icon{ width:46px; height:46px; border-radius:12px; background:rgba(255,255,255,0.16); color:#fff; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.dash-hero-icon svg{ width:24px; height:24px; }
.card-icon{
  position:absolute; top:14px; right:14px; width:34px; height:34px; border-radius:8px;
  display:flex; align-items:center; justify-content:center; background:var(--paper-2); color:var(--ink-soft);
}
.card-icon svg{ width:18px; height:18px; }
.card-icon.accent{ background:var(--green-light); color:var(--green); }
.card-icon.warn{ background:var(--brick-light); color:var(--brick); }
.card-icon.neutral{ background:var(--brass-light); color:var(--brass); }
.card-icon.purple{ background:var(--purple-light); color:var(--purple); }
.card .label{font-size:12px; color:var(--ink-soft); font-weight:500;}
.card .value{font-family:'IBM Plex Mono',monospace; font-size:28px; font-weight:500; margin-top:6px; color:var(--ink);}
.card .value.accent{color:var(--green);}
.card .value.warn{color:var(--brick);}
.panel{ background:var(--white); border:1px solid var(--line); border-radius:8px; padding:20px 22px; margin-bottom:20px; }
.panel h3{font-family:'Lora',serif; font-size:16px; margin:0 0 12px; font-weight:600;}
.row-item{display:flex; justify-content:space-between; align-items:center; padding:9px 0; border-bottom:1px solid var(--paper); font-size:13.5px;}
.row-item:last-child{border-bottom:none;}
.tag{font-size:11px; font-weight:600; padding:3px 9px; border-radius:20px; white-space:nowrap;}
table{width:100%; border-collapse:collapse; background:var(--white); border:1px solid var(--line); border-radius:8px; overflow:hidden;}
thead th{ text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-soft); font-weight:600; padding:11px 14px; background:var(--paper-2); border-bottom:2px solid var(--line); }
tbody td{ padding:11px 14px; font-size:13.5px; border-bottom:1px solid var(--paper); vertical-align:middle; }
tbody tr:last-child td{border-bottom:none;}
tbody tr:hover{background:#FBF9F2;}
.empty{padding:34px; text-align:center; color:var(--ink-soft); font-size:13.5px;}
.form-overlay{ position:fixed; inset:0; background:rgba(10,20,32,0.55); display:flex; align-items:flex-start; justify-content:center; padding:40px 20px; overflow-y:auto; z-index:200; }
.form-box{ background:var(--paper-2); border:1px solid var(--line); border-radius:10px; padding:24px 26px; width:100%; max-width:460px; }
.form-box h3{font-family:'Lora',serif; margin:0 0 16px; font-size:17px;}
.field{margin-bottom:13px;}
.field label{display:block; font-size:12px; font-weight:600; color:var(--ink-soft); margin-bottom:5px;}
.field input, .field select, .field textarea{ width:100%; padding:9px 10px; border:1px solid var(--line); border-radius:5px; font-family:'Inter',sans-serif; font-size:13.5px; background:var(--white); color:var(--ink); }
.field textarea{resize:vertical; min-height:60px;}
.field-row{display:flex; gap:10px;}
.field-row > .field{flex:1;}
.form-actions{display:flex; gap:10px; justify-content:flex-end; margin-top:18px;}
.status-pill{border:none; font-family:'Inter',sans-serif; cursor:pointer;}
.icon-btn{background:none; border:none; cursor:pointer; color:var(--ink-soft); font-size:14px; padding:4px;}
.icon-btn:hover{color:var(--brick);}
.att-cell{ width:30px; height:30px; border-radius:5px; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:600; cursor:pointer; border:1px solid var(--line); background:var(--white); color:var(--ink-soft); }
.att-cell.P{background:var(--green-light); color:var(--green); border-color:var(--green);}
.att-cell.A{background:var(--brick-light); color:var(--brick); border-color:var(--brick);}
.att-cell.L{background:var(--brass-light); color:var(--brass); border-color:var(--brass);}
.att-cell.H{background:#DCEAFB; color:#2E7DD1; border-color:#2E7DD1;}
.att-big{width:64px;height:64px;font-size:15px;}
.att-toggle{ display:inline-flex; gap:4px; }
.att-opt{ width:28px; height:28px; border-radius:5px; border:1px solid var(--line); background:var(--white); color:var(--ink-soft); font-size:11px; font-weight:600; cursor:pointer; }
.att-opt.active.P{background:var(--green-light); color:var(--green); border-color:var(--green);}
.att-opt.active.A{background:var(--brick-light); color:var(--brick); border-color:var(--brick);}
.att-opt.active.L{background:var(--brass-light); color:var(--brass); border-color:var(--brass);}
.att-opt.active.H{background:#DCEAFB; color:#2E7DD1; border-color:#2E7DD1;}
.loading{padding:60px; text-align:center; color:var(--ink-soft); font-size:14px;}
::placeholder{color:#A6A18C;}
.hint{font-size:12px; color:var(--ink-soft); margin-top:4px;}
.error-msg{background:var(--brick-light); color:var(--brick); font-size:13px; padding:9px 12px; border-radius:6px; margin-bottom:12px;}
.success-msg{background:var(--green-light); color:var(--green); font-size:13px; padding:9px 12px; border-radius:6px; margin-bottom:12px;}
.login-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--paper); padding:20px; }
.login-card{ background:var(--white); border:1px solid var(--line); border-radius:10px; padding:34px 32px; width:100%; max-width:360px; }
.login-card .brand{ color:var(--ink); font-family:'Lora',serif; font-size:22px; font-weight:600; padding:0; border:none; margin-bottom:2px; }
.login-card .brand span{color:var(--ink-soft);}
.login-card p.tag-line{color:var(--ink-soft); font-size:13px; margin:2px 0 22px;}
.login-card a{color:var(--green);}
.link-btn{background:none;border:none;color:var(--green);font-size:12.5px;cursor:pointer;padding:0;text-decoration:underline;}

.avatar{
  width:36px; height:36px; border-radius:50%; object-fit:cover;
  border:1px solid var(--line); background:var(--paper-2); vertical-align:middle;
}
.avatar.lg{width:88px; height:88px;}
.avatar-placeholder{
  width:36px; height:36px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  background:var(--paper-2); color:var(--ink-soft); font-size:13px; font-weight:600; border:1px solid var(--line);
}
.avatar-placeholder.lg{width:88px; height:88px; font-size:26px;}
.profile-row{display:flex; align-items:center; gap:16px; margin-bottom:8px;}

/* School Setup: working days picker */
.working-days{display:flex; flex-wrap:wrap; gap:8px;}
.day-check{display:inline-flex; align-items:center; gap:6px; border:1px solid var(--line); border-radius:8px; padding:7px 12px; font-size:13px; cursor:pointer; background:#fff;}
.day-check input{accent-color:var(--brick, #2E7DD1); cursor:pointer;}
.day-check:has(input:checked){border-color:var(--brick, #2E7DD1); background:rgba(46,125,209,0.06);}

/* Admission CRM: pipeline board */
.view-toggle{display:inline-flex; gap:4px; background:var(--paper); border-radius:10px; padding:3px;}
.pipeline{display:flex; gap:12px; overflow-x:auto; padding-bottom:14px; align-items:flex-start;}
.pipe-col{flex:0 0 240px; background:var(--paper); border-radius:12px; min-height:120px;}
.pipe-col-rejected{opacity:0.75;}
.pipe-col-head{display:flex; justify-content:space-between; align-items:center; padding:10px 12px 8px; font-size:12.5px; font-weight:700; border-radius:12px 12px 0 0; background:#fff; border:1px solid var(--line); border-bottom:none;}
.pipe-count{font-size:11px; font-weight:700; padding:2px 8px; border-radius:12px;}
.pipe-cards{display:flex; flex-direction:column; gap:8px; padding:10px; border:1px solid var(--line); border-top:none; border-radius:0 0 12px 12px; min-height:70px;}
.pipe-empty{color:var(--ink-soft); text-align:center; font-size:12px; padding:14px 0;}
.lead-card{background:#fff; border:1px solid var(--line); border-radius:10px; padding:10px 11px; font-size:12.5px; box-shadow:0 1px 2px rgba(0,0,0,0.04);}
.lead-name{font-weight:700; font-size:13.5px; margin-bottom:5px;}
.lead-tags{display:flex; flex-wrap:wrap; gap:5px; margin-bottom:6px;}
.lead-line{color:var(--ink-soft); margin-top:3px; font-size:12px;}
.lead-overdue{color:#C0392B; font-weight:600;}
.lead-actions{display:flex; align-items:center; gap:4px; margin-top:8px; flex-wrap:wrap;}

/* ===================== Responsive ===================== */

/* Mobile topbar + off-canvas sidebar (hidden on desktop) */
.mobile-topbar{ display:none; }
.sidebar-backdrop{ display:none; }

@media (max-width: 900px){
  .mobile-topbar{
    display:flex; align-items:center; gap:12px;
    position:fixed; top:0; left:0; right:0; height:52px; z-index:90;
    background:var(--sidebar-bg); color:#fff; padding:0 14px;
    box-shadow:0 2px 8px rgba(0,0,0,0.18);
  }
  .mobile-topbar button{
    background:rgba(255,255,255,0.12); border:none; color:#fff;
    font-size:19px; line-height:1; padding:7px 11px; border-radius:8px; cursor:pointer;
  }
  .mobile-brand{ font-family:'Lora',serif; font-weight:700; font-size:16px; }

  .sidebar{
    position:fixed; top:0; left:0; bottom:0; width:262px; z-index:110;
    transform:translateX(-105%); transition:transform .22s ease;
    overflow-y:auto; box-shadow:4px 0 18px rgba(0,0,0,0.25);
  }
  .sidebar.open{ transform:none; }
  .sidebar-backdrop.show{
    display:block; position:fixed; inset:0; z-index:100;
    background:rgba(10,20,32,0.45);
  }

  .main{ padding:68px 14px 28px; max-width:none; width:100%; }

  .page-head{ flex-wrap:wrap; gap:12px; align-items:flex-start; }
  .page-head h1{ font-size:20px; }
  .page-head > div:last-child{ width:100%; }
  .page-head > div:last-child .btn{ flex:1; }

  .field-row{ flex-direction:column; gap:0; }
  /* 16px stops iOS Safari from zooming in when a field is focused */
  .field input, .field select, .field textarea{ font-size:16px; }
  .form-overlay{ padding:14px 8px; }
  .form-box{ padding:18px 16px; }

  /* Tables scroll sideways instead of squashing */
  table{ display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; white-space:nowrap; }
  thead th, tbody td{ padding:10px 11px; }

  .chart-row{ flex-direction:column; }
  .chart-row .panel{ min-width:0; width:100%; }
  .dash-hero{ flex-wrap:wrap; padding:16px 18px; }
  .profile-row{ flex-wrap:wrap; }
  .panel{ padding:16px 14px; }

  /* Pipeline board: slightly narrower columns, momentum scrolling */
  .pipeline{ -webkit-overflow-scrolling:touch; gap:10px; }
  .pipe-col{ flex-basis:225px; }
  .view-toggle{ flex:0 0 auto; }
}

@media (max-width: 480px){
  .main{ padding:64px 10px 24px; }
  .cards{ grid-template-columns:1fr 1fr; gap:10px; }
  .card .value{ font-size:22px; }
  .pipe-col{ flex-basis:82vw; }
  .login-card{ padding:22px 18px; }
}

/* Student form: tabs, subject picker, avatar */
.stab-bar{ display:flex; gap:4px; border-bottom:1px solid var(--line); margin:4px 0 16px; flex-wrap:wrap; }
.stab{ background:none; border:none; padding:8px 14px; font-size:13px; font-weight:600; color:var(--ink-soft); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; }
.stab:hover{ color:var(--ink); }
.stab.active{ color:var(--brick, #2E7DD1); border-bottom-color:var(--brick, #2E7DD1); }
.subject-picker{ display:flex; flex-wrap:wrap; gap:8px; }
.subj-check{ display:inline-flex; align-items:center; gap:6px; border:1px solid var(--line); border-radius:8px; padding:7px 11px; font-size:13px; cursor:pointer; background:#fff; }
.subj-check input{ accent-color:var(--brick, #2E7DD1); cursor:pointer; }
.subj-check:has(input:checked){ border-color:var(--brick, #2E7DD1); background:rgba(46,125,209,0.06); }
.avatar-placeholder{ display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px; border-radius:50%; background:var(--paper); color:var(--ink-soft); font-weight:700; font-size:13px; border:1px solid var(--line); }

/* Timetable grid */
.tt-table{ width:100%; border-collapse:collapse; }
.tt-table th, .tt-table td{ border:1px solid var(--line); padding:8px; text-align:center; font-size:12.5px; vertical-align:middle; }
.tt-table th{ background:var(--paper); font-weight:700; }
.tt-cell:hover{ background:rgba(46,125,209,0.06); }
.tt-filled{ display:flex; flex-direction:column; gap:2px; }
.tt-filled strong{ font-size:12.5px; }
.tt-filled span{ font-size:11px; color:var(--ink-soft); }

/* QR / RFID scanner modal */
.scan-video-wrap{ position:relative; width:100%; aspect-ratio:4/3; background:#000; border-radius:10px; overflow:hidden; }
.scan-video-wrap video{ width:100%; height:100%; object-fit:cover; }
.scan-frame{ position:absolute; inset:18%; border:3px solid rgba(255,255,255,0.85); border-radius:12px; box-shadow:0 0 0 4000px rgba(0,0,0,0.25); pointer-events:none; }
.scan-log{ margin-top:12px; max-height:150px; overflow-y:auto; display:flex; flex-direction:column; gap:4px; }
.scan-log-line{ font-size:13px; padding:6px 10px; border-radius:7px; }
.scan-log-line.ok{ background:rgba(30,132,73,0.1); color:#1E8449; }
.scan-log-line.err{ background:rgba(192,57,43,0.1); color:#C0392B; }

/* Examination: report card + row list */
.row-list{ display:flex; flex-direction:column; gap:6px; }
.report-card{ border:1px solid var(--line); border-radius:10px; padding:18px; background:#fff; max-width:640px; }
.report-card .rc-head{ text-align:center; border-bottom:2px solid var(--ink); padding-bottom:8px; margin-bottom:12px; }
.report-card .rc-student{ line-height:1.6; margin-bottom:12px; font-size:14px; }
.rc-table{ width:100%; border-collapse:collapse; }
.rc-table th, .rc-table td{ border:1px solid var(--line); padding:7px; text-align:center; font-size:13px; }
.rc-table tfoot td{ background:var(--paper); }

/* ===== Mobile bottom navigation =====
   Hidden on anything wide enough for the sidebar. On a phone the sidebar
   sits behind a hamburger, which makes every move two taps and a slide;
   this puts the handful of places each role actually uses one tap away. */
#bottomNav { display: none; }

@media (max-width: 820px) {
  #bottomNav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    background: var(--surface, #fff);
    border-top: 1px solid var(--line, #dfe3e8);
    /* Clear the home indicator on iPhones. */
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 10px rgba(0,0,0,.05);
  }
  #bottomNav .bn-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px 7px;
    border: none;
    background: none;
    color: var(--ink-soft, #6b7480);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
    /* Comfortably tappable even with a thumb. */
    min-height: 54px;
  }
  #bottomNav .bn-item .head-icon { margin: 0; }
  #bottomNav .bn-item .head-icon svg { width: 21px; height: 21px; }
  #bottomNav .bn-item.active { color: var(--accent, #1F3A5F); }
  #bottomNav .bn-item.active .head-icon svg { stroke-width: 2.4; }
  #bottomNav .bn-item span { white-space: nowrap; }

  /* Keep the last card clear of the bar. */
  .main-area, #appRoot { padding-bottom: 76px; }
}

/* An installed app has no browser chrome, so give the top a little room. */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top, 0); }
}

/* ===================== Dashboard =====================
   The old dashboard laid seven identical cards in a row, which gave the
   student count the same weight as unpaid fees. A principal opening this
   at nine already knows how many students there are; what they cannot see
   from memory is which register is still open and what is overdue. So the
   order here is: today, then anything needing a decision, then the
   figures, then the charts. */

.dash-today {
  background: linear-gradient(158deg, #123A5C 0%, #0E2E49 62%, #16405F 100%);
  border-radius: 12px;
  padding: 24px 26px 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
}
/* A faint ruled grid, borrowed from the attendance register this replaces. */
.dash-today::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom, rgba(255,255,255,.05) 0 1px, transparent 1px 34px);
  pointer-events: none;
}
.dash-today > * { position: relative; z-index: 1; }

.dash-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8FB4D6;
  margin: 0 0 5px;
}
.dash-greet {
  font-family: 'Lora', serif;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 3px;
  letter-spacing: -.01em;
}
.dash-sub { color: #B9D0E6; font-size: 13.5px; margin: 0; }

/* ---- The register ribbon ----
   The signature of this screen. Rather than stating "142 of 180 marked",
   it shows the whole school as one band: present, absent, and a genuine
   gap where nobody has been marked yet. An open register is meant to look
   unfinished, because it is. */
.ribbon-wrap { margin-top: 20px; }
.ribbon-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: #B9D0E6; margin-bottom: 7px;
}
.ribbon-head strong { color: #fff; font-size: 15px; font-weight: 600; }
.ribbon {
  display: flex;
  height: 30px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(255,255,255,.07);
  /* The unmarked part reads as ruled paper, not as another category. */
  background-image: repeating-linear-gradient(
    115deg, rgba(255,255,255,.10) 0 2px, transparent 2px 9px);
}
.ribbon span {
  display: block;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.ribbon .r-present { background: #16A085; }
.ribbon .r-absent  { background: #E8752C; }
.ribbon-key {
  display: flex; gap: 16px; margin-top: 9px;
  font-size: 12px; color: #B9D0E6;
}
.ribbon-key i {
  width: 9px; height: 9px; border-radius: 2px;
  display: inline-block; margin-right: 6px; vertical-align: 0;
}
.ribbon-key .k-open {
  background: rgba(255,255,255,.14);
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.28) 0 1px, transparent 1px 4px);
}

/* ---- Needs a decision ----
   Only appears when something actually does. A dashboard that always has
   a red panel teaches people to ignore red panels. */
.needs {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brick);
  border-radius: 10px;
  padding: 15px 18px;
  margin-bottom: 16px;
}
.needs h3 {
  margin: 0 0 11px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft);
}
.needs-list { display: flex; flex-direction: column; gap: 9px; }
.needs-item {
  display: flex; align-items: center; gap: 11px;
  font-size: 14.5px; line-height: 1.35;
}
.needs-item .n-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px; font-weight: 500;
  min-width: 34px; text-align: right;
  color: var(--brick);
}
.needs-item .n-go {
  margin-left: auto; font-size: 13px; white-space: nowrap;
  color: var(--brass); text-decoration: none; font-weight: 500;
}
.needs-item .n-go:hover { text-decoration: underline; }
.needs-clear { color: var(--green); font-size: 14.5px; margin: 0; }

/* ---- Figures ----
   Money is what gets asked about first, so it is the larger of the two
   and sits on the left. The rest are quieter by design. */
.fig-row { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; margin-bottom: 16px; }
.fig {
  background: var(--white); border: 1px solid var(--line);
  border-radius: 10px; padding: 17px 19px;
}
.fig .f-label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 7px;
}
.fig .f-value {
  font-family: 'Lora', serif; font-size: 30px; font-weight: 600;
  line-height: 1.05; letter-spacing: -.015em;
}
.fig .f-value.money-in { color: var(--green); }
.fig .f-value.money-out { color: var(--brick); }
.fig .f-note { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; }

.mini-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.mini {
  background: var(--white); border: 1px solid var(--line);
  border-radius: 9px; padding: 13px 15px;
}
.mini .m-value {
  font-size: 21px; font-weight: 600; line-height: 1.1;
  font-family: 'IBM Plex Mono', monospace;
}
.mini .m-label { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }

@media (max-width: 820px) {
  .dash-today { padding: 20px 18px 18px; }
  .dash-greet { font-size: 22px; }
  .fig-row { grid-template-columns: 1fr; }
  .mini-row { grid-template-columns: repeat(2, 1fr); }
  .needs-item { flex-wrap: wrap; }
  .needs-item .n-go { margin-left: 45px; }
}

/* Someone who has asked for less movement gets none. */
@media (prefers-reduced-motion: reduce) {
  .ribbon span { transition: none; }
}

/* ===================== SIDEBAR ENHANCEMENTS ===================== */
.sidebar { width: 248px; background: linear-gradient(180deg, #0F2D4A 0%, #123A5C 100%); }
.brand { background: rgba(255,255,255,0.06); border-bottom: 1px solid rgba(255,255,255,0.10); padding: 0 18px 16px; margin-bottom: 4px; }
.brand svg { width: 22px; height: 22px; }

/* Nav group headers */
.nav-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 16px 6px; color: #6FA8D4; font-size: 10.5px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; cursor: pointer;
  transition: color .15s;
}
.nav-group-header:hover { color: #fff; background: rgba(255,255,255,0.04); }
.nav-group-header .chevron { width: 13px; height: 13px; transition: transform .18s ease; opacity: .7; }
.nav-group.collapsed .chevron { transform: rotate(-90deg); }
.nav-group.collapsed .navtab { display: none; }

/* Nav tabs — icon left, label right */
.navtab {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px 9px 20px; color: #AECDE8;
  font-size: 13px; font-weight: 500; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .13s, color .13s, border-color .13s;
  border-radius: 0 6px 6px 0; margin-right: 8px;
  position: relative;
}
.navtab .nav-icon {
  width: 17px; height: 17px; flex-shrink: 0;
  color: #6FA8D4; transition: color .13s;
  display: flex; align-items: center; justify-content: center;
}
.navtab .nav-icon svg { width: 100%; height: 100%; }
.navtab:hover { background: rgba(255,255,255,0.08); color: #fff; }
.navtab:hover .nav-icon { color: #8FC8F0; }
.navtab.active {
  background: rgba(91,182,255,0.15); color: #fff;
  border-left-color: #5BB6FF;
}
.navtab.active .nav-icon { color: #5BB6FF; }

/* Loading ripple on active tab */
.navtab.loading::after {
  content: '';
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(91,182,255,0.3); border-top-color: #5BB6FF;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

/* Smooth page fade-in */
/* .main opacity removed — breaks position:fixed overlays */

/* Sidefoot upgrade */
.sidefoot { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,0.10); background: rgba(0,0,0,0.15); }
.sidefoot .who { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidefoot .role {
  color: #fff; font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  background: rgba(91,182,255,0.2); display: inline-block;
  padding: 2px 8px; border-radius: 10px; margin: 4px 0 8px;
}
.sidefoot button {
  width: 100%; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18); color: #AECDE8;
  padding: 7px; border-radius: 6px; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .13s, color .13s;
}
.sidefoot button:hover { background: rgba(255,255,255,0.16); color: #fff; }

/* ===================== DASHBOARD REDESIGN ===================== */
.dash-hero-section {
  background: linear-gradient(135deg, #0F2D4A 0%, #163D5E 50%, #1A5070 100%);
  border-radius: 16px; padding: 28px 28px 24px; margin-bottom: 20px;
  color: #fff; position: relative; overflow: hidden;
  box-shadow: 0 4px 24px rgba(15,45,74,0.35);
}
.dash-hero-section::before {
  content: ''; position: absolute; top: -60px; right: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(91,182,255,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.dash-hero-section::after {
  content: ''; position: absolute; bottom: -40px; left: 30%;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(22,160,133,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.dash-hero-section > * { position: relative; z-index: 1; }
.dash-hero-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 6px; }
.dash-date-chip {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: #8FC8F0; background: rgba(255,255,255,0.08);
  padding: 4px 12px; border-radius: 20px;
}
.dash-school-name { font-size: 12px; color: #8FC8F0; text-align: right; }
.dash-greet {
  font-family: 'Lora', serif; font-size: 30px; font-weight: 600;
  margin: 0 0 4px; letter-spacing: -0.02em; line-height: 1.15;
}
.dash-role-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(91,182,255,0.2); border: 1px solid rgba(91,182,255,0.3);
  color: #A8D8F5; font-size: 12px; font-weight: 600;
  padding: 3px 12px; border-radius: 20px; margin-bottom: 18px;
}
.dash-role-badge svg { width: 13px; height: 13px; }
.dash-ribbon-wrap { margin-top: 2px; }
.dash-ribbon-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11.5px; color: #8FC8F0; margin-bottom: 8px;
}
.dash-ribbon-label strong { color: #fff; font-size: 15px; }
.dash-ribbon {
  display: flex; height: 10px; border-radius: 5px; overflow: hidden;
  background: rgba(255,255,255,0.1);
}
.dash-ribbon span { display: block; transition: width .8s cubic-bezier(.4,0,.2,1); }
.dash-ribbon .rp { background: linear-gradient(90deg, #16A085, #1ABC9C); }
.dash-ribbon .ra { background: linear-gradient(90deg, #E8752C, #F39C12); }
.dash-ribbon-key { display: flex; gap: 16px; margin-top: 8px; font-size: 11.5px; color: #8FC8F0; }
.dash-ribbon-key i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: 1px; }

/* Quick stats row */
.dash-stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px;
}
.dash-stat {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 16px 14px; position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s; cursor: pointer;
}
.dash-stat:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(18,58,92,0.12); }
.dash-stat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.dash-stat-icon svg { width: 20px; height: 20px; }
.dash-stat-icon.blue  { background: #DCEAFB; color: #2E7DD1; }
.dash-stat-icon.green { background: #D7F3EC; color: #16A085; }
.dash-stat-icon.amber { background: #FDE7D6; color: #E8752C; }
.dash-stat-icon.purple{ background: #EEE5FB; color: #8E5FD6; }
.dash-stat-val { font-size: 26px; font-weight: 700; font-family: 'IBM Plex Mono', monospace; line-height: 1; }
.dash-stat-lbl { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; font-weight: 500; }
.dash-stat-arrow {
  position: absolute; right: 12px; top: 12px;
  color: var(--line); font-size: 16px; transition: color .13s;
}
.dash-stat:hover .dash-stat-arrow { color: var(--brass); }

/* Quick access shortcuts */
.dash-quick-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin: 0 0 10px; }
.dash-quick-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px;
}
.dash-quick {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 10px 12px; text-align: center; cursor: pointer;
  transition: all .15s; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.dash-quick:hover { border-color: #2E7DD1; background: #DCEAFB; transform: translateY(-1px); }
.dash-quick:hover .dash-quick-icon { background: #2E7DD1; color: #fff; }
.dash-quick-icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  color: var(--brass); transition: all .15s;
}
.dash-quick-icon svg { width: 20px; height: 20px; }
.dash-quick-lbl { font-size: 11.5px; font-weight: 600; color: var(--ink); line-height: 1.3; }

/* Needs-a-decision — styled card */
.dash-needs {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid #E8752C;
  border-radius: 12px; padding: 16px 20px; margin-bottom: 20px;
}
.dash-needs-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); margin: 0 0 12px; }
.dash-needs-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.dash-needs-item:last-child { border-bottom: none; padding-bottom: 0; }
.dash-needs-count {
  font-size: 20px; font-weight: 700; font-family: 'IBM Plex Mono', monospace;
  color: #E8752C; min-width: 36px; text-align: right;
}
.dash-needs-text { flex: 1; font-size: 14px; line-height: 1.4; }
.dash-needs-go {
  font-size: 12.5px; font-weight: 600; color: #2E7DD1;
  text-decoration: none; white-space: nowrap;
  background: #DCEAFB; padding: 4px 10px; border-radius: 6px;
  transition: background .13s;
}
.dash-needs-go:hover { background: #2E7DD1; color: #fff; }
.dash-all-clear {
  display: flex; align-items: center; gap: 10px;
  background: #D7F3EC; border: 1px solid #16A085;
  border-radius: 10px; padding: 13px 16px; margin-bottom: 20px;
  color: #0D7A63; font-weight: 600; font-size: 14px;
}
.dash-all-clear svg { width: 20px; height: 20px; flex-shrink: 0; }

/* Money panels */
.dash-money-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-bottom: 20px; }
.dash-money {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px;
}
.dash-money-lbl { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); margin-bottom: 6px; }
.dash-money-val { font-family: 'Lora', serif; font-size: 30px; font-weight: 600; line-height: 1.05; }
.dash-money-val.in  { color: #16A085; }
.dash-money-val.out { color: #E8752C; }
.dash-money-note { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }

/* Charts row */
.dash-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }

/* Recent enquiries table row */
.dash-recent-enquiries { margin-bottom: 20px; }

/* Responsive */
@media (max-width: 900px) {
  .dash-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-quick-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-money-row { grid-template-columns: 1fr; }
  .dash-charts { grid-template-columns: 1fr; }
  .dash-greet { font-size: 24px; }
}
@media (max-width: 480px) {
  .dash-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .dash-quick-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .dash-quick-icon { width: 34px; height: 34px; }
  .dash-quick-icon svg { width: 17px; height: 17px; }
}

/* Page content fade-in animation */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* .main > * animation removed — creates stacking context breaking fixed overlays */

/* ---- Nav group header with icon ---- */
.nav-group-label-inner {
  display: flex; align-items: center; gap: 7px;
}
.nav-group-icon {
  width: 15px; height: 15px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.7;
}
.nav-group-icon svg { width: 100%; height: 100%; }
.nav-group-header:hover .nav-group-icon { opacity: 1; }

/* ---- Ensure form overlays always appear above everything ---- */
.form-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 500 !important;
  background: rgba(10, 20, 32, 0.6) !important;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.form-box {
  position: relative;
  z-index: 501;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px 28px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

/* ---- Circular popup notifications ---- */
@keyframes slideInRight {
  from { opacity:0; transform:translateX(100px); }
  to   { opacity:1; transform:translateX(0); }
}
@keyframes slideOutRight {
  from { opacity:1; transform:translateX(0); }
  to   { opacity:0; transform:translateX(100px); }
}

/* ---- Fee Payment Page Responsive ---- */
@media (max-width: 700px) {
  .fee-stats-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 480px) {
  .fee-stats-grid { grid-template-columns: 1fr !important; }
}
