/* ==========================================================================
   BEGIN: Shared app shell styles (all pages)
   Includes global tokens, body defaults, sidebar, top navbar, notifications, and page lead.
   ========================================================================== */

:root {
    --sidebar-w: 260px;
    --sidebar-w-sm: 70px;
    --navbar-h: 62px;
    --sidebar-bg: #1a2236;
    --sidebar-text: #8892a4;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-active-bg: rgba(78, 115, 223, 0.14);
    --sidebar-border: rgba(255, 255, 255, 0.07);
    --accent: #4e73df;
    --danger: #e74a3b;
    --navbar-bg: #ffffff;
    --navbar-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    --content-bg: #f0f2f5;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

:lang(ar) body {
    font-family: "Cairo", sans-serif;
}

body {
    margin: 0;
    overflow-x: hidden;
    background: var(--content-bg);
    color: #343a40;
    font-family: "Inter", sans-serif;
    font-size: 0.9rem;
}

a {
    text-decoration: none;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

#appSidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    min-height: 100vh;
    overflow: hidden;
    background: var(--sidebar-bg);
    flex-direction: column;
    transition: var(--transition);
}

[dir="rtl"] #appSidebar {
    right: 0;
    left: auto;
}

#appSidebar.collapsed {
    width: var(--sidebar-w-sm);
    min-width: var(--sidebar-w-sm);
}

#appSidebar.collapsed.hover-expanded {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.sidebar-brand {
    display: flex;
    height: var(--navbar-h);
    padding: 0 1.25rem;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    border-bottom: 1px solid var(--sidebar-border);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-brand .brand-icon {
    display: flex;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
}

.sidebar-brand .brand-name {
    line-height: 1.2;
}

.sidebar-brand .brand-sub {
    display: block;
    color: var(--sidebar-text);
    font-size: 0.68rem;
    font-weight: 400;
}

#appSidebar.collapsed:not(.hover-expanded) .brand-name {
    display: none;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.75rem 0;
    overscroll-behavior: contain;
}

.sidebar-nav::-webkit-scrollbar {
    width: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
}

.nav-section-title {
    overflow: hidden;
    padding: 0.9rem 1.25rem 0.3rem;
    color: var(--sidebar-text);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

#appSidebar.collapsed:not(.hover-expanded) .nav-section-title {
    opacity: 0;
    pointer-events: none;
}

.sidebar-nav .nav-item {
    list-style: none;
}

.sidebar-nav .nav-link {
    display: flex;
    overflow: hidden;
    padding: 0.58rem 1.25rem;
    align-items: center;
    gap: 0.8rem;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    transition: var(--transition);
    white-space: nowrap;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    border-left: 3px solid var(--accent);
    background: var(--sidebar-active-bg);
    color: #fff;
}

[dir="rtl"] .sidebar-nav .nav-link.active {
    border-right: 3px solid var(--accent);
    border-left: none;
}

.nav-icon {
    width: 20px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.95rem;
}

.nav-label {
    font-weight: 500;
}

#appSidebar.collapsed:not(.hover-expanded) .nav-label {
    display: none;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.65rem;
}

[dir="rtl"] .nav-badge {
    margin-right: auto;
    margin-left: 0;
}

#appSidebar.collapsed:not(.hover-expanded) .nav-badge {
    display: none;
}

.sub-menu {
    max-height: 0;
    overflow: hidden;
    padding-left: 1rem;
    list-style: none;
    transition: max-height 0.3s ease;
}

[dir="rtl"] .sub-menu {
    padding-right: 1rem;
    padding-left: 0;
}

.sub-menu.open {
    max-height: 600px;
}

.sub-menu .nav-link {
    padding: 0.42rem 1.25rem;
    font-size: 0.82rem;
}

.sub-menu-indicator {
    opacity: 0.6;
    font-size: 0.35rem;
}

.nav-arrow {
    margin-left: auto;
    font-size: 0.65rem;
    transition: transform 0.2s;
}

[dir="rtl"] .nav-arrow {
    margin-right: auto;
    margin-left: 0;
}

.nav-link.open > .nav-arrow {
    transform: rotate(90deg);
}

#appSidebar.collapsed:not(.hover-expanded) .nav-arrow {
    display: none;
}

.sidebar-foot {
    display: flex;
    overflow: hidden;
    padding: 0.85rem 1.25rem;
    align-items: center;
    gap: 0.7rem;
    border-top: 1px solid var(--sidebar-border);
    white-space: nowrap;
}

.sidebar-foot .s-avatar {
    display: flex;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
}

.sidebar-foot .s-name {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
}

.sidebar-foot .s-role {
    color: var(--sidebar-text);
    font-size: 0.7rem;
}

#appSidebar.collapsed:not(.hover-expanded) .s-info {
    display: none;
}

.main-content {
    display: flex;
    min-height: 100vh;
    min-width: 0;
    margin-left: var(--sidebar-w);
    flex: 1;
    flex-direction: column;
    transition: margin 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="rtl"] .main-content {
    margin-right: var(--sidebar-w);
    margin-left: 0;
}

.main-content.expanded {
    margin-left: var(--sidebar-w-sm);
}

[dir="rtl"] .main-content.expanded {
    margin-right: var(--sidebar-w-sm);
    margin-left: 0;
}

.top-navbar {
    position: sticky;
    top: 0;
    z-index: 1040;
    display: flex;
    min-width: 0;
    height: var(--navbar-h);
    padding: 0 1.5rem;
    align-items: center;
    gap: 0.75rem;
    background: var(--navbar-bg);
    box-shadow: var(--navbar-shadow);
}

.toggle-btn {
    display: flex;
    padding: 0.38rem;
    align-items: center;
    border: none;
    border-radius: 0.375rem;
    background: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 1.15rem;
    transition: var(--transition);
}

.toggle-btn:hover {
    background: #f0f2f5;
    color: var(--accent);
}

.page-heading-sm {
    margin: 0;
    color: #343a40;
    font-size: 0.95rem;
    font-weight: 600;
}

.nav-actions {
    display: flex;
    min-width: 0;
    margin-left: auto;
    align-items: center;
    gap: 0.4rem;
}

[dir="rtl"] .nav-actions {
    margin-right: auto;
    margin-left: 0;
}

