/* DASHBOARD SPECIFIC */

.hero-clock {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 2.2rem;
    letter-spacing: .02em;
    background: rgb(var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.greeting {
    font-size: 1.35rem;
    font-weight: 800;
}

.countdown-ring-wrap {
    position: relative;
    width: 132px;
    height: 132px;
    margin: 0 auto;
}

.countdown-ring-wrap svg {
    transform: rotate(-90deg);
}

.countdown-ring-bg {
    fill: none;
    stroke: var(--surface-2);
    stroke-width: 9;
}

.countdown-ring-fg {
    fill: none;
    stroke: url(#ringGrad);
    stroke-width: 9;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.countdown-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.countdown-center .num {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.35rem;
}

.countdown-center .lbl {
    font-size: .62rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.stat-num {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.7rem;
}

.progress {
    background: var(--surface-2);
    border-radius: 6px;
    height: 9px;
    overflow: hidden;
}

.progress-bar {
    background: rgb(var(--accent));
}

.list-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 4px;
    transition: .2s;
    border: 1px solid transparent;
    min-width: 0;
}

.list-row > .flex-grow-1,
.task-row > .flex-grow-1 {
    min-width: 0;
    overflow-wrap: anywhere;
}

.task-row {
    min-width: 0;
}

.topbar,
.card-pad,
.glass {
    min-width: 0;
}

.list-row:hover {
    background: var(--surface-2);
    border-color: var(--border);
}

.dot-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}

/* pomodoro */

.pomo-ring-wrap {
    width: 180px;
    height: 180px;
    position: relative;
    margin: 0 auto;
}

.pomo-time {
    font-family: var(--font-mono);
    font-size: 2.1rem;
    font-weight: 700;
}

/* Grade bar chart improvements */

.grade-bar-val-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 44px;
    flex-shrink: 0;
}

.grade-bar-pct {
    font-family: var(--font-mono);
    font-size: .72rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.grade-bar-gwa {
    font-family: var(--font-mono);
    font-size: .6rem;
    color: var(--text-faint);
    line-height: 1;
    margin-top: 1px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* Semester overview */

.sem-overview {
    background: linear-gradient(135deg, rgba(var(--accent),.12), rgba(var(--accent-2),.06));
    border: 1px solid rgba(var(--accent),.22);
    border-radius: var(--radius-md);
    padding: var(--card-pad-md);
    position: relative;
    overflow: hidden;
}

.sem-overview::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(var(--accent),.15), transparent 70%);
    pointer-events: none;
}

.sem-label {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -.01em;
}

.sem-meta {
    font-size: .75rem;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 3px;
}

.sem-meta #dashWeekInfo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sem-meta #dashWeekInfo i {
    flex-shrink: 0;
    margin: 0 !important;
}

.sem-overview > .d-flex {
    flex-wrap: nowrap !important;
    gap: 8px !important;
}

.sem-overview > .d-flex > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
}

.sem-overview > .d-flex > .text-end {
    flex: 0 0 auto;
    white-space: nowrap;
}

@media (max-width: 399.98px) {
    .sem-label {
        font-size: .95rem;
    }
    .sem-meta {
        font-size: .68rem;
        gap: 5px;
    }
    .sem-overview > .d-flex > .text-end > div:last-child {
        font-size: .58rem !important;
    }
}

.sem-pct-label {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: .82rem;
    color: rgb(var(--accent));
}

.sem-progress-bar {
    height: 7px;
    background: var(--surface-2);
    border-radius: 6px;
    overflow: hidden;
    margin: 8px 0 4px;
}

.sem-progress-fill {
    height: 100%;
    background: rgb(var(--accent));
    border-radius: 6px;
    transition: width 1.2s cubic-bezier(.22,.9,.35,1);
    width: 0%;
}

/* Stats row */

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    padding: var(--card-pad-md);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
    text-align: left;
    transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.stat-card-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgb(var(--accent));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s var(--ease);
}

.stat-card:hover {
    transform: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.25);
    border-color: rgba(var(--accent),.3);
}

.stat-card:hover::after {
    transform: scaleX(1);
}

