/* =========================================================
   ABI Parent Portal — Light Pro (RTL) — FULL app.css (Enhanced)
   - Light background, premium cards, stronger typography
   - Safer focus states, smoother spacing, mobile-first polish
   - Palette: #1c2a5c #2a4076 #b4962a #dcba3c
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&display=swap');

:root{
  --font: 'Cairo', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Tahoma, Arial, "Noto Kufi Arabic", "Noto Naskh Arabic", sans-serif;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tap: 44px;

  --radius: 18px;
  --radius-lg: 24px;
  --radius-xl: 26px;

  --container: 1168px;
  --transition: all .24s cubic-bezier(.2,.9,.2,1);

  --abi-navy: #1c2a5c;
  --abi-navy2:#2a4076;
  --abi-gold: #b4962a;
  --abi-gold2:#dcba3c;

  --ink: #0b1626;
  --text: rgba(11,22,38,.94);
  --muted: rgba(11,22,38,.68);

  --card: rgba(255,255,255,.82);
  --card2: rgba(255,255,255,.72);

  --stroke: rgba(28,42,92,.14);
  --stroke2: rgba(28,42,92,.10);

  --shadow: 0 14px 34px rgba(14,25,55,.10);
  --shadow-lg: 0 26px 70px rgba(14,25,55,.14);

  --focus: 0 0 0 3px rgba(180,150,42,.22);
}

/* ===== helpers ===== */
*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
img{ max-width:100%; height:auto; }
.hidden{ display:none !important; }
.num{ direction:ltr; text-align:left; }
.sr-only{
  position:absolute;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden;
  clip: rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

body, button, input, select, textarea{ font-family: var(--font) !important; }
a{ color: inherit; text-decoration: none; }
:focus{ outline: none; }
:focus-visible{
  box-shadow: var(--focus) !important;
  border-color: rgba(180,150,42,.70) !important;
}

/* Container */
.container{
  width:100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
}

/* =========================================================
   LIGHT THEME
   ========================================================= */
body.abi-light{
  background:
    radial-gradient(1200px 820px at 10% 6%, rgba(220,186,60,.20), transparent 62%),
    radial-gradient(1100px 780px at 92% 8%, rgba(42,64,118,.15), transparent 66%),
    radial-gradient(980px 740px at 88% 96%, rgba(180,150,42,.10), transparent 64%),
    linear-gradient(180deg, #fcfdff 0%, #eef3fb 100%);
  color: var(--text);
  min-height:100vh;
}

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(10px + var(--safe-t)) 0 10px;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.topbar .container{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 240px;
}
.brand-logo{
  width:46px;
  height:46px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(28,42,92,.04);
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 26px rgba(28,42,92,.08);
}
.brand-text{ display:flex; flex-direction:column; }
.brand-title{
  font-weight: 950;
  letter-spacing: .15px;
  font-size: 15px;
  line-height: 1.25;
  color: rgba(28,42,92,.98);
}
.brand-sub{
  margin-top: 2px;
  font-weight: 900;
  font-size: 12px;
  color: rgba(11,22,38,.66);
}

/* =========================================================
   FORMS / INPUTS / BUTTONS
   ========================================================= */
.search{
  display:flex;
  gap:10px;
  align-items:center;
  flex: 1 1 420px;
  justify-content:flex-end;
  flex-wrap:wrap;
}

.input{
  width:100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(28,42,92,.18);
  background: rgba(255,255,255,.94);
  color: var(--text);
  outline: none;
  transition: var(--transition);
  box-shadow: 0 10px 22px rgba(28,42,92,.06);
}
.input::placeholder{ color: rgba(11,22,38,.48); }
.input:focus{
  border-color: rgba(180,150,42,.70);
  box-shadow: var(--focus), 0 14px 34px rgba(28,42,92,.10);
}
.input-sm{
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 12px;
}

.btn{
  min-height: var(--tap);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(28,42,92,.18);
  background: rgba(255,255,255,.88);
  color: rgba(28,42,92,.96);
  font-weight: 950;
  cursor:pointer;
  transition: var(--transition);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  box-shadow: 0 10px 22px rgba(28,42,92,.08);
  user-select:none;
}
.btn:hover{ transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active{ transform: translateY(0); }
.btn:disabled{ opacity:.55; cursor:not-allowed; transform:none; box-shadow:none; }

.btn .ic,
.abi-bottomnav .bn-item .bn-ic{
  filter: saturate(1.1);
  color: rgba(28,42,92,.96);
}

.btn-primary{
  border-color: rgba(180,150,42,.62);
  background: linear-gradient(180deg, rgba(220,186,60,.98), rgba(180,150,42,.86));
  color: rgba(28,42,92,.98);
  box-shadow: 0 18px 44px rgba(180,150,42,.20);
}
.btn-primary:hover{ box-shadow: 0 22px 52px rgba(180,150,42,.26); }

.btn-ghost{
  background: rgba(255,255,255,.82);
  border-color: rgba(28,42,92,.16);
  color: rgba(28,42,92,.92);
}

.btn-wide{ width:100%; }

.btn-mini{
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(28,42,92,.16);
  background: rgba(255,255,255,.82);
  color: rgba(28,42,92,.92);
  font-weight: 950;
  cursor:pointer;
  transition: var(--transition);
}
.btn-mini:hover{ transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-mini.primary{
  border-color: rgba(180,150,42,.55);
  background: rgba(220,186,60,.22);
  color: rgba(28,42,92,.96);
}

/* Busy state */
#abiForm[data-busy="1"] .btn-primary{
  position: relative;
  padding-inline-start: 42px;
  pointer-events: none;
}
#abiForm[data-busy="1"] .btn-primary::before{
  content:"";
  position:absolute;
  inset-inline-start: 14px;
  top: 50%;
  width: 16px; height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid rgba(28,42,92,.18);
  border-top-color: rgba(28,42,92,.75);
  animation: abiSpin .8s linear infinite;
}
@keyframes abiSpin{ to{ transform: rotate(360deg); } }

/* =========================================================
   MAIN LAYOUT
   ========================================================= */
main{ padding: 18px 0 72px; }

.hero{
  display:grid;
  grid-template-columns: 1fr;
  gap:14px;
  align-items: start;
}

.panel{
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.panel:hover{ box-shadow: 0 18px 44px rgba(14,25,55,.12); }

.panel-hd{
  padding: 14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.76));
  border-bottom: 1px solid var(--stroke2);
}
.panel-title{
  font-weight: 950;
  font-size: 14px;
  color: rgba(28,42,92,.98);
}
.panel-sub{
  font-weight: 900;
  font-size: 12px;
  color: rgba(11,22,38,.66);
}
.panel-bd{ padding: 14px 16px 16px; }

.muted{ color: rgba(11,22,38,.66); }
.badge{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(180,150,42,.55);
  background: rgba(220,186,60,.22);
  color: rgba(28,42,92,.98);
  font-weight: 950;
  font-size: 12px;
  white-space:nowrap;
}

/* =========================================================
   KPIs
   ========================================================= */
.kpis{
  display:grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap:10px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.kpi{
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 12px 12px;
  overflow:hidden;
  position:relative;
}
.kpi:hover{ transform: translateY(-1px); transition: var(--transition); box-shadow: 0 18px 44px rgba(14,25,55,.12); }
.kpi::before{
  content:"";
  position:absolute;
  top:0; left:0; right:0;
  height: 3px;
  background: linear-gradient(90deg, rgba(28,42,92,.92), rgba(180,150,42,.92), rgba(42,64,118,.92));
}

.kpi-label, .kpi .k{
  color: rgba(11,22,38,.72);
  font-weight: 900;
  font-size: 12px;
}
.kpi-value, .kpi .v{
  margin-top: 6px;
  font-weight: 950;
  font-size: 19px;
  direction:ltr;
  text-align:left;
  color: rgba(28,42,92,.96);
}
.kpi-strong{ color: rgba(28,42,92,.98); }

/* Optional KPI action button (e.g., "السداد") */
.kpi-btn{
  margin-top: 10px;
  width: 100%;
  min-height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(180,150,42,.55);
  background: rgba(220,186,60,.18);
  color: rgba(28,42,92,.98);
  font-weight: 950;
  cursor:pointer;
  transition: var(--transition);
}
.kpi-btn:hover{ transform: translateY(-1px); box-shadow: 0 14px 34px rgba(180,150,42,.18); }
.kpi-btn:disabled{ opacity:.55; cursor:not-allowed; transform:none; box-shadow:none; }

/* =========================================================
   OVERVIEW (donut + bars)
   ========================================================= */
.overview{ display:flex; gap:14px; align-items:stretch; }

.donut{
  width: 120px;
  height: 120px;
  flex: 0 0 auto;
  position: relative;
}
.donut svg{ width:100%; height:100%; transform: rotate(-90deg); }
.donut circle{ fill:none; stroke-width: 12; }
.donut-bg{ stroke: rgba(28,42,92,.14); }
.donut-fg{ stroke: rgba(180,150,42,.98); stroke-linecap: round; }
.donut-center{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
}
.donut-pct{
  font-weight: 950;
  font-size: 16px;
  color: rgba(28,42,92,.98);
}
.donut-mini{
  font-weight: 900;
  font-size: 11px;
  color: rgba(11,22,38,.62);
  margin-top: 2px;
}

.mini-bars{ flex:1; min-width: 0; }
.mini-bars-title{ font-weight: 950; font-size: 13px; margin-bottom: 10px; color: rgba(28,42,92,.98); }
.mini-bars-grid{ display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:10px; }

.mbar{
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: var(--card);
  padding: 12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.mbar:hover{ box-shadow: 0 18px 44px rgba(14,25,55,.12); transition: var(--transition); }
.mbar-col{
  height: 74px;
  border-radius: 16px;
  background: rgba(28,42,92,.04);
  border: 1px solid rgba(28,42,92,.10);
  display:flex;
  align-items:flex-end;
  justify-content:center;
  overflow:hidden;
}
.mbar-fill{
  width: 70%;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, rgba(220,186,60,.98), rgba(180,150,42,.34));
  box-shadow: 0 12px 26px rgba(180,150,42,.16);
}
.mbar-lbl{
  font-weight: 950;
  font-size: 12px;
  color: rgba(28,42,92,.94);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.mbar-amt{
  font-weight: 950;
  font-size: 12px;
  color: rgba(28,42,92,.86);
  direction:ltr; text-align:left;
}

/* =========================================================
   TOOLBAR + RESULTS
   ========================================================= */
.toolbar{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.meta{
  font-weight: 950;
  font-size: 12px;
  color: rgba(11,22,38,.66);
  margin-inline-start:auto;
}

.results{ margin-top: 10px; }
.list-footer{ margin-top: 12px; }
.hint{
  color: rgba(11,22,38,.66);
  font-weight: 900;
  font-size: 12px;
  padding: 6px 0;
}

/* =========================================================
   TOASTS
   ========================================================= */
.toast{
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(28,42,92,.14);
  background: rgba(255,255,255,.86);
  font-weight: 900;
  font-size: 13px;
  color: rgba(28,42,92,.92);
  box-shadow: 0 14px 34px rgba(28,42,92,.10);
}
.toast-ok{
  border-color: rgba(180,150,42,.28);
  background: rgba(220,186,60,.14);
}
.toast-err{
  border-color: rgba(220,56,72,.26);
  background: rgba(220,56,72,.08);
}
.toast-loading{
  border-color: rgba(42,64,118,.22);
  background: rgba(42,64,118,.08);
}

/* =========================================================
   STUDENT LIST CARDS
   ========================================================= */
.list{ display:flex; flex-direction:column; gap:12px; }

.card{
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card:hover{ box-shadow: 0 18px 44px rgba(14,25,55,.12); transition: var(--transition); }

.card-hd{
  padding: 14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  cursor:pointer;
  user-select:none;
  outline:none;
  position:relative;
}
.card-hd::after{
  content:"";
  position:absolute;
  inset-inline: 14px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(180,150,42,.35), transparent);
  opacity: .75;
}
.card-hd:focus{ box-shadow: 0 0 0 3px rgba(180,150,42,.18) inset; }

.card-name{
  font-weight: 950;
  font-size: 15px;
  color: rgba(28,42,92,.98);
}
.card-sub{
  margin-top: 3px;
  font-weight: 900;
  font-size: 12px;
  color: rgba(11,22,38,.66);
}

.codepill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(180,150,42,.55);
  background: rgba(220,186,60,.22);
  color: rgba(28,42,92,.98);
  font-weight: 950;
  direction:ltr;
}

.remain{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:2px;
  min-width: 88px;
}
.remain .v{
  font-weight: 950;
  color: rgba(28,42,92,.98);
  direction:ltr; text-align:left;
}
.remain .k{
  font-weight: 900;
  font-size: 12px;
  color: rgba(11,22,38,.62);
}

.chips{ display:flex; gap:8px; flex-wrap:wrap; margin-top: 8px; }
.chip{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(28,42,92,.14);
  background: rgba(255,255,255,.74);
  color: rgba(28,42,92,.92);
  font-weight: 950;
  font-size: 12px;
  white-space:nowrap;
}
.chip-score{
  border-color: rgba(180,150,42,.55);
  background: rgba(220,186,60,.22);
  color: rgba(28,42,92,.98);
}

.card-bd{ display:none; padding: 0 16px 16px; }
.card.open .card-bd{ display:block; }

.grid3{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.panel3{
  border-radius: 18px;
  border: 1px solid rgba(28,42,92,.12);
  background: rgba(255,255,255,.78);
  overflow:hidden;
  box-shadow: 0 12px 26px rgba(28,42,92,.08);
}
.panel3-hd{
  padding: 10px 12px;
  font-weight: 950;
  font-size: 13px;
  color: rgba(28,42,92,.98);
  border-bottom: 1px solid rgba(28,42,92,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.74));
}
.kv{ padding: 10px 12px 12px; }
.kv-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(28,42,92,.10);
}
.kv-row:last-child{ border-bottom:none; }
.kv-k{
  font-weight: 900;
  font-size: 12px;
  color: rgba(11,22,38,.62);
  white-space:nowrap;
}
.kv-v{
  font-weight: 950;
  font-size: 12px;
  color: rgba(28,42,92,.92);
  max-width: 64%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  text-align:left;
  direction:ltr;
}
.kv-total{
  background: rgba(220,186,60,.16);
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(180,150,42,.30);
}

/* progress bar */
.pbar{
  height: 10px;
  border-radius: 999px;
  background: rgba(28,42,92,.04);
  border: 1px solid rgba(28,42,92,.12);
  overflow:hidden;
}
.pbar > span{
  display:block;
  height:100%;
  width:0%;
  background: linear-gradient(90deg, rgba(42,64,118,.70), rgba(180,150,42,.98));
}

/* Tabs */
.tabs{ display:flex; gap:10px; margin-top: 12px; }
.tabbtn{
  flex:1;
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(28,42,92,.12);
  background: rgba(255,255,255,.78);
  color: rgba(28,42,92,.92);
  font-weight: 950;
  cursor:pointer;
  transition: var(--transition);
}
.tabbtn.active{
  border-color: rgba(180,150,42,.55);
  background: rgba(220,186,60,.22);
  color: rgba(28,42,92,.98);
}
.tabpanel{ display:none; margin-top: 10px; }
.tabpanel.active{ display:block; }

/* Tables */
.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: 18px;
  border: 1px solid rgba(28,42,92,.14);
  background: rgba(255,255,255,.82);
}
.table th, .table td{
  padding: 10px;
  border-bottom: 1px solid rgba(28,42,92,.08);
  text-align:right;
  font-weight: 900;
  font-size: 12px;
  color: rgba(11,22,38,.92);
}
.table thead th{
  background: linear-gradient(180deg, rgba(28,42,92,.92), rgba(42,64,118,.92));
  color: rgba(255,255,255,.96);
  font-weight: 950;
  border-bottom-color: rgba(255,255,255,.18);
}
.table tbody tr:nth-child(odd){ background: rgba(28,42,92,.02); }
.table tbody tr:hover{ background: rgba(220,186,60,.10); }

/* Actions */
.actions{ display:flex; gap:10px; margin-top: 12px; flex-wrap:wrap; }

/* =========================================================
   SKELETON
   ========================================================= */
.abi-skeleton{ display:none; }
.abi-skeleton.on{ display:block; }
.skel{
  border-radius: var(--radius-lg);
  border: 1px solid rgba(28,42,92,.12);
  background: rgba(255,255,255,.78);
  overflow:hidden;
  box-shadow: var(--shadow);
}
.skel-hd{
  padding: 12px;
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
}
.skel-line{
  height: 12px;
  border-radius: 999px;
  background: rgba(28,42,92,.08);
  overflow:hidden;
  position:relative;
}
.skel-line::after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.05s infinite;
}
@keyframes shimmer{ to{ transform: translateX(100%); } }
.skel-a{ width: 52%; }
.skel-b{ width: 28%; }
.skel-c{ width: 64%; margin-top: 10px; }