.role-switcher {
    display: flex;
    padding: 0.25rem 0.6rem;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: #fff;
}

.role-switcher-icon {
    color: #6c757d;
    font-size: 0.8rem;
}

.role-switcher-select {
    min-width: 9.75rem;
    border: none;
    background: transparent;
    color: #343a40;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    outline: none;
}

.role-switcher-select:focus {
    outline: none;
}

.icon-btn {
    position: relative;
    display: flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: none;
    color: #6c757d;
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
}

.icon-btn:hover {
    background: #f0f2f5;
    color: var(--accent);
}

.dot-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--danger);
}

[dir="rtl"] .dot-badge {
    right: auto;
    left: 6px;
}

.lang-btn {
    display: flex;
    padding: 0.28rem 0.6rem;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: none;
    color: #495057;
    cursor: pointer;
    font-size: 0.78rem;
    transition: var(--transition);
}

.lang-btn:hover {
    border-color: #ced4da;
    background: #f8f9fa;
}

.user-btn {
    display: flex;
    padding: 0.25rem 0.45rem;
    align-items: center;
    gap: 0.45rem;
    border: none;
    border-radius: 0.375rem;
    background: none;
    cursor: pointer;
    transition: var(--transition);
}

.user-btn:hover {
    background: #f0f2f5;
}

.u-avatar {
    display: flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}

.u-name {
    color: #343a40;
    font-size: 0.8rem;
    font-weight: 600;
}

.dropdown-chevron {
    font-size: 0.6rem;
}

.top-navbar .dropdown {
    position: relative;
}

.top-navbar .dropdown-menu {
    top: calc(100% + 0.5rem);
    right: 0;
    left: auto;
    margin: 0;
    max-width: calc(100vw - 1rem);
}

[dir="rtl"] .top-navbar .dropdown-menu {
    right: auto;
    left: 0;
}

.top-navbar .dropdown-menu.show {
    z-index: 1051;
    display: block;
}

.top-navbar .dropdown-menu[aria-labelledby="userDropdown"] {
    min-width: 13rem;
}

.top-navbar .dropdown-menu[aria-labelledby="langDropdown"] {
    min-width: 10rem;
}

.notif-icon {
    display: flex;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 0.78rem;
}

.notifications-menu {
    width: 310px;
    max-height: 400px;
    overflow-y: auto;
}

.notifications-mark-all {
    font-size: 0.75rem;
}

.notification-title {
    font-size: 0.82rem;
}

.notification-copy {
    font-size: 0.75rem;
}

.notification-time {
    font-size: 0.7rem;
}

.notifications-view-all {
    font-size: 0.78rem;
}

.page-lead {
    margin: 0;
    color: #6c757d;
    font-size: 0.88rem;
}

/* ==========================================================================
   END: Shared app shell styles (all pages)
   ========================================================================== */

/* ==========================================================================
   BEGIN: Shared data, card, table, and form components (role pages)
   Used by GeneralManager/Schools.html and other GeneralManager, SchoolManager,
   Teacher, Student, Parent, and Counselor pages.
   ========================================================================== */

.gm-toolbar-card,
.gm-table-card {
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.gm-toolbar-card {
    padding: 1.1rem;
}

.gm-toolbar-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(3, minmax(150px, 1fr)) auto;
    gap: 0.9rem;
    align-items: end;
}

.gm-field-label {
    display: block;
    margin-bottom: 0.4rem;
    color: #495057;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.gm-search-wrap {
    position: relative;
}

.gm-search-icon {
    position: absolute;
    top: 50%;
    left: 0.95rem;
    transform: translateY(-50%);
    color: #9aa3af;
    font-size: 0.82rem;
}

[dir="rtl"] .gm-search-icon {
    right: 0.95rem;
    left: auto;
}

.gm-search-input,
.gm-filter-select {
    width: 100%;
    border: 1px solid #d9dee7;
    border-radius: 0.85rem;
    background: #fff;
    color: #1f2937;
    font-size: 0.88rem;
}

.gm-search-input {
    padding: 0.78rem 1rem 0.78rem 2.5rem;
}

[dir="rtl"] .gm-search-input {
    padding-right: 2.5rem;
    padding-left: 1rem;
}

.gm-filter-select {
    padding: 0.78rem 0.95rem;
}

.gm-primary-btn {
    display: inline-flex;
    padding: 0.78rem 1rem;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: 0.85rem;
    background: var(--accent);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
}

.gm-primary-btn:hover {
    background: #4166d1;
    color: #fff;
}

.gm-table-card {
    overflow: hidden;
}

.gm-table-header {
    display: flex;
    padding: 1.1rem 1.25rem;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid #edf1f6;
}

.gm-table-title {
    margin: 0;
    color: #1f2937;
    font-size: 1rem;
    font-weight: 700;
}

.gm-table-subtitle {
    margin: 0.15rem 0 0;
    color: #6b7280;
    font-size: 0.82rem;
}