.stat-card-val {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.3rem;
    line-height: 1.15;
    background: rgb(var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card-lbl {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
    margin-top: 3px;
}

.stat-card-icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--btn-radius-sm);
    background: rgba(var(--accent),.14);
    color: rgb(var(--accent));
    font-size: var(--icon-size-md);
}

/* Grade bar chart */

.grade-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
}

.grade-bar-label {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-soft);
    min-width: 90px;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.grade-bar-track {
    flex: 1;
    height: 8px;
    background: var(--surface-2);
    border-radius: 6px;
    overflow: hidden;
}

.grade-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: rgb(var(--accent));
    transition: width 1.1s cubic-bezier(.22,.9,.35,1);
    width: 0%;
}

.grade-bar-val {
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-soft);
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* grade-bar-val-wrap, .grade-bar-pct, .grade-bar-gwa defined in style.css */

.donut-wrap svg {
    transform: rotate(-90deg);
    display: block;
    width: 100%;
    height: 100%;
}

/* SVG text elements need counter-rotation to be readable */

.donut-wrap svg text {
    transform-origin: 65px 65px;
    transform: rotate(90deg);
}

.donut-svg-pct {
    font-family: var(--font-mono), monospace;
    font-weight: 800;
    font-size: 18px;
    fill: rgb(var(--accent));
}

.donut-svg-sub {
    font-size: 7.5px;
    font-weight: 700;
    letter-spacing: .06em;
    fill: var(--text-faint);
    text-transform: uppercase;
}

.donut-legend-wrap {
    display: flex;
    align-items: stretch;
    gap: 14px;
    width: 100%;
}

.donut-wrap {
    position: relative;
    width: 120px;
    min-width: 120px;
    height: 120px;
    flex-shrink: 0;
    align-self: center;
}.att-legend {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    flex: 1;
    min-height: 120px;
}

.dash-attendance-note {
    margin-top: var(--space-3);
    color: var(--text-faint);
    font-size: .68rem;
    line-height: 1.4;
    text-align: center;
}

.att-legend-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .73rem;
    flex: 1;
    max-height: 32px;
}

.att-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.att-legend-label {
    color: var(--text-soft);
    flex: 1;
    font-size: .72rem;
}

.att-legend-val {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: .68rem;
    text-align: right;
    white-space: nowrap;
}

/* Schedule today */

.sched-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background .18s, border-color .18s;
    margin-bottom: 6px;
}

.sched-row:last-child {
    margin-bottom: 0;
}

.sched-row:hover {
    background: var(--surface-2);
    border-color: var(--border);
}

.sched-time {
    font-family: var(--font-mono);
    font-size: .65rem;
    font-weight: 600;
    color: var(--text-faint);
    min-width: 70px;
    flex-shrink: 0;
}

.sched-code {
    font-weight: 700;
    font-size: .82rem;
}

.sched-room {
    font-size: .68rem;
    color: var(--text-faint);
}

.sched-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Upcoming tasks */

.task-row-dash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background .18s, border-color .18s;
    margin-bottom: 6px;
    cursor: default;
}

.task-row-dash:last-child {
    margin-bottom: 0;
}

.task-row-dash:hover {
    background: var(--surface-2);
    border-color: var(--border);
}

.task-row-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: rgba(var(--accent),.14);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .8rem;
    color: rgb(var(--accent));
}

.task-title-dash {
    font-weight: 700;
    font-size: .82rem;
    line-height: 1.2;
}

.task-meta-dash {
    font-size: .67rem;
    color: var(--text-faint);
    margin-top: 1px;
}

.task-days-left {
    font-family: var(--font-mono);
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

.days-urgent {
    background: rgba(251,113,133,.14);
    color: #fb7185;
    border: 1px solid rgba(251,113,133,.3);
}

.days-soon {
    background: rgba(180,83,9,.14);
    color: var(--warning);
    border: 1px solid rgba(180,83,9,.3);
}

.days-ok {
    background: rgba(52,211,153,.14);
    color: #34d399;
    border: 1px solid rgba(52,211,153,.3);
}

/* Dashboard card section title */

.dash-section-title {
    font-size: .7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: var(--title-gap);
}

.dash-section-title i {
    color: rgb(var(--accent));
    font-size: .78rem;
}

/* view-all link */

.view-all-link {
    font-size: .7rem;
    font-weight: 700;
    color: rgb(var(--accent));
    text-decoration: none;
    opacity: .8;
    transition: opacity .18s;
}

.view-all-link:hover {
    opacity: 1;
    color: rgb(var(--accent));
}

/* card header with view-all */

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--title-gap);
}