/* =========================================================
   BOTTOM NAV (MOBILE)
   ========================================================= */
.abi-bottomnav{
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(62px + var(--safe-b));
  padding: 10px 14px calc(10px + var(--safe-b));
  display: none;
  gap: 10px;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(255,255,255,.90);
  border-top: 1px solid rgba(28,42,92,.12);
}
.abi-bottomnav .bn-item{
  flex: 1;
  min-height: 42px;
  border-radius: 16px;
  border: 1px solid rgba(28,42,92,.14);
  background: rgba(255,255,255,.86);
  color: rgba(28,42,92,.96);
  font-weight: 950;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  cursor:pointer;
  transition: var(--transition);
}
.abi-bottomnav .bn-item:hover{ box-shadow: var(--shadow); transform: translateY(-1px); }
.abi-bottomnav .bn-item:active{ transform: translateY(0); }
.abi-bottomnav .bn-item .bn-ic{ width: 18px; height: 18px; display:inline-flex; }

/* =========================================================
   BOTTOM SHEET (MOBILE FILTERS)
   ========================================================= */
.abi-sheet{
  position: fixed;
  inset: 0;
  display:none;
  z-index: 60;
}
.abi-sheet.open{ display:block; }
.abi-sheet .sh-backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.36);
}
.abi-sheet .sh-panel{
  position:absolute;
  left: 0; right: 0;
  bottom: 0;
  border-radius: 22px 22px 0 0;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(28,42,92,.14);
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  animation: sheetUp .18s ease forwards;
}
@keyframes sheetUp{ to{ transform: translateY(0); } }
.abi-sheet .sh-hd{
  padding: 12px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom: 1px solid rgba(28,42,92,.10);
}
.sh-title{ font-weight: 950; color: rgba(28,42,92,.98); }
.sh-close{
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(28,42,92,.14);
  background: rgba(255,255,255,.86);
  color: rgba(28,42,92,.92);
  font-weight: 950;
  cursor:pointer;
  transition: var(--transition);
}
.sh-close:hover{ box-shadow: var(--shadow); transform: translateY(-1px); }
.abi-sheet .sh-bd{ padding: 14px; }
.sh-row{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
.sh-actions{ display:flex; gap:10px; margin-top: 12px; flex-wrap:wrap; }

/* =========================================================
   FOOTER
   ========================================================= */
.footer{ padding: 18px 0 calc(18px + var(--safe-b)); }
.footer-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  border-top: 1px solid rgba(28,42,92,.10);
  padding-top: 14px;
  color: rgba(28,42,92,.86);
}
.footer-inner .muted{ color: rgba(11,22,38,.62); }

