:root {
    --bg: #F8FAFC;
    --sidebar: #FFFFFF;
    --card: #FBFCFD;
    --text: #111827;
    --muted: #7E7E7E;
    --heading: #656565;
    --line: #E5E7EB;
    --nav: #64748B;
    --nav-hover: #0F172A;
    --nav-hover-bg: #F1F5F9;
    --active-bg: #E6F7F7;
    --active: #008C8C;
    --brand: #009999;
    --brand-lip: #007777;
    --shadow: rgba(0, 0, 0, 0.05);
    --btn-shadow: #e5e5e5;
    --muted-btn: #EEF1F4;
    --muted-btn-text: #6B7280;
    --nav-width: 260px;
    --teal-text: #FFF;
}

html[data-theme="dark"] {
    --bg: #17181c;
    --sidebar: #202124;
    --card: #2a2c31;
    --text: #F4F5F7;
    --muted: #B0B6C0;
    --heading: #D5DAE2;
    --line: #3a3d44;
    --nav: #C5CAD3;
    --nav-hover: #FFFFFF;
    --nav-hover-bg: #2c2f36;
    --active-bg: #143836;
    --active: #7DDEDE;
    --brand: #018b8b;
    --brand-lip: #016363;
    --shadow: rgba(0, 0, 0, 0.35);
    --btn-shadow: #111214;
    --muted-btn: #34373e;
    --muted-btn-text: #C5CAD3;
    --teal-text: #D5DAE2;
}

html[data-nav="compact"] {
    --nav-width: 84px;
}

