/* ═══════════════════════════════════════════
   মাদরাসাতুল মদীনা — Shared Stylesheet
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Bengali:wght@400;600;700&family=Noto+Sans+Bengali:wght@300;400;500;600&display=swap');

:root {
  --ink: #1a1208;
  --ink2: #3d2e14;
  --ink3: #6b5a3e;
  --cream: #faf6ef;
  --cream2: #f2ead8;
  --cream3: #e8dcc4;
  --gold: #c9952a;
  --gold2: #e8b84b;
  --gold-light: #fdf3dc;
  --green: #2d6a4f;
  --green2: #40916c;
  --green-light: #d8f3dc;
  --red: #c1440e;
  --red-light: #fde8df;
  --blue: #1a5276;
  --blue-light: #d6eaf8;
  --teal: #0e6655;
  --teal-light: #d0ece7;
  --purple: #6c3483;
  --purple-light: #e8daef;
  --shadow: 0 2px 12px rgba(26,18,8,0.10);
  --shadow-md: 0 4px 20px rgba(26,18,8,0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  /* নিচের পিল নেভ — main-nav / hub / bottom-nav একই মাপ (ইনসেট, প্রস্থ, সেফ এরিয়া) */
  --app-nav-pill-inset: 12px;
  --app-nav-pill-max: 520px;
  /* safe-area: বাইরের bottom-এ gap দেবেন না — নেভের ভেতরে padding-diye হাতেল। */
  --app-content-pad-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  /* ইনবок্স ফ্যাব: পিলের উপর */
  /* চ্যাট/লেআউট: নিচের পিল ধরে উচ্চতা কমানো */
  --app-nav-layout-offset: 72px;
  --app-fab-bottom: calc(64px + max(0px, env(safe-area-inset-bottom, 0px)));
  /* টোস্ট/ফ্লোট: পিলের ঠিক উপরে */
  --app-floating-above-nav: calc(84px + max(0px, env(safe-area-inset-bottom, 0px)));
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Noto Sans Bengali', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── TOPBAR (soft light — easy on the eyes) ── */
.topbar {
  background: linear-gradient(180deg, #fffefb 0%, #f7f1e6 100%);
  color: var(--ink);
  padding: 14px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(26, 18, 8, 0.06);
  box-shadow: 0 4px 18px rgba(26, 18, 8, 0.04);
}
.topbar-left {}
.topbar-role { font-size: 11px; color: var(--ink3); letter-spacing: .4px; }
.topbar-name { font-family: 'Noto Serif Bengali', serif; font-size: 16px; font-weight: 600; color: var(--ink2); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-btn {
  font-size: 11px; color: var(--ink3); cursor: pointer;
  padding: 6px 10px; border: 1px solid rgba(26, 18, 8, 0.1); border-radius: 10px;
  background: rgba(255, 255, 255, 0.75); font-family: 'Noto Sans Bengali', sans-serif;
  transition: background 0.15s, border-color 0.15s;
}
.topbar-btn:hover { background: #fff; border-color: rgba(201, 149, 42, 0.28); color: var(--ink2); }
.topbar-btn.topbar-btn--icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar-btn.topbar-btn--icon svg {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}
.notif-btn {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream2); border-radius: 12px; cursor: pointer; font-size: 18px;
  border: 1px solid rgba(26, 18, 8, 0.06);
}
.notif-badge {
  position: absolute; top: 5px; right: 5px;
  width: 8px; height: 8px; background: var(--gold);
  border-radius: 50%; border: 2px solid #fffefb;
}

/* ── CONTENT ── */
.content { padding: 16px; max-width: 480px; margin: 0 auto; }
.pb-safe { height: 100px; }

/* ── Class / year pill tabs (shared: admin, daftar, dept, …) ── */
.tab-bar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.tab-btn {
  background: #fff; border: 1px solid var(--cream3); border-radius: 20px;
  padding: 7px 14px; font-size: 12px; white-space: nowrap; cursor: pointer;
  font-family: 'Noto Sans Bengali', sans-serif; color: var(--ink3); transition: all .15s;
}
.tab-btn.active { background: var(--ink); color: var(--gold2); border-color: var(--ink); }
.tab-bar.tab-bar-class {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; padding-bottom: 0; overflow: visible;
}
.tab-bar.tab-bar-class .tab-btn {
  flex: 1 1 calc(50% - 3px);
  min-width: calc(50% - 3px);
  box-sizing: border-box;
  padding: 8px 6px; font-size: 11px; border-radius: var(--radius-sm);
  line-height: 1.25; white-space: normal; text-align: center;
}

/* ── BOTTOM NAV — .main-nav / hub / one pill; নিচে সটিক, রাউন্ড, main-admin-nav.css সঙ্গে মিল -- */
.bottom-nav {
  position: fixed;
  left: var(--app-nav-pill-inset, 12px);
  right: var(--app-nav-pill-inset, 12px);
  bottom: 0;
  /* পর্দার নিচে সটিক; ফাঁকা “ধূসর” লাইন এড়াতে bottom offset দেবেন না (পেজ-level ওভাররাইড সরান) */
  max-width: var(--app-nav-pill-max, 520px);
  margin: 0 auto;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
  box-sizing: border-box;
  padding: 6px 8px max(10px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #ffffff 0%, #faf6ef 100%);
  border: 1px solid rgba(26, 18, 8, 0.08);
  border-radius: 999px;
  box-shadow:
    0 4px 6px rgba(26, 18, 8, 0.04),
    0 14px 36px rgba(26, 18, 8, 0.1);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.nav-item {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 0;
  padding: 6px 6px 8px;
  cursor: pointer;
  border: none;
  background: transparent;
  border-radius: 14px;
  color: var(--ink3);
  font-family: 'Noto Sans Bengali', sans-serif;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover {
  color: var(--ink2);
  background: rgba(255, 255, 255, 0.7);
}
.nav-item.active {
  color: var(--ink2);
  background: rgba(232, 184, 75, 0.22);
  font-weight: 600;
  box-shadow: none;
  border: none;
  transform: none;
}
.mm-chat-badge {
  position: absolute;
  top: 3px;
  right: 18%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  border: 2px solid #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.nav-item.active .nav-icon svg,
.nav-item.active > svg.nav-svg {
  opacity: 1;
}
.nav-item .nav-icon svg,
.nav-item > svg.nav-svg {
  opacity: 0.88;
}
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex-shrink: 0;
}
.nav-icon svg.nav-svg,
.nav-icon .nav-svg,
.nav-item > svg.nav-svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.nav-label,
.nav-item > span:not(.nav-icon) {
  font-size: 10px;
  font-weight: inherit;
  letter-spacing: 0.02em;
  color: inherit;
  line-height: 1.2;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item.active .nav-label,
.nav-item.active > span:not(.nav-icon) {
  font-weight: 600;
}

/* ── PANELS ── */
.panel { display: none; }
.panel.active { display: block; }

/* ── SECTION HEADER ── */
.sec-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 0 10px;
}
.sec-title { font-family: 'Noto Serif Bengali', serif; font-size: 15px; font-weight: 700; color: var(--ink2); }
.sec-link { font-size: 12px; color: var(--gold); cursor: pointer; }

/* ── STAT ROW ── */
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 12px; }
.stat-row-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-bottom: 12px; }
.stat-card {
  background: #fff; border-radius: var(--radius-sm);
  padding: 12px 10px; text-align: center; box-shadow: var(--shadow);
}
.stat-num { font-family: 'Noto Serif Bengali', serif; font-size: 20px; font-weight: 700; color: var(--ink2); display: block; }
.stat-label { font-size: 10px; color: var(--ink3); display: block; margin-top: 2px; line-height: 1.3; }

/* ── CARDS ── */
.card {
  background: #fff; border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 10px;
  cursor: pointer; transition: transform .12s;
}
.card:active { transform: scale(.98); }
.card-static { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 10px; }

/* ── HEADER CARD ── */
.header-card {
  border-radius: var(--radius); padding: 20px 18px; color: #fff;
  margin-bottom: 14px; position: relative; overflow: hidden;
}
.header-card::after {
  content: ''; position: absolute; top: -20px; right: -20px;
  width: 100px; height: 100px; border-radius: 50%; background: rgba(255,255,255,0.06);
}
.hc-icon { font-size: 30px; margin-bottom: 8px; display: block; }
.hc-name { font-family: 'Noto Serif Bengali', serif; font-size: 19px; font-weight: 700; }
.hc-sub { font-size: 12px; opacity: .65; margin-top: 3px; }

/* ── LIST ITEMS ── */
.list-item {
  background: #fff; border-radius: var(--radius-sm);
  padding: 14px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px; cursor: pointer; transition: transform .12s;
}
.list-item:active { transform: scale(.98); }
.list-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--cream3); display: flex; align-items: center;
  justify-content: center; font-size: 18px; flex-shrink: 0;
}
.list-info { flex: 1; }
.list-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.list-sub { font-size: 11px; color: var(--ink3); margin-top: 2px; }
.list-meta { text-align: right; flex-shrink: 0; }
.list-badge {
  font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 500; display: inline-block;
}
.badge-green { background: var(--green-light); color: var(--green); }
.badge-gold { background: var(--gold-light); color: var(--gold); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-ink { background: rgba(61,46,20,0.1); color: var(--ink2); }

/* ── ADD BUTTON ── */
.add-btn {
  background: var(--green); color: #fff; border: none; border-radius: 12px;
  padding: 14px 18px; width: 100%; font-family: 'Noto Sans Bengali', sans-serif;
  font-size: 14px; font-weight: 600; cursor: pointer; display: flex;
  align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 14px; transition: all .15s;
}
.add-btn:active { transform: scale(.98); filter: brightness(.95); }

/* ── FORM ── */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 12px; color: var(--ink3); display: block; margin-bottom: 6px; font-weight: 500; }
.form-input {
  width: 100%; background: #fff; border: 1px solid var(--cream3);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-family: 'Noto Sans Bengali', sans-serif; font-size: 14px;
  color: var(--ink); outline: none; transition: border-color .2s;
}
.form-input:focus { border-color: var(--gold); }
.form-textarea { min-height: 90px; resize: none; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b5a3e' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.submit-btn {
  background: var(--green); color: #fff; border: none; border-radius: 12px;
  padding: 14px; width: 100%; font-family: 'Noto Sans Bengali', sans-serif;
  font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 8px; transition: all .15s;
}
.submit-btn:active { transform: scale(.98); }
.submit-btn.blue { background: var(--blue); }
.submit-btn.gold { background: var(--gold); }

/* ── MODAL ── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 200; display: none; align-items: flex-end;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--cream); border-radius: 20px 20px 0 0;
  padding: 24px 18px 36px; width: 100%; max-height: 88vh; overflow-y: auto;
}
.modal-title {
  font-family: 'Noto Serif Bengali', serif; font-size: 17px; font-weight: 700;
  color: var(--ink2); margin-bottom: 20px; display: flex;
  justify-content: space-between; align-items: center;
}
.modal-close { font-size: 20px; cursor: pointer; color: var(--ink3); background: none; border: none; }

/* ── DETAIL VIEW ── */
.detail-view {
  display: none; position: fixed; inset: 0;
  background: var(--cream); z-index: 150; overflow-y: auto;
}
.detail-view.open { display: block; }
.detail-topbar {
  background: var(--ink); color: #fff; padding: 14px 18px;
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0;
}
.detail-back { font-size: 22px; cursor: pointer; line-height: 1; }
.detail-title { font-family: 'Noto Serif Bengali', serif; font-size: 16px; font-weight: 600; color: var(--gold2); }
.detail-content { padding: 16px; max-width: 480px; margin: 0 auto; }

/* ── LOG ITEMS ── */
.log-item {
  background: #fff; border-radius: var(--radius-sm);
  padding: 14px; box-shadow: var(--shadow);
  border-left: 3px solid var(--green2); margin-bottom: 8px;
}
.log-meta { font-size: 11px; color: var(--ink3); margin-bottom: 5px; display: flex; justify-content: space-between; }
.log-text { font-size: 13px; color: var(--ink); line-height: 1.6; }

/* ── ATTENDANCE ── */
.att-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--cream2);
}
.att-name { font-size: 13px; color: var(--ink); flex: 1; }
.att-id { font-size: 11px; color: var(--ink3); margin-right: 8px; }
.att-toggle { display: flex; gap: 6px; }
.att-btn {
  width: 32px; height: 32px; border-radius: var(--radius-xs);
  border: 1.5px solid var(--cream3); background: #fff;
  font-size: 14px; cursor: pointer; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.att-btn.present { background: var(--green-light); border-color: var(--green2); }
.att-btn.absent { background: var(--red-light); border-color: var(--red); }
.att-btn.leave { background: var(--gold-light); border-color: var(--gold); color: var(--ink2); }

/* ── KHULUK SCORE ── */
.khuluk-bar {
  height: 6px; border-radius: 3px; background: var(--cream3); overflow: hidden; margin-top: 6px;
}
.khuluk-fill { height: 100%; border-radius: 3px; background: var(--green2); transition: width .4s; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: var(--app-floating-above-nav, 88px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 20px;
  border-radius: 20px; font-size: 13px; opacity: 0;
  transition: opacity .3s; pointer-events: none; z-index: 999; white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ── LOGIN (light theme — readable numpad on every entry page) ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, #faf6ef 0%, #f0e8d8 42%, #e6dcc8 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
  color: var(--ink);
}
.login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 95% 65% at 50% 0%, rgba(232, 184, 75, 0.16) 0%, transparent 58%);
  pointer-events: none;
}
.login-logo {
  font-family: 'Noto Serif Bengali', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink2);
  text-align: center;
  line-height: 1.3;
  margin-bottom: 4px;
  position: relative;
}
.login-subtitle {
  font-size: 12px;
  color: var(--ink3);
  text-align: center;
  margin-bottom: 40px;
}
.login-box {
  background: #fff;
  border: 1px solid rgba(26, 18, 8, 0.1);
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 12px 40px rgba(26, 18, 8, 0.08);
  position: relative;
}
.login-label {
  font-size: 11px;
  color: var(--ink3);
  display: block;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pin-dots { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; }
.pin-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(201, 149, 42, 0.45);
  transition: all 0.2s;
}
.pin-dot.filled {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 184, 75, 0.25);
}
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.num-btn {
  background: #fff;
  border: 1px solid rgba(26, 18, 8, 0.12);
  border-radius: 12px;
  color: var(--ink2);
  font-family: 'Noto Sans Bengali', sans-serif;
  font-size: 19px;
  font-weight: 600;
  padding: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  text-align: center;
  box-shadow: 0 1px 2px rgba(26, 18, 8, 0.04);
}
.num-btn:hover {
  background: var(--cream2);
  border-color: rgba(201, 149, 42, 0.28);
}
.num-btn:active {
  background: var(--gold-light);
  border-color: rgba(201, 149, 42, 0.45);
  transform: scale(0.96);
}
.num-btn.del {
  font-size: 15px;
  color: var(--ink3);
  font-weight: 500;
}
.num-btn.empty { visibility: hidden; pointer-events: none; }
.login-error {
  color: #c1440e;
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
  min-height: 16px;
}
.login-back {
  font-size: 12px;
  color: var(--ink3);
  text-align: center;
  margin-top: 16px;
  cursor: pointer;
}
.login-back:hover { color: var(--ink2); text-decoration: underline; }