/* =========================================================
   HOME / LANDING
   ========================================================= */
.abi-home{
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 36px 16px;
}

.welcome-card{
  width: min(980px, 100%);
  border-radius: 26px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.82);
  box-shadow: var(--shadow-lg);
  overflow:hidden;
  position:relative;
}

.welcome-card::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(1100px 820px at 15% 15%, rgba(220,186,60,.16), transparent 60%),
    radial-gradient(1100px 820px at 85% 0%, rgba(42,64,118,.14), transparent 62%),
    radial-gradient(1100px 820px at 90% 90%, rgba(180,150,42,.10), transparent 64%);
  pointer-events:none;
}

.welcome-inner{
  position:relative;
  padding: 56px 34px 28px;
  text-align:center;
}

.welcome-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(28,42,92,.14);
  background: rgba(255,255,255,.74);
  color: rgba(28,42,92,.98);
  font-weight: 950;
  font-size: 12px;
  box-shadow: 0 10px 24px rgba(28,42,92,.10);
}

.welcome-title{
  margin: 18px 0 0;
  font-weight: 950;
  letter-spacing: .2px;
  font-size: clamp(28px, 3.6vw, 54px);
  line-height: 1.08;
  color: rgba(28,42,92,.98);
}

.welcome-desc{
  margin: 16px auto 0;
  max-width: 720px;
  font-weight: 850;
  font-size: 14px;
  line-height: 1.9;
  color: rgba(11,22,38,.70);
}

