/* ======================
   MAIN DASHBOARD STYLING
   ======================
*/

:root {
    --bg: #ffffff;
    --text: #111111;
    --panel: rgb(141, 157, 141);
    --border: rgb(3, 46, 8);
    --surface: #ffffff;
    --nav-width: 180px;
    --content-max: 1280px;
    --content-pad: 24px;
}

/* MAIN BODY */
html, body {
    text-align: center;
    display: flex;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overscroll-behavior: none;
    width: 100%;
    font-family: "Manrope";
}

.content {
    text-align: center;
    flex: 1;
    padding: var(--content-pad);
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    box-sizing: border-box;
}

ul { /* for the navbar for now so the bulletpoints don't show (will organise later) */
    list-style: none;
    padding: 0;
    margin: 0;
}

.navbar {
    width: var(--nav-width);
    border-right: 1px solid #ddd;
    padding: 16px;
    text-align: left;
    transition: width 0.24s ease, padding 0.24s ease;
}

.navbar ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    font-family: "Noto Sans";
    gap: 12px;
    padding: 0;
    margin-top: 16px;
    font-size: 20px;
    text-align: center;
    transition: opacity 0.2s ease, transform 0.2s ease, margin-top 0.2s ease;
}

.navbar a {
    border-radius: 6px;
    display: block;
    width: 100%;
    text-decoration: none;
    color: black;
}

.navbar a:hover {
    background: rgba(4, 255, 0, 0.742);
}

.navbar a.active {
    background: rgba(124, 255, 122, 0.66);
    font-weight: 700;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 70px;
    cursor: pointer;
    margin-bottom: 10px;
    margin-left: 50px;
    text-align: center;
    transition: margin-left 0.24s ease;
}

body.nav-collapsed .navbar {
    width: 72px;
    padding: 16px 10px;
    overflow: hidden;
}

body.nav-collapsed .navbar ul {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-12px);
    margin-top: 0;
    height: 0;
}

body.nav-collapsed .menu-toggle {
    margin-left: 0;
}

/* ----- HEADERS STYLING ----- */
h1 {
    color: black;
    font-family: "Manrope";
    font-size: 36px;
    font-weight: 700;
}

h2 {
    color: black;
    font-family: "Manrope";
    font-size: 28px;
    font-weight: 600;
}

.date-header {
    display: grid;
    justify-content: center;
    gap: 12px;
    margin: 16px 0;
}

.home-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 800px;
    align-items: start;
    gap: 24px;
    width: 100%;
}

.home-date-summary {
    display: grid;
    justify-items: center;
    grid-column: 2;
}

.date-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    justify-content: center;
    column-gap: 16px;
    width: 100%;
}

.date-text h1, .date-text h2 {
    margin: 0;
}

/* MAIN BUTTONS */
.btn-primary {
    font-size: 18px;
    border-radius: 999px;
    background-color: black;
    border: 2px solid grey;
    color: white;
    width: 30px;
    height: 30px;
    padding: 0;
    box-sizing: border-box;
    display: inline-grid;
    place-items: center;
    line-height: 1;
    align-self: center;
    justify-self: center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.btn-primary:hover {
    background-color: rgb(80, 90, 80);
    cursor: pointer;
    border-color: black;
    color: black;
}

.btn-secondary {
    font-size: 14px;
    border-radius: 5px;
    background-color: rgb(141, 157, 141);
    border: 2px solid black;
    color: black;
    width: 70px;
    height: 30px;
    align-self: center;
    justify-self: center;
}

.btn-secondary:hover {
    background-color: rgb(80, 90, 80);
    cursor: pointer;
    border-color: grey;
    color: black;
}

#today-btn {
    font-size: 20px;
    border-radius: 5px;
    background-color: black;
    border: 2px solid grey;
    color: white;
    width: 100px;
    height: 38px;
}

#previous-btn, #next-btn {
    font-size: 25px;
    border-radius: 20px;
    background-color: black;
    border: 2px solid grey;
    color: white;
    width: 40px;
}

