/* ═══════════════════════════════════════════════════════════════════════
   BASE RESET & LAYOUT
═══════════════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: #f4f7fb; color: #1f2937; }
a { color: #1d4ed8; text-decoration: none; }
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
    width: 320px; min-width: 320px; flex-shrink: 0;
    background: #0f172a; color: #e2e8f0;
    padding: 20px; position: sticky; top: 0;
    min-height: 100vh; overflow-y: auto;
}
.sidebar h2 { font-size: 20px; margin-top: 0; }
.nav { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.nav a { color: #cbd5e1; padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,.03); }
.nav a:hover { background: rgba(255,255,255,.08); }
.nav a.active { background: #1d4ed8; color: #fff; font-weight: 700; border-left: 4px solid #93c5fd; }

/* ── Main content ────────────────────────────────────────────────────── */
.content { flex: 1; padding: 24px; min-width: 0; }
.content.no-sidebar { max-width: 520px; margin: 40px auto; }

/* ── Card ────────────────────────────────────────────────────────────── */
.card { background: white; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.06); padding: 18px; margin-bottom: 20px; }
h1, h2, h3 { margin-top: 0; }

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert.success { background: #dcfce7; color: #166534; }
.alert.error   { background: #fee2e2; color: #991b1b; }

/* ═══════════════════════════════════════════════════════════════════════
   GRID — full col-1 through col-12
═══════════════════════════════════════════════════════════════════════ */
.row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; align-items: start; }
.col-1  { grid-column: span 1; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

/* ── Form elements ───────────────────────────────────────────────────── */
label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
input, select, textarea, button {
    width: 100%; padding: 8px 12px; border: 1px solid #cbd5e1;
    border-radius: 8px; font: inherit; font-size: 13px;
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}
textarea { min-height: 88px; resize: vertical; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
button, .btn {
    display: inline-block; width: auto; background: #1d4ed8;
    color: white; border: none; cursor: pointer;
    padding: 9px 16px; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    transition: background .15s, opacity .15s;
}
button:hover, .btn:hover { opacity: .88; }
.btn.secondary { background: #475569; }
.btn.success   { background: #15803d; }
.btn.warning   { background: #b45309; }
.btn.danger    { background: #b91c1c; }
.btn.light     { background: #e2e8f0; color: #0f172a; }
.btn-group     { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Table ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: middle; }
th { background: #eff6ff; font-size: 13px; white-space: nowrap; }
td { font-size: 13px; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: 11px; font-weight: 600; }
.badge.gray    { background: #e5e7eb; color: #374151; }
.badge.green   { background: #dcfce7; color: #166534; }
.badge.red     { background: #fee2e2; color: #991b1b; }
.badge.warning { background: #fef3c7; color: #92400e; }

/* ── KPI ─────────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: white; border-radius: 12px; padding: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.kpi .num { font-size: 24px; font-weight: 700; }

/* ── Filters ─────────────────────────────────────────────────────────── */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end; }
.filters > div { min-width: 160px; }

/* ── Utilities ───────────────────────────────────────────────────────── */
.small   { font-size: 12px; }
.muted   { color: #64748b; }
.top-gap { margin-top: 18px; }
.right   { text-align: right; }
.center  { text-align: center; }
.req     { color: #ef4444; }

/* ── Pagination ──────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.pagination a { background: white; border: 1px solid #cbd5e1; border-radius: 8px; padding: 7px 12px; font-size: 13px; }
.pagination a.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; font-weight: 700; }

/* ── Form card ───────────────────────────────────────────────────────── */
.form-card { max-width: 1100px; }

/* ── Login ───────────────────────────────────────────────────────────── */
.login-box { background: white; padding: 28px; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.08); }

/* ── Misc ────────────────────────────────────────────────────────────── */
.stat-list { list-style: none; padding: 0; margin: 0; }
.stat-list li { padding: 8px 0; border-bottom: 1px dashed #cbd5e1; }
.print-area { background: white; padding: 24px; }

/* ── Brand ───────────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.brand-logo { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; background: #fff; padding: 3px; }
.brand-text { min-width: 0; }
.brand-text h2 { font-size: 20px; margin: 0; line-height: 1.1; }
.brand-text .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; display: block; }
.settings-logo-preview { max-width: 70px; max-height: 70px; border-radius: 8px; border: 1px solid #cbd5e1; padding: 4px; background: #fff; }

/* ── Student photos ──────────────────────────────────────────────────── */
.student-photo-thumb { width: 44px; height: 54px; object-fit: cover; border: 1px solid #cbd5e1; border-radius: 4px; background: #f8fafc; display: block; }
.student-photo-preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.student-profile-layout { display: grid; grid-template-columns: 45mm 1fr; gap: 28px; align-items: start; }
.student-profile-grid { display: grid; grid-template-columns: repeat(2, minmax(240px, 1fr)); gap: 16px 36px; }
.student-profile-item { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: start; }
.student-profile-item strong { display: block; }
.student-profile-block { margin-top: 18px; line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════════════════
   GROUPED ACCORDION SIDEBAR
═══════════════════════════════════════════════════════════════════════ */
.grouped-nav > a:first-child { margin-bottom: 4px; }
.nav-group { border: 1px solid rgba(148,163,184,.16); border-radius: 12px; background: rgba(255,255,255,.02); padding: 0; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.nav-group-title { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; color: #f8fafc; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.4; cursor: pointer; user-select: none; border-radius: 12px; transition: background .15s; gap: 8px; }
.nav-group-title:hover { background: rgba(255,255,255,.06); }
.toggle-icon { flex-shrink: 0; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,.08); color: #93c5fd; font-size: 16px; font-weight: 400; line-height: 1; transition: background .15s; }
.nav-group.open .toggle-icon { background: rgba(59,130,246,.25); color: #fff; }
.nav-sub { display: flex; flex-direction: column; gap: 4px; padding: 0 8px 8px; max-height: 0; opacity: 0; overflow: hidden; }
.nav-ready .nav-sub { transition: max-height .28s ease, opacity .22s ease; }
.nav-sub a { margin-left: 0; background: rgba(255,255,255,.03); border-left: 3px solid transparent; }
.nav-sub a:hover { background: rgba(255,255,255,.08); border-left-color: #3b82f6; }
.nav-sub a.active { background: #1d4ed8; border-left-color: #93c5fd; color: #fff; font-weight: 700; }
.nav-group.open, .nav-group.active { border-color: rgba(147,197,253,.45); box-shadow: inset 0 0 0 1px rgba(59,130,246,.12); }
.nav-group-placeholder .nav-group-title { color: #94a3b8; }
.nav-group-placeholder .nav-group-title:hover { background: rgba(255,255,255,.03); }
.nav-placeholder { display: block; padding: 10px 12px; border-radius: 8px; color: #64748b; background: rgba(255,255,255,.02); border: 1px dashed rgba(148,163,184,.15); font-size: 12px; font-style: italic; }
.nav-logout { display: block; margin-top: 8px; padding: 10px 12px; border-radius: 10px; color: #fca5a5; font-size: 13px; font-weight: 600; border: 1px solid rgba(252,165,165,.2); background: rgba(239,68,68,.06); transition: background .15s, border-color .15s; }
.nav-logout:hover { background: rgba(239,68,68,.18); border-color: rgba(252,165,165,.5); color: #fff; }
.nav-sub-label { font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #64748b; padding: 8px 4px 3px; margin-top: 4px; border-top: 1px solid rgba(148,163,184,.1); }
.nav-sub-label:first-child { margin-top: 0; border-top: none; padding-top: 2px; }

/* ═══════════════════════════════════════════════════════════════════════
   SUBJECT FORM — shared fieldset style
═══════════════════════════════════════════════════════════════════════ */
.subj-form-section { border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.subj-form-section legend { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; padding: 0 6px; }
.subj-form-card { max-width: 1100px; }
.subj-form-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.subj-form-header h1 { margin: 0; font-size: 20px; }

/* Action bar */
.subj-action-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.subj-action-left  { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.subj-action-right { display: flex; flex-wrap: wrap; gap: 6px; }
.subj-page-title   { font-size: 22px; font-weight: 700; margin: 0; }
.subj-breadcrumb   { color: #6b7280; font-size: 14px; }
.subj-breadcrumb strong { color: #374151; }

/* Medium / Level tabs */
.subj-tab-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; border-bottom: 2px solid #e5e7eb; }
.subj-tab-row-level { margin-top: 6px; border-bottom-color: #dbeafe; background: #f8fafc; padding: 8px 8px 0; border-radius: 10px 10px 0 0; }
.subj-tab { display: inline-flex; flex-direction: column; align-items: center; padding: 8px 16px 10px; font-size: 13px; font-weight: 500; color: #6b7280; border-radius: 8px 8px 0 0; border: 1px solid transparent; border-bottom: none; text-decoration: none; cursor: pointer; transition: background .12s, color .12s; position: relative; bottom: -2px; background: transparent; }
.subj-tab:hover { background: #f3f4f6; color: #111827; }
.subj-tab.active { background: #fff; color: #1d4ed8; border-color: #e5e7eb; border-bottom-color: #fff; font-weight: 600; }
.subj-tab-bangla.active  { color: #15803d; border-color: #bbf7d0; border-bottom-color: #fff; }
.subj-tab-english.active { color: #1d4ed8; border-color: #bfdbfe; border-bottom-color: #fff; }
.subj-tab-hint { font-size: 10px; font-weight: 400; color: #9ca3af; margin-top: 1px; }
.subj-tab.active .subj-tab-hint { color: #93c5fd; }

/* Curriculum card */
.subj-curriculum-card { border-radius: 0 0 10px 10px; margin-top: 0; padding: 14px 18px; border-top: 2px solid #dbeafe; background: #f0f6ff; }
.subj-curriculum-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.subj-curriculum-form > div { display: flex; flex-direction: column; gap: 4px; }
.subj-curriculum-form label { font-size: 12px; font-weight: 600; color: #374151; }
.subj-curriculum-form select { min-width: 170px; }
.subj-curriculum-actions { display: flex; gap: 6px; }
.subj-active-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip-remove { color: #9ca3af; text-decoration: none; margin-left: 2px; font-size: 14px; }
.chip-remove:hover { color: #ef4444; }

/* Status + search */
.subj-status-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.subj-count { display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.25); border-radius: 10px; font-size: 11px; padding: 0 6px; min-width: 22px; margin-left: 4px; }
.subj-search-form { display: flex; gap: 6px; align-items: center; }
.subj-search-input { padding: 7px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px; min-width: 260px; outline: none; transition: border-color .15s; }
.subj-search-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.15); }

/* Sort bar */
.subj-sort-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; font-size: 12px; }
.subj-sort-link { padding: 3px 10px; border-radius: 6px; color: #6b7280; text-decoration: none; border: 1px solid transparent; transition: background .12s; }
.subj-sort-link:hover { background: #f3f4f6; color: #111827; }
.subj-sort-link.active { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; font-weight: 600; }

/* Medium toggle */
.subj-toggle-group { display: flex; gap: 6px; }
.subj-toggle-btn { flex: 1; padding: 9px 12px; border-radius: 8px; border: 2px solid #e5e7eb; background: #fff; cursor: pointer; font-size: 13px; font-weight: 500; color: #6b7280; transition: all .15s; width: auto; }
.subj-toggle-btn:hover { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }
.subj-toggle-btn.active { border-color: #1d4ed8; background: #1d4ed8; color: #fff; font-weight: 700; }
.subj-toggle-btn.active.bangla  { border-color: #16a34a; background: #16a34a; }
.subj-toggle-btn.active.english { border-color: #1d4ed8; background: #1d4ed8; }

/* Checkbox */
.subj-check-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; padding: 6px 0; }
.subj-check-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #1d4ed8; padding: 0; border: none; box-shadow: none; }

/* Upper/lower class blocks — JS sets display:block / display:none directly */
/* No default display set here so JS has full control */

/* Computed marks */
.subj-computed-marks { display: flex; align-items: center; justify-content: center; height: 40px; border-radius: 8px; background: #dbeafe; color: #1d4ed8; font-size: 20px; font-weight: 700; border: 2px solid #93c5fd; }

/* Radio group */
.subj-radio-group { display: flex; flex-wrap: wrap; gap: 10px; }
.subj-radio-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; padding: 8px 14px; border-radius: 8px; border: 2px solid #e5e7eb; background: #fff; transition: border-color .15s, background .15s; }
.subj-radio-label:has(input:checked) { border-color: #1d4ed8; background: #eff6ff; color: #1d4ed8; font-weight: 700; }
.subj-radio-label input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: #1d4ed8; padding: 0; border: none; box-shadow: none; }

/* Tier badge */
.subj-tier-badge { display: inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.subj-tier-upper { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.subj-tier-lower { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Indent block */
.subj-indent-block { margin-top: 10px; padding: 14px; background: #f8fafc; border-radius: 8px; border: 1px solid #e5e7eb; }

/* Import column reference */
.subj-import-cols { display: flex; flex-direction: column; gap: 10px; }
.subj-import-col-group { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; }
.subj-import-col-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; margin-bottom: 6px; }
.subj-import-col-item { font-size: 12px; padding: 2px 0; color: #374151; }
.subj-import-col-item code { background: #e0f2fe; color: #0369a1; padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* ═══════════════════════════════════════════════════════════════════════
   STUDENTS PAGE
═══════════════════════════════════════════════════════════════════════ */
.stu-action-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.stu-page-title { font-size: 22px; font-weight: 700; margin: 0; }

/* Admission section — photo left, fields right */
.stu-admission-layout {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 20px;
    align-items: start;
}
.stu-photo-col {}
.stu-photo-wrap {
    width: 130px;
    height: 159px;               /* 45mm×55mm ratio */
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}
.stu-photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stu-photo-col input[type="file"] { font-size: 11px; padding: 4px 6px; }
.stu-photo-hint { font-size: 11px; color: #64748b; margin-top: 4px; line-height: 1.5; }

/* Phone input with icon */
.stu-phone-input-wrap { display: flex; align-items: stretch; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; background: #fff; transition: border-color .15s; }
.stu-phone-input-wrap:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.15); }
.stu-phone-icon { padding: 0 8px; font-size: 14px; background: #f3f4f6; border-right: 1px solid #e5e7eb; display: flex; align-items: center; color: #6b7280; flex-shrink: 0; }
.stu-phone-input-wrap input[type="tel"] { border: none !important; border-radius: 0 !important; box-shadow: none !important; flex: 1; padding: 8px 10px; font-size: 13px; width: auto; }

/* Phone link in table */
.stu-phone { color: #1d4ed8; text-decoration: none; font-size: 12px; }
.stu-phone:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════
   STUDENTS TABLE — compact, no-wrap, horizontal scroll
═══════════════════════════════════════════════════════════════════════ */

/* Wrapper: clips the table and provides the horizontal scrollbar */
.stu-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;      /* smooth scroll on iOS */
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 4px;
}

/* Custom scrollbar — thin and visible */
.stu-table-wrap::-webkit-scrollbar        { height: 7px; }
.stu-table-wrap::-webkit-scrollbar-track  { background: #f1f5f9; border-radius: 4px; }
.stu-table-wrap::-webkit-scrollbar-thumb  { background: #94a3b8; border-radius: 4px; }
.stu-table-wrap::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Table itself: no forced 100% width so it can be wider than viewport */
.stu-table {
    width: 100%;
    min-width: 1170px;            /* never squash below this */
    border-collapse: collapse;
    background: white;
    table-layout: fixed;          /* fixed layout for predictable column widths */
}

/* Column widths — total ≈ 1080px */
.stu-table .stu-col-photo    { width: 60px;  }
.stu-table .stu-col-student  { width: 160px; }
.stu-table .stu-col-id       { width: 90px;  }
.stu-table .stu-col-birth    { width: 130px; }
.stu-table .stu-col-class    { width: 130px; }
.stu-table .stu-col-roll     { width: 80px;  }
.stu-table .stu-col-guardian { width: 120px; }
.stu-table .stu-col-phone    { width: 115px; }   /* x2 = 230px */
.stu-table .stu-col-status   { width: 70px;  }
.stu-table .stu-col-actions  { width: 200px; }

/* Header */
.stu-table th {
    background: #eff6ff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    padding: 9px 10px;
    border-bottom: 2px solid #dbeafe;
    vertical-align: middle;
    /* Prevent header cell from being narrower than its column definition */
    overflow: hidden;
}
/* Ensure Actions th background always fills — explicit min-width */
.stu-table th.stu-col-actions {
    min-width: 200px;
    background: #eff6ff;
}

/* Cells */
.stu-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 13px;
}
.stu-table tbody tr:hover { background: #fafbff; }

/* No-wrap utility for single-value cells */
.stu-nowrap { white-space: nowrap; }

/* Class/Section cell — Class on line 1, Section on line 2 */
.stu-table td.stu-col-class {
    white-space: normal;
    vertical-align: middle;
}
.stu-class-line {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
}
.stu-section-line {
    display: block;
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 128px;
}
/* Roll — bold, centered, always visible */
.stu-table td.stu-col-roll {
    text-align: center;
    font-weight: 700;
    white-space: nowrap;
}

/* Student name — one line, truncate if too long */
.stu-name {
    display: block;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 155px;
}
.stu-sub {
    display: block;
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 155px;
}

/* Guardian / parent name (smaller, single line) */
.stu-name-sm {
    display: block;
    font-size: 12px;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

/* Phone link */
.stu-phone {
    display: block;
    color: #1d4ed8;
    text-decoration: none;
    font-size: 12px;
    white-space: nowrap;
}
.stu-phone:hover { text-decoration: underline; }

/* ── Action buttons — always single row, never wrap ─────────────────── */
.stu-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;          /* KEY: never stack */
    gap: 4px;
    align-items: center;
}
.stu-btn {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    border: none;
    line-height: 1.4;
    transition: opacity .15s;
}
.stu-btn:hover { opacity: .82; }
.stu-btn-edit    { background: #e2e8f0; color: #0f172a; }
.stu-btn-archive { background: #b45309; color: #fff; }
.stu-btn-profile { background: #475569; color: #fff; }


/* ID card action button */
.stu-btn-idcard  { background: #0e7490; color: #fff; }

/* Action bar for students page */
.stu-action-bar .btn-group { gap: 6px; }


/* ── Student view (read-only) fields ────────────────────────────────── */
.stu-view-field {
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    color: #1e293b;
    min-height: 38px;
    display: flex;
    align-items: center;
}
.stu-view-area {
    min-height: 70px;
    align-items: flex-start;
    padding-top: 10px;
    white-space: pre-wrap;
}


/* ── Top scrollbar mirror ────────────────────────────────────────────── */
.stu-scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    height: 12px;                  /* thin scroll strip */
    margin-bottom: 2px;
    border-radius: 4px;
}
.stu-scroll-top::-webkit-scrollbar        { height: 7px; }
.stu-scroll-top::-webkit-scrollbar-track  { background: #f1f5f9; border-radius: 4px; }
.stu-scroll-top::-webkit-scrollbar-thumb  { background: #94a3b8; border-radius: 4px; }
.stu-scroll-top::-webkit-scrollbar-thumb:hover { background: #64748b; }
.stu-scroll-top-inner { height: 1px; }   /* just wide enough to create scrollbar */

/* ── Summary row (showing X of Y) ───────────────────────────────────── */
.stu-summary-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 2px 8px;
    font-size: 12px;
    color: #64748b;
}


/* ── Subjects bulk toolbar ───────────────────────────────────────────── */
.subj-bulk-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    animation: fadeInDown .15s ease;
}
@keyframes fadeInDown {
    from { opacity:0; transform:translateY(-6px); }
    to   { opacity:1; transform:translateY(0); }
}
.subj-bulk-count {
    font-size: 13px;
    font-weight: 700;
    color: #92400e;
    margin-right: auto;
}
/* Row hover highlight when in select mode */
tr.subj-row { cursor: pointer; transition: background .1s; }
tr.subj-row:has(.row-check:checked) { background: #eff6ff !important; }
tr.subj-row:hover { background: #f8fafc; }


/* ── Re-assign level panel ───────────────────────────────────────────── */
.subj-reassign-panel {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}
.subj-reassign-panel summary {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.subj-reassign-panel summary::-webkit-details-marker { display: none; }
.subj-reassign-panel[open] summary {
    border-bottom: 1px solid #fcd34d;
}
.subj-reassign-body {
    padding: 14px 16px;
}
.subj-reassign-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
.subj-reassign-form > div { display: flex; flex-direction: column; gap: 4px; }
.subj-reassign-form label { font-size: 12px; font-weight: 600; color: #374151; }
.subj-reassign-form select { min-width: 180px; }
.subj-reassign-arrow {
    font-size: 22px; color: #d97706;
    align-self: flex-end; padding-bottom: 8px;
    flex-direction: row !important;
}


/* Student delete button */
.stu-btn-delete { background: #b91c1c; color: #fff; }
/* Student row hover & selected */
tr.stu-row { cursor: pointer; transition: background .1s; }
tr.stu-row:has(.stu-row-check:checked) { background: #fff1f2 !important; }

/* ═══════════════════════════════════════════════════════════════════════
   SMS & MESSAGING MODULE
═══════════════════════════════════════════════════════════════════════ */
.sms-page-header { display:flex;align-items:flex-start;justify-content:space-between;flex-wrap:wrap;gap:12px;margin-bottom:18px; }
.sms-page-title  { font-size:22px;font-weight:700;margin:0; }
.sms-card        { padding:20px;margin-bottom:0; }
.sms-section-title { font-size:14px;font-weight:700;color:#374151;margin:0 0 14px;padding-bottom:8px;border-bottom:1px solid #e5e7eb; }

/* Filter tabs */
.sms-filter-tabs { display:flex;gap:4px;margin-bottom:12px;flex-wrap:wrap; }
.sms-tab { padding:7px 14px;border-radius:8px;border:1px solid #e5e7eb;background:#f9fafb;font-size:13px;font-weight:500;cursor:pointer;transition:all .15s;width:auto;color:#374151; }
.sms-tab:hover  { background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8; }
.sms-tab.active { background:#1d4ed8;color:#fff;border-color:#1d4ed8;font-weight:700; }

/* Tab content */
.sms-tab-content { display:none;padding:12px 0 0; }
.sms-tab-content.active { display:block; }

/* Select */
.sms-select { width:100%;padding:8px 12px;border:1px solid #cbd5e1;border-radius:8px;font-size:13px; }

/* Char count */
.sms-char-count { font-size:12px;color:#6b7280;margin-top:6px;text-align:right; }

/* Radio row */
.sms-radio-row { display:flex;gap:16px;flex-wrap:wrap; }
.sms-radio-label { display:flex;align-items:center;gap:6px;font-size:13px;cursor:pointer; }
.sms-radio-label input { width:16px;height:16px;accent-color:#1d4ed8; }

/* Checkbox group */
.sms-check-group { display:flex;gap:16px;flex-wrap:wrap;margin-top:6px; }
.sms-check-label { display:flex;align-items:center;gap:6px;font-size:13px;cursor:pointer; }

/* Hub cards */
.sms-hub-card {
    display:block;text-decoration:none;color:inherit;
    background:#fff;border:2px solid #e5e7eb;border-radius:12px;
    padding:20px;margin-bottom:16px;transition:all .15s;
}
.sms-hub-card:hover { border-color:#3b82f6;box-shadow:0 4px 16px rgba(59,130,246,.12);transform:translateY(-1px); }
.sms-hub-warn { border-color:#fcd34d;background:#fffbeb; }
.sms-hub-icon  { font-size:28px;margin-bottom:10px; }
.sms-hub-title { font-size:15px;font-weight:700;color:#1e293b;margin-bottom:6px; }
.sms-hub-desc  { font-size:13px;color:#64748b;line-height:1.5; }


/* ── SMS Gateway Cards ────────────────────────────────────────────── */
.gw-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    height: 100%;
    box-sizing: border-box;
    transition: border-color .15s;
}
.gw-card:hover      { border-color: #93c5fd; }
.gw-card-default    { border-color: #22c55e; background: #f0fdf4; }

.gw-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
    flex-wrap: wrap;
}
.gw-card-label  { font-size: 15px; font-weight: 700; color: #1e293b; }
.gw-card-meta   { font-size: 13px; color: #64748b; margin-bottom: 12px; }
.gw-card-creds  { background: #f8fafc; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.gw-card-creds > div { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.gw-card-creds > div:last-child { margin-bottom: 0; }
.gw-cred-label  { font-weight: 600; color: #64748b; min-width: 70px; }
.gw-cred-val    { color: #334155; font-family: monospace; }
.gw-card-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }


/* ═══════════════════════════════════════════════════════════════════
   ATTENDANCE MODULE
═══════════════════════════════════════════════════════════════════ */
/* Status radio buttons */
.att-status-btns { display:flex; gap:4px; flex-wrap:wrap; }
.att-status-opt  {
    display:inline-flex; align-items:center; gap:5px;
    padding:5px 10px; border-radius:7px; cursor:pointer;
    font-size:12px; font-weight:500; border:2px solid #e5e7eb;
    background:#f9fafb; color:#374151; transition:all .1s; user-select:none;
}
.att-status-opt:hover { border-color:#cbd5e1; background:#f1f5f9; }
.att-status-opt input[type=radio] { display:none; }
.att-status-active.att-status-present { background:#f0fdf4; border-color:#22c55e; color:#15803d; font-weight:700; }
.att-status-active.att-status-absent  { background:#fef2f2; border-color:#ef4444; color:#b91c1c; font-weight:700; }
.att-status-active.att-status-late    { background:#fffbeb; border-color:#f59e0b; color:#92400e; font-weight:700; }
.att-status-active.att-status-leave   { background:#f5f3ff; border-color:#8b5cf6; color:#5b21b6; font-weight:700; }

/* Row highlight */
tr.att-row-absent { background:#fff5f5 !important; }
tr.att-row-late   { background:#fffbeb !important; }
tr.att-row-leave  { background:#f5f3ff !important; }
@media print {
    .sidebar, .filters, .no-print, .alert { display: none !important; }
    .layout, .content, .content.no-sidebar { display: block; width: 100%; margin: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .layout  { display: block; }
    .sidebar { width: 100%; min-height: auto; position: static; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .row { grid-template-columns: 1fr; }
    .col-1, .col-2, .col-3, .col-4, .col-5,
    .col-6, .col-7, .col-8, .col-9, .col-10,
    .col-11, .col-12 { grid-column: span 1; }
    .stu-admission-layout { grid-template-columns: 1fr; }
    .stu-photo-wrap { width: 100%; height: 200px; }
}
