.dashboard-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) clamp(400px, 22vw, 460px);
    grid-template-areas: "left main right";
    height: 100vh;
    overflow: hidden;
}

/* Global scrollbar polish */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.25);
}

.dashboard-sidebar-left {
    grid-area: left;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.dashboard-sidebar-left .sidebar-logo {
    width: 100%;
    padding: 16px 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.dashboard-sidebar-left .sidebar-logo img,
.dashboard-sidebar-left .sidebar-logo .sidebar-logo-img,
.sidebar .sidebar-logo img,
.sidebar .sidebar-logo .sidebar-logo-img {
    width: 90%;
    max-width: none;
    height: auto;
    object-fit: contain;
    display: block;
}

.sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-nav {
    flex: 1;
}

.sidebar-footer {
    margin-top: auto;
}

.sidebar-logout {
    width: 100%;
    background: transparent;
    border: 1px solid #e57373;
    color: #e57373;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-logout:hover {
    background: rgba(229, 115, 115, 0.1);
    color: #d9534f;
    border-color: #d9534f;
}

.admin-dashboard-cards {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 1.5rem;
}

.admin-dashboard-page .admin-dashboard-title {
    font-size: 1.875rem;
    font-weight: 600;
    line-height: 1.2;
}

.admin-dashboard-page .welcome-greeting {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.admin-dashboard-page .welcome-body {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #4b5563;
}

.welcome-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: visible;
    min-height: 300px;
    padding-right: 620px;
    z-index: 1;
}

.welcome-text {
    max-width: 520px;
    position: relative;
    z-index: 2;
}

.welcome-illustration {
    position: absolute;
    right: 0px;
    top: -90px;
    width: clamp(420px, 50%, 640px);
    max-width: 640px;
    z-index: 1;
    pointer-events: none;
}

.welcome-illustration img {
    width: 100%;
    height: auto;
    display: block;
}

.admin-tasks {
    position: relative;
    z-index: 5;
}

@media (max-width: 1200px) {
    .welcome-card {
        padding-right: 420px;
    }

    .welcome-illustration {
        width: clamp(360px, 45%, 480px);
        top: -60px;
    }
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-avatar-fallback {
    background: #FFD2CA;
    color: #EB6666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.sidebar-user-name {
    font-weight: 600;
    color: #1f2937;
}

.sidebar-user-username {
    font-size: 0.85rem;
    color: #6b7280;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: #9ca3af;
}

.clock-total-value {
    margin-top: 0.25rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.admin-tasks .section-header {
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.75rem;
}

.admin-tasks-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.task-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.task-meta .title {
    font-weight: 600;
    color: #111827;
}

.task-meta .subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: 4px;
}

.task-badge {
    min-width: 44px;
    height: 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0 10px;
}

.task-badge.is-zero {
    background: #f1f3f5;
    color: #667085;
}

.task-badge.is-hot {
    background: rgba(235, 102, 102, 0.16);
    color: #e85c5c;
}

.dashboard-ops .ops-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.ops-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.ops-title {
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.ops-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feed-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.feed-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.feed-avatar-fallback {
    background: #FFD2CA;
    color: #EB6666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.feed-content {
    flex: 1;
    min-width: 0;
}

.feed-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #111827;
}

.feed-preview {
    color: #667085;
    font-size: 0.9rem;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-meta {
    font-size: 0.8rem;
    color: #9ca3af;
    white-space: nowrap;
    margin-left: 8px;
}

.ops-empty {
    font-size: 0.9rem;
    color: #9ca3af;
}

.card-footer-link {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
    font-size: 0.9rem;
    padding-top: 12px;
}

.team-snapshot-card .team-snapshot-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    align-items: start;
    margin-top: 12px;
}

.team-snapshot-card .stat {
    text-align: center;
}

.team-snapshot-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: #111827;
}

.team-snapshot-card .stat-label {
    margin-top: 6px;
    font-size: 0.95rem;
    color: #667085;
}

@media (max-width: 480px) {
    .team-snapshot-card .team-snapshot-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .admin-dashboard-page .admin-dashboard-title {
        font-size: 1.5rem;
    }

    .admin-dashboard-page .welcome-greeting {
        font-size: 2.1rem;
    }
}

@media (max-width: 1200px) {
    .admin-tasks-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-ops .ops-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .admin-tasks-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-ops .ops-grid {
        grid-template-columns: 1fr;
    }
}

.student-list-page .levels-label {
    font-size: 0.9rem;
    font-weight: 600;
}

.student-list-page .level-box-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.student-list-page .level-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
    box-shadow: none;
    color: #111827;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
    text-align: center;
    appearance: none;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.student-list-page .level-box:hover {
    border-color: rgba(235, 102, 102, 0.5);
    box-shadow: 0 4px 10px rgba(235, 102, 102, 0.12);
}

.student-list-page .level-box:focus-visible {
    outline: 2px solid rgba(235, 102, 102, 0.4);
    outline-offset: 2px;
}

.student-list-page .level-box.is-active {
    border-color: rgba(235, 102, 102, 0.7);
    background: rgba(235, 102, 102, 0.08);
}

.student-list-page .class-group.is-hidden,
.student-list-page .roster-section.is-hidden {
    display: none;
}

.student-list-page .class-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #fbfbfb;
}

.student-list-page .class-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}