/* MAIN BUTTONS HOVER SETTINGS */
#today-btn:hover, #previous-btn:hover, #next-btn:hover {
    background-color: rgb(80, 90, 80);
    cursor: pointer;
    border-color: black;
    color: black;
}

/* DASHBOARD CARDS STYLING */
.dashboard-cards {
    display: grid;
    grid-template-columns: minmax(240px, 0.9fr) minmax(320px, 1.35fr) minmax(260px, 1fr);
    gap: 30px;
    width: auto;
    margin: 30px 24px 0;
    padding-inline: 0;
    box-sizing: border-box;
    align-items: start;
}

.today-tasks,
.assignments-due,
.calendar-widget,
.upcoming-assignments-widget {
    min-width: 0;
}

/* SHARED CARDS STYLING */
.today-tasks { grid-column: 1; }
.assignments-due { grid-column: 2; }
.calendar-widget { grid-column: 3; }

.today-tasks, .assignments-due {
    display: grid;
    align-content: start;
    background-color: rgb(141, 157, 141);
    border: rgb(3, 46, 8) 2px solid;
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px;
    padding: 14px 12px;
    gap: 10px;
    max-height: 420px;
    justify-self: start;
}

.today-tasks {
    grid-template-rows: auto minmax(0, 1fr);
    overflow: visible;
    position: relative;
}

.assignments-due {
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.assignments-due-header {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 30px 1fr 30px;
    align-items: center;
    column-gap: 10px;
    position: relative;
    flex: 0 0 auto;
}

.assignments-due-header {
    grid-template-columns: 1fr;
}

.today-tasks-header h2, .assignments-due-header h2 {
    margin: 0;
    text-align: center;
    line-height: 1.05;
}

.today-tasks-header {
    grid-column: 1 / -1;
    display: grid;
    gap: 14px;
    align-items: start;
}

.today-tasks-controls {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.today-tasks-controls .controls-group {
    display: grid;
    gap: 6px;
    justify-items: center;
    max-width: 160px;
}

.control-label {
    font-family: "Noto Sans";
    font-size: 16px;
    font-weight: 500;
    text-align: left;
}

.control-select {
    font-family: "Noto Sans";
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 2px solid #111;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.3);
    width: 100%;
}

/* TODAY'S TASKS (Card 1) */
.today-tasks #add-task-btn {
    font-size: 18px;
    border-radius: 20px;
    background-color: black;
    color: white;
    width: 30px;
    height: 30px;
    align-self: center;
    justify-self: center;
    cursor: pointer;
}

#add-task-btn:hover, #sort-btn:hover {
    background-color: rgb(80, 90, 80);
    cursor: pointer;
    border-color: black;
    color: black;
}

#task-list {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: left;
    overflow-y: auto;
    max-height: 100%;
    min-height: 0;
}

#task-list .task-list-item {
    background: rgba(255, 255, 255, 0.6);
    border: rgb(3, 46, 8) 2px solid;
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 10px;
    font-family: "Noto Sans";
    font-size: 16px;
    font-weight: 500;
    color: #111;
    cursor: pointer;
}

#task-list .task-empty {
    text-align: center;
}

/* TODAY'S TASKS (ADD TASK) STYLING */
.hidden { display: none; }

#modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
}

#add-task-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 360px;
    font-family: "Noto Sans";
    background: white;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #ddd;
    z-index: 10;
    text-align: left;
}

#add-task-modal .form-row {
    display: grid;
    grid-template-columns: 90px 1fr;
    align-items: start;
    column-gap: 12px;
    margin-bottom: 12px;
}

#add-task-modal .form-row label {
    text-align: left;
    margin: 0;
    padding-top: 8px;
}

#modal-backdrop { z-index: 9; }

#add-task-modal input, #add-task-modal textarea {
    width: 80%;
    margin: 0;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-family: "Noto Sans";
}

#add-task-modal select {
    width: 60%;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-family: "Noto Sans";
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

/* individual "add task" elements input styling */
#task-notes {
    resize: none;
    height: 90px;
    max-height: 90px;
    overflow-y: auto;
}

.task-status {
    margin: 8px 0 12px;
    font-family: "Noto Sans";
    font-weight: 700;
    text-align: center;
    min-height: 1.2em;
}

