@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Noto+Nastaliq+Urdu:wght@700&display=swap');

/* ── TOKENS ── */
:root {
  --g900: #0d2b16; --g800: #14381e; --g700: #1e4d2b;
  --g600: #1e5c32; --g500: #256b3c; --g400: #3a8a55;
  --g100: #eef7f1; --g50:  #f7fbf8;
  --gold: #b8963e; --gold-l: #d4af5a; --gold-bg: #fdf8ee;
  --ink: #1c2b1e; --body: #3d4f3e; --muted: #6b7a6d;
  --border: #dde8df; --surface: #ffffff; --bg: #f5f8f5;
  --danger: #c0392b; --danger-bg: #fdf2f2;
  --warn: #d97706; --warn-bg: #fffbeb;
  --info: #2563eb; --info-bg: #eff6ff;
  --radius-sm: 6px; --radius: 10px; --radius-lg: 16px; --radius-xl: 22px;
  --shadow-xs: 0 1px 3px rgba(10,31,16,.08);
  --shadow-sm: 0 2px 8px rgba(10,31,16,.10);
  --shadow-md: 0 4px 20px rgba(10,31,16,.13);
  --shadow-lg: 0 8px 40px rgba(10,31,16,.16);
  --sidebar: 250px;
  --topbar: 58px;
  --font: 'Hind Siliguri', sans-serif;
}