.gm-table-count {
    display: inline-flex;
    padding: 0.35rem 0.65rem;
    align-items: center;
    border-radius: 999px;
    background: rgba(78, 115, 223, 0.12);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

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

.gm-table {
    min-width: 980px;
    margin: 0;
    vertical-align: middle;
}

.gm-table thead th {
    padding: 0.95rem 1.1rem;
    border-bottom: 1px solid #edf1f6;
    background: #f8fafc;
    color: #6b7280;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.gm-table tbody td {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid #edf1f6;
    color: #334155;
    font-size: 0.88rem;
}

.gm-table tbody tr:last-child td {
    border-bottom: none;
}

.school-cell {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.school-logo {
    display: flex;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    background: rgba(78, 115, 223, 0.12);
    color: var(--accent);
    font-size: 1rem;
}

.school-name {
    color: #111827;
    font-weight: 700;
}

.school-sub {
    margin-top: 0.15rem;
    color: #6b7280;
    font-size: 0.78rem;
}

.gm-meta {
    display: inline-flex;
    padding: 0.28rem 0.6rem;
    align-items: center;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.76rem;
    font-weight: 600;
}

.status-pill {
    display: inline-flex;
    padding: 0.32rem 0.65rem;
    align-items: center;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.status-pill.active {
    background: rgba(16, 185, 129, 0.14);
    color: #0f9f6e;
}

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

.status-pill.review {
    background: rgba(59, 130, 246, 0.14);
    color: #2563eb;
}

.status-pill.inactive {
    background: rgba(100, 116, 139, 0.14);
    color: #475569;
}

.gm-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gm-action-btn {
    display: inline-flex;
    padding: 0.5rem 0.75rem;
    align-items: center;
    gap: 0.4rem;
    border-radius: 0.7rem;
    border: 1px solid #d9dee7;
    background: #fff;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.gm-action-btn:hover {
    border-color: #c4cfdd;
    background: #f8fafc;
}

.gm-action-btn.delete {
    border-color: rgba(220, 38, 38, 0.18);
    color: #b91c1c;
}

.gm-action-btn.delete:hover {
    background: rgba(220, 38, 38, 0.06);
}

.gm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.gm-kpi-card,
.gm-panel-card {
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.gm-kpi-card {
    display: flex;
    padding: 1.15rem;
    align-items: flex-start;
    gap: 0.95rem;
}

.gm-kpi-icon {
    display: inline-flex;
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.95rem;
    font-size: 1.05rem;
}

.gm-kpi-icon.primary {
    background: rgba(78, 115, 223, 0.14);
    color: #4e73df;
}

.gm-kpi-icon.success {
    background: rgba(16, 185, 129, 0.14);
    color: #0f9f6e;
}

.gm-kpi-icon.warning {
    background: rgba(245, 158, 11, 0.16);
    color: #b7791f;
}

.gm-kpi-icon.danger {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.gm-kpi-label {
    color: #6b7280;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.gm-kpi-value {
    margin-top: 0.2rem;
    color: #111827;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}

.gm-kpi-trend {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.gm-kpi-trend.positive {
    color: #15803d;
}

.gm-kpi-trend.warning {
    color: #b45309;
}

.gm-kpi-trend.negative {
    color: #b91c1c;
}

.gm-panel-card {
    padding: 1.15rem;
}

.gm-panel-header {
    margin-bottom: 0.9rem;
}

.gm-panel-title {
    margin: 0;
    color: #1f2937;
    font-size: 1rem;
    font-weight: 700;
}

.gm-panel-subtitle {
    margin: 0.2rem 0 0;
    color: #6b7280;
    font-size: 0.82rem;
}

.gm-quick-actions,
.gm-status-list,
.gm-region-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gm-quick-action,
.gm-status-row,
.gm-region-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid #edf1f6;
    border-radius: 0.9rem;
    background: #f8fafc;
}

.gm-quick-action {
    padding: 0.85rem 0.9rem;
    color: inherit;
    text-decoration: none;
}

.gm-quick-action:hover {
    border-color: #d9dee7;
    background: #f1f5f9;
    color: inherit;
}

.gm-quick-action-icon {
    display: inline-flex;
    width: 2.6rem;
    height: 2.6rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.8rem;
    background: rgba(78, 115, 223, 0.12);
    color: var(--accent);
    font-size: 0.95rem;
}

.gm-quick-action strong,
.gm-region-row strong {
    display: block;
    color: #111827;
    font-size: 0.9rem;
}

.gm-quick-action small,
.gm-region-row small {
    display: block;
    margin-top: 0.12rem;
    color: #6b7280;
    font-size: 0.76rem;
}

.gm-status-row,
.gm-region-row {
    padding: 0.85rem 0.9rem;
}

.gm-status-label {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #334155;
    font-size: 0.86rem;
    font-weight: 600;
}

.gm-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.95fr);
    gap: 1rem;
    align-items: start;
}

.gm-form-stack,
.gm-form-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gm-form-card {
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    padding: 1.15rem;
}

.gm-form-card-header {
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid #edf1f6;
}

.gm-form-card-title {
    margin: 0;
    color: #1f2937;
    font-size: 1rem;
    font-weight: 700;
}

.gm-form-card-subtitle {
    margin: 0.2rem 0 0;
    color: #6b7280;
    font-size: 0.82rem;
}

.gm-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.95rem 1rem;
}

.gm-input,
.gm-select,
.gm-textarea {
    width: 100%;
    border: 1px solid #d9dee7;
    border-radius: 0.85rem;
    background: #fff;
    color: #1f2937;
    font-size: 0.88rem;
}

.gm-input,
.gm-select {
    padding: 0.78rem 0.95rem;
}

.gm-textarea {
    min-height: 7.75rem;
    padding: 0.85rem 0.95rem;
    resize: vertical;
}

.gm-field-span-2 {
    grid-column: span 2;
}

.gm-form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.gm-form-actions .gm-primary-btn,
.gm-form-actions .gm-action-btn {
    min-width: 11.5rem;
    min-height: 3rem;
    padding: 0.78rem 1rem;
    justify-content: center;
}

.gm-switch {
    position: relative;
    display: flex;
    padding: 0.95rem;
    align-items: flex-start;
    gap: 0.85rem;
    border: 1px solid #d9dee7;
    border-radius: 0.9rem;
    background: #f8fafc;
    cursor: pointer;
}

.gm-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.gm-switch-slider {
    position: relative;
    width: 3rem;
    height: 1.7rem;
    flex-shrink: 0;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 0.2s ease;
}

.gm-switch-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 1.325rem;
    height: 1.325rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16);
    transition: transform 0.2s ease;
}

.gm-switch input:checked + .gm-switch-slider {
    background: var(--accent);
}

.gm-switch input:checked + .gm-switch-slider::before {
    transform: translateX(1.28rem);
}

[dir="rtl"] .gm-switch input:checked + .gm-switch-slider::before {
    transform: translateX(-1.28rem);
}

.gm-switch-copy strong {
    display: block;
    color: #111827;
    font-size: 0.9rem;
}

.gm-switch-copy small {
    display: block;
    margin-top: 0.2rem;
    color: #6b7280;
    font-size: 0.78rem;
    line-height: 1.45;
}

/* ==========================================================================
   END: Shared data, card, table, and form components (role pages)
   ========================================================================== */

/* ==========================================================================
   BEGIN: Shared content area, breadcrumbs, and dashboard utilities (all pages)
   ========================================================================== */

.content-area {
    flex: 1;
    min-width: 0;
    padding: 1.75rem;
}

.page-title-row {
    margin-bottom: 1.25rem;
}

.page-title-row h2 {
    margin: 0 0 0.2rem;
    color: #343a40;
    font-size: 1.3rem;
    font-weight: 700;
}

.breadcrumb {
    margin: 0;
    padding: 0;
    background: none;
    font-size: 0.78rem;
}

.breadcrumb-item a {
    color: #6c757d;
}

.stat-icon {
    display: flex;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.2rem;
}

.stat-icon-students {
    background: rgba(78, 115, 223, 0.12);
    color: #4e73df;
}

.stat-icon-teachers {
    background: rgba(28, 200, 138, 0.12);
    color: #1cc88a;
}

.stat-icon-classes {
    background: rgba(246, 194, 62, 0.12);
    color: #f6c23e;
}

.stat-icon-absent {
    background: rgba(231, 74, 59, 0.12);
    color: #e74a3b;
}

.stat-label {
    font-size: 0.75rem;
}

/* ==========================================================================
   END: Shared content area, breadcrumbs, and dashboard utilities (all pages)
   ========================================================================== */

/* ==========================================================================
   BEGIN: index.html specific styles (portal home)
   ========================================================================== */

.portal-home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.85fr);
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.35rem;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 1.15rem;
    background:
        radial-gradient(circle at top right, rgba(78, 115, 223, 0.16), transparent 42%),
        linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.portal-home-eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.portal-home-title {
    margin: 0.45rem 0 0;
    color: #0f172a;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.15;
}