.student-list-page .class-card-timing {
    font-size: 1.1rem;
    font-weight: 700;
    color: #374151;
    margin-top: 2px;
}

.student-list-page .class-card-subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: 8px;
}

.student-list-page .class-card-stats {
    text-align: right;
    min-width: 220px;
}

.student-list-page .stat-strong {
    font-weight: 700;
    color: #111827;
}

.student-list-page .stat-muted {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 4px;
}

.student-list-page .stat-note {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 4px;
}

.student-list-page .class-details-link {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #eb6666;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

.student-list-page .class-details-link:hover {
    color: #d84f4f;
}

.student-list-page .compact-table-wrapper {
    overflow-x: auto;
}

.student-list-page .compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.student-list-page .compact-table thead th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.student-list-page .compact-table tbody td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    vertical-align: middle;
    color: #374151;
}

.student-list-page .compact-table tbody tr:last-child td {
    border-bottom: none;
}

.student-list-page .row-index {
    width: 32px;
    color: #9ca3af;
    text-align: right;
}

.student-list-page .compact-person {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.student-list-page .avatar-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.student-list-page .person-name {
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 6px;
}

.student-list-page .student-name-row {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-weight: 600;
    color: #111827;
}

.student-list-page .student-name-chinese {
    font-size: 0.85rem;
    color: #6b7280;
}

.student-list-page .person-meta {
    font-size: 0.8rem;
    color: #9ca3af;
}

.student-list-page .person-contact {
    font-size: 0.85rem;
    color: #4b5563;
}

.student-list-page .edit-cell {
    width: 40px;
    text-align: right;
}

.student-list-page .edit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    color: #6b7280;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.student-list-page .edit-icon:hover {
    background: rgba(235, 102, 102, 0.12);
    color: #d84f4f;
}

.student-list-page .edit-icon-svg {
    width: 16px;
    height: 16px;
}

.student-list-page .details-summary {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #6b7280;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #fafafa;
}

.student-list-page .address-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.student-list-page .remarks-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.student-list-page .remarks-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.status-check-page .status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.status-check-page .status-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
    padding: 18px;
    position: relative;
}

.status-check-page .status-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #111827;
}

.status-check-page .status-subtitle {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 2px;
}

.status-check-page .status-donut-wrapper {
    display: flex;
    justify-content: center;
    margin: 16px 0 8px;
}

.status-check-page .status-donut {
    position: relative;
    width: 140px;
    height: 140px;
}

.status-check-page .donut-svg {
    width: 140px;
    height: 140px;
    transform: rotate(-90deg);
}

.status-check-page .donut-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 12;
}

.status-check-page .donut-ring {
    fill: none;
    stroke: #eb6666;
    stroke-width: 12;
}

.status-check-page .donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.status-check-page .donut-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #111827;
}

.status-check-page .donut-note {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 4px;
}

.status-check-page .status-footer {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 8px;
}

.status-check-page .status-footer span {
    color: #111827;
    font-weight: 600;
}