.welcome-divider{
  height:1px;
  margin: 34px 0 0;
  background: rgba(28,42,92,.10);
}

.welcome-actions{
  position:relative;
  padding: 26px 34px 34px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 14px;
}

.welcome-form{
  width: min(720px, 100%);
  display:flex;
  gap: 10px;
  align-items:stretch;
  justify-content:center;
  flex-wrap:wrap;
}

.welcome-form .input{
  width: min(420px, 100%);
  text-align:center;
  font-weight: 950;
  letter-spacing: .6px;
}

.welcome-note{
  font-weight: 850;
  font-size: 12px;
  color: rgba(11,22,38,.62);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1080px){
  .hero{ grid-template-columns: 1fr; }
  .kpis{ grid-template-columns: repeat(2, minmax(0,1fr)); }
  .mini-bars-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid3{ grid-template-columns: 1fr; }
  .abi-bottomnav{ display:flex; }
  main{ padding-bottom: 92px; }
}
@media (max-width: 520px){
  .brand{ min-width: 0; }
  .brand-title{ font-size: 14px; }
  .topbar .container{ gap: 10px; }
  .welcome-inner{ padding: 44px 16px 22px; }
  .welcome-actions{ padding: 22px 16px 28px; }
  .welcome-form .btn{ width:100%; }
  .welcome-form .input{ width:100%; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce){
  *{ animation: none !important; transition: none !important; scroll-behavior:auto !important; }
}

/* =========================================================
   PRINT
   ========================================================= */
@media print{
  .topbar, .abi-bottomnav, .abi-sheet{ display:none !important; }
  body{ background:#fff !important; color:#111 !important; }
  .panel, .card, .kpi, .mbar{ box-shadow:none !important; border-color:#e5e7eb !important; background:#fff !important; }
  .table, .table th, .table td{ border-color:#e5e7eb !important; color:#111 !important; }
  .table thead th{ background:#f3f4f6 !important; color:#111 !important; }
}

/* =========================================================
   MARK highlight
   ========================================================= */
mark{
  background: rgba(220,186,60,.26);
  color: rgba(28,42,92,.98);
  padding: .05em .45em;
  border-radius: 10px;
  border: 1px solid rgba(180,150,42,.30);
}
/* =========================================================
   ABI — Pro Icon System (No HTML changes)
   - Replaces emoji icons in buttons/bottomnav with SVG masks
   - Brand color icons (navy) + better responsive layouts
   ========================================================= */

/* 1) Make icon spans behave like real icons */
.action-group .ic,
.abi-bottomnav .bn-ic{
  width:18px;
  height:18px;
  display:inline-block;
  position:relative;
  font-size:0 !important;    /* hides emoji text */
  line-height:0 !important;  /* hides emoji text */
  flex: 0 0 auto;
}

/* Base icon renderer */
.action-group .ic::before,
.abi-bottomnav .bn-ic::before{
  content:"";
  position:absolute;
  inset:0;
  background: rgba(28,42,92,.96); /* brand navy */
  -webkit-mask-repeat:no-repeat;
  -webkit-mask-position:center;
  -webkit-mask-size:contain;
          mask-repeat:no-repeat;
          mask-position:center;
          mask-size:contain;
  opacity:.98;
}

/* Slightly different icon color on primary (still navy for gold button harmony) */
.btn-primary .ic::before{ background: rgba(28,42,92,.98); }

/* --- SVG masks (data URI) --- */
/* Search */
#btnSearch .ic::before{
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 4a6 6 0 1 1 0 12a6 6 0 0 1 0-12Zm0-2a8 8 0 1 0 4.9 14.3l4.4 4.4a1 1 0 0 0 1.4-1.4l-4.4-4.4A8 8 0 0 0 10 2Z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10 4a6 6 0 1 1 0 12a6 6 0 0 1 0-12Zm0-2a8 8 0 1 0 4.9 14.3l4.4 4.4a1 1 0 0 0 1.4-1.4l-4.4-4.4A8 8 0 0 0 10 2Z'/%3E%3C/svg%3E");
}

/* Family */
#btnFamily .ic::before{
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11a3 3 0 1 0-3-3a3 3 0 0 0 3 3Zm-8 0a3 3 0 1 0-3-3a3 3 0 0 0 3 3Zm8 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4Zm-8 .15C5.67 13.15 0 14.5 0 17v2h6v-2c0-1.31.6-2.23 1.6-2.85A9.6 9.6 0 0 1 8 13.15Z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 11a3 3 0 1 0-3-3a3 3 0 0 0 3 3Zm-8 0a3 3 0 1 0-3-3a3 3 0 0 0 3 3Zm8 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4Zm-8 .15C5.67 13.15 0 14.5 0 17v2h6v-2c0-1.31.6-2.23 1.6-2.85A9.6 9.6 0 0 1 8 13.15Z'/%3E%3C/svg%3E");
}

/* Print */
#btnPrint .ic::before,
#bnPrint .bn-ic::before{
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 7V2h12v5H6Zm12 2h1a3 3 0 0 1 3 3v5h-4v5H6v-5H2v-5a3 3 0 0 1 3-3h1v2H5a1 1 0 0 0-1 1v3h16v-3a1 1 0 0 0-1-1h-1V9ZM8 17v3h8v-3H8Z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 7V2h12v5H6Zm12 2h1a3 3 0 0 1 3 3v5h-4v5H6v-5H2v-5a3 3 0 0 1 3-3h1v2H5a1 1 0 0 0-1 1v3h16v-3a1 1 0 0 0-1-1h-1V9ZM8 17v3h8v-3H8Z'/%3E%3C/svg%3E");
}

/* BottomNav: Top */
#bnTop .bn-ic::before{
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 5l7 7-1.4 1.4L13 8.8V20h-2V8.8L6.4 13.4 5 12l7-7Z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 5l7 7-1.4 1.4L13 8.8V20h-2V8.8L6.4 13.4 5 12l7-7Z'/%3E%3C/svg%3E");
}

/* BottomNav: Filters */
#bnFilters .bn-ic::before{
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 5h18v2H3V5Zm4 6h10v2H7v-2Zm3 6h4v2h-4v-2Z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 5h18v2H3V5Zm4 6h10v2H7v-2Zm3 6h4v2h-4v-2Z'/%3E%3C/svg%3E");
}