/* TODAY'S TASKS (SORT) STYLING */
.sort-panel {
    position: absolute;
    top: 40px;
    left: calc(100% + 10px);
    right: auto;

    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px;

    display: grid;
    gap: 8px;

    width: 190px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 999;
    font-family: "Noto Sans";

    display: none;
}

.sort-panel:not(.hidden) {
    display: grid;
}

.sort-panel label, .sort-panel select {
    font-family: inherit;
    font-size: 14px;
}

.sort-panel select {
    width: 100%;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
}

.sort-row {
    display: flex;
    flex-direction: column;
    text-align: center;
}

.sort-row label {
    margin-bottom: 8px;
}

/* ASSIGNMENTS DUE (Card 2) */
#assignments-due-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
    overflow-y: auto;
    max-height: 100%;
    min-height: 0;
}

.assignment-due-item {
    background: rgba(255, 255, 255, 0.75);
    border: rgb(3, 46, 8) 2px solid;
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
}

.assignment-due-item:hover {
    transform: translateY(-1px);
}

.assignment-due-task {
    font-size: 22px;
    font-weight: 700;
    color: #111;
    line-height: 1.15;
}

.assignment-due-subject {
    margin-top: 4px;
    font-size: 16px;
    color: rgba(17, 17, 17, 0.72);
}

/* "meta" being short for metadata here */
.assignment-due-meta {
    margin-top: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: #111;
    font-size: 14px;
    font-weight: 600;
}

.assignment-priority-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.assignment-priority-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.assignment-priority-dot.priority-high { background: #e74c3c; }
.assignment-priority-dot.priority-medium { background: #f2c94c; }
.assignment-priority-dot.priority-low { background: #27ae60; }
.assignment-priority-dot:not(.priority-high):not(.priority-medium):not(.priority-low) { background: #9e9e9e; }

.assignments-due-more {
    margin-top: auto;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #222;
}

/* UPCOMING ASSIGNMENTS (Card 3) */
.upcoming-assignments-widget {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
    justify-self: end;
    background-color: rgb(141, 157, 141);
    border: rgb(3, 46, 8) 2px solid;
    max-width: 210px;
    max-height: 210px;
    box-sizing: border-box;
    border-radius: 10px;
    padding: 10px;
    gap: 8px;
    overflow: visible;
    position: relative;
    grid-column: 3;
    box-shadow: 4px 4px 6px rgb(0, 0, 0);
}

.today-tasks.has-more::after, .upcoming-assignments-widget.has-more::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    height: 28px;
    pointer-events: none;
    border-radius: 8px;
    background: linear-gradient(to bottom, rgba(141, 157, 141, 0), rgba(141, 157, 141, 1));
}

.upcoming-assignments-widget.has-more::after {
    bottom: 5px;
}

.upcoming-assignments-header h3 {
    margin: 0;
    text-align: left;
    line-height: 1.05;
    font-size: 20px;
    font-weight: 750;
}

#upcoming-assignments-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
    overflow-y: auto;
    max-height: 100%;
    min-height: 0;
    padding-right: 2px;
}

.upcoming-assignment-item {
    width: 100%;
    max-width: 220px;
}

.upcoming-assignment-link {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 0;
    align-items: center;
    background: rgba(255, 255, 255, 0.75);
    border: rgb(3, 46, 8) 2px solid;
    border-radius: 10px;
    padding: 0 8px 0 0;
    text-decoration: none;
    color: inherit;
}

.upcoming-assignment-countdown {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 1px;
    min-height: 100%;
    align-self: stretch;
    border-radius: 8px;
    background: rgba(124, 255, 122, 0.3);
}

.upcoming-assignment-days-value {
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    color: #111;
}

.upcoming-assignment-days-label {
    font-size: 12px;
    font-weight: 700;
    color: #111;
    letter-spacing: 0.04em;
}

.upcoming-assignment-content {
    display: grid;
    gap: 1px;
    text-align: left;
}

.upcoming-assignment-task {
    font-size: 15px;
    font-weight: 550;
    color: #111;
    padding-left: 4px;
}

.upcoming-assignment-subject {
    font-size: 13px;
    color: rgba(17, 17, 17, 0.72);
    padding-left: 4px;
}

.upcoming-assignment-empty {
    text-align: center;
    font-size: 16px;
    color: #111;
    padding: 12px 8px;
}

/* CALENDAR WIDGET (Card 4) */
.calendar-widget {
    display: grid;
    align-content: start;
    border: 2px solid #ddd;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px;
    padding: 14px 12px;
    gap: 10px;

}

.calendar-widget-header h2 {
    margin: 0;
    text-align: left;
    line-height: 1.05;
}

.calendar-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.calendar-widget-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-nav {
    font-size: 20px;
    border-radius: 20px;
    background-color: black;
    border: 2px solid grey;
    color: white;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    box-sizing: border-box;
}

.calendar-nav:hover {
    background-color: rgb(80, 90, 80);
    border-color: black;
    color: black;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    color: #7b7b7b;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.calendar-day-cell {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 3px;
    min-height: 52px;
}

.calendar-day {
    border: none;
    background: transparent;
    border-radius: 999px;
    width: 38px;
    height: 38px;
    margin: 0 auto;
    font-size: 20px;
    font-weight: 600;
    color: #111;
    cursor: pointer;
}

.calendar-day-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 8px;
}

.calendar-day-dot {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: rgb(3, 46, 8);
}

.calendar-day-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    display: none;
    min-width: 140px;
    max-width: 180px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 2px solid rgb(3, 46, 8);
    background: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
    text-align: left;
    z-index: 5;
    pointer-events: none;
}