html[data-nav="compact"] .eventPicker {
    display: none;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========== Sidebar ========== */
.sideNav {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: var(--nav-width);
    height: 100vh;
    box-sizing: border-box;
    padding: 22px 14px 16px;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: width 0.25s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.brand {
    padding: 6px 14px 18px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--brand);
    white-space: nowrap;
    transition: color 0.3s ease;
}

.eventPicker {
    position: relative;
    margin: 0 0 16px;
}

.eventPickerButton {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1), 0 4px 10px 0 rgba(0, 0, 0, 0.07);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.eventPickerLabel {
    width: 100%;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

#eventPickerValue {
    font-size: 14px;
    font-weight: 700;
}

.eventPickerButton svg {
    width: 16px;
    height: 16px;
    margin-left: auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.eventPickerMenu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 30px var(--shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.eventPickerMenu button {
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    text-align: left;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.eventPickerMenu button:hover,
.eventPickerMenu button[aria-selected="true"] {
    background: var(--active-bg);
    color: var(--active);
}

.navLinks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.navLinks a,
.themeToggle,
.navToggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--nav);
    font-size: 14px;
    font-weight: 550;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    white-space: nowrap;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.navLinks a svg,
.themeToggle svg,
.navToggle svg {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.navLinks a:hover,
.themeToggle:hover,
.navToggle:hover {
    background: var(--nav-hover-bg);
    color: var(--nav-hover);
}

.navLinks a.active {
    background: var(--active-bg);
    color: var(--active);
    border-color: var(--brand);
    border-radius: 10px;
    border-width: 2px;
}

.navToggle {
    margin-top: auto;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

.themeToggle {
    margin-top: 6px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

html[data-theme="dark"] .iconMoon,
html:not([data-theme="dark"]) .iconSun {
    display: none;
}

html[data-nav="compact"] .brand,
html[data-nav="compact"] .navLinks a span,
html[data-nav="compact"] .themeToggle span,
html[data-nav="compact"] .navToggle span,
html[data-nav="compact"] .eventPickerLabel,
html[data-nav="compact"] #eventPickerValue {
    display: none;
}

html[data-nav="compact"] .navLinks a,
html[data-nav="compact"] .themeToggle,
html[data-nav="compact"] .navToggle,
html[data-nav="compact"] .eventPickerButton {
    justify-content: center;
    padding: 12px;
    gap: 0;
}

/* ========== Content ========== */
.content {
    margin-left: var(--nav-width);
    padding: 30px;
    min-height: 100vh;
    box-sizing: border-box;
    background: var(--bg);
    transition: margin-left 0.25s ease, background-color 0.3s ease;
}

/* ========== Dashboard Layout ========== */
.dashboardLayout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    max-width: 1480px;
    margin: 0 auto;
}

.mainColumn {
    flex: 1;
    min-width: 0;
}

.sideColumn {
    width: 35%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ========== Existing Cards ========== */
.heroCards {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 16px;
    box-sizing: border-box;
}

.cardSmall {
    background-color: var(--card);
    width: 100%;
    max-width: 450px;
    min-width: 0;
    min-height: 300px;
    box-sizing: border-box;
    border: 2px solid var(--line);
    border-radius: 14px;
    text-align: left;
    padding: 28px;
    overflow-wrap: break-word;
    box-shadow: 0 4px 0 0 var(--btn-shadow);
    transition:
        background-color 0.3s ease,
        border-color 0.3s ease,
        color 0.3s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.float:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 0 var(--btn-shadow);
}

.todayLabel {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 14px;
    text-align: left;
    transition: color 0.3s ease;
}

.cardSmall p {
    font-family: Arial, sans-serif;
    color: var(--muted);
    margin-top: 10px;
    line-height: 1.6;
    text-align: left;
    transition: color 0.3s ease;
}

.cardSmall h2,
.cardSmall h3 {
    font-family: Arial, sans-serif;
    margin: 0;
    line-height: 1.3;
    color: var(--text);
    text-align: left;
    transition: color 0.3s ease;
}

.cardSmall h2 {
    font-size: 26px;
    font-weight: 750;
    letter-spacing: -0.4px;
}

.cardSmall h3 {
    color: var(--heading);
    margin-top: 22px;
    font-size: 18px;
}

.performanceCard {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.performanceCard h2,
.performanceCard .chartDescription,
.performanceCard .chartLegend {
    text-align: center;
    width: 100%;
}

.performanceCard h2 {
    font-size: 24px;
    color: var(--text);
    margin-bottom: 6px;
}

.performanceCard .chartDescription {
    color: var(--muted);
    font-size: 14px;
    margin: 0 0 8px;
    transition: color 0.3s ease;
}

.radarWrapper {
    width: 100%;
    max-width: 420px;
    height: 350px;
    margin: 0 auto;
}

.chartContainer,
.chartContainer canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.chartLegend {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 22px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
    transition: color 0.3s ease;
}

.chartLegend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chartLegend i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
}

.legendCorrect { background-color: #8EC5FF; }
.legendIncorrect { background-color: #FF9999; }

/* ========== Panel Cards (Math Medic style) ========== */
.panelCard {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 26px 26px 20px;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

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

.panelCardHeader h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
    transition: color 0.3s ease;
}

.panelCardSub {
    margin: 0 0 22px;
    font-size: 15.5px;
    color: var(--muted);
    line-height: 1.45;
    transition: color 0.3s ease;
}

.pinIcon {
    width: 20px;
    height: 20px;
    color: var(--brand);
    flex-shrink: 0;
    margin-top: 2px;
    opacity: 0.85;
    transition: color 0.3s ease;
}

/* Announcements */
.announceList {
    list-style: none;
    margin: 0;
    padding: 0;
}

.announceItem {
    display: flex;
    gap: 16px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    transition: border-color 0.3s ease;
}

.announceItem:first-child {
    border-top: none;
    padding-top: 2px;
}

.announceItem:last-child {
    padding-bottom: 4px;
}

.announceDate {
    flex-shrink: 0;
    width: 44px;
    text-align: center;
    line-height: 1.1;
    padding-top: 1px;
}

.announceDate .day {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
    transition: color 0.3s ease;
}

.announceDate .month {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.3s ease;
}

.announceBody {
    flex: 1;
    min-width: 0;
}

.announceBody p {
    margin: 0 0 8px;
    font-size: 16.5px;
    line-height: 1.5;
    color: var(--text);
    transition: color 0.3s ease;
}

.announceLink {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--brand);
    text-decoration: none;
    transition: color 0.3s ease;
}

.announceLink:hover {
    text-decoration: underline;
}

/* Quick Resources */
.resourceList {
    list-style: none;
    margin: 0;
    padding: 0;
}

.resourceItem {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 15px 0;
    border-top: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.3s ease, background-color 0.15s ease;
}

.resourceItem:first-child {
    border-top: none;
    padding-top: 4px;
}

.resourceItem:last-child {
    padding-bottom: 2px;
}

.resourceItem:hover .resourceTitle {
    color: var(--brand);
}

.resourceTitle {
    font-size: 16.5px;
    font-weight: 650;
    color: var(--text);
    transition: color 0.3s ease;
    padding-top: 10px;
}

.resourceMeta {
    font-size: 16.5px;
    color: var(--muted);
    margin-top: 3px;
    transition: color 0.3s ease;
}

.resourceArrow {
    color: var(--muted);
    font-size: 25px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: color 0.3s ease;
}

/* ========== Buttons ========== */
.btn {
    border-style: solid;
    border-width: 2px;
    user-select: none;
    display: inline-block;
    padding: 12px 16px;
    margin: 12px 8px 0 0;
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.white {
    background: var(--card);
    color: var(--brand);
    border-color: var(--line);
    box-shadow: 0 3px 0 0 var(--btn-shadow);
}

.white:hover {
    filter: brightness(0.98);
}

.white:active {
    box-shadow: none;
    transform: translateY(3px);
}

.teal {
    background: var(--brand);
    color: var(--teal-text);
    border-color: var(--brand-lip);
    box-shadow: 0 3px 0 0 var(--brand-lip);
}

.teal:hover {
    filter: brightness(1.05);
}

.teal:active {
    box-shadow: none;
    transform: translateY(3px);
}

.muted {
    background: var(--card);
    color: var(--muted-btn-text);
    border-color: var(--line);
    box-shadow: 0 3px 0 0 var(--btn-shadow);
}

.muted:hover {
    filter: brightness(0.98);
}

.muted:active {
    box-shadow: none;
    transform: translateY(3px);
}

.badge {
    background: var(--active-bg);
    color: var(--active);
    border-color: transparent;
    box-shadow: none;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.badge:hover,
.badge:active {
    transform: none;
    filter: none;
}

.btnRow {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 16px;
}

.btnRow .btn {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    padding: 12px 8px;
}

/* ========== Responsive ========== */

/* Large tablets / smaller desktops */
@media screen and (max-width: 1200px) {
    .sideColumn {
        width: 340px;
    }
}

/* Stack layout */
@media screen and (max-width: 1050px) {
    .dashboardLayout {
        flex-direction: column;
    }

    .sideColumn {
        width: 100%;
        max-width: 100%;
    }

    .panelCard {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Tablet + mobile sidebar */
@media screen and (max-width: 900px) {
    .sideNav {
        width: 100%;
        height: auto;
        min-height: 64px;
        padding: 10px 14px;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        border-right: none;
        border-bottom: 1px solid var(--line);
        overflow: visible;
    }

    .brand,
    .navToggle {
        display: none;
    }

    html[data-nav="compact"] .eventPicker {
        display: flex;
        align-self: stretch;
        flex: 0 1 145px;
        width: auto;
        min-width: 0;
        margin: 0;
    }

    .eventPickerButton,
    html[data-nav="compact"] .eventPickerButton {
        flex: 1;
        height: 100%;
        box-sizing: border-box;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        gap: 6px;
        padding: 10px 12px;
        border-radius: 10px;
    }

    .eventPickerLabel,
    html[data-nav="compact"] .eventPickerLabel {
        display: none;
    }

    html[data-nav="compact"] #eventPickerValue {
        display: block;
    }

    #eventPickerValue {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }

    .eventPickerMenu {
        width: 230px;
        right: auto;
    }

    .navLinks {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 4px;
        flex: 1;
        min-width: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .navLinks::-webkit-scrollbar {
        display: none;
    }

    .navLinks a {
        justify-content: center;
        padding: 10px 12px;
        gap: 0;
        font-size: 12px;
        flex-shrink: 0;
        border-radius: 10px;
    }

    .navLinks a span,
    .themeToggle span {
        display: none;
    }

    .themeToggle {
        margin-top: 0;
        margin-left: auto;
        padding: 10px;
        flex-shrink: 0;
    }

    .content {
        margin-left: 0;
        padding: 80px 18px 24px;
    }

    .heroCards {
        gap: 14px;
    }

    .cardSmall {
        max-width: 100%;
        width: 100%;
        margin: 0;
        box-shadow: 0 3px 0 0 var(--btn-shadow);
    }

    .sideColumn {
        width: 100%;
    }
}

/* Phones */
@media screen and (max-width: 600px) {
    .btnRow .btn {
        font-size: 11px;
        letter-spacing: 0.02em;
        padding: 10px 6px;
    }
    
    .content {
        padding: 76px 12px 20px;
    }

    .dashboardLayout {
        gap: 16px;
    }

    .heroCards {
        flex-direction: column;
        gap: 14px;
    }

    .cardSmall {
        width: 100%;
        min-height: 0;
        padding: 20px;
    }

    .cardSmall h2 {
        font-size: 21px;
    }

    .cardSmall h3 {
        font-size: 17px;
    }

    .cardSmall p {
        font-size: 14px;
    }

    .float:hover {
        transform: none;
    }

    .performanceCard {
        padding: 20px 14px;
    }

    .radarWrapper {
        height: 300px;
    }

    .panelCard {
        padding: 20px 16px 16px;
        border-radius: 14px;
    }

    .panelCardHeader h3 {
        font-size: 16.5px;
    }

    .announceItem {
        gap: 12px;
        padding: 14px 0;
    }

    .announceDate {
        width: 38px;
    }

    .announceDate .day {
        font-size: 18px;
    }

    .announceBody p {
        font-size: 14px;
    }

    .resourceItem {
        padding: 13px 0;
    }
}

/* Very small phones */
@media screen and (max-width: 400px) {
    .content {
        padding: 72px 10px 16px;
    }

    .cardSmall {
        padding: 16px;
    }

    .performanceCard {
        padding: 16px 10px;
    }

    .radarWrapper {
        height: 280px;
    }

    .panelCard {
        padding: 18px 14px 14px;
    }

    .sideNav {
        padding: 8px 10px;
    }

    .navLinks a {
        padding: 9px 10px;
    }
}