/* BottomNav: CSV/Download */
#bnCsv .bn-ic::before{
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3a1 1 0 0 1 1 1v9.59l2.3-2.3 1.4 1.42L12 17.4l-4.7-4.69 1.4-1.42 2.3 2.3V4a1 1 0 0 1 1-1ZM5 19h14v2H5v-2Z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3a1 1 0 0 1 1 1v9.59l2.3-2.3 1.4 1.42L12 17.4l-4.7-4.69 1.4-1.42 2.3 2.3V4a1 1 0 0 1 1-1ZM5 19h14v2H5v-2Z'/%3E%3C/svg%3E");
}

/* =========================================================
   RESPONSIVE polish (Professional)
   ========================================================= */

/* Better spacing on tablets */
@media (max-width: 920px){
  .topbar{ padding: calc(8px + var(--safe-t)) 0 8px; }
  .brand-logo{ width:42px; height:42px; border-radius: 13px; }
  main{ padding: 14px 0 84px; }
}

/* Action buttons become grid on mobile (clean & consistent) */
@media (max-width: 720px){
  .topbar .container{ align-items: stretch; }

  .search{
    flex: 1 1 100%;
    justify-content: stretch;
  }
  .search .input{
    flex: 1 1 100%;
    width: 100%;
  }

  /* if .action-group exists in page */
  .action-group{
    width: 100%;
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:10px;
    align-items: stretch;
  }
  .action-group .btn{
    width: 100%;
    justify-content:center;
  }
}