.status-check-page .status-tooltip {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translate(-50%, 8px);
    background: #111827;
    color: #ffffff;
    font-size: 0.75rem;
    padding: 8px 10px;
    border-radius: 10px;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.status-check-page .status-donut:hover .status-tooltip {
    opacity: 1;
}

.status-check-page .tooltip-row + .tooltip-row {
    margin-top: 4px;
}

@media (max-width: 1200px) {
    .status-check-page .status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .status-check-page .status-grid {
        grid-template-columns: 1fr;
    }
}

.student-list-page .details-summary:hover {
    color: #d84f4f;
}

.student-list-page .compact-empty {
    padding: 16px 20px;
    color: #9ca3af;
    font-size: 0.9rem;
}

.student-list-page .class-group {
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.student-list-page .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    background: #d1d5db;
    flex-shrink: 0;
}

.student-list-page .status-official {
    background: #3b82f6;
}

.student-list-page .status-trial {
    background: #22c55e;
}

.student-list-page .status-new {
    background: #f59e0b;
}

.student-list-page .status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.student-list-page .status-official {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.student-list-page .status-trial {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

.student-list-page .status-new {
    background: #fef3c7;
    color: #b45309;
    border-color: #fcd34d;
}

.student-list-page .status-neutral {
    background: #f3f4f6;
    color: #4b5563;
    border-color: #d1d5db;
}

.student-list-page .mode-label {
    font-weight: 600;
    color: #6b7280;
}

.student-list-page .status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: #6b7280;
}

.student-list-page .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 900px) {
    .student-list-page .class-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .student-list-page .class-card-stats {
        text-align: left;
        min-width: 0;
    }
}

.student-list-page .level-box-grid::-webkit-scrollbar {
    height: 6px;
}

@media (max-width: 992px) {
    .admin-dashboard-cards {
        grid-template-columns: 1fr;
    }

    .welcome-card {
        flex-direction: column;
        align-items: flex-start;
        min-height: unset;
        padding-right: 24px;
    }

    .welcome-text {
        max-width: 100%;
    }

    .welcome-illustration {
        position: static;
        width: min(360px, 100%);
        margin-top: 20px;
        margin-left: auto;
        align-self: flex-end;
    }
}

.dashboard-main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
}

.dashboard-content {
    flex: 1;
    overflow-y: auto;
    background: #EDEDED;
    padding: 1.5rem;
}

.dashboard-sidebar-right {
    grid-area: right;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.dashboard-sidebar-content {
    padding: 1.5rem 1rem;
}

.right-sidebar {
    display: flex;
    flex-direction: column;
}

.right-sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.right-sidebar-card {
    padding: 16px;
    border-radius: 14px;
}

.right-sidebar .card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.right-sidebar .profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.right-sidebar .profile-card .sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.right-sidebar .sidebar-user-name {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
}

.right-sidebar .sidebar-user-username {
    font-size: 0.95rem;
    color: #6b7280;
    margin-top: 2px;
}

.right-sidebar .sidebar-user-role {
    font-size: 0.9rem;
    color: #9ca3af;
    margin-top: 2px;
}

.right-sidebar .calendar-header {
    grid-template-columns: 28px 1fr 28px;
    margin-bottom: 10px;
}

.right-sidebar .calendar-title {
    font-weight: 700;
    font-size: 1rem;
}

.right-sidebar .calendar-nav {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
}

.right-sidebar .calendar-nav:hover {
    background: rgba(0, 0, 0, 0.04);
}

.right-sidebar .calendar-grid {
    gap: 8px;
    font-size: 0.92rem;
}

.right-sidebar .calendar-day {
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
}

.right-sidebar .calendar-day-label {
    font-size: 0.78rem;
    color: #9ca3af;
}

.daily-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.daily-task-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.daily-task-item input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
}

.daily-task-item .task-text {
    font-size: 0.98rem;
    color: #374151;
    line-height: 1.3;
}

.sidebar-calendar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendar-header {
    display: grid;
    grid-template-columns: 24px 1fr 24px;
    align-items: center;
}

.calendar-title {
    text-align: center;
    font-size: 0.92rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.01em;
    cursor: pointer;
}

.calendar-nav {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 0.85rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: all 0.15s;
}

.calendar-nav:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    text-align: center;
    font-size: 0.78rem;
    color: #475569;
}

.calendar-day {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #475569;
    font-weight: 600;
    transition: background 0.12s;
    cursor: default;
}

.calendar-day-clickable:hover:not(.calendar-day-today):not(.ring--public_holiday):not(.ring--centre_break) {
    background: #f1f5f9;
}

.calendar-day-label {
    font-size: 0.58rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-day-muted {
    color: #94a3b8;
    opacity: 0.28;
}

.calendar-day-today {
    background: #0f172a !important;
    color: white !important;
    font-weight: 700;
    border-radius: 8px;
}

/* Day number span */
.calendar-day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Event type cell colouring */
.ring--public_holiday {
    background: #fef2f2;
    color: #ef4444;
}

.ring--centre_break {
    background: #eff6ff;
    color: #3b82f6;
}

/* Dot indicator for events */
.sidebar-cal-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
}