/* ── ROLE SELECT ── */
.role-grid { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
.role-btn {
  background: #fff;
  border: 1px solid rgba(26, 18, 8, 0.1);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.role-btn:hover {
  border-color: rgba(201, 149, 42, 0.3);
  box-shadow: var(--shadow-md);
}
.role-btn:active { transform: scale(0.98); }
.role-icon { font-size: 26px; flex-shrink: 0; }
.role-name { font-size: 15px; font-weight: 600; color: var(--ink2); }
.role-desc { font-size: 11px; color: var(--ink3); margin-top: 2px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--ink3); }
.empty-icon { font-size: 40px; margin-bottom: 12px; display: block; }
.empty-text { font-size: 14px; }

/* ── জিম্মাদার পর্যবেক্ষণ মোড — টপবার মাঝখানে ── */
.topbar.mm-monitor-topbar {
  position: relative;
}
.mm-monitor-topbar-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.03em;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
  max-width: 38vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mm-monitor-banner--fallback {
  background: linear-gradient(135deg, #1a5276 0%, #2471a3 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 6px 10px;
  text-align: center;
  line-height: 1.3;
  position: relative;
  z-index: 200;
}

/* ছাত্রের নাম → MMStudentModal */
.s-name-btn {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  line-height: inherit;
}
.s-name-btn:hover,
.s-name-btn:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--blue);
  outline: none;
}