/* Single column buttons + better readability on very small phones */
@media (max-width: 420px){
  .action-group{ grid-template-columns: 1fr; }

  .kpis{ grid-template-columns: 1fr; }
  .mini-bars-grid{ grid-template-columns: 1fr; }
  .donut{ width: 108px; height:108px; }
  .overview{ flex-direction: column; align-items: center; }
}

/* BottomNav: larger tap targets & nicer labels */
@media (max-width: 1080px){
  .abi-bottomnav .bn-item{
    min-height: 44px;
    border-radius: 16px;
    font-size: 12px;
  }
  .abi-bottomnav .bn-item .bn-ic{
    width: 18px;
    height: 18px;
  }
}

/* Improve tables on small screens (no breaking) */
@media (max-width: 520px){
  .table th, .table td{ padding: 9px 10px; font-size: 12px; }
  .panel-bd{ padding: 12px 12px 14px; }
}

/* Keep footer readable with wrap */
.footer-inner{
  flex-wrap: wrap;
}
.footer-inner > *{
  flex: 1 1 auto;
}
/* =========================
   ABI Pro UI — Responsive Polish (append to app.css)
   ========================= */

:root{
  --abi-bg: #f6f8fc;
  --abi-card: #ffffff;
  --abi-ink: #0b1220;
  --abi-muted: #64748b;
  --abi-line: rgba(15,23,42,.10);
  --abi-line2: rgba(15,23,42,.08);
  --abi-brand: #003b73;
  --abi-brand2:#002a52;
  --abi-gold:#dcb734;
  --abi-gold2:#f1e39a;
  --abi-shadow: 0 14px 40px rgba(2,10,30,.10);
  --abi-radius: 18px;
}