.portal-home-copy {
    max-width: 44rem;
    margin: 0.9rem 0 0;
    color: #475569;
    font-size: 0.94rem;
    line-height: 1.65;
}

.portal-home-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.15rem;
}

.portal-home-highlight {
    display: grid;
    gap: 0.75rem;
}

.portal-home-highlight-card {
    display: flex;
    padding: 0.95rem 1rem;
    gap: 0.35rem;
    border: 1px solid rgba(78, 115, 223, 0.12);
    border-radius: 0.95rem;
    background: rgba(255, 255, 255, 0.88);
    flex-direction: column;
}

.portal-home-highlight-label {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.portal-home-highlight-value {
    color: #0f172a;
    font-size: 1.05rem;
    font-weight: 800;
}

.portal-home-highlight-copy {
    color: #475569;
    font-size: 0.8rem;
    line-height: 1.5;
}

.portal-home-kpi-grid,
.portal-home-grid {
    margin-top: 1rem;
}

.portal-home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 1rem;
    align-items: start;
}

.portal-home-grid .gm-panel-card {
    height: 100%;
}

/* ==========================================================================
   END: index.html specific styles (portal home)
   ========================================================================== */

/* ==========================================================================
   BEGIN: GeneralManager/SchoolDetails.html specific styles
   ========================================================================== */

.school-detail-hero {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 1.25rem;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.school-detail-hero-main {
    display: flex;
    min-width: 0;
    gap: 1rem;
    align-items: flex-start;
}

.school-detail-logo {
    display: flex;
    width: 4.5rem;
    height: 4.5rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: rgba(78, 115, 223, 0.12);
    color: var(--accent);
    font-size: 1.65rem;
}

.school-detail-title {
    margin: 0;
    color: #111827;
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.2;
}

.school-detail-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.school-detail-copy {
    margin: 0.65rem 0 0;
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.55;
}

.school-detail-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.school-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
    gap: 1rem;
    align-items: start;
}

.school-detail-stack {
    display: flex;
    gap: 1rem;
    flex-direction: column;
}

.school-detail-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.school-detail-info-item {
    padding: 0.85rem;
    border: 1px solid #edf1f6;
    border-radius: 0.9rem;
    background: #f8fafc;
}

.school-detail-info-label {
    display: block;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.school-detail-info-value {
    display: block;
    margin-top: 0.25rem;
    color: #111827;
    font-size: 0.9rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.school-detail-progress {
    overflow: hidden;
    height: 0.55rem;
    border-radius: 999px;
    background: #e2e8f0;
}

.school-detail-progress-bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.school-detail-progress-bar.success {
    background: #10b981;
}

.school-detail-progress-bar.warning {
    background: #f59e0b;
}

/* ==========================================================================
   END: GeneralManager/SchoolDetails.html specific styles
   ========================================================================== */

/* ==========================================================================
   BEGIN: Shared standalone view toolbar and layout base
   Used by calendar.html, messages.html, and settings.html.
   ========================================================================== */

.shared-view-toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.shared-view-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    align-items: center;
}

.calendar-layout,
.messages-layout,
.settings-layout {
    display: grid;
    gap: 1rem;
    align-items: start;
}

/* ==========================================================================
   END: Shared standalone view toolbar and layout base
   ========================================================================== */

/* ==========================================================================
   BEGIN: calendar.html specific styles
   ========================================================================== */

.calendar-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
}

.calendar-toolbar {
    align-items: stretch;
}

.calendar-toolbar-copy {
    display: flex;
    min-width: min(100%, 22rem);
    padding: 0.85rem 1rem;
    gap: 0.2rem;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    flex-direction: column;
}

