/* ======================================================
   AISAT College Admin System - Master Stylesheet
   Design: Blue-themed, modern dashboard UI
   Font: Inter (Google Fonts)
====================================================== */

/* --- CSS Variables --- */
:root {
    --primary-blue: #3754DB;
    --primary-dark: #2a3fc7;
    --primary-light: #5a73e8;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #2d2d4a;
    --sidebar-active: rgba(55, 84, 219, 0.2);
    --sidebar-active-border: #3754DB;
    --content-bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --text-white: #ffffff;
    --border-color: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --purple: #8b5cf6;
    --orange: #f97316;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --sidebar-width: 220px;
    --transition: all 0.25s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--content-bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- App Layout --- */
.app-container {
    display: flex;
    min-height: 100vh;
    min-width: 0;
}

/* ======================================================
   SIDEBAR
====================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    z-index: 2;
    flex-shrink: 0;
    overflow: visible;
}

.logo-placeholder {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    min-width: 0;
}

.logo-circle {
    --logo-size: 48px;
    width: var(--logo-size);
    min-width: var(--logo-size);
    max-width: var(--logo-size);
    height: var(--logo-size);
    min-height: var(--logo-size);
    max-height: var(--logo-size);
    aspect-ratio: 1;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px rgba(55, 84, 219, 0.4);
    flex-shrink: 0;
    overflow: hidden;
    padding: 2px;
}

.logo-circle img {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
    object-position: center;
    display: block;
}

.logo-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.logo-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.logo-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.3px;
    overflow-wrap: anywhere;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.65);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.nav-item:hover {
    color: var(--text-white);
    background: var(--sidebar-hover);
}

.nav-item.active {
    color: var(--text-white);
    background: var(--sidebar-active);
    border-color: var(--sidebar-active-border);
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-item-compact {
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-height: 64px;
    padding: 10px 8px;
    text-align: center;
}

.nav-item-compact i {
    width: auto;
}

.nav-item-compact span {
    font-size: 11px;
    line-height: 1.2;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.logout-btn i {
    font-size: 15px;
    width: 18px;
    text-align: center;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* ======================================================
   MAIN CONTENT AREA
====================================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 36px;
    min-height: 100vh;
    min-width: 0;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

/* ======================================================
   STAT CARDS (Dashboard)
====================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-info h3 {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
    display: block;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stat-icon.blue {
    background: rgba(55, 84, 219, 0.1);
    color: var(--primary-blue);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.orange {
    background: rgba(249, 115, 22, 0.1);
    color: var(--orange);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--purple);
}

/* ======================================================
   CONTENT CARDS
====================================================== */
.content-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ======================================================
   DATA TABLES
====================================================== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    background: var(--content-bg);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.data-table thead th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.data-table thead th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(55, 84, 219, 0.03);
}

.data-table tbody tr.selected-row {
    background: rgba(55, 84, 219, 0.06);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.empty-cell {
    text-align: center;
    color: var(--text-light);
    padding: 32px 16px !important;
    font-style: italic;
}

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ======================================================
   BUTTONS
====================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(55, 84, 219, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(55, 84, 219, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--content-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    background: transparent;
}

.btn-icon:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-edit {
    color: var(--primary-blue);
}

.btn-edit:hover {
    background: rgba(55, 84, 219, 0.1);
}

.btn-view {
    color: var(--primary-blue);
}

.btn-view:hover {
    background: rgba(55, 84, 219, 0.1);
}

.btn-delete {
    color: var(--danger);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ======================================================
   BADGES
====================================================== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-completed {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-pending {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-missing {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* ======================================================
   FORMS
====================================================== */
.form-group {
    margin-bottom: 16px;
    flex: 1;
    min-width: 0;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(55, 84, 219, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: flex;
    gap: 16px;
    min-width: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 12px;
}

/* ======================================================
   SEARCH BAR
====================================================== */
.search-bar {
    margin-bottom: 20px;
}

.search-form {
    position: relative;
    width: min(100%, 520px);
    max-width: 520px;
}

.search-form i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 14px;
}

.search-form input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition);
    outline: none;
}

.search-form input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(55, 84, 219, 0.1);
}

/* ======================================================
   FILTER BAR
====================================================== */
.filter-bar {
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.filter-form input,
.filter-form select {
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    outline: none;
    cursor: pointer;
    min-width: 250px;
    transition: var(--transition);
}

.filter-form input:focus,
.filter-form select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(55, 84, 219, 0.1);
}

.filter-input {
    flex: 1 1 220px;
    min-width: 220px;
}

.filter-input-wide {
    flex-basis: 320px;
}

.filter-select {
    flex: 1 1 190px;
    min-width: 190px;
}

.filter-select-wide {
    flex-basis: 240px;
    min-width: 240px;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.filter-actions .btn {
    min-width: 120px;
    justify-content: center;
}

.students-filter-form {
    padding: 14px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.students-filter-select {
    min-width: 190px;
    flex: 1 1 190px;
}

.students-filter-select-wide {
    min-width: 240px;
    flex-basis: 240px;
}

.students-filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.students-filter-actions .btn {
    min-width: 120px;
    justify-content: center;
}

.records-table-wrap {
    overflow-x: auto;
}

.records-table {
    min-width: 1180px;
}

.records-table th,
.records-table td {
    vertical-align: middle;
}

.records-name-cell {
    min-width: 210px;
}

.records-name-cell strong,
.records-name-cell span {
    display: block;
}

.records-name-cell span {
    margin-top: 2px;
    color: var(--text-light);
    font-size: 11px;
}

.record-status-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.record-status-select {
    width: 126px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 700;
    outline: none;
    background: var(--card-bg);
}

.record-status-pending {
    color: #d97706;
    background: rgba(245, 158, 11, 0.08);
}

.record-status-missing {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.08);
}

.record-status-completed {
    color: #059669;
    background: rgba(16, 185, 129, 0.08);
}

.records-send-button {
    padding: 8px 12px;
    font-size: 12px;
}

.record-balance-form {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 150px;
}

.record-balance-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 116px;
    padding: 6px 9px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: #f8fafc;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.record-balance-control span {
    flex-shrink: 0;
}

.record-balance-control input {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    outline: 0;
}

.record-balance-control input::-webkit-outer-spin-button,
.record-balance-control input::-webkit-inner-spin-button {
    margin: 0;
}

/* ======================================================
   STUDENTS LAYOUT
====================================================== */
.students-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 320px);
    gap: 20px;
    align-items: start;
    min-width: 0;
}

.students-table-card {
    min-width: 0;
    overflow-x: auto;
}

#students-table {
    table-layout: fixed;
}