body{
  background: radial-gradient(1200px 600px at 20% -10%, rgba(0,59,115,.08), transparent 60%),
              radial-gradient(900px 600px at 90% 0%, rgba(220,183,52,.10), transparent 55%),
              linear-gradient(180deg, #f7f9fd 0%, #f1f5fb 100%);
  color: var(--abi-ink);
}

.card,
.panel3,
.vtimeline,
.vcard,
.sem-card{
  background: var(--abi-card);
  border: 1px solid var(--abi-line2);
  border-radius: var(--abi-radius);
  box-shadow: var(--abi-shadow);
}

.card-hd{
  gap: 14px;
  padding: 14px 14px;
}

.card-name{
  font-weight: 1000;
  letter-spacing: .1px;
}

.card-sub{
  color: var(--abi-muted);
  font-weight: 800;
}

.remain .v{
  font-weight: 1100;
  font-size: 18px;
  color: var(--abi-brand2);
}
.remain .k{
  color: var(--abi-muted);
  font-weight: 900;
}

.grid3{
  display:grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0,1fr));
  margin-top: 12px;
}

.panel3-hd{
  font-weight: 1000;
  color: var(--abi-brand2);
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--abi-line);
  margin-bottom: 10px;
}

.kv-row{
  border-bottom: 1px dashed rgba(15,23,42,.08);
  padding: 8px 0;
}
.kv-row:last-child{border-bottom:0}
.kv-k{color:var(--abi-muted);font-weight:900}
.kv-v{font-weight:1000}
.kv-v.num{direction:ltr;text-align:left}

.kv-total{
  background: linear-gradient(90deg, rgba(220,183,52,.16), rgba(0,59,115,.06));
  border-radius: 14px;
  padding: 10px 10px;
}

.pbar{
  height: 10px;
  border-radius: 999px;
  background: rgba(2,10,30,.06);
  overflow:hidden;
}
.pbar span{
  display:block;height:100%;
  background: linear-gradient(90deg, var(--abi-brand) 0%, var(--abi-gold) 100%);
}

.codepill{
  border: 1px solid rgba(0,59,115,.20);
  background: rgba(0,59,115,.06);
  color: var(--abi-brand2);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 1000;
}