.calendar-day-cell:hover .calendar-day-tooltip,
.calendar-day-cell:focus-within .calendar-day-tooltip {
    display: grid;
    gap: 6px;
}

.calendar-day-tooltip-item {
    display: grid;
    gap: 2px;
}

.calendar-day-tooltip-task {
    font-size: 12px;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
}

.calendar-day-tooltip-subject {
    font-size: 11px;
    color: #555;
    line-height: 1.2;
}

.calendar-day:hover {
    background: rgba(0, 0, 0, 0.20);
}

.calendar-day.outside-month {
    color: rgba(70, 70, 70, 0.4);
}

.calendar-day.is-today {
    box-shadow: inset 0 0 0 2px rgba(115, 228, 111, 0.6);
}

.calendar-day.selected {
    background: rgba(115, 228, 111, 0.6);
    color: #fff;
}

/* SYSTEM SETTINGS STYLING */
.system-settings {
    position: fixed;
    bottom: 50px;
    left: 50px;
    transition: transform 0.24s ease, opacity 0.2s ease;
}

body.nav-collapsed .system-settings {
    transform: translateX(-120px);
    opacity: 0;
    pointer-events: none;
}

#system-settings-btn {
    appearance: none;
    background: transparent;
    font-size: 40px;
    align-self: center;
    justify-self: center;
    border: none;
    cursor: pointer;
}

#system-settings-btn:hover {
    transition: transform 0.3s ease, filter 0.3s ease;
    transform: scale(1.15) rotate(8deg);
    filter: brightness(1.05);
}

#system-settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 360px;
    font-family: "Noto Sans";
    background: white;
    border-radius: 12px;
    padding: 0;
    border: 1px solid #ddd;
    z-index: 10;
    text-align: left;
    overflow: hidden;
}

.settings-panel p {
    margin-left: 10px;
}

.settings-layout {
    display: grid;
    grid-template-columns: 120px 1fr;
    height: auto;
}

.settings-sidebar {
    border-right: 1px solid #ddd;
    padding: 12px;
    background: #f7f7f7;
}

.settings-sidebar-title {
    margin: 0 0 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
}