#students-table th,
#students-table td {
    overflow-wrap: anywhere;
    word-break: normal;
    vertical-align: middle;
}

#students-table th:nth-child(1),
#students-table td:nth-child(1) {
    width: 13%;
}

#students-table th:nth-child(2),
#students-table td:nth-child(2),
#students-table th:nth-child(3),
#students-table td:nth-child(3),
#students-table th:nth-child(5),
#students-table td:nth-child(5) {
    width: 13%;
}

#students-table th:nth-child(4),
#students-table td:nth-child(4) {
    width: 25%;
}

#students-table th:nth-child(6),
#students-table td:nth-child(6) {
    width: 15%;
}

#students-table th:nth-child(7),
#students-table td:nth-child(7) {
    width: 48px;
    text-align: center;
    white-space: nowrap;
}

.student-detail-panel {
    width: 100%;
    min-width: 0;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 24px;
    align-self: flex-start;
    position: sticky;
    top: 32px;
}

.student-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.student-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4b5563, #374151);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.student-detail-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
    overflow-wrap: anywhere;
}

.student-detail-info p {
    font-size: 12px;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.student-detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.student-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.student-meta-item span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.student-meta-item strong {
    font-size: 13px;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.student-detail-body h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-pill-connected {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.status-pill-pending {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.status-pill-alert {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.messenger-account-card {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.balance-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.balance-summary-card {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--content-bg);
    border: 1px solid var(--border-color);
}

.balance-summary-card span {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.balance-summary-card strong {
    font-size: 18px;
    font-weight: 700;
}

.balance-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    max-width: 100%;
    white-space: nowrap;
}

.balance-ledger-table td:nth-child(4),
.balance-ledger-table td:nth-child(5) {
    font-weight: 700;
    white-space: nowrap;
}

.amount-positive {
    color: #b91c1c;
}

.amount-negative {
    color: #047857;
}

.amount-neutral {
    color: var(--text-primary);
}

.detail-actions {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.inline-action-form {
    width: 100%;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.student-helper-text {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.student-helper-text strong {
    color: var(--text-primary);
}

.mini-table {
    font-size: 12px;
}

.mini-table th {
    padding: 8px 10px !important;
    font-size: 11px !important;
}

.mini-table td {
    padding: 8px 10px !important;
    font-size: 12px !important;
}

.student-detail-panel .mini-table {
    width: 100%;
}

.student-detail-panel .mini-table,
.student-detail-panel .mini-table thead,
.student-detail-panel .mini-table tbody,
.student-detail-panel .mini-table tr,
.student-detail-panel .mini-table th,
.student-detail-panel .mini-table td {
    display: block;
}

.student-detail-panel .mini-table thead {
    display: none;
}

.student-detail-panel .mini-table tbody tr {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--content-bg);
    margin-bottom: 10px;
}

.student-detail-panel .mini-table tbody tr:last-child {
    margin-bottom: 0;
}

.student-detail-panel .mini-table tbody td {
    display: grid;
    grid-template-columns: minmax(92px, 40%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border-bottom: 0;
    padding: 5px 0 !important;
    overflow-wrap: anywhere;
}

.student-detail-panel .mini-table tbody td::before {
    content: attr(data-label);
    color: var(--text-light);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.student-detail-panel .balance-ledger-table td:nth-child(4),
.student-detail-panel .balance-ledger-table td:nth-child(5) {
    white-space: normal;
}

/* ======================================================
   MODALS
====================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: 24px;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    min-width: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

.modal-content-wide {
    max-width: min(860px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--content-bg);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    flex-wrap: wrap;
    margin: 8px -28px -28px;
    padding: 16px 28px 28px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--card-bg) 26%, var(--card-bg));
}

.modal .form-actions .btn {
    justify-content: center;
    min-width: 128px;
}

/* ======================================================
   ADD STUDENT MODAL - Premium Design
====================================================== */
.add-student-modal-content {
    padding: 0;
    max-width: 680px;
    overflow: hidden;
}

/* Gradient header banner */
.add-student-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 24px 20px;
    background: linear-gradient(135deg, #3754DB 0%, #5a73e8 60%, #7b96f0 100%);
    position: relative;
}

.add-student-header-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.add-student-header-text {
    flex: 1;
    min-width: 0;
}

.add-student-header-text h2 {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 2px;
}

.add-student-header-text p {
    font-size: 12px;
    color: rgba(255,255,255,0.78);
    margin: 0;
    line-height: 1.4;
}

.add-student-close {
    background: rgba(255,255,255,0.18) !important;
    color: #fff !important;
    border: none !important;
}

.add-student-close:hover {
    background: rgba(255,255,255,0.3) !important;
}

/* Section groups */
.add-student-section {
    padding: 18px 24px 4px;
    border-bottom: 1px solid var(--border-color);
}

.add-student-section:last-of-type {
    border-bottom: none;
}

.add-student-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.add-student-section-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.add-student-section-icon.blue {
    background: rgba(55, 84, 219, 0.12);
    color: var(--primary-blue);
}

.add-student-section-icon.green {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.add-student-section-icon.purple {
    background: rgba(139, 92, 246, 0.12);
    color: var(--purple);
}

/* Field labels with icons */
.add-student-field label {
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.add-student-field label i {
    font-size: 10px;
    color: var(--text-light);
}

.req-star {
    color: var(--danger);
    font-size: 11px;
    line-height: 1;
}

.add-student-field input,
.add-student-field select {
    font-size: 13px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    background: #fafbfc;
    transition: var(--transition);
}

.add-student-field input:focus,
.add-student-field select:focus {
    border-color: var(--primary-blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(55, 84, 219, 0.08);
}

/* Footer actions bar */
.add-student-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px 20px;
    gap: 10px;
    background: var(--content-bg);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.add-student-footer-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Set Requirements button */
.add-student-req-btn {
    background: #fff;
    border: 1.5px dashed var(--border-color);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.add-student-req-btn:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    background: rgba(55, 84, 219, 0.04);
}

.req-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(55, 84, 219, 0.1);
    color: var(--primary-blue);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-left: 2px;
    transition: var(--transition);
}

.req-badge.has-checked {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

/* Requirements sub-modal */
.req-modal-content {
    max-width: 430px;
    padding: 0;
    overflow: hidden;
}

.req-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #f0f9f4 0%, #e8f5e9 100%);
    border-bottom: 1px solid #c8e6c9;
}

.req-modal-header-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--success);
}

.req-modal-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2px;
}

.req-modal-header p {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin: 0;
}

.req-modal-header .modal-close {
    margin-left: auto;
}

/* Checklist items */
.req-checklist {
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.req-check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
    width: 100%;
}

.req-check-item:hover {
    border-color: var(--primary-blue);
    background: rgba(55, 84, 219, 0.03);
}

.req-checkbox {
    display: none;
}

.req-check-box {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: transparent;
    transition: var(--transition);
    background: #fff;
}

.req-check-item:has(.req-checkbox:checked) {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.req-check-item:has(.req-checkbox:checked) .req-check-box {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.req-check-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

.req-check-item:has(.req-checkbox:checked) .req-check-label {
    color: #047857;
    font-weight: 600;
}

.req-modal-content .form-actions {
    position: static;
    margin: 0 !important;
    padding: 0 20px 20px !important;
    background: none !important;
}

/* ======================================================
   PREMIUM MODAL SHARED STYLES (Add Section, Add Class, etc.)
====================================================== */
.premium-modal-content {
    padding: 0;
    overflow: hidden;
}

.premium-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px 18px;
    position: relative;
}

.premium-modal-header-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.premium-modal-header-text {
    flex: 1;
    min-width: 0;
}

.premium-modal-header-text h2 {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 2px;
}

.premium-modal-header-text p {
    font-size: 11.5px;
    color: rgba(255,255,255,0.78);
    margin: 0;
    line-height: 1.4;
}

.premium-modal-close {
    background: rgba(255,255,255,0.18) !important;
    color: #fff !important;
    border: none !important;
    margin-left: auto;
}

.premium-modal-close:hover {
    background: rgba(255,255,255,0.3) !important;
}

/* Premium modal: color themes for header */
.premium-header-blue   { background: linear-gradient(135deg, #3754DB 0%, #5a73e8 60%, #7b96f0 100%); }
.premium-header-green  { background: linear-gradient(135deg, #059669 0%, #10b981 60%, #34d399 100%); }
.premium-header-purple { background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 60%, #a78bfa 100%); }
.premium-header-orange { background: linear-gradient(135deg, #d97706 0%, #f59e0b 60%, #fbbf24 100%); }
.premium-header-teal   { background: linear-gradient(135deg, #0d9488 0%, #14b8a6 60%, #2dd4bf 100%); }

/* Premium modal: body */
.premium-modal-body {
    padding: 20px 24px 6px;
}

.premium-modal-section {
    margin-bottom: 16px;
}

.premium-modal-section-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.premium-field label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.premium-field label i {
    font-size: 10px;
    color: var(--text-light);
}

.premium-field input,
.premium-field select,
.premium-field textarea {
    font-size: 13px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    background: #fafbfc;
    width: 100%;
    font-family: inherit;
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.premium-field input:focus,
.premium-field select:focus,
.premium-field textarea:focus {
    border-color: var(--primary-blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(55, 84, 219, 0.08);
}

.premium-field textarea {
    resize: vertical;
    min-height: 72px;
}

/* Premium modal footer */
.premium-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px 20px;
    background: var(--content-bg);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ======================================================
   RECENT ACTIVITY
====================================================== */
.recent-section {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 26px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.recent-section h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

.dashboard-compact {
    padding-top: 24px;
    padding-bottom: 20px;
}

.dashboard-compact-header {
    align-items: center;
    margin-bottom: 16px;
}

.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-compact-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.dashboard-compact .stat-card {
    padding: 14px;
    min-width: 0;
}

.dashboard-compact .stat-info {
    min-width: 0;
}

.dashboard-compact .stat-info h3 {
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-compact .stat-number {
    font-size: 24px;
}

.dashboard-compact .stat-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-compact .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 18px;
    flex-shrink: 0;
}

.dashboard-compact-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 14px;
}

.dashboard-compact .recent-section {
    padding: 16px;
    margin-bottom: 0;
}

.dashboard-compact .recent-section h2 {
    margin-bottom: 0;
}

.dashboard-compact .dashboard-focus-list,
.dashboard-compact .classroom-snapshot-list {
    gap: 8px;
}

.dashboard-compact .dashboard-focus-item,
.dashboard-compact .classroom-snapshot-item {
    padding: 10px 12px;
}

.dashboard-compact .dashboard-focus-copy strong,
.dashboard-compact .classroom-snapshot-header h4 {
    font-size: 12.5px;
}

.dashboard-compact .dashboard-focus-copy span,
.dashboard-compact .classroom-snapshot-header p {
    font-size: 11.5px;
    line-height: 1.35;
}

.dashboard-compact .dashboard-focus-copy span,
.dashboard-compact .classroom-snapshot-header p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dashboard-compact .classroom-snapshot-meta {
    margin-top: 6px;
    gap: 6px 12px;
    font-size: 11.5px;
}

.dashboard-compact .dashboard-tag-row {
    margin-top: 6px;
    gap: 5px;
}

.dashboard-compact .dashboard-mini-tag,
.dashboard-compact .dashboard-focus-tag {
    padding: 4px 8px;
    font-size: 10.5px;
}

.dashboard-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.dashboard-action-link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #fbfcff;
    transition: var(--transition);
}

.dashboard-action-link:hover {
    border-color: rgba(55, 84, 219, 0.24);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.dashboard-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.dashboard-action-icon.blue {
    background: rgba(55, 84, 219, 0.1);
    color: var(--primary-blue);
}

.dashboard-action-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.dashboard-action-icon.orange {
    background: rgba(249, 115, 22, 0.1);
    color: var(--orange);
}

.dashboard-action-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--purple);
}

.dashboard-action-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.dashboard-action-copy strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.dashboard-action-copy span {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.dashboard-focus-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dashboard-focus-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #fbfcff;
    transition: var(--transition);
}

.dashboard-focus-item:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.dashboard-focus-warning {
    border-color: rgba(245, 158, 11, 0.24);
    background: rgba(245, 158, 11, 0.06);
}

.dashboard-focus-danger {
    border-color: rgba(239, 68, 68, 0.24);
    background: rgba(239, 68, 68, 0.06);
}

.dashboard-focus-info {
    border-color: rgba(55, 84, 219, 0.18);
    background: rgba(55, 84, 219, 0.05);
}

.dashboard-focus-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.dashboard-focus-copy strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.dashboard-focus-copy span {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.dashboard-focus-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.classroom-snapshot-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.classroom-snapshot-item {
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: #fbfcff;
}

.classroom-snapshot-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.classroom-snapshot-header h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.classroom-snapshot-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.classroom-snapshot-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.classroom-snapshot-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.classroom-snapshot-meta i {
    color: var(--primary-blue);
}

.dashboard-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.dashboard-mini-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(55, 84, 219, 0.08);
    color: var(--primary-blue);
    font-size: 11px;
    font-weight: 700;
}

@media (max-width: 900px) {
    .filter-actions {
        width: 100%;
        margin-left: 0;
    }

    .filter-actions .btn {
        flex: 1 1 160px;
    }

    .students-filter-actions {
        width: 100%;
        margin-left: 0;
    }

    .students-filter-actions .btn {
        flex: 1 1 160px;
    }

    .dashboard-focus-item,
    .classroom-snapshot-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-focus-tag {
        white-space: normal;
    }
}

@media (max-width: 1280px) {
    .students-layout {
        grid-template-columns: 1fr;
    }

    .student-detail-panel {
        position: static;
    }
}

.section-header-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-header-inline .card-title,
.section-header-inline h2 {
    margin-bottom: 0;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.section-students-table {
    min-width: 640px;
}

.section-students-table th,
.section-students-table td {
    vertical-align: top;
}

.section-students-table td:nth-child(3) {
    overflow-wrap: anywhere;
}

.attendance-entry-table select {
    width: 100%;
    min-width: 140px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
}

.attendance-history-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
    background: var(--bg-secondary);
}

.attendance-history-item summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 700;
}

.attendance-history-item .table-scroll {
    margin-top: 12px;
}

.text-link,
.message-count-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-blue);
}

.announcement-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.announcement-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.announcement-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--purple);
    font-size: 16px;
    flex-shrink: 0;
}

.announcement-content h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.message-route-target {
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 4px;
}

.announcement-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.announcement-date {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    display: block;
}

/* Announcement workspace */
.announcements-workspace {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.announcements-composer-card,
.announcements-feed-card {
    min-width: 0;
    margin-bottom: 0;
}

.announcements-feed-card {
    scrollbar-gutter: stable;
}

.announcements-composer-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.announcements-feed-card {
    background: transparent;
    border: 0;
    box-shadow: none;
}

@media (min-width: 1025px) {
    .announcements-page {
        height: 100vh;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .announcements-page .page-header {
        flex: 0 0 auto;
        margin-bottom: 16px;
    }

    .announcements-page .page-header h1 {
        font-size: 25px;
    }

    .announcements-page .flash-message {
        flex: 0 0 auto;
    }

    .announcements-workspace {
        flex: 1 1 auto;
        min-height: 0;
        grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
        align-items: stretch;
    }

    .announcements-composer-card,
    .announcements-feed-card {
        min-height: 0;
        overflow-y: auto;
        padding: 18px;
    }

    .announcements-composer-card {
        align-self: start;
        max-height: 100%;
        overflow-y: auto;
    }

    .announcements-feed-card {
        height: 100%;
        padding: 0 4px 0 0;
    }

    .announcements-composer-card .card-title,
    .announcements-feed-card .card-title {
        margin-bottom: 12px;
    }

    .announcements-feed-card .card-title {
        position: sticky;
        top: 0;
        z-index: 2;
        padding: 0 0 12px;
        background: var(--content-bg);
    }

    .announcements-composer-card .form-row {
        flex-direction: column;
        gap: 12px;
    }

    .announcements-composer-card .form-group {
        margin-bottom: 12px;
    }

    .announcements-composer-card .form-group label {
        margin-bottom: 5px;
        font-size: 11px;
    }

    .announcements-composer-card .form-group input,
    .announcements-composer-card .form-group select,
    .announcements-composer-card .form-group textarea {
        padding: 9px 12px;
        font-size: 12.5px;
    }

    .announcements-composer-card .form-group textarea {
        min-height: 116px;
    }

    .announcements-composer-card .form-actions {
        padding-top: 4px;
    }

    .announcements-composer-card .btn {
        padding: 9px 16px;
        font-size: 12.5px;
    }

    .announcements-feed-card .announcement-card {
        padding: 16px;
    }
}

/* Announcement Cards (on the announcements page) */
.announcements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.announcement-card {
    position: relative;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.announcement-card:last-child {
    border-bottom: 1px solid var(--border-color);
}

.announcement-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.announcement-card-header h4 {
    font-size: 15px;
    line-height: 1.25;
    font-weight: 700;
}

.announcement-meta {
    font-size: 11px;
    color: var(--text-light);
    display: block;
    margin-top: 4px;
}

.announcement-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 2px;
}

.announcement-form .form-actions {
    justify-content: flex-start;
}

.attachment-input {
    display: none;
}

.attachment-picker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px 16px;
    border: 1.5px dashed rgba(55, 84, 219, 0.35);
    border-radius: var(--radius-sm);
    background: rgba(55, 84, 219, 0.04);
    color: var(--primary-blue);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.attachment-picker:hover {
    background: rgba(55, 84, 219, 0.08);
    border-color: var(--primary-blue);
}

.announcement-attachment-note {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--text-secondary);
}

.announcement-selected-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    max-height: 132px;
    overflow-y: auto;
}

.announcement-selected-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(55, 84, 219, 0.16);
    background: #f7f9ff;
}

.announcement-selected-preview {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(55, 84, 219, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.announcement-selected-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.announcement-selected-icon {
    color: var(--primary-blue);
    font-size: 18px;
}

.announcement-selected-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.announcement-selected-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.announcement-selected-size {
    font-size: 11px;
    color: var(--text-secondary);
}

.announcement-selected-remove {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.announcement-selected-remove:hover {
    background: rgba(239, 68, 68, 0.2);
}

.announcement-file-pill,
.announcement-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(55, 84, 219, 0.08);
    color: var(--primary-blue);
    font-size: 12px;
    font-weight: 600;
}

.announcement-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.announcement-image-thumb {
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #f8f9fc;
    height: clamp(112px, 18vh, 184px);
    min-height: 0;
    padding: 0;
    cursor: zoom-in;
    appearance: none;
}

.announcement-image-thumb img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    display: block;
}

.announcement-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 16, 28, 0.86);
}

.announcement-image-lightbox.active {
    display: flex;
}

.announcement-image-lightbox img {
    max-width: min(100%, 1100px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.announcement-image-lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: white;
    cursor: pointer;
}

.announcement-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.announcement-file-chip {
    text-decoration: none;
}

.announcement-comments {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.announcement-comments summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-blue);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.announcement-comment-empty {
    margin-top: 10px;
    color: var(--text-light);
    font-size: 12px;
    font-style: italic;
}

.announcement-comment-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.announcement-comment-item {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f8fafc;
}

.announcement-comment-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--text-light);
    font-size: 11px;
}

.announcement-comment-meta strong {
    color: var(--text-primary);
    font-size: 12px;
}

.announcement-comment-item p {
    color: var(--text-secondary);
    font-size: 12.5px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

/* Empty message */
.empty-message {
    color: var(--text-light);
    font-style: italic;
    padding: 16px 0;
    font-size: 13px;
}

/* Flash message */
.flash-message {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.flash-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.flash-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ======================================================
   LOGIN PAGE
====================================================== */
.login-body {
    background: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-circle {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
    height: 96px;
    min-height: 96px;
    max-height: 96px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 4px 20px rgba(55, 84, 219, 0.35);
    overflow: hidden;
    padding: 3px;
}

.login-logo-circle img {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
    display: block;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: -0.3px;
}

.login-error {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.login-success {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid rgba(16, 185, 129, 0.18);
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form .form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.login-form .form-group input {
    padding: 13px 18px;
    border-radius: 25px;
    background: var(--primary-blue);
    border: 2px solid transparent;
    color: white;
    font-size: 13.5px;
}

.login-form .form-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.login-form .form-group input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(90, 115, 232, 0.2);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
    box-shadow: 0 4px 15px rgba(55, 84, 219, 0.3);
}

.login-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 20px rgba(55, 84, 219, 0.4);
    transform: translateY(-1px);
}

.login-helper-actions {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.login-link-btn {
    background: transparent;
    border: none;
    color: var(--primary-blue);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.login-link-btn:hover {
    color: var(--primary-dark);
}

/* ======================================================
   MESSAGES
====================================================== */
.messages-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.message-scope-tabs {
    display: inline-flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}

.message-scope-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.message-scope-tab:hover {
    color: var(--text-primary);
    background: rgba(55, 84, 219, 0.06);
}

.message-scope-tab.active {
    background: linear-gradient(135deg, var(--primary-blue), #5a73e8);
    color: white;
    box-shadow: 0 4px 12px rgba(55, 84, 219, 0.25);
}

.conversations-panel,
.message-panel {
    margin-bottom: 0;
}

@media (min-width: 1025px) {
    .messages-page {
        height: 100vh;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .messages-page .page-header {
        flex: 0 0 auto;
        margin-bottom: 18px;
    }

    .messages-page .message-scope-tabs {
        flex: 0 0 auto;
        margin-bottom: 14px;
    }

    .messages-page .flash-message {
        flex: 0 0 auto;
    }

    .messages-page .messages-layout {
        flex: 1 1 auto;
        min-height: 0;
        align-items: stretch;
    }

    .messages-page .conversations-panel,
    .messages-page .message-panel {
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .messages-page .section-header-inline,
    .messages-page .message-panel-header,
    .messages-page .message-compose {
        flex: 0 0 auto;
    }

    .messages-page .conversation-list,
    .messages-page .message-thread {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

    .messages-page .message-thread {
        max-height: none;
    }
}

.messages-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: min(100%, 760px);
}

.messages-availability-trigger {
    flex-shrink: 0;
}

.messages-availability-trigger small {
    margin-left: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.messages-search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    width: min(100%, 460px);
}

.messages-search-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--card-bg);
    outline: none;
    transition: var(--transition);
}

.messages-search-form input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(55, 84, 219, 0.1);
}

.message-availability-modal {
    max-width: 620px;
}

.availability-modal-status {
    margin-bottom: 18px;
    padding: 14px 16px;
    background: rgba(55, 84, 219, 0.06);
    border: 1px solid rgba(55, 84, 219, 0.12);
    border-radius: var(--radius-md);
}

.availability-modal-status span {
    display: block;
    color: var(--primary-blue);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.availability-modal-status p {
    color: var(--text-secondary);
    font-size: 12px;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.conversation-link {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    background: #fbfbfd;
}

.conversation-link:hover,
.conversation-link.active {
    border-color: rgba(55, 84, 219, 0.35);
    background: rgba(55, 84, 219, 0.05);
    box-shadow: var(--shadow-sm);
}

.conversation-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.conversation-name {
    display: inline-block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-right: 8px;
}

.role-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(55, 84, 219, 0.1);
    color: var(--primary-blue);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.conversation-badge {
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--primary-blue);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.conversation-snippet {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.5;
}

.conversation-meta {
    font-size: 11px;
    color: var(--text-light);
}

.conversation-context {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.role-pill-group {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.message-panel {
    padding: 0;
    overflow: hidden;
}

.message-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 70px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
    background: #ffffff;
}

.message-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, #64B5F6, #2962FF);
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(41, 98, 255, 0.24);
}

.message-panel-header h3 {
    font-size: 16px;
    line-height: 1.2;
    margin-bottom: 2px;
}

.message-panel-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.message-thread {
    min-height: 420px;
    max-height: 620px;
    overflow-y: auto;
    padding: 18px 22px;
    margin-bottom: 0;
    background: #ffffff;
    scrollbar-gutter: stable;
}

.message-row {
    display: flex;
    margin-bottom: 8px;
}

.message-row.incoming {
    justify-content: flex-start;
}

.message-row.outgoing {
    justify-content: flex-end;
}

.message-bubble {
    max-width: min(68%, 680px);
    border-radius: 20px;
    padding: 10px 14px 9px;
    box-shadow: none;
}

.message-bubble.incoming {
    background: #f0f2f5;
    border: 0;
    color: #111827;
    border-bottom-left-radius: 6px;
}

.message-bubble.outgoing {
    background: linear-gradient(135deg, #64B5F6, #2962FF);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-bubble p {
    font-size: 13.5px;
    line-height: 1.45;
    margin-bottom: 5px;
    word-break: break-word;
}

.message-attachment-image {
    display: block;
    width: min(260px, 100%);
    max-height: 240px;
    overflow: hidden;
    border: 0;
    border-radius: 12px;
    padding: 0;
    margin: 4px 0 10px;
    background: rgba(0, 0, 0, 0.08);
    cursor: zoom-in;
}

.message-attachment-image img {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: cover;
}

.message-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 8px 11px;
    margin: 4px 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary-blue);
    font-size: 12px;
    font-weight: 700;
}

.message-attachment-file span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-bubble.incoming .message-attachment-file {
    background: rgba(55, 84, 219, 0.08);
}

.message-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10, 16, 28, 0.86);
}

.message-image-lightbox.active {
    display: flex;
}

.message-image-lightbox img {
    max-width: min(100%, 1100px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.message-image-lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: white;
    cursor: pointer;
}

.message-time {
    display: block;
    font-size: 10.5px;
    line-height: 1.2;
    opacity: 0.72;
}

.message-compose {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 14px;
    border-top: 0;
    background: #1A3A5C;
    box-shadow: 0 -8px 22px rgba(13, 27, 42, 0.16);
}

.messenger-attachment-input {
    display: none;
}

.messenger-compose-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 2px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

.messenger-compose-icon-btn,
.messenger-send-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    cursor: pointer;
    transition: var(--transition);
}

.messenger-compose-icon-btn {
    background: transparent;
    color: #ffffff;
    font-size: 15px;
}

.messenger-compose-icon-btn:hover,
.messenger-compose-icon-btn:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.messenger-compose-field {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    border-radius: 999px;
    background: #0f2b45;
}

.messenger-compose-field textarea {
    width: 100%;
    min-height: 38px;
    max-height: 132px;
    padding: 10px 46px 10px 16px;
    border: 0;
    border-radius: 999px;
    resize: none;
    overflow-y: auto;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.35;
    outline: none;
}

.messenger-compose-field textarea::placeholder {
    color: rgba(255, 255, 255, 0.62);
}

.messenger-compose-field .messenger-emoji-toggle {
    position: absolute;
    right: 2px;
    bottom: 1px;
    color: rgba(255, 255, 255, 0.76);
}

.messenger-send-btn {
    min-width: 36px;
    color: #ffffff;
    font-size: 14px;
    background: linear-gradient(135deg, #2962FF, #1E88E5);
    box-shadow: 0 6px 14px rgba(41, 98, 255, 0.32);
}

.messenger-send-btn:hover,
.messenger-send-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(41, 98, 255, 0.4);
    outline: none;
}

.messenger-file-chip {
    position: absolute;
    left: 12px;
    bottom: calc(100% + 8px);
    max-width: min(320px, 80%);
    padding: 6px 10px;
    border-radius: 999px;
    background: #ffffff;
    color: #1A3A5C;
    font-size: 11px;
    font-weight: 700;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.messenger-emoji-panel {
    position: absolute;
    right: 58px;
    bottom: calc(100% + 8px);
    display: flex;
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(26, 58, 92, 0.12);
    border-radius: 999px;
    background: #ffffff;
    box-shadow: var(--shadow-lg);
    z-index: 4;
}

.messenger-emoji-panel[hidden] {
    display: none;
}

.messenger-emoji-panel button {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.messenger-emoji-panel button:hover,
.messenger-emoji-panel button:focus-visible {
    background: #f0f2f5;
    outline: none;
}

.group-thread-item {
    margin-bottom: 14px;
}

.group-thread-item.outgoing {
    text-align: right;
}

.group-thread-item.incoming {
    text-align: left;
}

.group-thread-sender {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding: 0 4px;
}

.group-notification-row {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.group-notification-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(26, 58, 92, 0.08);
    color: var(--text-secondary);
    font-size: 11.5px;
    font-style: italic;
}

.messages-empty-state {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
}

.messages-empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ======================================================
   AUTO REPLIES
====================================================== */
.auto-reply-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.auto-reply-summary-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auto-reply-summary-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auto-reply-summary-card strong {
    font-size: 28px;
    line-height: 1.1;
}

.auto-reply-summary-card p {
    font-size: 12px;
    color: var(--text-secondary);
}

.auto-reply-layout {
    display: grid;
    gap: 20px;
}

.auto-reply-guide-card {
    margin-bottom: 0;
}

.auto-reply-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.auto-reply-guide-item {
    display: flex;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: #fafbff;
}

.auto-reply-guide-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(55, 84, 219, 0.12);
    color: var(--primary-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.auto-reply-guide-item h4 {
    font-size: 14px;
    margin-bottom: 6px;
}

.auto-reply-guide-item p,
.auto-reply-note,
.form-hint,
.auto-reply-readonly {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.auto-reply-note {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(55, 84, 219, 0.05);
    border: 1px solid rgba(55, 84, 219, 0.12);
}

.auto-reply-table td {
    vertical-align: top;
}

.auto-reply-keywords-cell,
.auto-reply-preview-cell {
    max-width: 260px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.role-pill-scope {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.auto-reply-checkbox {
    margin-bottom: 8px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-transform: none;
    letter-spacing: 0;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

/* ======================================================
   ACADEMIC STRUCTURE MODULES
====================================================== */
.academic-summary-grid {
    margin-bottom: 24px;
}

.academic-summary-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.04));
    border: 1px solid rgba(59, 130, 246, 0.12);
}

.academic-table-title {
    font-weight: 600;
    color: var(--text-primary);
}

.academic-table-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

#classworkModal .premium-modal-content {
    display: flex;
    flex-direction: column;
    width: min(860px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow: hidden;
}

.classwork-modal-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}

#classworkModal .classwork-modal-tabs {
    flex: 0 0 auto;
    display: flex;
    width: 100%;
    margin: 0;
    padding: 6px 24px;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
    overflow-x: auto;
}

.classwork-modal-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.classwork-modal-tab:hover {
    color: var(--text-primary);
    background: rgba(55, 84, 219, 0.06);
}

.classwork-modal-tab.active {
    background: linear-gradient(135deg, var(--primary-blue), #5a73e8);
    color: white;
    box-shadow: 0 4px 12px rgba(55, 84, 219, 0.25);
}

.classwork-tab-panel {
    display: none;
}

#classworkModal .classwork-tab-panel {
    min-height: 0;
    padding: 20px 24px 24px;
    overflow-y: auto;
}

.classwork-tab-panel.active {
    display: block;
}

#classworkModal .form-actions {
    margin: 8px -24px -24px;
    padding: 16px 24px 24px;
}

.classwork-review-list {
    display: grid;
    gap: 16px;
}

.classwork-review-card {
    margin-bottom: 0;
}

.classwork-review-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.classwork-stat-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(55, 84, 219, 0.08);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.classwork-answer-text {
    white-space: pre-wrap;
    line-height: 1.5;
    color: var(--text-primary);
}

.classwork-link-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.assessment-question-list,
.assessment-answer-list,
.assessment-summary {
    display: grid;
    gap: 12px;
}

.assessment-question-card,
.assessment-answer-item,
.assessment-summary-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    padding: 14px;
}

.assessment-question-header,
.assessment-answer-prompt {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.assessment-answer-prompt {
    margin-bottom: 6px;
}

.assessment-answer-prompt span,
.assessment-summary-item span {
    color: var(--text-light);
    font-size: 12px;
    font-weight: 600;
}

.assessment-summary-item {
    display: grid;
    gap: 4px;
}

.classwork-grade-form {
    display: grid;
    gap: 8px;
    min-width: 220px;
}

.classwork-grade-form label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.classwork-grade-form input,
.classwork-grade-form textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    font-family: inherit;
    font-size: 14px;
    background: white;
}

.btn-small {
    padding: 10px 12px;
    font-size: 12px;
}

.classwork-review-table td {
    vertical-align: top;
}

.classwork-gradebook-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.classwork-gradebook-actions select {
    min-width: 170px;
    padding: 10px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: white;
    color: var(--text-primary);
    outline: none;
}

.classwork-gradebook-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.classwork-gradebook-stat {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(55, 84, 219, 0.14);
    background: linear-gradient(135deg, rgba(55, 84, 219, 0.08), rgba(90, 115, 232, 0.03));
}

.classwork-gradebook-stat span {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.classwork-gradebook-stat strong {
    font-size: 24px;
    color: var(--text-primary);
}

.classwork-gradebook-layout {
    display: grid;
    gap: 18px;
}

.classwork-gradebook-card {
    margin-bottom: 0;
}

.classwork-gradebook-card .content-card {
    margin-bottom: 14px;
}

.classwork-comment-thread {
    margin-top: 14px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(55, 84, 219, 0.12);
    background: #f8faff;
}

.classwork-comment-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.classwork-comment-list {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.classwork-comment-item {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: white;
}

.classwork-comment-item.student {
    border-color: rgba(59, 130, 246, 0.16);
    background: rgba(59, 130, 246, 0.05);
}

.classwork-comment-item.teacher {
    border-color: rgba(16, 185, 129, 0.18);
    background: rgba(16, 185, 129, 0.07);
}

.classwork-comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.classwork-comment-meta strong {
    font-size: 12px;
    color: var(--text-primary);
}

.classwork-comment-meta span {
    font-size: 11px;
    color: var(--text-light);
}

.classwork-comment-body {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    white-space: pre-wrap;
}

.classwork-comment-form {
    display: grid;
    gap: 8px;
}

.classwork-comment-form textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    min-height: 72px;
    background: white;
}

/* ======================================================
   RESPONSIVE
====================================================== */
@media (max-width: 1024px) {
    .dashboard-grid,
    .dashboard-compact-grid,
    .messages-layout {
        grid-template-columns: 1fr;
    }

    .students-layout {
        grid-template-columns: 1fr;
    }

    .student-detail-panel {
        position: static;
    }

    .classwork-review-stats {
        justify-content: flex-start;
    }

    .classwork-gradebook-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 200px;
    }

    .main-content {
        padding: 20px;
        overflow-wrap: anywhere;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
    }

    .messages-header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .messages-availability-trigger {
        justify-content: center;
    }

    .messages-search-form {
        width: 100%;
    }

    .message-scope-tabs {
        display: flex;
        width: 100%;
    }

    .message-scope-tab {
        flex: 1 1 0;
        justify-content: center;
    }

    .message-thread {
        min-height: 320px;
    }

    .content-card {
        overflow-x: auto;
    }

    .content-card > .data-table,
    #sections-table,
    #classes-table,
    .auto-reply-table {
        min-width: 720px;
    }

    .records-table {
        min-width: 920px;
    }

    .students-table-card {
        overflow-x: visible;
    }

    #students-table {
        min-width: 0;
    }

    #students-table,
    #students-table thead,
    #students-table tbody,
    #students-table tr,
    #students-table th,
    #students-table td {
        display: block;
        width: 100% !important;
    }

    #students-table thead {
        display: none;
    }

    #students-table tbody {
        display: grid;
        gap: 12px;
    }

    #students-table tbody tr {
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        background: var(--card-bg);
        padding: 12px 14px;
        box-shadow: var(--shadow-sm);
    }

    #students-table tbody tr.selected-row {
        border-color: rgba(55, 84, 219, 0.35);
        background: rgba(55, 84, 219, 0.06);
    }

    #students-table tbody td {
        display: grid;
        grid-template-columns: minmax(110px, 34%) minmax(0, 1fr);
        gap: 12px;
        align-items: center;
        border-bottom: 0;
        padding: 6px 0;
        text-align: left;
        white-space: normal;
    }

    #students-table tbody td::before {
        content: attr(data-label);
        color: var(--text-light);
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    #students-table tbody td[data-label="Actions"] {
        display: flex;
        justify-content: flex-end;
        padding-top: 10px;
    }

    #students-table tbody td[data-label="Actions"]::before {
        display: none;
    }

    #students-table tbody td.empty-cell {
        display: block;
        text-align: center;
    }

    #students-table tbody td.empty-cell::before {
        display: none;
    }

    .filter-form input,
    .filter-form select,
    .filter-input,
    .filter-input-wide,
    .filter-select,
    .filter-select-wide,
    .students-filter-select,
    .students-filter-select-wide {
        min-width: 0;
        width: 100%;
        flex: 1 1 100%;
    }

    .message-bubble {
        max-width: 92%;
    }

    .message-attachment-image {
        width: min(220px, 100%);
    }

    .modal {
        align-items: flex-start;
        padding: 12px;
    }

    .modal-content {
        max-width: 100%;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding: 20px;
    }

    .modal .form-actions {
        margin: 8px -20px -20px;
        padding: 14px 20px 20px;
    }

    .classwork-modal-tabs {
        display: flex;
        width: 100%;
    }

    .classwork-modal-tab {
        flex: 1 1 0;
        justify-content: center;
    }

    #classworkModal .classwork-modal-tabs {
        padding: 6px 16px;
    }

    #classworkModal .classwork-tab-panel {
        padding: 16px;
    }

    #classworkModal .form-actions {
        margin: 8px -16px -16px;
        padding: 14px 16px 16px;
    }

    .classwork-grade-form {
        min-width: 0;
    }

    .classwork-gradebook-actions {
        width: 100%;
    }

    .classwork-gradebook-actions select,
    .classwork-gradebook-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .classwork-comment-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 520px) {
    :root {
        --sidebar-width: 76px;
    }

    .sidebar-header {
        padding: 18px 12px;
    }

    .logo-placeholder {
        justify-content: center;
    }

    .logo-text,
    .nav-item span,
    .logout-btn span {
        display: none;
    }

    .nav-pair {
        grid-template-columns: 1fr;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .nav-item-compact {
        min-height: 44px;
    }

    .main-content {
        padding: 16px;
    }

    .modal-content {
        padding: 16px;
    }

    .modal .form-actions {
        margin: 8px -16px -16px;
        padding: 12px 16px 16px;
    }

    .modal .form-actions .btn {
        flex: 1 1 100%;
    }

    .stats-grid,
    .auto-reply-summary-grid {
        grid-template-columns: 1fr;
    }

    .message-scope-tabs,
    .classwork-modal-tabs {
        border-radius: var(--radius-md);
        overflow-x: auto;
    }

    .message-scope-tab,
    .classwork-modal-tab {
        min-width: max-content;
    }
}

@media (max-height: 720px) {
    .sidebar-header {
        padding: 14px 16px;
    }

    .logo-placeholder {
        min-height: 40px;
    }

    .logo-circle {
        --logo-size: 40px;
    }

    .logo-title {
        font-size: 16px;
    }

    .sidebar-nav {
        padding: 10px;
        gap: 2px;
    }

    .nav-item {
        padding: 9px 12px;
    }

    .sidebar-footer {
        padding: 12px;
    }

    .logout-btn {
        padding: 10px;
    }

    .modal {
        align-items: flex-start;
        padding: 12px;
    }

    .modal-content {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding: 18px 20px;
        border-radius: var(--radius-md);
    }

    .modal-header {
        margin-bottom: 14px;
    }

    .modal-header h2 {
        font-size: 17px;
    }

    .modal .form-group {
        margin-bottom: 12px;
    }

    .modal .form-group label {
        margin-bottom: 5px;
    }

    .modal .form-group input,
    .modal .form-group select,
    .modal .form-group textarea {
        padding: 9px 12px;
    }

    .modal .form-group textarea {
        min-height: 64px;
    }

    .modal .form-actions {
        margin: 6px -20px -18px;
        padding: 14px 20px 18px;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
}