.chip{
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.75);
  font-weight: 1000;
}
.chip-good{border-color: rgba(6,95,70,.25); background: rgba(6,95,70,.08); color:#065f46}
.chip-mid{ border-color: rgba(2,132,199,.25); background: rgba(2,132,199,.08); color:#075985}
.chip-low{ border-color: rgba(127,29,29,.25); background: rgba(127,29,29,.08); color:#7f1d1d}
.chip-score{border-color: rgba(220,183,52,.30); background: rgba(220,183,52,.12); color:#6b4e00}

/* Tabs */
.tabs{
  margin-top: 12px;
  display:flex; gap:10px; flex-wrap:wrap;
}
.tabbtn{
  border:1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.8);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 1000;
  cursor:pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tabbtn.active{
  background: linear-gradient(90deg, rgba(0,59,115,.10), rgba(220,183,52,.18));
  border-color: rgba(0,59,115,.20);
}
.tabbtn:hover{transform: translateY(-1px)}

/* Voucher timeline */
.vtimeline{padding: 12px 12px; margin-top: 12px}
.vt-hd{font-weight:1100;color:var(--abi-brand2);margin-bottom:10px}
.vt-item{display:flex;gap:12px;align-items:flex-start;padding:10px 6px}
.vt-rail{position:relative;width:20px;flex:0 0 20px;margin-top:2px}
.vt-dot{width:10px;height:10px;border-radius:999px;background:linear-gradient(180deg,var(--abi-gold),var(--abi-brand));display:block;margin:2px auto 0}
.vt-line{position:absolute;top:14px;bottom:-10px;left:50%;width:2px;transform:translateX(-50%);background:rgba(15,23,42,.12)}
.vt-body{flex:1;border:1px solid rgba(15,23,42,.08);background:rgba(255,255,255,.75);border-radius:16px;padding:10px 12px}
.vt-top{display:flex;justify-content:space-between;gap:10px;align-items:center}
.vt-amt{font-weight:1100;color:var(--abi-brand2);direction:ltr;text-align:left}
.vt-sub{margin-top:6px;color:var(--abi-muted);font-weight:900}
.vt-meta{margin-top:6px;color:rgba(100,116,139,.95);font-weight:900}

/* Table */
.table{
  width:100%;
  border-collapse:collapse;
  border-radius: 16px;
  overflow:hidden;
}
.table thead th{
  background: var(--abi-brand2);
  color:#fff;
  font-weight:1100;
  border:0;
}
.table td, .table th{
  border-bottom: 1px solid rgba(15,23,42,.08);
  padding: 10px 10px;
  font-weight: 1000;
}
.table td.num{direction:ltr;text-align:left}

/* Voucher cards (mobile) */
.vouch-cards{display:none;margin-top:12px}
.vcard{
  border-radius: 18px;
  overflow:hidden;
  margin-top: 12px;
}
.vcard-hd{
  display:flex;justify-content:space-between;align-items:center;gap:10px;
  padding: 12px 12px;
  background: linear-gradient(90deg, rgba(0,59,115,.10), rgba(220,183,52,.16));
  border-bottom: 1px solid rgba(15,23,42,.08);
}
.vamt{font-weight:1100;color:var(--abi-brand2);direction:ltr}
.vcard-bd{padding: 12px 12px}
.vrow{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px dashed rgba(15,23,42,.10)}
.vrow:last-child{border-bottom:0}
.vlbl{color:var(--abi-muted);font-weight:900}
.vval{font-weight:1000}
.vactions{display:flex;gap:10px;flex-wrap:wrap;margin-top:10px}

/* Semesters */
.sem-cards{display:none;margin-top:12px}
.sem-card{padding:12px 12px;margin-top:12px}
.sem-top{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
.sem-title{font-weight:1100;color:var(--abi-brand2)}
.sem-kv{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:10px}
.sem-kv-item{border:1px solid rgba(15,23,42,.08);border-radius:14px;padding:10px 10px;background:#fff}
.sem-kv-item .k{color:var(--abi-muted);font-weight:900;font-size:12px}
.sem-kv-item .v{font-weight:1100;margin-top:2px}
.sem-bar{height:10px;border-radius:999px;background:rgba(15,23,42,.06);overflow:hidden;margin-top:10px}
.sem-bar span{display:block;height:100%;background:linear-gradient(90deg,var(--abi-brand),var(--abi-gold))}
.acc{margin-top:10px;border:1px solid rgba(15,23,42,.08);border-radius:14px;overflow:hidden}
.acc-hd{width:100%;display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 12px;background:rgba(0,59,115,.05);font-weight:1100;border:0;cursor:pointer}
.acc-bd{padding:10px 12px;background:#fff}
.feeitems{display:grid;gap:8px}
.feeitem{display:flex;justify-content:space-between;gap:10px;border-bottom:1px dashed rgba(15,23,42,.10);padding:8px 0}
.feeitem:last-child{border-bottom:0}

/* Responsive rules */
@media (max-width: 980px){
  .grid3{grid-template-columns: 1fr}
}
@media (max-width: 820px){
  .vouch-table{display:none}
  .vouch-cards{display:block}
  .sem-table{display:none}
  .sem-cards{display:block}
}