.card-header-row .dash-section-title {
    margin-bottom: 0;
}

/* Empty states */

.dash-empty {
    text-align: center;
    padding: 18px 8px;
}

.dash-empty i {
    font-size: 1.4rem;
    color: var(--text-faint);
    display: block;
    margin-bottom: 6px;
}

.dash-empty-title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 2px;
}

.dash-empty-sub {
    font-size: .72rem;
    color: var(--text-faint);
}

/* Card entrance animation */

.dash-card-anim {
    animation: dashCardIn .55s var(--ease) both;
}

@keyframes dashCardIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dash-card-anim:nth-child(1) {
    animation-delay: .03s;
}

.dash-card-anim:nth-child(2) {
    animation-delay: .08s;
}

.dash-card-anim:nth-child(3) {
    animation-delay: .13s;
}

.dash-card-anim:nth-child(4) {
    animation-delay: .18s;
}

.dash-card-anim:nth-child(5) {
    animation-delay: .22s;
}

.dash-card-anim:nth-child(6) {
    animation-delay: .26s;
}

.dash-card-anim:nth-child(7) {
    animation-delay: .30s;
}

/* Now badge */

.now-badge {
    font-size: .6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: rgb(var(--accent));
    color: #fff;
    padding: 2px 7px;
    border-radius: 6px;
}

.done-badge {
    font-size: .6rem;
    font-weight: 700;
    color: var(--text-faint);
    background: var(--surface-2);
    padding: 2px 7px;
    border-radius: 6px;
}

/* Upcoming tasks section labels */

.upcoming-section-label {
    font-size: .62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-faint);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}

.upcoming-overdue-label {
    color: #fb7185;
}

.task-row-overdue {
    border-color: rgba(251,113,133,.2) !important;
    background: rgba(251,113,133,.04) !important;
}

.task-row-icon-overdue {
    background: rgba(251,113,133,.14) !important;
    color: #fb7185 !important;
}

@media (max-width: 575px) {
    .dash-stats .dash-stat-link {
        min-height: 92px;
        padding: 12px;
        gap: 8px;
    }
    .dash-stats .stat-card-val {
        font-size: 1.15rem;
    }
    .dash-stats .stat-card-icon {
        width: 1.8rem;
        height: 1.8rem;
        font-size: var(--icon-size-sm);
    }
    .dash-stats .stat-card-lbl {
        font-size: .6rem;
        margin-top: 2px;
    }
    .dash-stats .stat-card-hint {
        font-size: .58rem;
    }
    .att-legend-label {
        font-size: .66rem;
    }
    .att-legend-val {
        font-size: .63rem;
    }
    .sem-overview {
        padding: 12px 14px;
    }
    .sem-label {
        font-size: .92rem;
    }
    .grade-bar-label {
        min-width: 64px;
        max-width: 64px;
        font-size: .67rem;
    }
    .sched-time {
        min-width: 60px;
        font-size: .6rem;
    }
    .sched-code {
        font-size: .78rem;
    }
}

@media (min-width: 768px) {
    .grade-bar-label {
        min-width: 96px;
        max-width: 96px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dash-card-anim {
        animation: none !important;
    }
    .sem-progress-fill {
        transition: none !important;
    }
    .grade-bar-fill {
        transition: none !important;
    }
}

/* DASHBOARD LAYOUT (authoritative) */

.dash-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--grid-gap);
    margin-bottom: var(--page-gap);
}

.dash-stats .stat-card {
    min-height: 104px;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px;
    color: var(--text);
    text-decoration: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-color: var(--border);
}

.dash-stats .dash-stat-link:hover {
    color: var(--text);
    border-color: var(--border);
    box-shadow: none;
}

.dash-stats .dash-stat-link::after {
    display: none;
}

.dash-stats .stat-card-text {
    order: 1;
}

