:root{
  --navy:#0b2a5b;
  --green:#12823b;
  --gold:#d4a017;
  --bg:#f8fafc;
  --card-bg:#ffffff;
  --line:#e2e8f0;
  --txt:#0f172a;
  --txt-muted:#64748b;
  --err:#dc2626;
  --bottom-nav-h:64px;
}
*{box-sizing:border-box}
body{
  margin:0;
  font:15px/1.5 system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  background:var(--bg);
  color:var(--txt);
  padding-bottom:calc(var(--bottom-nav-h) + 16px);
  -webkit-tap-highlight-color:transparent;
}
a{color:var(--navy)}

.container{max-width:1100px;margin:0 auto;padding:16px}
h1{color:var(--navy);margin:.2em 0 .6em}
h1 small{font-size:.5em;color:var(--txt-muted);font-weight:400;margin-left:.5em}

/* Top bar for desktop & mobile */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background:linear-gradient(135deg, #071e42 0%, #0b2a5b 100%);
  color:#fff;
  padding:8px 16px;
  border-bottom:3px solid var(--gold);
  box-shadow:0 3px 12px rgba(0,0,0,0.12);
  position:relative;
  z-index:50;
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  color:#fff;
  text-decoration:none;
}
.brand img{
  height:38px;
  width:38px;
  border-radius:50%;
  background:#fff;
  border:2px solid rgba(255,255,255,0.85);
  box-shadow:0 2px 6px rgba(0,0,0,0.2);
}
.brand-text{display:flex;flex-direction:column;line-height:1.15}
.brand-title{font-size:1.05em;font-weight:700;letter-spacing:-0.01em;color:#ffffff}
.brand-sub{font-size:0.7em;color:var(--gold);font-weight:700;text-transform:uppercase;letter-spacing:0.08em}

.topbar nav.desktop-nav{display:flex;flex-wrap:wrap;gap:4px;flex:1;margin:0 12px}
.topbar nav.desktop-nav a{color:#cfd9ee;text-decoration:none;padding:6px 12px;border-radius:8px;font-size:0.92em;transition:all 0.15s ease}
.topbar nav.desktop-nav a:hover,.topbar nav.desktop-nav a.active{background:rgba(255,255,255,.16);color:#fff}

.user-pill{
  display:flex;
  align-items:center;
  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.15);
  border-radius:24px;
  padding:3px 4px 3px 8px;
  gap:6px;
  backdrop-filter:blur(4px);
}
.user-badge{
  display:flex;
  align-items:center;
  gap:7px;
  color:#ffffff;
  text-decoration:none;
}
.user-avatar{
  width:24px;
  height:24px;
  border-radius:50%;
  background:var(--gold);
  color:var(--navy);
  font-weight:800;
  font-size:0.75em;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.user-name{
  font-size:0.85em;
  font-weight:600;
  color:#f1f5f9;
  max-width:110px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.logout-form{margin:0;display:flex}
.logout-btn{
  background:transparent;
  border:none;
  color:rgba(255,255,255,0.7);
  border-radius:50%;
  width:28px;
  height:28px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
  transition:all 0.15s ease;
}
.logout-btn:hover{
  background:rgba(220,38,38,0.25);
  color:#fca5a5;
}
.logout-btn svg{width:16px;height:16px}

/* Mobile Bottom Navigation */
.mobile-bottom-nav{
  display:none;
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  height:var(--bottom-nav-h);
  background:#ffffff;
  border-top:1px solid var(--line);
  box-shadow:0 -3px 12px rgba(0,0,0,0.06);
  z-index:999;
  justify-content:space-around;
  align-items:center;
}
.mobile-bottom-nav :is(a,button){
  border:0;background:transparent;font-family:inherit;cursor:pointer;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  flex:1;
  height:100%;
  color:var(--txt-muted);
  text-decoration:none;
  font-size:0.72em;
  font-weight:600;
  gap:3px;
  transition:color 0.15s ease;
}
.mobile-bottom-nav :is(a,button).active{
  color:var(--navy);
}
.mobile-bottom-nav :is(a,button) svg{
  width:22px;
  height:22px;
  stroke-width:2;
  transition:transform 0.15s ease;
}
.mobile-bottom-nav a.scan-btn{
  color:#ffffff!important;
  background:var(--green);
  border-radius:50%;
  width:52px;
  height:52px;
  flex:0 0 52px;
  margin-top:-22px;
  box-shadow:0 4px 14px rgba(18,130,59,0.4);
  border:3px solid #ffffff;
}
.mobile-bottom-nav a.scan-btn span{display:none}
.mobile-bottom-nav a.scan-btn svg{width:26px;height:26px;stroke:#fff}

/* Cards & Layout */
.card{
  background:var(--card-bg);
  border:1px solid var(--line);
  border-radius:12px;
  padding:18px;
  margin-bottom:16px;
  box-shadow:0 1px 3px rgba(0,0,0,0.03);
}
.center{text-align:center}
.grid{display:grid;gap:12px}
.stats{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}
.stat{text-align:center;padding:16px 12px}
.stat b{display:block;font-size:2.2em;color:var(--green);line-height:1.1}
.stat span{color:var(--txt-muted);font-size:0.88em;font-weight:500;margin-top:4px}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--navy);
  padding:8px 14px;
  border-radius:8px;
  cursor:pointer;
  font:inherit;
  font-weight:600;
  text-decoration:none;
  transition:all 0.15s ease;
}
.btn:hover{background:#f1f5f9;border-color:#cbd5e1}
.btn-primary{background:var(--green);border-color:var(--green);color:#fff}
.btn-primary:hover{background:#0e6b2f;border-color:#0e6b2f}
.btn-danger{background:var(--err);border-color:var(--err);color:#fff}
.btn-ghost{background:transparent;border-color:rgba(255,255,255,.4);color:#fff}
.btn-ghost:hover{background:rgba(255,255,255,.1)}
.btn-sm{padding:5px 10px;font-size:.82em;border-radius:6px}
.actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}

label{display:block;margin:0 0 12px;font-weight:600;font-size:.9em;color:#334155}
input,select,textarea{
  display:block;
  width:100%;
  margin-top:5px;
  padding:9px 12px;
  border:1.5px solid #cbd5e1;
  border-radius:8px;
  font:inherit;
  background:#fff;
  transition:border-color 0.15s ease;
}
input:focus,select:focus,textarea:focus{
  outline:none;
  border-color:var(--gold);
  box-shadow:0 0 0 3px rgba(212,160,23,0.18);
}
.row{display:flex;flex-wrap:wrap;gap:12px}.row>*{flex:1;min-width:160px}

table{width:100%;border-collapse:collapse;background:#fff}
th,td{padding:10px 12px;border-bottom:1px solid var(--line);text-align:left;vertical-align:middle}
th{background:#f1f5f9;color:var(--navy);font-size:.82em;text-transform:uppercase;letter-spacing:.04em;font-weight:700}
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}

.flash{padding:12px 16px;border-radius:10px;margin-bottom:14px;font-weight:500}
.flash-ok{background:#dcfce7;color:#15803d;border:1px solid #bbf7d0}
.flash-err{background:#fee2e2;color:var(--err);border:1px solid #fecaca}

.badge{
  display:inline-block;
  padding:3px 9px;
  border-radius:999px;
  font-size:.76em;
  font-weight:600;
  background:#e2e8f0;
  color:var(--navy);
}
.badge-ok{background:#dcfce7;color:#15803d}
.badge-warn{background:#fef9c3;color:#854d0e}
.badge-err{background:#fee2e2;color:var(--err)}

.login-wrap{display:flex;justify-content:center;align-items:center;min-height:75vh}
.login{width:100%;max-width:390px;box-shadow:0 8px 24px rgba(0,0,0,0.08);padding:24px}
.login-logo{display:block;width:110px;margin:0 auto 12px;border-radius:50%;box-shadow:0 4px 12px rgba(0,0,0,0.1)}
.login h1{text-align:center;font-size:1.6em}
.login .btn{width:100%;padding:11px}

@media print{
  .no-print,.topbar,.mobile-bottom-nav{display:none!important}
  body{background:#fff;padding-bottom:0}
  .container{max-width:none;padding:0}
  .card{border:0;padding:0;box-shadow:none}
}

@media(max-width:768px){
  body:has(.mobile-bottom-nav){padding-bottom:calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 20px)}
  .topbar nav,
  .topbar nav.desktop-nav,
  .desktop-nav{
    display:none !important;
  }
  .topbar{
    padding:8px 12px;
  }
  .brand-title{font-size:0.95em}
  .user-name{display:none} /* Show only avatar circle on phone */
  .user-pill{padding:3px;gap:2px}
  .mobile-bottom-nav{display:flex;height:calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom)}
  .container{padding:12px 10px}
  .card{padding:14px}
  .login-wrap{padding-top:2vh}
}

/* Ghost buttons are for the dark top bar; on page content they must stay visible */
main .btn-ghost{background:#fff;border-color:var(--line);color:var(--navy)}
main .btn-ghost:hover{background:#f1f5f9;border-color:#cbd5e1}

/* ---- Phone-friendly tables and forms (screen only) ----
   responsive-tables.js adds .rt and data-label to every table that has a header. */
@media screen and (max-width:768px){
  .card.table-wrap{background:transparent;border:0;box-shadow:none;padding:0;overflow:visible}
  .table-wrap{overflow-x:visible}
  table.rt,table.rt tbody,table.rt tfoot{display:block;width:100%;background:transparent}
  table.rt thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  table.rt tr{
    display:flex;flex-direction:column;background:#fff;border:1px solid var(--line);border-radius:14px;
    padding:6px 14px 10px;margin-bottom:12px;box-shadow:0 1px 3px rgba(0,0,0,.05);
  }
  table.rt td{
    display:flex;justify-content:space-between;align-items:center;gap:14px;
    padding:9px 0;border:0;border-bottom:1px solid #f1f5f9;text-align:right;min-height:40px;
  }
  table.rt td:last-child{border-bottom:0}
  table.rt td::before{
    content:attr(data-label);flex:0 0 36%;text-align:left;
    font-size:.78em;font-weight:700;color:var(--txt-muted);text-transform:uppercase;letter-spacing:.03em;
  }
  table.rt td[data-label=""]::before,table.rt td:not([data-label])::before{display:none}
  table.rt td.rt-title{
    display:block;order:-1;text-align:left;font-size:1.08em;font-weight:700;color:var(--navy);
    padding:12px 0 10px;border-bottom:1px solid var(--line);
  }
  table.rt td.rt-title::before{display:none}
  table.rt td[data-mobile=hide]{display:none}
  code{overflow-wrap:anywhere}
  table.rt td[colspan]{display:block;text-align:center;color:var(--txt-muted)}
  table.rt td.actions{display:flex;flex-wrap:wrap;justify-content:flex-start;gap:8px;padding-top:12px}
  table.rt td.actions::before{display:none}
  table.rt td.actions form{display:flex!important;gap:8px;flex:1 1 100%}
  table.rt td.actions .btn,table.rt td.actions button{flex:1 1 auto}
  table.rt td.actions input{width:auto!important;flex:1 1 0;min-width:0;margin:0}
  table.user-accounts.rt td:has(form){display:grid;grid-template-columns:minmax(0,1fr);gap:8px;text-align:left}
  table.user-accounts.rt td form{min-width:0;width:100%}
  table.user-accounts.rt td form button{min-height:44px}
  table.rt td form select{flex:1 1 auto;min-width:0;width:auto}

  /* Forms: one column, big touch targets, no zoom-on-focus on iPhones */
  .row>*{flex:1 1 100%;min-width:0}
  label{font-size:1em;margin-bottom:14px}
  input,select,textarea{font-size:16px;min-height:48px;padding:12px 14px;margin-top:6px}
  textarea{min-height:96px}
  input[type=checkbox],input[type=radio]{min-height:0;width:22px;height:22px}
  form.card>.btn,form.card>button{width:100%;min-height:50px;margin-bottom:8px}
  main.container>.actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
  main.container>.actions .btn{width:100%;min-height:46px}
  main.container>.actions .btn-primary{grid-column:1/-1}
  h1{font-size:1.5em}
}

/* Mobile More Bottom Sheet */
.mobile-sheet{
  position:fixed;
  inset:0;
  margin:0;
  width:100%;max-width:none;
  height:100%;max-height:none;
  border:0;padding:0;background:transparent;color:inherit;
}
.mobile-sheet::backdrop{background:rgba(0,0,0,.5);backdrop-filter:blur(2px)}
body:has(.mobile-sheet[open]){overflow:hidden}
.mobile-sheet .sheet-content{
  position:absolute;
  bottom:0;left:0;right:0;
  background:#ffffff;
  border-radius:20px 20px 0 0;
  padding:20px 18px calc(env(safe-area-inset-bottom) + 20px);
  overscroll-behavior:contain;
  max-height:80vh;
  overflow-y:auto;
  box-shadow:0 -6px 24px rgba(0,0,0,0.2);
  animation:slideUp 0.2s ease-out;
}
@keyframes slideUp{
  from{transform:translateY(100%)}
  to{transform:translateY(0)}
}
.sheet-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:16px;
  border-bottom:1px solid var(--line);
  padding-bottom:10px;
}
.sheet-header h3{margin:0;color:var(--navy);font-size:1.15em}
.sheet-links{display:flex;flex-direction:column;gap:8px}
.sheet-links a{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 14px;
  border-radius:10px;
  background:#f8fafc;
  color:var(--txt);
  text-decoration:none;
  font-weight:600;
  font-size:0.95em;
  border:1px solid var(--line);
}
.sheet-links a.active{
  background:#e0f2fe;
  color:#0369a1;
  border-color:#bae6fd;
}
.sheet-links a svg{width:20px;height:20px;color:var(--navy)}

/* ============================================================
   MOBILE-FIRST FEES & CARD STYLING (Stitch V3 Balanced Design)
   ============================================================ */

/* Month Switcher Bar */
.month-nav-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:#ffffff;
  border:1px solid var(--line);
  border-radius:12px;
  padding:6px 12px;
  margin-bottom:14px;
  box-shadow:0 1px 3px rgba(0,0,0,0.03);
}
.month-nav-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  border-radius:8px;
  background:#f8fafc;
  color:var(--navy);
  border:1px solid var(--line);
  transition:all 0.15s ease;
}
.month-nav-btn:hover{background:#e2e8f0}
.month-nav-btn svg{width:18px;height:18px}
.month-nav-current{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:700;
  color:var(--navy);
  font-size:1.05em;
}
.month-nav-current svg{width:20px;height:20px;color:var(--gold)}

/* Fee Hero Overview Card */
.fee-hero-card{
  background:#ffffff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:16px;
  margin-bottom:14px;
}
.fee-hero-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
}
.fee-hero-title{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:700;
  color:var(--navy);
  font-size:1.05em;
}
.fee-hero-title svg{width:20px;height:20px;color:var(--navy)}

.fee-metrics-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:10px;
  margin-bottom:12px;
}
.metric-box{
  border-radius:10px;
  padding:12px 10px;
  display:flex;
  flex-direction:column;
  text-align:left;
  border:1px solid transparent;
}
.metric-expected{
  background:#f1f5f9;
  border-color:#e2e8f0;
}
.metric-expected .metric-val{color:var(--navy)}
.metric-collected{
  background:#f0fdf4;
  border-color:#bbf7d0;
  border-left:3.5px solid #15803d;
}
.metric-collected .metric-val{color:#15803d}
.metric-pending{
  background:#fffbeb;
  border-color:#fde68a;
  border-left:3.5px solid #d97706;
}
.metric-pending .metric-val{color:#b45309}

.metric-lbl{
  font-size:0.7em;
  font-weight:800;
  letter-spacing:0.04em;
  color:#64748b;
  margin-bottom:4px;
}
.metric-val{
  font-size:1.25em;
  font-weight:800;
  line-height:1.15;
}
.metric-sub{
  font-size:0.75em;
  color:#64748b;
  margin-top:4px;
}

/* Progress Bar */
.fee-progress-wrap{
  background:#f8fafc;
  border-radius:8px;
  padding:8px 10px;
  margin-bottom:12px;
  border:1px solid #f1f5f9;
}
.fee-progress-meta{
  display:flex;
  justify-content:space-between;
  font-size:0.78em;
  margin-bottom:6px;
}
.fee-progress-track{
  height:7px;
  background:#fed7aa;
  border-radius:999px;
  overflow:hidden;
}
.fee-progress-fill{
  height:100%;
  background:#15803d;
  border-radius:999px;
  transition:width 0.3s ease;
}

/* Rate & Register Bar */
.fee-rate-inline-form{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding-top:10px;
  border-top:1px solid #f1f5f9;
}
.rate-input-group{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:0.88em;
  font-weight:600;
  color:#334155;
}
.rate-input-group input{
  width:90px;
  margin:0;
  padding:5px 8px;
  font-weight:700;
}
.register-actions{
  display:flex;
  gap:6px;
}

/* Search & Pills Bar */
.fees-filter-panel{
  background:#ffffff;
  border-radius:16px;
  border:1px solid rgba(11, 42, 91, 0.08);
  box-shadow:0 4px 16px -2px rgba(11, 42, 91, 0.04);
  padding:12px;
  margin-bottom:14px;
}
.search-input-wrap{
  position:relative;
  margin-bottom:10px;
}
.search-input-wrap svg{
  position:absolute;
  left:12px;
  top:50%;
  transform:translateY(-50%);
  width:17px;
  height:17px;
  color:#94a3b8;
  pointer-events:none;
}
.search-input-wrap input{
  margin:0;
  padding:9px 12px 9px 38px;
  background:#f8fafc;
  border:1px solid #e2e8f0;
  border-radius:10px;
  font-size:0.92em;
  transition:border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.search-input-wrap input:focus{
  background:#ffffff;
  border-color:var(--navy);
  box-shadow:0 0 0 3px rgba(11, 42, 91, 0.08);
  outline:none;
}

.filter-controls-row{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.filter-selects-group{
  display:flex;
  align-items:center;
  gap:8px;
  flex:1;
  min-width:220px;
}
.filter-selects-group .filter-dropdown-pill{
  flex:1;
  min-width:0;
}

.pills-scroll-row{
  display:flex;
  gap:6px;
  overflow-x:auto;
  padding-bottom:2px;
  -webkit-overflow-scrolling:touch;
}
.pills-scroll-row::-webkit-scrollbar{display:none}
.filter-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
  height:34px;
  padding:0 13px;
  border-radius:999px;
  border:1px solid #e2e8f0;
  background:#f8fafc;
  color:#334155;
  font-size:0.82em;
  font-weight:600;
  cursor:pointer;
  transition:all 0.15s ease;
}
.filter-pill:hover{
  border-color:#cbd5e1;
  background:#f1f5f9;
}
.filter-pill .pill-count{
  background:rgba(0,0,0,0.06);
  padding:1px 6px;
  border-radius:999px;
  font-size:0.85em;
}
.filter-pill.active{
  background:var(--navy);
  color:#ffffff;
  border-color:var(--navy);
}
.filter-pill.active .pill-count{
  background:rgba(255,255,255,0.25);
  color:#ffffff;
}
.filter-pill.pill-amber.active{
  background:#d97706;
  border-color:#d97706;
}
.filter-pill.pill-green.active{
  background:#15803d;
  border-color:#15803d;
}
.filter-dropdown-pill{
  width:auto;
  height:36px;
  margin:0;
  padding:0 30px 0 12px;
  border-radius:10px;
  border:1px solid #e2e8f0;
  font-size:0.82em;
  font-weight:600;
  background-color:#f8fafc;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2.2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 9px center;
  background-size:14px 14px;
  appearance:none;
  -webkit-appearance:none;
  color:#0f172a;
  cursor:pointer;
  text-overflow:ellipsis;
  white-space:nowrap;
  overflow:hidden;
  transition:border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.filter-dropdown-pill:hover{
  border-color:#cbd5e1;
  background-color:#ffffff;
}
.filter-dropdown-pill:focus{
  background-color:#ffffff;
  border-color:var(--navy);
  box-shadow:0 0 0 3px rgba(11, 42, 91, 0.08);
  outline:none;
}

/* Mobile Student Cards (Roster) */
.mobile-fee-roster{
  display:none; /* Shown only on mobile */
  flex-direction:column;
  gap:10px;
}
.fee-student-card{
  background:#ffffff;
  border:1px solid var(--line);
  border-radius:12px;
  padding:14px;
  box-shadow:0 1px 3px rgba(0,0,0,0.03);
  display:flex;
  flex-direction:column;
  gap:8px;
  transition:transform 0.1s ease;
}
.fee-student-card.card-pending{
  border-left:4px solid #d97706;
}
.fee-student-card.card-paid{
  border-left:4px solid #15803d;
}
.fcard-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.fcard-identity{
  display:flex;
  align-items:center;
  gap:8px;
}
.fcard-lrc{
  background:#e0f2fe;
  color:#0369a1;
  font-weight:800;
  font-size:0.78em;
  padding:2px 7px;
  border-radius:6px;
  letter-spacing:0.02em;
}
.fcard-name{
  font-weight:700;
  color:var(--txt);
  text-decoration:none;
  font-size:1.02em;
}
.fcard-grade{
  background:#f1f5f9;
  color:#475569;
  font-size:0.75em;
  font-weight:600;
  padding:2px 8px;
  border-radius:999px;
}

.fcard-tags{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
  font-size:0.82em;
}
.fcard-prog{
  background:#ede9fe;
  color:#6d28d9;
  font-weight:600;
  padding:1px 7px;
  border-radius:6px;
  font-size:0.78em;
}
.fcard-days{
  display:inline-flex;
  align-items:center;
  gap:5px;
  color:#15803d;
  font-weight:600;
  background:#f0fdf4;
  padding:1px 8px;
  border-radius:999px;
  font-size:0.78em;
}
.dot-green{
  width:6px;
  height:6px;
  background:#22c55e;
  border-radius:50%;
}

.fcard-finance{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  background:#f8fafc;
  border-radius:8px;
  font-size:0.86em;
  color:#475569;
}
.fcard-finance strong{color:var(--txt)}
.ffinance-sep{color:#cbd5e1}

.fcard-actions-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-top:2px;
}
.status-pill{
  font-size:0.82em;
  font-weight:700;
  padding:4px 10px;
  border-radius:8px;
}
.status-due{
  background:#fef3c7;
  color:#b45309;
  border:1px solid #fde68a;
}
.status-paid{
  background:#dcfce7;
  color:#15803d;
  border:1px solid #bbf7d0;
}
.status-none{
  color:#94a3b8;
  font-weight:500;
}
.btn-collect{
  background:#15803d;
  color:#ffffff;
  border-color:#15803d;
  padding:6px 14px;
  font-weight:700;
  border-radius:8px;
}
.btn-collect:hover{
  background:#166534;
  border-color:#166534;
}
.btn-collect svg{width:16px;height:16px}
.btn-ghost-dark{
  background:#f8fafc;
  color:var(--navy);
  border:1px solid var(--line);
}

/* Responsive display toggle */
@media(max-width:768px){
  .desktop-fee-table{display:none!important}
  .mobile-fee-roster{display:flex!important}
  .fee-metrics-grid{grid-template-columns:1fr 1fr 1fr;gap:6px}
  .metric-box{padding:8px 6px}
  .metric-val{font-size:1.05em}
  .rate-input-group{width:100%;justify-content:space-between}
  .register-actions{width:100%;justify-content:flex-end}
}

/* Student Mobile Cards Styling */
.page-top-actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
}
.page-title-wrap{
  display:flex;
  align-items:center;
  gap:10px;
}
.page-title-wrap h1{margin:0}

.mobile-student-roster{
  display:none;
  flex-direction:column;
  gap:10px;
}
.student-card{
  background:#ffffff;
  border:1px solid var(--line);
  border-radius:12px;
  padding:14px;
  box-shadow:0 1px 3px rgba(0,0,0,0.03);
  display:flex;
  flex-direction:column;
  gap:10px;
}
.student-card.card-inactive{
  opacity:0.65;
  background:#f8fafc;
}
.scard-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.scard-identity{
  display:flex;
  align-items:center;
  gap:8px;
}
.scard-check{
  width:18px!important;
  height:18px!important;
  margin:0!important;
  accent-color:var(--navy);
}
.scard-name{
  font-weight:700;
  font-size:1.05em;
  color:var(--txt);
}
.scard-body{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.scard-meta{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
}
.scard-parent{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:0.84em;
  color:#64748b;
  margin-top:2px;
}
.scard-parent svg{width:16px;height:16px;color:#94a3b8}
.scard-parent a{color:var(--navy);font-weight:600;text-decoration:none}
.scard-actions{
  display:flex;
  gap:8px;
  border-top:1px solid #f1f5f9;
  padding-top:10px;
  margin-top:2px;
}

@media(max-width:768px){
  .desktop-student-table{display:none!important}
  .mobile-student-roster{display:flex!important}
}

/* Attendance Mobile Cards Styling */
.mobile-attendance-roster{
  display:none;
  flex-direction:column;
  gap:10px;
}
.student-card.card-inside{
  border-left:4px solid #0284c7;
  background:#f8fafc;
}
.student-card.card-departed{
  border-left:4px solid #d97706;
}
.att-time-pills{
  display:flex;
  gap:6px;
  align-items:center;
}
.time-tag{
  font-size:0.78em;
  font-weight:600;
  padding:2px 8px;
  border-radius:6px;
  background:#f1f5f9;
  color:#64748b;
}
.time-tag.time-ok{
  background:#dcfce7;
  color:#15803d;
}
.time-tag.time-warn{
  background:#fef3c7;
  color:#b45309;
}

@media(max-width:768px){
  .desktop-att-table{display:none!important}
  .mobile-attendance-roster{display:flex!important}
}

/* ========================================================
   MODERN STITCH MOBILE CARDS (Students & Attendance)
   ======================================================== */
.students-view-wrapper { max-width: 100%; }
.page-top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.page-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-title-wrap h1 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--navy, #0b2a5b);
  margin: 0;
  letter-spacing: -0.02em;
}
.st-enrolled-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #dcfce7;
  color: #15803d;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
}
.st-enrolled-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
}

/* Student Cards (<768px) */
.mobile-student-roster {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.st-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid rgba(11, 42, 91, 0.08);
  box-shadow: 0 4px 16px -2px rgba(11, 42, 91, 0.04);
  position: relative;
  overflow: hidden;
  padding: 14px;
}
.st-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: #12823b;
}
.st-card.st-card-inactive::before {
  background: #cbd5e1;
}
.st-card-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.st-avatar {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  border-radius: 50%;
  background: #e0e7ff;
  color: #3730a3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.st-info {
  flex: 1;
  min-width: 0;
}
.st-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
.st-tags-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.st-lrc-badge {
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: #f1f5f9;
  color: var(--navy, #0b2a5b);
}
.st-grade-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}
.st-menu-btn {
  color: #94a3b8;
  padding: 2px 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.st-menu-btn svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
}
.st-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  text-decoration: none;
  display: block;
  margin-bottom: 6px;
  line-height: 1.25;
}
.st-name:hover {
  color: var(--navy, #0b2a5b);
}
.st-programs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.st-prog-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.st-parent-box {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  color: #64748b;
}
.st-parent-text {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-parent-text svg {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  flex-shrink: 0;
  color: #94a3b8;
}
.st-call-btn {
  width: 26px !important;
  height: 26px !important;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.st-call-btn svg {
  width: 13px !important;
  height: 13px !important;
  max-width: 13px !important;
  max-height: 13px !important;
}
.st-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}
.st-qr-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy, #0b2a5b);
  text-decoration: none;
}
.st-qr-btn svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  display: inline-block !important;
}
.st-status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.st-status-active {
  background: #dcfce7;
  color: #15803d;
}
.st-status-inactive {
  background: #f1f5f9;
  color: #94a3b8;
}

/* Force constrain any rogue svg */
.mobile-student-roster svg {
  max-width: 20px !important;
  max-height: 20px !important;
}
.st-call-btn svg {
  width: 13px;
  height: 13px;
}
.st-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}
.st-qr-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy, #0b2a5b);
  text-decoration: none;
}
.st-qr-btn svg {
  width: 14px;
  height: 14px;
}
.st-status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.st-status-active {
  background: #dcfce7;
  color: #15803d;
}
.st-status-inactive {
  background: #f1f5f9;
  color: #94a3b8;
}

/* Digital ID Badge & Profile Styles */
.profile-view-wrapper {
  max-width: 500px;
  margin: 0 auto;
}
.profile-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.profile-back-btn, .profile-edit-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--navy, #0b2a5b);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.profile-back-btn svg, .profile-edit-btn svg {
  width: 20px;
  height: 20px;
}
.profile-title-block {
  flex: 1;
  text-align: center;
}
.profile-title-block h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--navy, #0b2a5b);
  margin: 0 0 4px 0;
}
.profile-meta-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.digital-id-card {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(11, 42, 91, 0.12);
  box-shadow: 0 10px 30px -4px rgba(11, 42, 91, 0.08);
  overflow: hidden;
  margin-bottom: 16px;
}
.digi-header {
  background: #0b2a5b;
  border-bottom: 3px solid #d49c2d;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.digi-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.4);
}
.digi-inst-text {
  flex: 1;
}
.digi-inst-name {
  display: block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.digi-inst-branch {
  display: block;
  font-size: 10px;
  color: #cbd5e1;
}
.digi-chip-tag {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
  color: #f8fafc;
}
.digi-body {
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.digi-left {
  flex: 1;
  min-width: 0;
}
.digi-name-line {
  display: flex;
  align-items: center;
  gap: 10px;
}
.digi-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}
.digi-session-line {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #64748b;
  margin-top: 8px;
}
.digi-session-line svg {
  width: 14px;
  height: 14px;
  color: #15803d;
}
.digi-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.digi-qr-wrap {
  width: 86px;
  height: 86px;
  background: #ffffff;
  padding: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.digi-qr-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}
.digi-qr-sub {
  font-size: 9px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.06em;
}
.profile-action-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.action-tile {
  background: #ffffff;
  border: 1px solid rgba(11, 42, 91, 0.08);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #0f172a;
  box-shadow: 0 2px 8px -2px rgba(11, 42, 91, 0.04);
}
.tile-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile-icon-circle svg {
  width: 18px;
  height: 18px;
}
.tile-lbl {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

/* Home screen: big, obvious actions */
.home-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin:14px 0 18px}
.home-tile{
  display:flex;flex-direction:column;justify-content:center;gap:4px;min-height:84px;padding:14px 16px;
  background:#fff;border:1px solid var(--line);border-radius:14px;color:var(--navy);text-decoration:none;
  box-shadow:0 1px 3px rgba(0,0,0,.05);
}
.home-tile span{font-weight:800;font-size:1.05em}
.home-tile small{color:var(--txt-muted);font-weight:500}
.home-tile-main{
  grid-column:1/-1;flex-direction:row;align-items:center;justify-content:center;gap:12px;min-height:92px;
  background:var(--primary,var(--green));border-color:var(--primary,var(--green));color:#fff;
}
.home-tile-main svg{width:34px;height:34px}
.home-tile-main span{font-size:1.25em}