/* ── RESET ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size:15px; scroll-behavior:smooth; -webkit-text-size-adjust:100%; }
body { font-family:var(--font); background:var(--bg); color:var(--body); line-height:1.65; min-height:100vh; }
img  { max-width:100%; display:block; }
a    { color:inherit; text-decoration:none; }
button, input, select, textarea { font-family:var(--font); }

/* ── LAYOUT ── */
.app { display:flex; min-height:100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width:var(--sidebar); background:var(--g800);
  display:flex; flex-direction:column;
  position:fixed; inset:0 auto 0 0; z-index:300;
  transition:transform .25s cubic-bezier(.4,0,.2,1);
  overflow-y:auto;
}
.sidebar-logo {
  padding:18px 16px; border-bottom:1px solid rgba(255,255,255,.07);
  display:flex; align-items:center; gap:10px; flex-shrink:0;
}
.logo-mark {
  width:38px; height:38px; background:var(--gold); border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  font-size:1.25rem; flex-shrink:0;
}
.logo-text { line-height:1.2; }
.logo-text strong { color:#fff; font-size:.9rem; display:block; }
.logo-text small  { color:rgba(255,255,255,.4); font-size:.7rem; }

.nav-section { padding:10px 0; flex:1; }
.nav-label {
  padding:8px 16px 3px;
  font-size:.65rem; font-weight:700; letter-spacing:.1em;
  color:rgba(255,255,255,.25); text-transform:uppercase;
}
.nav-link {
  display:flex; align-items:center; gap:10px;
  padding:10px 16px; color:rgba(255,255,255,.6);
  font-size:.875rem; font-weight:500;
  border-left:3px solid transparent;
  transition:all .15s; cursor:pointer;
}
.nav-link:hover { background:rgba(255,255,255,.05); color:#fff; }
.nav-link.active { background:rgba(26,107,69,.3); color:#fff; border-left-color:var(--gold); }
.nav-icon { font-size:1rem; width:20px; text-align:center; flex-shrink:0; }
.nav-badge {
  margin-left:auto; background:var(--danger); color:#fff;
  font-size:.65rem; font-weight:700; padding:1px 7px; border-radius:20px;
}

.sidebar-user {
  padding:14px 16px; border-top:1px solid rgba(255,255,255,.07); flex-shrink:0;
}
.user-row { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.user-av {
  width:34px; height:34px; border-radius:50%;
  background:var(--g600); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:.9rem; font-weight:700; flex-shrink:0;
}
.user-info strong { display:block; color:#fff; font-size:.85rem; line-height:1.2; }
.user-info span   { color:rgba(255,255,255,.4); font-size:.72rem; }
.btn-logout {
  width:100%; padding:7px; background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.1); color:rgba(255,255,255,.5);
  border-radius:6px; cursor:pointer; font-size:.8rem;
  transition:background .15s;
}
.btn-logout:hover { background:rgba(255,255,255,.1); color:#fff; }

/* ── MAIN ── */
.main { margin-left:var(--sidebar); flex:1; display:flex; flex-direction:column; min-height:100vh; }

/* ── TOPBAR ── */
.topbar {
  height:var(--topbar); background:var(--surface);
  border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 20px; position:sticky; top:0; z-index:200;
  box-shadow:var(--shadow-xs);
}
.topbar-left { display:flex; align-items:center; gap:12px; }
.menu-toggle {
  display:none; background:none; border:none; cursor:pointer;
  width:38px; height:38px; border-radius:8px;
  align-items:center; justify-content:center; font-size:1.2rem;
  color:var(--muted); transition:background .15s;
}
.menu-toggle:hover { background:var(--g50); }
.page-title { font-size:1rem; font-weight:700; color:var(--ink); }
.topbar-right { display:flex; align-items:center; gap:10px; }

/* ── PAGE BODY ── */
.page-body { padding:20px; flex:1; }
.page-body.wide { max-width:1200px; margin:0 auto; width:100%; }

/* ── CARDS ── */
.card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); box-shadow:var(--shadow-xs);
  overflow:hidden;
}
.card-head {
  padding:14px 18px; border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  flex-wrap:wrap;
}
.card-head h2 { font-size:.95rem; font-weight:700; color:var(--ink); }
.card-body { padding:18px; }

/* ── STAT GRID ── */
.stats-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(140px, 1fr));
  gap:12px; margin-bottom:20px;
}
.stat {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:16px 14px;
  border-left:4px solid var(--g600); box-shadow:var(--shadow-xs);
}
.stat.gold   { border-left-color:var(--gold); }
.stat.danger { border-left-color:var(--danger); }
.stat.info   { border-left-color:var(--info); }
.stat-label  { font-size:.72rem; color:var(--muted); font-weight:600; margin-bottom:4px; }
.stat-value  { font-size:1.7rem; font-weight:700; color:var(--ink); line-height:1; }
.stat-sub    { font-size:.72rem; color:var(--muted); margin-top:3px; }

/* ── BUTTONS ── */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:9px 16px; border-radius:var(--radius-sm);
  font-size:.875rem; font-weight:600; cursor:pointer; border:none;
  transition:all .15s; white-space:nowrap; font-family:var(--font);
  text-decoration:none;
}
.btn-primary { background:var(--g600); color:#fff; }
.btn-primary:hover { background:var(--g500); }
.btn-gold    { background:var(--gold); color:var(--ink); }
.btn-gold:hover { background:var(--gold-l); }
.btn-danger  { background:var(--danger); color:#fff; }
.btn-danger:hover { filter:brightness(1.1); }
.btn-outline { background:transparent; color:var(--g600); border:1.5px solid var(--g600); }
.btn-outline:hover { background:var(--g100); }
.btn-ghost   { background:transparent; color:var(--muted); border:1.5px solid var(--border); }
.btn-ghost:hover { background:var(--g50); }
.btn-wa      { background:#16a34a; color:#fff; }
.btn-wa:hover { background:#15803d; }
.btn-zoom    { background:#2563eb; color:#fff; }
.btn-zoom:hover { background:#1d4ed8; }
.btn-meet    { background:#0f9d58; color:#fff; }
.btn-meet:hover { background:#0d8a4d; }
.btn-sm  { padding:6px 12px; font-size:.8rem; }
.btn-lg  { padding:12px 24px; font-size:1rem; }
.btn-full { width:100%; }
.btn:disabled { opacity:.5; cursor:not-allowed; }

/* ── FORMS ── */
.form-group { margin-bottom:14px; }
.form-grid  { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
label { display:block; font-size:.82rem; font-weight:600; color:var(--ink); margin-bottom:5px; }
.required::after { content:' *'; color:var(--danger); }
input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], input[type="number"], input[type="date"],
input[type="time"], select, textarea {
  width:100%; padding:10px 13px;
  border:1.5px solid var(--border); border-radius:var(--radius-sm);
  font-size:.9rem; color:var(--ink); background:var(--surface);
  outline:none; transition:border-color .15s, box-shadow .15s;
  -webkit-appearance:none; appearance:none;
}
input:focus, select:focus, textarea:focus {
  border-color:var(--g600);
  box-shadow:0 0 0 3px rgba(26,107,69,.1);
}
textarea { resize:vertical; min-height:88px; }
.input-hint { font-size:.75rem; color:var(--muted); margin-top:4px; }

/* ── TABLE ── */
.table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
table { width:100%; border-collapse:collapse; font-size:.85rem; white-space:nowrap; }
th {
  background:var(--g50); padding:10px 13px;
  text-align:left; font-size:.72rem; color:var(--muted);
  font-weight:700; letter-spacing:.04em;
  border-bottom:1px solid var(--border); position:sticky; top:0;
}
td { padding:12px 13px; border-bottom:1px solid var(--g50); color:var(--body); }
tr:last-child td { border-bottom:none; }
tr:hover td { background:var(--g50); }

/* ── BADGES ── */
.badge {
  display:inline-flex; align-items:center;
  padding:3px 9px; border-radius:20px;
  font-size:.72rem; font-weight:700;
}
.badge-new      { background:#dcfce7; color:#166534; }
.badge-active   { background:#dbeafe; color:#1e40af; }
.badge-pending  { background:#fef9c3; color:#854d0e; }
.badge-done     { background:#ede9fe; color:#5b21b6; }
.badge-cancelled{ background:var(--danger-bg); color:var(--danger); }
.badge-basic    { background:var(--g50); color:var(--muted); }
.badge-standard { background:#dbeafe; color:#1e40af; }
.badge-premium  { background:var(--gold-bg); color:#92400e; }

/* ── ALERT ── */
.alert {
  padding:11px 14px; border-radius:var(--radius-sm);
  font-size:.875rem; display:flex; align-items:flex-start; gap:10px;
  margin-bottom:14px; border:1px solid transparent;
}
.alert-info    { background:var(--info-bg); color:#1e3a8a; border-color:#bfdbfe; }
.alert-success { background:#dcfce7; color:#166534; border-color:#bbf7d0; }
.alert-warn    { background:var(--warn-bg); color:#78350f; border-color:#fde68a; }
.alert-danger  { background:var(--danger-bg); color:#7f1d1d; border-color:#fecaca; }

/* ── MODAL ── */
.modal-overlay {
  display:none; position:fixed; inset:0;
  background:rgba(10,31,16,.6); z-index:500;
  align-items:flex-end; justify-content:center;
  padding:0;
}
.modal-overlay.active { display:flex; }
.modal-box {
  background:var(--surface); border-radius:var(--radius-xl) var(--radius-xl) 0 0;
  width:100%; max-width:540px; max-height:92vh;
  overflow-y:auto; position:relative;
  animation:slideUp .25s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
.modal-head {
  padding:14px 18px; border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  position:sticky; top:0; background:var(--surface); z-index:1;
}
.modal-head h3 { font-size:.95rem; font-weight:700; color:var(--ink); }
.modal-drag {
  width:36px; height:4px; background:var(--border);
  border-radius:4px; margin:10px auto 0; position:absolute;
  top:0; left:50%; transform:translateX(-50%);
}
.modal-body { padding:18px; }
.modal-close {
  background:var(--g50); border:none; border-radius:50%;
  width:32px; height:32px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; color:var(--muted); font-size:1rem; transition:background .15s;
}
.modal-close:hover { background:var(--border); }

/* ── TABS ── */
.tab-bar {
  display:flex; gap:3px; background:var(--g50);
  border-radius:var(--radius); padding:3px;
  margin-bottom:18px; overflow-x:auto;
}
.tab-btn {
  padding:8px 14px; border-radius:7px; border:none;
  background:none; font-family:var(--font);
  font-size:.82rem; font-weight:600; color:var(--muted);
  cursor:pointer; white-space:nowrap; transition:all .15s;
}
.tab-btn.active { background:var(--surface); color:var(--g600); box-shadow:var(--shadow-xs); }
.tab-pane { display:none; }
.tab-pane.active { display:block; }

/* ── CLASS CARD ── */
.class-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:14px 16px; margin-bottom:10px;
  border-left:4px solid var(--border); transition:box-shadow .15s;
}
.class-card:hover { box-shadow:var(--shadow-sm); }
.class-card.today    { border-left-color:var(--gold); }
.class-card.upcoming { border-left-color:var(--g600); }
.class-card.done     { border-left-color:#94a3b8; opacity:.85; }
.class-top { display:flex; align-items:flex-start; gap:12px; }
.class-time { flex-shrink:0; text-align:center; min-width:52px; }
.class-time .t { font-size:1rem; font-weight:700; color:var(--ink); line-height:1; }
.class-time .d { font-size:.68rem; color:var(--muted); margin-top:2px; }
.class-sep { width:1px; background:var(--border); align-self:stretch; flex-shrink:0; }
.class-info { flex:1; min-width:0; }
.class-info h3 {
  font-size:.9rem; font-weight:700; color:var(--ink);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:5px;
}
.class-meta { display:flex; flex-wrap:wrap; gap:8px; }
.class-meta span { font-size:.75rem; color:var(--muted); display:flex; align-items:center; gap:4px; }
.class-btns { display:flex; gap:7px; flex-wrap:wrap; margin-top:10px; padding-top:10px; border-top:1px solid var(--g50); }

/* ── STUDENT CHIP ── */
.student-chip {
  display:flex; align-items:center; gap:10px;
  padding:10px 13px; background:var(--g50);
  border:1px solid var(--border); border-radius:var(--radius-sm);
  margin-bottom:8px;
}
.chip-av {
  width:34px; height:34px; border-radius:50%;
  background:var(--g600); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:.9rem; font-weight:700; flex-shrink:0;
}
.chip-info { flex:1; min-width:0; }
.chip-info strong { display:block; font-size:.875rem; color:var(--ink); }
.chip-info span   { font-size:.75rem; color:var(--muted); }

/* ── ATTENDANCE TOGGLE ── */
.att-toggle { display:flex; gap:6px; flex-shrink:0; }
.att-btn {
  padding:5px 11px; border-radius:var(--radius-sm); border:1.5px solid;
  font-size:.78rem; font-weight:700; cursor:pointer;
  font-family:var(--font); transition:all .15s;
}
.att-present { border-color:var(--g600); color:var(--g600); background:#fff; }
.att-present.on { background:var(--g600); color:#fff; }
.att-absent  { border-color:var(--danger); color:var(--danger); background:#fff; }
.att-absent.on  { background:var(--danger); color:#fff; }

/* ── PROGRESS BAR ── */
.progress-wrap { background:var(--g50); border-radius:20px; height:9px; overflow:hidden; margin-top:5px; }
.progress-bar  { background:linear-gradient(90deg,var(--g600),var(--g400)); height:100%; border-radius:20px; transition:width .5s; }

/* ── EMPTY STATE ── */
.empty { text-align:center; padding:44px 20px; color:var(--muted); }
.empty-icon { font-size:2.8rem; margin-bottom:10px; display:block; }
.empty p { font-size:.875rem; }

/* ── TOAST ── */
#toast-container { position:fixed; bottom:80px; left:50%; transform:translateX(-50%); z-index:999; display:flex; flex-direction:column; align-items:center; gap:8px; pointer-events:none; }
.toast {
  background:var(--ink); color:#fff; padding:10px 18px;
  border-radius:var(--radius); font-size:.875rem; font-weight:500;
  box-shadow:var(--shadow-md); pointer-events:none;
  animation:toastIn .25s ease; max-width:90vw; text-align:center;
}
@keyframes toastIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
.toast.success { background:var(--g600); }
.toast.danger  { background:var(--danger); }
.toast.warn    { background:var(--warn); }

/* ── OVERLAY for mobile sidebar ── */
.sidebar-overlay {
  display:none; position:fixed; inset:0;
  background:rgba(0,0,0,.5); z-index:299;
}
.sidebar-overlay.active { display:block; }

/* ── MOBILE BOTTOM NAV ── */
.bottom-nav {
  display:none; position:fixed; bottom:0; left:0; right:0;
  background:var(--g800); border-top:1px solid rgba(255,255,255,.08);
  z-index:200; padding:6px 0 max(6px, env(safe-area-inset-bottom));
}
.bottom-nav-inner { display:flex; }
.bottom-nav-item {
  flex:1; display:flex; flex-direction:column; align-items:center;
  gap:3px; padding:6px 4px; color:rgba(255,255,255,.5);
  font-size:.65rem; font-weight:600; cursor:pointer;
  transition:color .15s; border:none; background:none;
  font-family:var(--font);
}
.bottom-nav-item.active { color:var(--gold-l); }
.bottom-nav-item .b-icon { font-size:1.25rem; line-height:1; }

/* ── RESPONSIVE ── */
@media (max-width:768px) {
  :root { --topbar: 52px; }

  .sidebar { transform:translateX(-100%); }
  .sidebar.open { transform:translateX(0); box-shadow:var(--shadow-lg); }
  .main { margin-left:0; padding-bottom:70px; }
  .menu-toggle { display:flex; }

  .stats-grid { grid-template-columns:repeat(2, 1fr); gap:10px; }
  .stat-value { font-size:1.4rem; }

  .form-grid { grid-template-columns:1fr; gap:12px; }

  .page-body { padding:14px; }
  .card-body { padding:14px; }
  .card-head { padding:12px 14px; }

  table { font-size:.8rem; }
  th, td { padding:10px 10px; }

  .modal-overlay { align-items:flex-end; }
  .modal-box { border-radius:var(--radius-xl) var(--radius-xl) 0 0; max-height:85vh; }

  .class-card { padding:12px 13px; }
  .class-btns .btn { flex:1; justify-content:center; }

  .topbar-right .btn { display:none; }
  .topbar-right .btn.always { display:inline-flex; }

  .bottom-nav { display:block; }
  .tab-bar { overflow-x:auto; }
  .tab-btn { padding:7px 12px; }

  .table-wrap { margin:0 -14px; }
}

@media (max-width:380px) {
  .stats-grid { grid-template-columns:1fr 1fr; }
  .stat { padding:12px 11px; }
  .stat-value { font-size:1.25rem; }
}

/* ── UTILITY ── */
.mt-4 { margin-top:4px; } .mt-8 { margin-top:8px; } .mt-12 { margin-top:12px; }
.mt-16 { margin-top:16px; } .mt-20 { margin-top:20px; } .mt-24 { margin-top:24px; }
.mb-12 { margin-bottom:12px; } .mb-16 { margin-bottom:16px; }
.flex { display:flex; } .items-center { align-items:center; }
.justify-between { justify-content:space-between; } .gap-8 { gap:8px; } .gap-12 { gap:12px; }
.flex-wrap { flex-wrap:wrap; } .flex-1 { flex:1; }
.text-muted { color:var(--muted); } .text-sm { font-size:.82rem; }
.text-center { text-align:center; }
.font-bold { font-weight:700; } .color-green { color:var(--g600); }
.truncate { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.divider { border:none; border-top:1px solid var(--border); margin:16px 0; }