.calendar-current-label {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.calendar-toolbar-copy strong {
    color: #111827;
    font-size: 0.98rem;
    font-weight: 800;
}

.calendar-toolbar-copy small {
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.4;
}

.calendar-toolbar-actions {
    justify-content: flex-end;
}

.calendar-date-input {
    min-height: 2.4rem;
    padding: 0.48rem 0.65rem;
    border: 1px solid #d9dee7;
    border-radius: 0.8rem;
    background: #fff;
    color: #111827;
    font-size: 0.82rem;
    font-weight: 700;
}

.calendar-board-scroll {
    overflow-x: visible;
    -webkit-overflow-scrolling: touch;
}

.calendar-board {
    width: 100%;
    min-width: 0;
}

.calendar-month-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.calendar-month-title {
    margin: 0;
    color: #111827;
    font-size: 1.05rem;
    font-weight: 800;
}

.calendar-control-group {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.calendar-icon-btn {
    display: inline-flex;
    width: 2.4rem;
    height: 2.4rem;
    align-items: center;
    justify-content: center;
    border: 1px solid #d9dee7;
    border-radius: 0.8rem;
    background: #fff;
    color: #334155;
    cursor: pointer;
    flex-shrink: 0;
}

.calendar-icon-btn:hover {
    border-color: #c4cfdd;
    background: #f8fafc;
    color: var(--accent);
}

.calendar-weekdays,
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
}

.calendar-weekdays {
    margin-bottom: 0.5rem;
}

.calendar-weekdays span {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
}

.calendar-day {
    display: flex;
    min-height: 7.25rem;
    min-width: 0;
    padding: 0.65rem;
    gap: 0.4rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    background: #fff;
    color: inherit;
    cursor: pointer;
    flex-direction: column;
    font: inherit;
    text-align: start;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.calendar-day:hover {
    border-color: rgba(78, 115, 223, 0.32);
    background: #f8fbff;
}

.calendar-day.muted {
    background: #f8fafc;
    color: #94a3b8;
}

.calendar-day.today {
    border-color: rgba(78, 115, 223, 0.48);
    box-shadow: inset 0 0 0 1px rgba(78, 115, 223, 0.18);
}

.calendar-day.is-selected {
    border-color: var(--accent);
    background: rgba(78, 115, 223, 0.08);
    box-shadow: inset 0 0 0 1px rgba(78, 115, 223, 0.24);
}

.calendar-date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    color: #111827;
    font-size: 0.84rem;
    font-weight: 800;
}

.calendar-date-note {
    color: var(--accent);
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
}

.calendar-event {
    display: block;
    padding: 0.35rem 0.45rem;
    border-left: 3px solid var(--accent);
    border-radius: 0.55rem;
    background: rgba(78, 115, 223, 0.1);
    color: #1e3a8a;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

[dir="rtl"] .calendar-event {
    border-right: 3px solid var(--accent);
    border-left: none;
}

.calendar-event.success {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.calendar-event.warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.14);
    color: #92400e;
}

.calendar-event.danger {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
    color: #991b1b;
}

.calendar-event-more {
    border-color: #94a3b8;
    background: #f1f5f9;
    color: #475569;
}

.calendar-selected-date-card {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 0.95rem;
}

.calendar-selected-number {
    display: flex;
    width: 4.75rem;
    height: 4.75rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: rgba(78, 115, 223, 0.12);
    color: var(--accent);
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
}

.calendar-selected-copy {
    min-width: 0;
}

.calendar-selected-copy h3 {
    margin: 0;
    color: #111827;
    font-size: 1.05rem;
    font-weight: 800;
}

.calendar-selected-copy p {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.45;
}

.calendar-day-nav-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
}

.schedule-list {
    display: flex;
    gap: 0.75rem;
    flex-direction: column;
}

/* ==========================================================================
   END: calendar.html specific styles
   ========================================================================== */

/* ==========================================================================
   BEGIN: Shared row/card base
   Used by calendar.html, messages.html, and settings.html.
   ========================================================================== */

.schedule-row,
.message-item,
.settings-nav-link,
.preference-row {
    display: flex;
    gap: 0.75rem;
    border: 1px solid #edf1f6;
    border-radius: 0.9rem;
    background: #f8fafc;
}

/* ==========================================================================
   END: Shared row/card base
   ========================================================================== */

/* ==========================================================================
   BEGIN: calendar.html specific styles (schedule rows and empty state)
   ========================================================================== */

.schedule-row {
    padding: 0.85rem 0.9rem;
    align-items: center;
}

.schedule-time {
    min-width: 4.75rem;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
}

.schedule-copy {
    min-width: 0;
    flex: 1;
}

.schedule-copy strong {
    display: block;
    color: #111827;
    font-size: 0.88rem;
}

.schedule-copy small {
    display: block;
    margin-top: 0.18rem;
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.45;
}

.schedule-row .status-pill {
    margin-left: auto;
    flex-shrink: 0;
}

[dir="rtl"] .schedule-row .status-pill {
    margin-right: auto;
    margin-left: 0;
}

.calendar-empty-state {
    display: flex;
    padding: 1rem;
    gap: 0.85rem;
    align-items: flex-start;
    border: 1px dashed #cbd5e1;
    border-radius: 0.9rem;
    background: #f8fafc;
    color: #475569;
}

.calendar-empty-state i {
    display: inline-flex;
    width: 2.35rem;
    height: 2.35rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: rgba(78, 115, 223, 0.12);
    color: var(--accent);
}

.calendar-empty-state strong {
    display: block;
    color: #111827;
    font-size: 0.9rem;
}

.calendar-empty-state small {
    display: block;
    margin-top: 0.18rem;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.45;
}

/* ==========================================================================
   END: calendar.html specific styles (schedule rows and empty state)
   ========================================================================== */

/* ==========================================================================
   BEGIN: messages.html specific styles
   ========================================================================== */

.messages-layout {
    grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
}

.message-list {
    display: flex;
    gap: 0.7rem;
    flex-direction: column;
}