.dot--centre_event  { background: #f97316; }
.dot--prep_class    { background: #8b5cf6; }

/* Today overrides event colours */
.calendar-day-today .sidebar-cal-dot { display: none; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE LAYOUT — 3-stage breakdown
   Stage 1 (≤1280px): Right sidebar drops below main
   Stage 2 (≤1023px): Left sidebar becomes a drawer, right hidden
   Stage 3 (≤767px):  Fine-tuned mobile styles
   ═══════════════════════════════════════════════════════════════ */

/* Mobile top bar hidden by default (desktop) */
.mobile-topbar {
    display: none;
}

.mobile-topbar-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.mobile-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
}
.mobile-hamburger:hover { background: #fff5f2; }
.mobile-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #4a3f3d;
    border-radius: 2px;
    transition: 0.25s;
}

/* ── Stage 1: Right sidebar drops below main ── */
@media (max-width: 1280px) {
    .dashboard-layout {
        grid-template-columns: 240px minmax(0, 1fr);
        grid-template-rows: 1fr auto;
        grid-template-areas:
            "left main"
            "left right";
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .dashboard-main {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    .dashboard-sidebar-right {
        position: static;
        height: auto;
        overflow-y: visible;
        border-left: none;
        border-top: 1px solid #f2e1de;
    }

    /* Lay sidebar cards out horizontally when below main */
    .right-sidebar-content {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 1rem 1.5rem;
        gap: 16px;
        align-items: flex-start;
    }

    .right-sidebar-card {
        flex: 1;
        min-width: 220px;
        max-width: 380px;
    }
}

/* ── Stage 2: Left sidebar becomes a drawer ── */
@media (max-width: 1023px) {
    /* Single column — main canvas takes everything */
    .dashboard-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "main";
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    /* Hide right sidebar entirely */
    .dashboard-sidebar-right {
        display: none !important;
    }

    /* Left sidebar becomes a fixed slide-in drawer */
    .dashboard-sidebar-left {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 300;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        height: 100%;
        box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    }

    .dashboard-sidebar-left.mobile-open {
        transform: translateX(0);
    }

    /* Overlay backdrop */
    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 299;
        background: rgba(0,0,0,0.45);
        backdrop-filter: blur(2px);
    }
    .mobile-overlay.active {
        display: block;
    }

    /* Show mobile top bar with hamburger */
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        z-index: 200;
        height: 56px;
        background: #fff;
        border-bottom: 1px solid #f2e1de;
        padding: 0 16px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }

    .dashboard-main {
        grid-area: main;
        height: auto;
        min-height: calc(100vh - 56px);
        overflow-y: auto;
    }

    .dashboard-content {
        padding: 16px !important;
    }
}

/* ── Stage 3: Mobile fine-tuning ── */
@media (max-width: 767px) {
    .welcome-card {
        padding-right: 16px !important;
        min-height: auto !important;
        flex-direction: column;
        align-items: flex-start;
    }
    .welcome-illustration { display: none !important; }
    .admin-dashboard-cards {
        grid-template-columns: 1fr !important;
    }

    .overflow-x-auto, table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .lg\:grid-cols-3, .lg\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    .md\:grid-cols-2, .md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }

    input, select, textarea {
        max-width: 100%;
    }
}

/* ── Standalone suite pages (Live Lesson + Homework Suite) ── */
@media (max-width: 767px) {
    /* Toolbar becomes a scrollable row */
    #toolbar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 10px;
        gap: 6px;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }
    #toolbar::-webkit-scrollbar { display: none; }
    .tool-group { flex-shrink: 0; }
    .logo { font-size: 0.8rem; }
    .file-title { display: none; }

    /* Sidebar becomes a bottom sheet */
    #sidebar, aside.sidebar {
        position: fixed !important;
        bottom: 0; left: 0; right: 0;
        top: auto !important;
        width: 100% !important;
        height: 50vh;
        z-index: 500;
        border-top: 2px solid #f2e1de;
        border-left: none !important;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
    }
    #sidebar.mobile-sidebar-open, aside.sidebar.mobile-sidebar-open {
        transform: translateY(0);
    }
    /* Sidebar toggle button */
    #mobile-sidebar-toggle {
        display: flex !important;
    }
    /* Main viewport uses full height minus toolbar */
    #main-layout {
        flex-direction: column !important;
    }
    #viewport {
        padding: 16px !important;
    }
    /* Fix main layout height for suites */
    #main-layout {
        top: var(--toolbar-h);
        left: 0; right: 0; bottom: 0;
        position: fixed;
    }
}

@media (min-width: 1024px) {
    #mobile-sidebar-toggle { display: none !important; }
    .mobile-topbar { display: none !important; }
    .mobile-overlay { display: none !important; }
}