.dash-stats .stat-card-icon {
    order: 2;
    width: 1.8rem;
    height: 1.8rem;
    background: var(--surface-2);
    color: var(--text-faint);
    font-size: .9rem;
}

.dash-stats .stat-card-val {
    color: var(--text);
    background: none;
    -webkit-text-fill-color: currentColor;
    font-size: 1.5rem;
}

.dash-stats .stat-card-hint {
    margin-top: 6px;
    color: var(--text-faint);
    font-size: .66rem;
    line-height: 1.3;
}

.dash-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--grid-gap);
    margin-bottom: var(--page-gap);
}

.dash-two-col > * {
    min-width: 0;
}

.dash-panel {
    border-radius: var(--radius-md);
}

@media (max-width: 991.98px) {
    .dash-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .dash-two-col {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (min-width: 1024px) and (pointer: fine) {
    /* .dashboard-page is placed by .main-content's padding-top at
       (shell-bar-height + 1px + page-gap) from the top of the document, so
       sizing it to a flat 100vh (the FULL viewport) always overshoots the
       remaining space by that offset. The box used to still get its own
       `overflow-y: auto` + `overscroll-behavior: contain`, i.e. its own
       scroll root nested inside the document's — but since that root
       starts shell-bar-height below the top, its bottom edge — and
       everything in it — rendered below the viewport by that same amount,
       with no way for the trapped 100vh box to reveal it: the document
       itself would need to scroll that remainder, but `overscroll-behavior:
       contain` on the inner panels (and on this element) stops scroll
       chaining from ever reaching the document. The result was the
       "stuck near 90%" bug: wheel/touch/trackpad scrolling over the
       dashboard's inner panels hit their own contained boundary and never
       handed off, so the user had to move the pointer off the panel and
       scroll again just to nudge the outer, mostly-invisible remainder.
       Sizing this box to exactly the viewport space left under the
       shell-bar removes the overshoot, so the document never needs to
       scroll and there is only ever ONE active scroll root at a time. */
    .dashboard-page {
        display: flex;
        flex-direction: column;
        height: calc(100vh - var(--shell-bar-height) - 1px - var(--page-gap));
        max-height: calc(100vh - var(--shell-bar-height) - 1px - var(--page-gap));
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-bottom: var(--space-4);
        row-gap: 14px;
    }

    .dashboard-page > .dash-topbar,
    .dashboard-page > .sem-overview,
    .dashboard-page > .dash-stats {
        flex: 0 0 auto;
        margin-bottom: 0 !important;
    }

    .dashboard-page > .dash-two-col {
        flex: 1 0 260px;
        min-height: 260px;
        margin-bottom: 0;
        gap: 14px;
    }

    .dashboard-page > .dash-two-col > .dash-card-anim {
        display: flex;
        min-height: 0;
    }

    .dashboard-page .dash-panel {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    .dashboard-page > .dash-stats {
        align-items: start;
    }

    .dashboard-page .dash-stats .stat-card {
        min-height: 86px;
        padding: 10px 12px;
        align-items: start;
    }

    .dashboard-page .dash-stats .stat-card-text {
        padding-right: 38px;
    }

    .dashboard-page .dash-stats .stat-card-icon {
        position: absolute;
        top: 10px;
        right: 12px;
    }

    .dashboard-page #dashTodaySchedule,
    .dashboard-page #dashUpcomingTasks,
    .dashboard-page #dashGradeChart {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .dashboard-page .dash-empty {
        width: 100%;
        margin: auto;
    }

    .dashboard-page .donut-legend-wrap {
        flex: 1 0 auto;
        min-height: clamp(90px, 13vh, 120px);
        align-items: center;
    }

    .dashboard-page .donut-wrap {
        width: clamp(90px, 13vh, 120px);
        min-width: clamp(90px, 13vh, 120px);
        height: clamp(90px, 13vh, 120px);
    }

    .dashboard-page .att-legend {
        min-height: 0;
    }

    .dashboard-page .att-legend-row,
    .dashboard-page .att-legend-label,
    .dashboard-page .att-legend-val {
        font-size: 14px;
    }

    .dashboard-page .dash-attendance-note {
        flex: 0 0 auto;
        margin-top: auto;
        color: var(--text-faint);
        font-size: 12px;
        text-align: center;
    }
}