.message-item {
    width: 100%;
    padding: 0.85rem;
    align-items: flex-start;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

[dir="rtl"] .message-item {
    text-align: right;
}

.message-item.active {
    border-color: rgba(78, 115, 223, 0.42);
    background: rgba(78, 115, 223, 0.08);
}

.message-avatar {
    display: inline-flex;
    width: 2.7rem;
    height: 2.7rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(78, 115, 223, 0.14);
    color: var(--accent);
    font-weight: 800;
}

.message-preview {
    min-width: 0;
    flex: 1;
}

.message-preview-top {
    display: flex;
    min-width: 0;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
}

.message-sender {
    color: #111827;
    font-size: 0.88rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.message-time {
    flex-shrink: 0;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
}

.message-subject {
    margin-top: 0.2rem;
    color: #334155;
    font-size: 0.8rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.message-snippet {
    margin-top: 0.18rem;
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.message-thread-header {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid #edf1f6;
}

.message-thread-title {
    margin: 0;
    color: #111827;
    font-size: 1.05rem;
    font-weight: 800;
}

.message-thread-meta {
    margin: 0.25rem 0 0;
    color: #64748b;
    font-size: 0.8rem;
}

.message-bubbles {
    display: flex;
    gap: 0.8rem;
    flex-direction: column;
}

.message-bubble {
    max-width: 78%;
    padding: 0.85rem 0.95rem;
    border: 1px solid #edf1f6;
    border-radius: 0.95rem;
    background: #f8fafc;
    color: #334155;
    line-height: 1.55;
}

.message-bubble.outgoing {
    margin-left: auto;
    border-color: rgba(78, 115, 223, 0.16);
    background: rgba(78, 115, 223, 0.1);
    color: #1e3a8a;
}

[dir="rtl"] .message-bubble.outgoing {
    margin-right: auto;
    margin-left: 0;
}

.message-bubble small {
    display: block;
    margin-bottom: 0.25rem;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
}

.message-compose {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    align-items: flex-end;
}

.message-compose textarea {
    flex: 1;
    min-height: 5rem;
}

/* ==========================================================================
   END: messages.html specific styles
   ========================================================================== */

/* ==========================================================================
   BEGIN: settings.html specific styles
   ========================================================================== */

.settings-layout {
    grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
}

.settings-nav {
    display: flex;
    gap: 0.65rem;
    flex-direction: column;
}

.settings-nav-link {
    padding: 0.8rem 0.85rem;
    align-items: center;
    color: #334155;
    font-size: 0.84rem;
    font-weight: 800;
    text-decoration: none;
}

.settings-nav-link:hover {
    border-color: #d9dee7;
    background: #f1f5f9;
    color: var(--accent);
}

.settings-nav-link.active {
    border-color: rgba(78, 115, 223, 0.36);
    background: rgba(78, 115, 223, 0.1);
    color: var(--accent);
}

.settings-nav-link i {
    width: 1.1rem;
    text-align: center;
}

.settings-section-stack {
    display: flex;
    gap: 1rem;
    flex-direction: column;
}

.settings-profile-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.settings-profile-avatar {
    display: flex;
    width: 4.25rem;
    height: 4.25rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 800;
}

.settings-profile-copy {
    min-width: 0;
}

.settings-profile-copy strong {
    display: block;
    color: #111827;
    font-size: 1rem;
}

.settings-profile-copy span {
    display: block;
    margin-top: 0.2rem;
    color: #64748b;
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.preference-row {
    padding: 0.9rem;
    align-items: flex-start;
    justify-content: space-between;
}

.preference-copy {
    min-width: 0;
}

.preference-copy strong {
    display: block;
    color: #111827;
    font-size: 0.9rem;
}

.preference-copy small {
    display: block;
    margin-top: 0.2rem;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.45;
}

.settings-color-list {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.settings-color-option {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.settings-color-option.active {
    border-color: #111827;
}

.settings-color-swatch {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.settings-color-swatch.blue {
    background: #4e73df;
}

.settings-color-swatch.green {
    background: #10b981;
}

.settings-color-swatch.gold {
    background: #f59e0b;
}

.settings-color-swatch.slate {
    background: #475569;
}

/* ==========================================================================
   END: settings.html specific styles
   ========================================================================== */

/* ==========================================================================
   BEGIN: Shared footer, overlay, and mobile table helpers (all pages)
   ========================================================================== */

.app-footer {
    display: flex;
    padding: 0.9rem 1.75rem;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-top: 1px solid #e9ecef;
    background: #fff;
    color: #858796;
    font-size: 0.76rem;
}

.app-footer a {
    color: #858796;
}

.app-footer a:hover {
    color: var(--accent);
}

body.mobile-friendly-view .gm-table-wrap {
    -webkit-overflow-scrolling: touch;
}

#sidebarOverlay {
    position: fixed;
    inset: 0;
    z-index: 1035;
    display: none;
    background: rgba(0, 0, 0, 0.4);
}

#sidebarOverlay.show {
    display: block;
}

/* ==========================================================================
   END: Shared footer, overlay, and mobile table helpers (all pages)
   ========================================================================== */

/* ==========================================================================
   BEGIN: Responsive overrides (shared and page-specific)
   When splitting files, keep page-prefixed selectors with their matching page CSS.
   ========================================================================== */

@media (max-width: 991.98px) {
    #appSidebar {
        left: calc(-1 * var(--sidebar-w));
    }

    [dir="rtl"] #appSidebar {
        right: calc(-1 * var(--sidebar-w));
        left: auto;
    }

    #appSidebar.mobile-open {
        left: 0;
    }

    [dir="rtl"] #appSidebar.mobile-open {
        right: 0;
        left: auto;
    }

    .main-content,
    [dir="rtl"] .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

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

    body.mobile-friendly-view .content-area {
        padding: 1.25rem;
    }

    body.mobile-friendly-view .app-footer {
        padding: 0.85rem 1.25rem;
    }

    body.mobile-friendly-view .gm-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.mobile-friendly-view .gm-table {
        min-width: 760px;
    }

    .portal-home-hero,
    .portal-home-grid,
    .school-detail-grid,
    .calendar-layout,
    .messages-layout,
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .school-detail-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .school-detail-actions {
        justify-content: flex-start;
    }

    .calendar-toolbar-copy {
        flex: 1 1 20rem;
    }

    .settings-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 767.98px) {
    .top-navbar {
        padding: 0 0.75rem;
    }

    .nav-actions {
        gap: 0.25rem;
    }

    .role-switcher {
        padding: 0.2rem 0.45rem;
        gap: 0.35rem;
    }

    .role-switcher-select {
        min-width: 7.75rem;
        font-size: 0.74rem;
    }

    .gm-toolbar-grid {
        grid-template-columns: 1fr;
    }

    .gm-table-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .gm-form-grid {
        grid-template-columns: 1fr;
    }

    .gm-field-span-2 {
        grid-column: auto;
    }

    .gm-kpi-card,
    .gm-quick-action,
    .gm-status-row,
    .gm-region-row {
        padding: 0.9rem;
    }

    .gm-form-card {
        padding: 1rem;
    }

    .gm-form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .gm-kpi-value {
        font-size: 1.5rem;
    }

    .top-navbar .dropdown-menu {
        position: absolute;
        top: calc(100% + 0.45rem);
        right: 0;
        left: auto;
        min-width: 0;
        margin: 0;
        max-width: calc(100vw - 1.25rem);
    }

    [dir="rtl"] .top-navbar .dropdown-menu {
        right: auto;
        left: 0;
    }

    .notifications-menu {
        width: min(310px, calc(100vw - 1.25rem));
        max-height: calc(100vh - var(--navbar-h) - 1rem);
    }

    .top-navbar .dropdown-menu[aria-labelledby="userDropdown"] {
        width: min(13rem, calc(100vw - 1.25rem));
    }

    .top-navbar .dropdown-menu[aria-labelledby="langDropdown"] {
        width: min(10rem, calc(100vw - 1.25rem));
    }

    body.mobile-friendly-view .top-navbar {
        height: auto;
        min-height: var(--navbar-h);
        padding: 0.7rem 0.75rem;
        align-items: center;
        gap: 0.45rem;
        flex-wrap: nowrap;
    }

    body.mobile-friendly-view .toggle-btn {
        flex: 0 0 auto;
    }

    body.mobile-friendly-view .page-heading-sm.d-none.d-sm-block {
        display: none !important;
    }

    body.mobile-friendly-view .nav-actions,
    [dir="rtl"] body.mobile-friendly-view .nav-actions {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        margin-right: 0;
        margin-left: auto;
        align-items: center;
        justify-content: flex-end;
        gap: 0.35rem;
        flex-wrap: nowrap;
    }

    [dir="rtl"] body.mobile-friendly-view .nav-actions {
        margin-right: auto;
        margin-left: 0;
    }

    body.mobile-friendly-view .nav-actions > * {
        flex: 0 0 auto;
        min-width: 0;
    }

    body.mobile-friendly-view .role-switcher {
        max-width: clamp(6.75rem, 34vw, 9rem);
        padding: 0.18rem 0.42rem;
        gap: 0.3rem;
        flex: 1 1 auto;
    }

    body.mobile-friendly-view .role-switcher-select {
        width: 100%;
        min-width: 0;
        font-size: 0.7rem;
    }

    body.mobile-friendly-view .icon-btn {
        width: 34px;
        height: 34px;
        font-size: 0.88rem;
    }

    body.mobile-friendly-view .lang-btn {
        min-width: 3.2rem;
        padding: 0.2rem 0.48rem;
        gap: 0.3rem;
        border-color: #cbd5e1;
        background: #f8fafc;
        color: #1f2937;
        font-size: 0.7rem;
        font-weight: 700;
    }

    body.mobile-friendly-view .lang-btn #langFlag {
        display: none;
    }

    body.mobile-friendly-view .lang-btn .dropdown-chevron {
        display: inline-block;
        color: #64748b;
    }

    body.mobile-friendly-view .user-btn {
        padding: 0.15rem;
    }

    body.mobile-friendly-view .u-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.74rem;
    }

    body.mobile-friendly-view .content-area {
        padding: 1rem 0.9rem;
    }

    body.mobile-friendly-view .page-title-row {
        margin-bottom: 1rem;
    }

    body.mobile-friendly-view .page-title-row h2 {
        font-size: 1.1rem;
    }

    body.mobile-friendly-view .page-lead {
        font-size: 0.82rem;
        line-height: 1.5;
    }

    body.mobile-friendly-view .portal-home-hero {
        padding: 1rem;
        border-radius: 1rem;
    }

    body.mobile-friendly-view .portal-home-title {
        font-size: 1.55rem;
    }

    body.mobile-friendly-view .portal-home-copy {
        font-size: 0.86rem;
    }

    body.mobile-friendly-view .portal-home-actions {
        flex-direction: column;
        align-items: stretch;
    }

    body.mobile-friendly-view .portal-home-actions .gm-primary-btn,
    body.mobile-friendly-view .portal-home-actions .gm-action-btn {
        width: 100%;
        justify-content: center;
    }

    body.mobile-friendly-view .breadcrumb {
        display: flex;
        gap: 0.2rem 0.45rem;
        flex-wrap: wrap;
    }

    body.mobile-friendly-view .gm-toolbar-card,
    body.mobile-friendly-view .gm-table-card,
    body.mobile-friendly-view .gm-panel-card,
    body.mobile-friendly-view .gm-form-card {
        padding: 0.95rem;
        border-radius: 0.9rem;
    }

    body.mobile-friendly-view .gm-kpi-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    body.mobile-friendly-view .gm-kpi-card {
        padding: 1rem;
        gap: 0.8rem;
    }

    body.mobile-friendly-view .gm-kpi-icon {
        width: 2.75rem;
        height: 2.75rem;
    }

    body.mobile-friendly-view .gm-kpi-value {
        font-size: 1.45rem;
    }

    body.mobile-friendly-view .gm-table {
        min-width: 640px;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack {
        display: block;
        width: 100%;
        min-width: 0;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack thead {
        display: none;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack tbody {
        display: flex;
        padding: 0.9rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack tr,
    body.mobile-friendly-view .gm-table.gm-table-stack th[scope="row"],
    body.mobile-friendly-view .gm-table.gm-table-stack td {
        display: block;
        width: 100%;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack tr {
        overflow: hidden;
        border: 1px solid #edf1f6;
        border-radius: 0.95rem;
        background: #f8fafc;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack th[scope="row"] {
        padding: 0.8rem 0.9rem;
        border-bottom: 1px solid #e2e8f0;
        background: #fff;
        color: #111827;
        font-size: 0.82rem;
        font-weight: 700;
        text-align: start !important;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack td {
        display: grid;
        grid-template-columns: minmax(5.75rem, 7.25rem) minmax(0, 1fr);
        gap: 0.7rem;
        align-items: start;
        padding: 0.8rem 0.9rem;
        border-bottom: 1px solid #edf1f6;
        color: #334155;
        font-size: 0.84rem;
        text-align: start !important;
        white-space: normal;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack tr td:last-child {
        border-bottom: none;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        line-height: 1.4;
        text-transform: uppercase;
        overflow-wrap: anywhere;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack td[colspan] {
        grid-template-columns: 1fr;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack td .status-pill {
        justify-self: start;
    }

    body.mobile-friendly-view .gm-table.gm-table-stack .school-cell {
        min-width: 0;
    }

    body.mobile-friendly-view .gm-table thead th,
    body.mobile-friendly-view .gm-table tbody td {
        padding: 0.8rem 0.85rem;
        white-space: nowrap;
    }

    body.mobile-friendly-view .school-cell {
        min-width: 12rem;
    }

    body.mobile-friendly-view .gm-quick-action,
    body.mobile-friendly-view .gm-status-row,
    body.mobile-friendly-view .gm-region-row,
    body.mobile-friendly-view .preference-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    body.mobile-friendly-view .shared-view-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    body.mobile-friendly-view .shared-view-actions,
    body.mobile-friendly-view .shared-view-actions .gm-action-btn,
    body.mobile-friendly-view .shared-view-actions .gm-primary-btn {
        width: 100%;
    }

    body.mobile-friendly-view .shared-view-actions .gm-action-btn,
    body.mobile-friendly-view .shared-view-actions .gm-primary-btn {
        justify-content: center;
    }

    body.mobile-friendly-view .calendar-toolbar-actions {
        display: grid;
        grid-template-columns: 2.4rem minmax(0, 1fr) 2.4rem;
        align-items: center;
    }

    body.mobile-friendly-view .calendar-toolbar-actions .gm-action-btn,
    body.mobile-friendly-view .calendar-toolbar-actions .gm-primary-btn {
        grid-column: span 3;
    }

    body.mobile-friendly-view .calendar-date-input {
        width: 100%;
        min-width: 0;
    }

    body.mobile-friendly-view .calendar-month-row,
    body.mobile-friendly-view .calendar-selected-date-card,
    body.mobile-friendly-view .school-detail-hero-main,
    body.mobile-friendly-view .message-thread-header,
    body.mobile-friendly-view .message-compose,
    body.mobile-friendly-view .settings-profile-row {
        align-items: stretch;
        flex-direction: column;
    }

    body.mobile-friendly-view .calendar-control-group,
    body.mobile-friendly-view .calendar-control-group .gm-action-btn {
        width: 100%;
    }

    body.mobile-friendly-view .calendar-control-group {
        display: grid;
        grid-template-columns: 2.4rem minmax(0, 1fr) 2.4rem;
    }

    body.mobile-friendly-view .calendar-control-group .gm-action-btn {
        justify-content: center;
    }

    body.mobile-friendly-view .calendar-day-nav-row {
        grid-template-columns: 1fr;
    }

    body.mobile-friendly-view .schedule-row {
        align-items: flex-start;
    }

    body.mobile-friendly-view .schedule-row .status-pill,
    [dir="rtl"] body.mobile-friendly-view .schedule-row .status-pill {
        margin-right: 0;
        margin-left: 0;
    }

    body.mobile-friendly-view .message-bubble {
        max-width: 100%;
    }

    body.mobile-friendly-view .message-compose .gm-primary-btn {
        width: 100%;
    }

    body.mobile-friendly-view .school-detail-actions .gm-action-btn,
    body.mobile-friendly-view .school-detail-actions .gm-primary-btn {
        width: 100%;
        justify-content: center;
    }

    body.mobile-friendly-view .school-detail-info-grid {
        grid-template-columns: 1fr;
    }

    body.mobile-friendly-view .gm-status-label,
    body.mobile-friendly-view .school-name,
    body.mobile-friendly-view .school-sub {
        overflow-wrap: anywhere;
    }

    body.mobile-friendly-view .gm-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    body.mobile-friendly-view .gm-action-btn {
        justify-content: center;
    }

    body.mobile-friendly-view .app-footer {
        padding: 0.85rem 0.9rem;
        font-size: 0.72rem;
    }
}

@media (max-width: 575.98px) {
    body.mobile-friendly-view .top-navbar {
        padding: 0.6rem 0.65rem;
        gap: 0.35rem;
    }

    body.mobile-friendly-view .nav-actions,
    [dir="rtl"] body.mobile-friendly-view .nav-actions {
        gap: 0.25rem;
    }

    body.mobile-friendly-view .role-switcher {
        max-width: clamp(5.75rem, 32vw, 7.5rem);
        padding-inline: 0.35rem;
    }

    body.mobile-friendly-view .role-switcher-icon {
        display: none;
    }

    body.mobile-friendly-view .lang-btn {
        min-width: 3rem;
        padding-inline: 0.42rem;
    }

    body.mobile-friendly-view .lang-btn .dropdown-chevron {
        font-size: 0.55rem;
    }

    body.mobile-friendly-view .icon-btn {
        width: 32px;
        height: 32px;
    }

    body.mobile-friendly-view .u-avatar {
        width: 28px;
        height: 28px;
    }

    body.mobile-friendly-view .gm-table {
        min-width: 560px;
    }

    body.mobile-friendly-view .calendar-weekdays,
    body.mobile-friendly-view .calendar-days {
        gap: 0.28rem;
    }

    body.mobile-friendly-view .calendar-weekdays span {
        font-size: 0.58rem;
        letter-spacing: 0;
    }

    body.mobile-friendly-view .calendar-day {
        min-height: 3.85rem;
        padding: 0.35rem;
        gap: 0.24rem;
        border-radius: 0.65rem;
    }

    body.mobile-friendly-view .calendar-date {
        font-size: 0.72rem;
    }

    body.mobile-friendly-view .calendar-date-note {
        display: none;
    }

    body.mobile-friendly-view .calendar-event {
        width: 0.46rem;
        height: 0.46rem;
        padding: 0;
        overflow: hidden;
        border: none;
        border-radius: 50%;
        color: transparent;
        line-height: 1;
    }

    body.mobile-friendly-view .calendar-event-more {
        width: auto;
        height: auto;
        padding: 0;
        border: none;
        background: transparent;
        color: #64748b;
        font-size: 0.58rem;
        line-height: 1.1;
    }
}

/* ==========================================================================
   END: Responsive overrides (shared and page-specific)
   ========================================================================== */

/* ==========================================================================
   BEGIN: Shared browser scrollbar styles (all pages)
   ========================================================================== */

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: #ced4da;
}

::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* ==========================================================================
   END: Shared browser scrollbar styles (all pages)
   ========================================================================== */