.settings-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.settings-nav {
    width: 100%;
    text-align: left;
    border: 1px solid #ccc;
    background: white;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.settings-nav:hover {
    transform: scale(1.03);
    filter: brightness(1.02);
}

.settings-nav.active {
    border-color: #111;
    font-weight: 700;
}

.settings-header {
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid #ddd;
}

.settings-title {
    margin: 5px;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
}

.settings-subtitle {
    margin-top: 6px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    opacity: 0.85;
}

.settings-panel.hidden { display: none; }

.settings-content {
    padding-bottom: 16px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
}

.setting-labels { text-align: left; margin-left: 10px; }
.setting-name { font-weight: 700; }
.setting-desc { font-size: 12px; opacity: 0.75; margin-top: 2px; }

.setting-action-btn {
    min-width: 84px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    margin-right: 10px;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.setting-action-btn:hover {
    transform: scale(1.03);
    filter: brightness(1.15);
}

.setting-action-btn.danger {
    background: #d84c4c;
    border-color: #b63b3b;
}

.setting-action-btn.success {
    background: #2f9a4a;
    border-color: #227738;
}

.setting-action-btn.neutral {
    background: #2f5d9a;
    border-color: #132a4896;
}

.setting-account-input {
    width: 130px;
    max-width: 100%;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid #b9b9b9;
    font-family: inherit;
    font-size: 13px;
    margin-right: 10px;
    box-sizing: border-box;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 25px;
    margin-right: 10px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cfcfcf;
    border-radius: 999px;
    transition: 0.2s ease;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.switch input:checked + .slider {
    background: rgba(124, 255, 122, 0.66);
}

.switch input:checked + .slider::before {
    transform: translateX(17px);
}

/*  ===================================
    RESPONSIVE SCREEN & WINDOW RESIZING 
    ===================================
*/
@media (max-width: 1400px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
        margin: 24px 8px 0;
    }

    .today-tasks,
    .assignments-due,
    .calendar-widget,
    .upcoming-assignments-widget {
        grid-column: auto;
        width: 100%;
        max-width: 100%;
    }

    .calendar-widget {
        grid-column: 1 / -1;
        max-width: 420px;
        justify-self: center;
    }
}

@media (max-width: 1100px) {
    html, body {
        display: block;
        width: 100%;
    }

    .navbar {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid #ddd;
    }

    .content {
        padding: 16px;
    }

    .home-overview {
        grid-template-columns: 1fr;
    }

    .upcoming-assignments-widget {
        justify-self: center;
        max-width: 320px;
    }
    
    .assignments-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .assignments-widgets {
        grid-row: auto;
    }

    .weighting-carousel, .assignments-controls {
        width: 100%;
        margin: 0;
    }

    .assignments-controls {
        margin-top: 12px;
    }
}

@media (max-width: 900px) {
    .assignments-table-card {
        overflow-x: auto;
    }

    .assignments-table {
        min-width: 720px;
    }
}

@media (max-width: 800px) {
    .tasks-range-label-wrap h2 {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    html,
    body {
        width: 100%;
        overflow-x: hidden;
    }

    body {
        display: block;
    }

    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 72px;
        min-height: 100vh;
        border-right: 1px solid #ddd;
        border-bottom: 0;
        padding: 12px 8px;
        box-sizing: border-box;
        text-align: center;
        overflow: hidden;
        background: #fff;
        z-index: 1000;
        transition: width 0.24s ease, padding 0.24s ease, box-shadow 0.24s ease;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    body.nav-collapsed .navbar {
        width: 72px;
        padding: 12px 8px;
    }

    body:not(.nav-collapsed) .navbar {
        width: min(220px, 72vw);
        padding: 16px 12px;
        box-shadow: 18px 0 36px rgba(0, 0, 0, 0.18);
    }

    .navbar ul {
        gap: 10px;
        margin-top: 12px;
        font-size: 18px;
    }

    body.nav-collapsed .navbar ul {
        opacity: 0;
        pointer-events: none;
        transform: translateX(-12px);
        margin-top: 0;
        height: 0;
    }

    body:not(.nav-collapsed) .navbar ul {
        opacity: 1;
        pointer-events: auto;
        transform: none;
        height: auto;
        margin-top: 12px;
    }

    .menu-toggle {
        display: block;
        font-size: 52px;
        margin: 0 0 10px 0;
        align-self: flex-start;
    }

    .content {
        padding: 16px;
        max-width: 100%;
        min-width: 0;
        margin-left: 72px;
        width: calc(100% - 72px);
    }

    #today-btn {
        font-size: 20px;
        width: auto;
        min-width: 96px;
        padding: 4px 12px;
    }

    .date-header {
        gap: 10px;
        margin: 14px 0;
    }

    .date-row {
        grid-template-columns: 40px minmax(0, 1fr) 40px;
        column-gap: 10px;
    }

    .date-text h1 {
        font-size: clamp(28px, 5vw, 36px);
        line-height: 1.05;
    }

    .date-text h2 {
        font-size: clamp(22px, 4vw, 28px);
        line-height: 1.1;
    }

    h2 {
        font-size: clamp(20px, 3.6vw, 26px);
    }

    #previous-btn,
    #next-btn {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .dashboard-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
        margin: 24px 0 0;
        width: 100%;
    }

    .today-tasks,
    .assignments-due,
    .calendar-widget,
    .upcoming-assignments-widget {
        grid-column: auto;
        width: 100%;
        max-width: 100%;
    }

    .today-tasks,
    .assignments-due {
        max-height: none;
        min-width: 0;
    }

    .calendar-widget {
        grid-column: 1 / -1;
        max-width: 420px;
        justify-self: center;
    }

    .today-tasks-header,
    .assignments-due-header {
        grid-template-columns: 36px minmax(0, 1fr) 36px;
        column-gap: 8px;
    }

    .today-tasks-header h2,
    .assignments-due-header h2,
    .calendar-widget-header h2 {
        font-size: 24px;
    }

    #task-list,
    #assignments-due-list {
        max-height: none;
        overflow: visible;
    }

    .upcoming-assignments-header h3 {
        font-size: 17px;
    }

    .calendar-widget-header {
        gap: 10px;
    }

    .calendar-widget-nav {
        gap: 6px;
    }

    .calendar-widget-header h2 {
        font-size: 24px;
    }

    .sort-panel {
        top: calc(100% + 8px);
        left: auto;
        right: 0;
        width: min(220px, calc(100vw - 48px));
    }

    .calendar-widget {
        min-height: auto;
    }

    .calendar-nav {
        width: 30px;
        height: 30px;
        font-size: 18px;
    }

    .calendar-day-cell {
        min-height: 48px;
    }

    .calendar-day {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    .calendar-day-tooltip {
        min-width: 126px;
        max-width: 156px;
        padding: 7px 8px;
    }

    .system-settings {
        bottom: 16px;
        left: 14px;
        z-index: 1101;
    }

    #system-settings-btn {
        font-size: 34px;
        padding: 0;
        line-height: 1;
    }

    body:not(.nav-collapsed) .system-settings {
        left: calc(min(220px, 72vw) - 54px);
    }

    body.nav-collapsed .system-settings {
        transform: none;
        opacity: 1;
        pointer-events: auto;
    }

    #add-task-modal,
    #system-settings-modal {
        width: min(92vw, 360px);
        z-index: 1200;
    }

    #add-task-modal {
        width: min(86vw, 320px);
        max-height: min(82vh, 560px);
        padding: 14px;
        overflow-y: auto;
    }

    #modal-backdrop {
        z-index: 1190;
    }

    #add-task-modal .form-row {
        grid-template-columns: 1fr;
        row-gap: 6px;
    }

    #add-task-modal input,
    #add-task-modal textarea,
    #add-task-modal select {
        width: 100%;
        box-sizing: border-box;
    }

    .modal-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .page-title { font-size: 26px; }
    .navbar ul { font-size: 18px; }
    .menu-toggle { font-size: 54px; margin-left: 0; }

    .carousel-slide {
        width: 100%;
        min-height: 160px;
    }
}

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

    .calendar-widget {
        grid-column: auto;
        max-width: 100%;
        justify-self: stretch;
    }

    .navbar ul {
        font-size: 16px;
    }

    .menu-toggle {
        font-size: 46px;
    }

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

    .upcoming-assignment-link {
        grid-template-columns: 62px minmax(0, 1fr);
        gap: 8px;
    }

    .upcoming-assignment-days-value {
        font-size: 22px;
    }

    .upcoming-assignment-task {
        font-size: 14px;
    }
}