/* ══ Shared: ছাত্র প্রোফাইল মডাল (दफतर, অ্যাডমিন, …) + mm-student-modal.js ══ */
#modal-student-detail.modal-bg {
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  backdrop-filter: blur(2px);
}
#modal-student-detail .modal.modal--student {
  --st-modal-h: min(75vh, 640px);
  width: min(600px, calc(100vw - 32px));
  max-width: min(600px, calc(100vw - 32px));
  height: var(--st-modal-h);
  min-height: var(--st-modal-h);
  max-height: var(--st-modal-h);
  margin: 0;
  padding: 0;
  border-radius: 20px;
  align-self: center;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fffef9 0%, #fcfaf5 8%, #fff 14%);
  box-shadow: 0 4px 6px rgba(26, 18, 8, 0.04), 0 24px 64px rgba(26, 18, 8, 0.16);
  border: 1px solid rgba(201, 149, 42, 0.12);
}
#modal-student-detail #st-tabs-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* শিক্ষক প্রোফাইল — দপ্তরের ছাত্র মডালের একই কাঠামো (mm-teacher-modal.js) */
#modal-teacher-detail.modal-bg {
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  backdrop-filter: blur(2px);
}
#modal-teacher-detail .modal.modal--student {
  --st-modal-h: min(75vh, 640px);
  width: min(600px, calc(100vw - 32px));
  max-width: min(600px, calc(100vw - 32px));
  height: var(--st-modal-h);
  min-height: var(--st-modal-h);
  max-height: var(--st-modal-h);
  margin: 0;
  padding: 0;
  border-radius: 20px;
  align-self: center;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fffef9 0%, #fcfaf5 8%, #fff 14%);
  box-shadow: 0 4px 6px rgba(26, 18, 8, 0.04), 0 24px 64px rgba(26, 18, 8, 0.16);
  border: 1px solid rgba(201, 149, 42, 0.12);
}
#modal-teacher-detail #mtch-tabs-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.st-modal-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--cream2);
}
.st-modal-hd-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.st-modal-texts {
  min-width: 0;
  flex: 1;
}
.st-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--cream2) 0%, #fff 100%);
  border: 1px solid var(--cream3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink2);
  font-family: 'Noto Serif Bengali', serif;
  position: relative;
}
.st-avatar--empty .st-avatar-img {
  display: none;
}
.st-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.st-avatar-ph {
  line-height: 1;
  user-select: none;
}
#modal-student-detail h2#st-modal-title,
.st-modal-texts h2#st-modal-title,
#modal-teacher-detail h2#mtch-title {
  font-family: 'Noto Serif Bengali', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink2);
  margin: 0 0 4px 0;
  line-height: 1.2;
  word-break: break-word;
}
.st-modal-sub { margin: 0; font-size: 12px; color: var(--ink3); line-height: 1.4; }
.st-modal-hd .modal-close { flex-shrink: 0; }
.st-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0 8px;
  background: #faf6ef;
  border-bottom: 1px solid var(--cream2);
}
.st-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Noto Sans Bengali', sans-serif;
  border: none;
  background: transparent;
  color: var(--ink3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, background 0.15s;
}
.st-tab:hover { color: var(--ink2); background: rgba(255, 255, 255, 0.4); }
.st-tab.st-tab--on {
  color: var(--ink2);
  background: #fff;
  border-bottom-color: var(--gold);
  border-radius: 10px 10px 0 0;
}
.st-tab-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px 16px;
  -webkit-overflow-scrolling: touch;
}
.st-tab-panel { display: none; }
.st-tab-panel.st-tab-panel--on { display: block; }
.st-kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.st-kv-item { min-width: 0; }
.st-kv-lbl { font-size: 10px; font-weight: 600; color: var(--ink3); letter-spacing: 0.02em; margin-bottom: 3px; }
.st-kv-val { font-size: 13px; color: var(--ink); line-height: 1.35; word-break: break-word; }
.st-kv-val--tag { display: inline-block; margin-top: 2px; font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--blue-light); color: var(--blue); font-weight: 600; }
.st-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--cream2); }
.st-block h4 { font-size: 12px; font-weight: 700; color: var(--ink2); margin: 0 0 8px; font-family: 'Noto Serif Bengali', serif; }
.st-hist-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--cream2); font-size: 12px;
}
.st-hist-item:last-child { border-bottom: none; }
.st-hist-date { flex: 1; min-width: 0; line-height: 1.3; }
.st-hist-meta { text-align: right; flex-shrink: 0; }
.st-badg { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.st-badg--p { color: var(--green); background: var(--green-light); }
.st-badg--a { color: var(--red); background: var(--red-light); }
.st-badg--l { color: var(--gold); background: var(--gold-light); }
.st-subdate { font-size: 10px; opacity: 0.7; }
.st-fee-line { font-size: 12px; padding: 8px 0; border-bottom: 1px solid var(--cream2); }
.st-fee-line:last-child { border-bottom: none; }
.st-fee-mo { font-weight: 700; color: var(--ink2); font-family: 'Noto Serif Bengali', serif; margin-bottom: 4px; }
.st-empty { text-align: center; padding: 20px 12px; color: var(--ink3); font-size: 12px; }
.st-logline { font-size: 11px; padding: 6px 0; border-bottom: 1px solid var(--cream2); color: var(--ink2); }
.st-logline small { color: var(--ink3); display: block; margin-top: 2px; }
.st-note { font-size: 11px; color: var(--ink3); margin-top: 8px; }
@media (max-width: 380px) {
  .st-kv-grid { grid-template-columns: 1fr; }
  .st-tab { font-size: 10px; padding: 8px 4px; }
  .st-avatar { width: 48px; height: 48px; font-size: 18px; }
}

/* ── FLOATING MODAL (center-aligned, not bottom sheet) ── */
.modal-bg.modal-float { align-items: center; justify-content: center; }
.modal-bg.modal-float .modal {
  border-radius: var(--radius); max-width: 460px;
  width: calc(100% - 32px); max-height: 90vh; padding: 20px 18px 24px;
}

/* ── RIGHT-SIDE SLIDE PANEL ── */
.side-panel {
  position: fixed; inset: 0; z-index: 250;
  display: flex; pointer-events: none; opacity: 0; transition: opacity .2s;
}
.side-panel.open { pointer-events: all; opacity: 1; }
.side-panel-backdrop { flex: 1; background: rgba(26,18,8,.35); }
.side-panel-drawer {
  width: min(340px, 90vw); background: var(--cream); height: 100%;
  overflow-y: auto; padding: 20px 16px calc(24px + env(safe-area-inset-bottom,0px));
  box-shadow: -4px 0 24px rgba(26,18,8,.2);
  transform: translateX(100%); transition: transform .25s ease;
}
.side-panel.open .side-panel-drawer { transform: translateX(0); }
