* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================================
   Grade Change Animations
   ============================================================ */
@keyframes gradePopIn {
    0%   { transform: scale(1); opacity: 1; }
    20%  { transform: scale(1.25); opacity: 0.8; }
    50%  { transform: scale(0.95); }
    70%  { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes valueTick {
    0%   { transform: translateY(0); opacity: 1; }
    30%  { transform: translateY(-6px); opacity: 0.5; }
    60%  { transform: translateY(2px); opacity: 0.9; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.grade-animate {
    display: inline-block;
    animation: gradePopIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.value-animate {
    display: inline-block;
    animation: valueTick 0.35s ease-out forwards;
}

.grade-shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.25) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 0.6s ease-out;
}

/* Subtle glow on course card icon when grade changes */
.course-card-icon.grade-flash {
    animation: gradePopIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Podium effect for grade-improved course cards ---- */
.course-card-wrapper.podium {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 0.5s ease;
    z-index: 2;
    position: relative;
}

.course-card-wrapper.podium-1 {
    transform: translateY(-6px);
}
.course-card-wrapper.podium-2 {
    transform: translateY(-12px);
}
.course-card-wrapper.podium-3 {
    transform: translateY(-18px);
}
.course-card-wrapper.podium-4 {
    transform: translateY(-22px);
}

/* Subtle ring around the card in podium state */
.course-card-wrapper.podium .course-card {
    box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.12);
}

.mini-grid .course-card-wrapper.podium .course-card-icon {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.10);
}

/* Podium badge — shows number of grade levels gained */
.course-card-wrapper.podium .podium-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--muted-foreground);
    text-align: center;
    margin-top: -0.1rem;
    opacity: 0;
    animation: podiumBadgeFadeIn 0.4s 0.25s ease forwards;
}

.podium-badge i {
    font-size: 0.5rem;
}

.course-card-wrapper:not(.podium) .podium-badge {
    display: none;
}

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

:root {
    --background: #ffffff;
    --foreground: #09090b;
    --card: #ffffff;
    --card-foreground: #09090b;
    --primary: #09090b;
    --primary-foreground: #fafafa;
    --secondary: #f4f4f5;
    --secondary-foreground: #09090b;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --accent: #f4f4f5;
    --accent-foreground: #09090b;
    --border: #e4e4e7;
    --input: #e4e4e7;
    --ring: #09090b;
    --radius: 0.5rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', 'Helvetica Neue', Arial, sans-serif;
    background: #fafafa;
    min-height: 100vh;
    color: var(--foreground);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: var(--background);
    min-height: 100vh;
}

/* Hamburger button */
.hamburger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--foreground);
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.hamburger-btn:hover {
    background: var(--accent);
    border-color: var(--ring);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Sidebar backdrop */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    background: var(--card);
    border-right: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}

body.sidebar-open .sidebar {
    left: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-size: 1rem;
}

.sidebar-close:hover {
    background: var(--accent);
    color: var(--foreground);
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.sidebar-section {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-foreground);
    padding: 0.5rem 1.25rem 0.375rem;
}

.sidebar-credential-list,
.sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-credential-item,
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    color: var(--foreground);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.sidebar-credential-item:hover,
.sidebar-nav-item:hover {
    background: var(--accent);
}

.sidebar-credential-item.active,
.sidebar-nav-item.active {
    background: var(--accent);
    border-left-color: var(--foreground);
    font-weight: 600;
}

.sidebar-credential-item i:first-child,
.sidebar-nav-item i:first-child {
    width: 1.25rem;
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-credential-item.active i:first-child {
    color: var(--foreground);
}

.sidebar-credential-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-active-check {
    color: var(--foreground);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.sidebar-empty {
    padding: 0.75rem 1.25rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-style: italic;
}

.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.sidebar-user i {
    flex-shrink: 0;
}

.sidebar-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user small {
    font-size: 0.75em;
    opacity: 0.7;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-logout-btn:hover {
    background: var(--accent);
    border-color: var(--ring);
}

/* Medium screens */
@media (min-width: 640px) {
    .sidebar {
        width: 300px;
        left: -320px;
    }
}

.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    height: 64px;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.8);
}

.header-content {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 0.5rem;
    width: 100%;
}

/* Left zone: hamburger + credential name */
.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.header h1 {
    font-size: clamp(0.875rem, 1.8vw, 1.25rem);
    font-weight: 700;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.header .term-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--secondary);
    color: var(--secondary-foreground);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Center zone: Grade + GPA */
.header-center {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Right zone: refresh button */
.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

/* Keep old class for credentials page compatibility */
.header-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-stat {
    text-align: center;
}

.header-stat.gpa-display,
.header-stat.average-display,
.header-stat.overall-grade-display {
    font-size: clamp(1.25rem, 3.5vw, 2rem);
    font-weight: 700;
    color: var(--foreground);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.header-stat-value,
.header-stat.overall-grade-display .overall-grade-value {
    line-height: 1;
}

.header-stat .gpa-label,
.header-stat .average-label,
.header-stat .overall-grade-label {
    font-size: 0.625rem;
    font-weight: 600;
    opacity: 0.7;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    margin-top: 0;
}

.header-stat.overall-grade-display .overall-grade-value {
    font-size: inherit;
    font-weight: 700;
    line-height: 1;
}

/* Use same lighter colors as course cards for header grade */
.header-stat .overall-grade-value.grade-a { color: #90EE90; }
.header-stat .overall-grade-value.grade-b { color: #87CEEB; }
.header-stat .overall-grade-value.grade-c { color: #FFD700; }
.header-stat .overall-grade-value.grade-d { color: #FFA500; }
.header-stat .overall-grade-value.grade-f { color: #FF6B6B; }

.overall-grade-display.overall-grade-toggle {
    cursor: pointer;
    transition: opacity 0.2s;
}

.overall-grade-display.overall-grade-toggle:hover {
    opacity: 0.8;
}

/* Overall grade simulation comparison (e.g. D → B) */
.overall-grade-comparison {
    display: inline-flex;
    align-items: baseline;
    gap: 0.15em;
    line-height: 1;
}

.overall-grade-original {
    color: #c0c0c0 !important;
    font-weight: inherit;
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}

/* GPA / stat simulation comparison in header */
.header-stat-comparison {
    display: inline-flex;
    align-items: baseline;
    gap: 0.15em;
    line-height: 1;
}

.header-stat-original {
    color: #c0c0c0 !important;
    font-weight: inherit;
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}

/* Refresh button styles */
.refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--foreground);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    text-decoration: none;
}

.refresh-btn:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--ring);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.refresh-btn .fa-sync-alt {
    transition: transform 0.3s ease;
}

.refresh-btn .fa-sync-alt.spinning,
.btn-icon .fa-sync-alt.spinning {
    animation: spin 1s linear infinite;
}

.header-actions {
    position: static;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--foreground);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    text-decoration: none;
}

.header-back-btn:hover {
    background: var(--accent);
    border-color: var(--ring);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.header-title-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.refresh-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    z-index: 2000;
}

body.refreshing {
    overflow: hidden;
}

body.refreshing .refresh-overlay {
    display: flex;
}

.refresh-overlay-card {
    width: min(680px, 90vw);
    padding: 2rem;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.refresh-overlay-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin: -2rem -2rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--muted);
    color: var(--muted-foreground);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.refresh-overlay-bar-label {
    font-weight: 600;
}

.refresh-overlay-bar-status {
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.refresh-overlay-bar-status.error {
    color: #991b1b;
}

.refresh-overlay-line {
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    min-height: 1.5rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.refresh-overlay-line.typing::after {
    content: '...';
    display: inline-block;
    width: 1.5em;
    overflow: hidden;
    vertical-align: bottom;
    animation: dots 1.2s steps(4, end) infinite;
}

.refresh-overlay-log {
    margin-top: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    color: var(--muted-foreground);
    display: none;
    gap: 0.35rem;
}

.refresh-overlay-log .log-line.error {
    color: #991b1b;
}

@keyframes dots {
    0% { width: 0; }
    33% { width: 0.5em; }
    66% { width: 1em; }
    100% { width: 1.5em; }
}

@media (max-width: 640px) {
    .refresh-overlay-card {
        padding: 1.5rem;
    }

    .refresh-overlay-bar {
        font-size: 0.75rem;
        margin: -1.5rem -1.5rem 1rem;
    }

    .refresh-overlay-line {
        font-size: 0.75rem;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}


@media (min-width: 640px) {
    .header-title-center {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Small screens: hide credential name, compact stats */
@media (max-width: 480px) {
    .header-left h1 {
        display: none;
    }
    
    .header-center {
        gap: 0.5rem;
    }
    
    .header-stat.gpa-display,
    .header-stat.average-display,
    .header-stat.overall-grade-display {
        font-size: clamp(1rem, 3vw, 1.5rem);
    }
}

/* Medium screens: show truncated name */
@media (min-width: 481px) and (max-width: 768px) {
    .header-left h1 {
        max-width: 120px;
    }
}

/* Large screens: full name */
@media (min-width: 769px) {
    .header-left h1 {
        max-width: 300px;
    }
    
    .header-center {
        gap: 1rem;
    }
}

.course-section {
    margin-bottom: 0;
    background: var(--card);
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    scroll-margin-top: 5rem;
    width: 100%;
}

.course-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.course-header-title {
    font-size: clamp(1.125rem, 3vw, 1.25rem);
    font-weight: 600;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.course-term-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--secondary);
    color: var(--secondary-foreground);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
}

.content {
    padding: 1.5rem;
    width: 100%;
}

@media (min-width: 640px) {
    .course-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .content {
        padding: 2rem;
    }
}

.grading-detail {
    margin-bottom: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
    background: var(--card);
    box-shadow: none;
    width: 100%;
    scroll-margin-top: 72px;
}

.grading-tasks {
    background: var(--muted);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.grading-task {
    display: inline-block;
    margin-right: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.5rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
    .grading-task {
        display: block;
        margin-right: 0;
        width: 100%;
    }
}

.grading-task-name {
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

.grading-task-name.mp-toggle,
.grading-task-name.pr-toggle {
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.25rem 0.5rem;
    border-radius: calc(var(--radius) / 2);
    display: inline-block;
}

.grading-task-name.mp-toggle:hover,
.grading-task-name.pr-toggle:hover {
    background: var(--accent);
    color: var(--foreground);
}

.grading-task-name.pr-toggle {
    background: var(--muted);
    color: var(--muted-foreground);
}

.grade-display {
    font-size: 1.5em;
    font-weight: bold;
}

.grade-a { color: #28a745; }
.grade-b { color: #007bff; }
.grade-c { color: #ffc107; }
.grade-d { color: #fd7e14; }
.grade-f { color: #dc3545; }

.gpa-summary .grade-a { color: #90EE90; }
.gpa-summary .grade-b { color: #87CEEB; }
.gpa-summary .grade-c { color: #FFD700; }
.gpa-summary .grade-d { color: #FFA500; }
.gpa-summary .grade-f { color: #FF6B6B; }

.percentage {
    color: #666;
    font-size: 0.9em;
    margin-left: 10px;
}

.assignment-categories {
    padding: 1.5rem;
}

@media (min-width: 640px) {
    .assignment-categories {
        padding: 2rem;
    }
}

.category {
    margin-bottom: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
    background: var(--card);
    box-shadow: none;
    width: 100%;
}

.category-header {
    background: var(--muted);
    color: var(--foreground);
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .category-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.category-name {
    font-size: 1.2em;
    font-weight: 600;
}

.category-meta {
    display: flex;
    gap: 20px;
    font-size: 0.9em;
}

.category-totals {
    background: var(--muted);
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
}

@media (min-width: 640px) {
    .category-totals {
        flex-direction: row;
        justify-content: space-between;
    }
}

.total-score {
    font-weight: 600;
    color: var(--foreground);
    font-size: 0.875rem;
}

.assignments-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.assignments-table th {
    background: var(--muted);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.assignments-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--background);
}

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

.assignments-table tr:hover td {
    background: var(--accent);
}

@media (max-width: 768px) {
    .assignments-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .assignments-table th,
    .assignments-table td {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }
}

.assignment-name {
    font-weight: 500;
    color: #333;
}

.due-date {
    color: #666;
    font-size: 0.9em;
}

.score {
    font-weight: 600;
    color: #333;
}

.percentage-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: calc(var(--radius) / 2);
    font-size: 0.75rem;
    font-weight: 600;
}

.percentage-high {
    background: #dcfce7;
    color: #166534;
}

.percentage-medium {
    background: #fef3c7;
    color: #92400e;
}

.percentage-low {
    background: #fee2e2;
    color: #991b1b;
}

.flag-missing {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #fee2e2;
    color: #991b1b;
    padding: 0.25rem 0.5rem;
    border-radius: calc(var(--radius) / 2);
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.comments {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-style: italic;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--muted-foreground);
}

.courses-summary {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    /* margin: 1.5rem; */
    box-shadow: var(--shadow-sm);
}

.courses-summary h2 {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.course-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--secondary);
    color: var(--secondary-foreground);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.course-badge:hover {
    background: var(--accent);
    border-color: var(--ring);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
    .courses-summary {
        padding: 2rem;
        /* margin: 2rem; */
    }
}

.gpa-summary {
    background: var(--card);
    border: none;
    border-radius: 0;
    padding: 1rem 1.5rem;
    box-shadow: none;
}

.gpa-summary h2 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gpa-summary h3 {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 1rem;
    color: var(--foreground);
}

.gpa-summary h3:first-of-type {
    margin-top: 0;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 1.5rem 0;
}

/* Medium screens - 4 columns */
@media (min-width: 640px) {
    .summary-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* Large screens - 6 columns */
@media (min-width: 1024px) {
    .summary-stats {
        grid-template-columns: repeat(6, 1fr);
        gap: 2rem;
    }
}

.gpa-display,
.average-display {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 700;
    color: var(--foreground);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.gpa-display.gpa-toggle {
    cursor: pointer;
    transition: opacity 0.2s;
}

.gpa-display.gpa-toggle:hover {
    opacity: 0.8;
}

.gpa-label,
.average-label {
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.7;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    margin-top: 0.5rem;
}

@media (min-width: 640px) {
    .gpa-summary {
        padding: 2rem;
        /* margin: 2rem; */
    }
}

.grades-summary-table {
    width: 100%;
    margin-top: 1rem;
    background: var(--muted);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.grades-summary-table table {
    width: 100%;
    border-collapse: collapse;
}

.grades-summary-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    background: var(--muted);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.grades-summary-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    background: var(--background);
    font-size: 0.875rem;
}

.grades-summary-table tr:last-child td {
    border-bottom: none;
}

.grades-summary-table tr:hover td {
    background: var(--accent);
}

@media (max-width: 768px) {
    .grades-summary-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .grades-summary-table th,
    .grades-summary-table td {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }
}

.marking-period-breakdown {
    line-height: 1.6;
    font-size: 0.875rem;
}

.marking-period-item {
    margin-bottom: 3px;
}

.marking-period-calc {
    font-size: 0.8125rem;
    opacity: 0.7;
    font-style: italic;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
}

.mp-item-wrapper {
    margin-bottom: 0.75rem;
}

.mp-label {
    display: inline-block;
    cursor: pointer;
    font-size: 0.875rem;
    user-select: none;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.mp-label:hover {
    background: var(--accent);
    border-color: var(--border);
}

.mp-label.excluded {
    opacity: 0.5;
    text-decoration: line-through;
    background: var(--muted);
}

html {
    scroll-behavior: smooth;
}

/* Recent Assignments Table Styles */
.assignments-table-container {
    background: var(--card);
    border: none;
    border-radius: var(--radius);
    padding: 0rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    min-width: 0;
}

.assignments-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .assignments-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
}

.search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--background);
    color: var(--foreground);
}

.search-box input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(9, 9, 11, 0.1);
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--background);
    color: var(--foreground);
    cursor: pointer;
    min-width: 150px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(9, 9, 11, 0.1);
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.875rem;
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 1rem;
    height: 1rem;
}

.filter-icon-toggle {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--muted-foreground);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.filter-icon-toggle:hover {
    color: var(--foreground);
    border-color: var(--ring);
}

.filter-icon-toggle.active {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
}

.filter-icon-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.assignments-results-count {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 1rem;
}

.assignments-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
}

.recent-assignments-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.recent-assignments-table th {
    background: var(--muted);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.recent-assignments-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--background);
}

.recent-assignments-table tr:last-child td {
    border-bottom: none;
}

.recent-assignments-table tr:hover td {
    background: var(--accent);
}

@media (max-width: 768px) {
    .recent-assignments-table {
        font-size: 0.8125rem;
    }
    
    .recent-assignments-table th,
    .recent-assignments-table td {
        padding: 0.75rem 0.5rem;
    }
}

.assignments-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--ring);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    font-weight: 500;
}

/* Stacked assignment details styles */
.assignment-details-stacked,
.grade-status-stacked {
    vertical-align: top;
}

.detail-item {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.detail-item:last-child {
    margin-bottom: 0;
}

.detail-item.due-date,
.detail-item.score {
    color: var(--foreground);
}

.detail-item .course-grade {
    display: inline-block;
}

/* Editable score styling */
.editable-score {
    position: relative;
    min-width: 60px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.editable-score:hover {
    background-color: var(--accent);
}

.editable-score:focus {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    background-color: var(--background);
}

.editable-score[contenteditable="true"]:empty::before {
    content: '-';
    color: var(--muted-foreground);
}

/* ---- Course Overview heading with Detail button ---- */
.course-overview-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.overview-detail-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.overview-detail-btn:hover {
    background: var(--accent);
    border-color: var(--ring);
}

.overview-detail-btn.active {
    background: var(--foreground);
    color: var(--background);
    border-color: var(--foreground);
}

/* ---- Course grid ---- */

/* Mini-grid (app icons) — compact, 6 per row */
.course-grid.mini-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    margin: 1.5rem 0;
}

@media (min-width: 640px) {
    .course-grid.mini-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.75rem;
    }
}

@media (min-width: 1024px) {
    .course-grid.mini-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 1rem;
    }
}

/* Expanded grid — fewer columns for full cards */
.course-grid:not(.mini-grid) {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin: 1.5rem 0;
}

@media (min-width: 640px) {
    .course-grid:not(.mini-grid) {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }
}

@media (min-width: 1024px) {
    .course-grid:not(.mini-grid) {
        grid-template-columns: repeat(6, 1fr);
        gap: 1rem;
    }
}

/* ---- Course card wrapper ---- */
.course-card-wrapper {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: visible;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Course card (shared) ---- */
.course-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    display: block;
}

.course-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--ring);
}

/* ============================================
   MINI MODE (app-icon style) — default
   ============================================ */

/* App-icon square */
.course-card-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.5rem 0.25rem;
    position: relative;
    gap: 0.125rem;
}

.course-card-icon .course-grade {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    font-weight: 700;
    line-height: 1;
    z-index: 1;
}

.course-card-icon .course-card-sparkline {
    width: 85%;
    min-width: 0;
    height: 20px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.course-card:hover .course-card-icon .course-card-sparkline {
    opacity: 1;
}

/* Tiny label below the icon */
.course-card-icon-label {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-align: center;
    line-height: 1.25;
    padding: 0.25rem 0.25rem 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: calc(1.25em * 2 + 0.5rem);
}

/* In mini mode, Apple-style icon — no border, no rounding */
.mini-grid .course-card {
    border-radius: 0;
    border: none;
    box-shadow: none;
    overflow: visible;
}

.mini-grid .course-card:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: none;
    border: none;
}

/* Hide expanded-only elements in mini mode */
.mini-grid .course-card-header,
.mini-grid .course-card-body,
.mini-grid .course-quarter-breakdown,
.mini-grid .course-card-sparkline-full {
    display: none;
}

/* ============================================
   EXPANDED MODE — toggled via JS
   ============================================ */

/* Hide mini-only elements in expanded mode */
.course-grid:not(.mini-grid) .course-card-icon,
.course-grid:not(.mini-grid) .course-card-icon-label {
    display: none;
}

/* Show expanded elements */
.course-grid:not(.mini-grid) .course-card-header {
    display: flex;
}

.course-grid:not(.mini-grid) .course-card-body {
    display: flex;
}

.course-card-header {
    background: var(--muted);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.course-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    flex: 1;
    min-height: calc(1.3em * 2);
}

.course-card-average {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted-foreground);
    white-space: nowrap;
}

.course-card-body {
    padding: 1rem 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    position: relative;
}

.course-card-grade {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.course-card-subject-bg {
    position: absolute;
    font-size: 1.5rem;
    font-weight: 300;
    color: #9ca3af;
    opacity: 0.5;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    z-index: 0;
    pointer-events: none;
    text-align: center;
    width: 100%;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 0.5rem;
    line-height: 1.2;
}

.course-card-grade .course-grade {
    position: relative;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    z-index: 1;
}

/* Sparkline in expanded card body */
.course-card-sparkline-full {
    width: 100%;
    min-width: 0;
    height: 32px;
    margin-top: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.course-card:hover .course-card-sparkline-full {
    opacity: 1;
}

.sparkline-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.course-card-sparkline:empty,
.course-card-sparkline-full:empty {
    display: none;
}

@media (max-width: 639px) {
    .course-card-sparkline-full {
        height: 24px;
    }
}

/* Expanded mode: quarter breakdown attached */
.course-grid:not(.mini-grid) .course-card-wrapper.has-quarters .course-card {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
}

.course-card-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.course-card-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
}

.stat-label {
    color: var(--muted-foreground);
    font-weight: 500;
}

.stat-value {
    color: var(--foreground);
    font-weight: 600;
}

.course-quarter-breakdown {
    margin-top: 0;
    padding: 0.75rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: var(--radius);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    font-size: 0.75rem;
}

.quarter-breakdown-header,
.quarter-item {
    display: grid;
    grid-template-columns: 1.75rem 4.25rem 2.25rem;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.2rem 0.35rem;
    border-radius: 6px;
    line-height: 1.4;
}

.quarter-breakdown-header {
    grid-template-columns: 1.75rem 4.25rem 2.25rem;
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.qb-hdr-grade,
.qb-hdr-cumulative {
    text-align: center;
    cursor: pointer;
    padding: 0.15rem 0.25rem;
    border-radius: 4px;
    transition: background 0.15s ease;
    grid-column: 2 / -1;
}

.qb-hdr-grade:hover,
.qb-hdr-cumulative:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Default: hide Period columns, show Cumulative */
.qb-hdr-grade,
.qb-hdr-sep,
.qb-col-pct,
.qb-col-letter,
.qb-col-sep {
    display: none;
}

/* Toggle: show Period columns, hide Cumulative */
.course-quarter-breakdown.show-period .qb-hdr-grade {
    display: block;
}

.course-quarter-breakdown.show-period .qb-hdr-cumulative,
.course-quarter-breakdown.show-period .qb-col-cum-pct,
.course-quarter-breakdown.show-period .qb-col-cum-letter {
    display: none;
}

.course-quarter-breakdown.show-period .qb-col-pct,
.course-quarter-breakdown.show-period .qb-col-letter {
    display: block;
}

/* Active header indicator */
.qb-hdr-cumulative::after {
    content: ' ▾';
    font-size: 0.55rem;
}

.course-quarter-breakdown.show-period .qb-hdr-grade::after {
    content: ' ▾';
    font-size: 0.55rem;
}

.qb-hdr-sep {
    background: var(--border);
    width: 1px;
    height: 100%;
    min-height: 0.75rem;
}

.quarter-item {
    cursor: pointer;
    transition: background 0.15s ease;
    margin-bottom: 0.125rem;
}

.quarter-item:last-child {
    margin-bottom: 0;
}

.quarter-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.qb-col-sep {
    background: var(--border);
    width: 1px;
    height: 100%;
    min-height: 1rem;
}

.quarter-name {
    font-weight: 600;
    color: var(--foreground);
}

.quarter-percentage {
    color: var(--muted-foreground);
    font-weight: 500;
    text-align: right;
}

.quarter-grade {
    font-weight: 700;
    font-size: 0.875rem;
    text-align: center;
}

/* Small screens */
@media (max-width: 639px) {
    .course-grid:not(.mini-grid) .course-card-body {
        padding: 1rem 0.5rem;
        min-height: 80px;
    }
    
    .course-card-grade .course-grade {
        font-size: 2.5rem;
    }
    
    .course-grid:not(.mini-grid) .course-card-header {
        padding: 0.5rem 0.75rem;
    }
    
    .course-grid:not(.mini-grid) .course-card-title {
        font-size: 0.75rem;
        line-height: 1.2;
        min-height: calc(1.2em * 2);
    }

    .course-card-icon-label {
        font-size: 0.55rem;
    }
    
    .summary-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .course-quarter-breakdown {
        padding: 0.5rem;
        font-size: 0.7rem;
    }
    
    .quarter-item {
        margin-bottom: 0.25rem;
    }
    
    .quarter-grade {
        font-size: 0.8rem;
    }
}

/* Big Wins section */
.big-wins-description {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--muted);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.big-wins-description p {
    margin: 0;
}

#big-wins-container .recent-assignments-table th {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
}

#big-wins-container .recent-assignments-table td {
    padding: 0.75rem;
    font-size: 0.875rem;
}


/* Fix toggle switch */
.fix-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--foreground);
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.fix-btn:hover {
    background: var(--accent);
    border-color: var(--ring);
}

.fix-btn i {
    font-size: 0.65rem;
    color: var(--muted-foreground);
    transition: color 0.15s ease;
}

.fix-btn:hover i {
    color: var(--foreground);
}

/* Reset All button styles */
.reset-all-btn {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.reset-all-btn.compact {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.reset-all-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.assignments-results-count.big-wins-results-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.big-wins-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-toggle {
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1;
}

.info-toggle:hover {
    color: var(--foreground);
}

.big-wins-info {
    margin: 0.35rem 0 0.75rem;
    color: var(--muted-foreground);
    font-size: 0.85rem;
}

.reset-all-btn:hover {
    background: var(--accent);
    border-color: var(--ring);
}

.reset-all-btn i {
    font-size: 0.75rem;
}

/* Fixed tiles bar */
.fixed-tiles-bar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    min-width: 0;
    overflow: visible;
}

.fixed-tiles-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}

.fixed-tiles-header i {
    color: #6b7280;
    font-size: 0.8rem;
}

.fixed-tiles-grid {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding-top: 1.5rem;
    padding-bottom: 0.25rem;
    min-width: 0;
    width: 100%;
}

/* Hide scrollbar but keep scrolling */
.fixed-tiles-grid::-webkit-scrollbar {
    height: 4px;
}
.fixed-tiles-grid::-webkit-scrollbar-track {
    background: transparent;
}
.fixed-tiles-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ---- Fixed tile — mirrors mini-grid course tile in podium state ---- */

/* Outer wrapper = course-card-wrapper */
.fixed-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    overflow: visible;
    min-width: 0;
    cursor: pointer;
    /* Match 1fr of a 6-col grid with 0.75rem gaps */
    width: calc((100% - 0.75rem * 5) / 6);
    max-width: calc((100% - 0.75rem * 5) / 6);
}

/* Card = course-card in mini-grid+podium — wraps icon + label, casts shadow on badge */
.fixed-tile-card {
    display: block;
    overflow: visible;
    border-radius: 0;
    border: none;
    text-decoration: none;
    color: inherit;
    width: 100%;
    box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fixed-tile:hover .fixed-tile-card {
    transform: translateY(-3px) scale(1.04);
    box-shadow: none;
}

/* Icon = course-card-icon in podium — grade area with its own shadow on label */
.fixed-tile-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.5rem 0.25rem;
    gap: 0.125rem;
    position: relative;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.10);
}

/* Grade change */
.fixed-tile-grade {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    white-space: nowrap;
}

.fixed-tile-grade .course-grade {
    font-size: clamp(1.1rem, 4vw, 1.6rem);
    font-weight: 700;
    line-height: 1;
}


/* Step-function sparkline inside fixed tile icon */
.fixed-tile-sparkline {
    width: 85%;
    min-width: 0;
    height: 18px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.fixed-tile:hover .fixed-tile-sparkline {
    opacity: 1;
}

.fixed-tile-spark-canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Label = course-card-icon-label — sits inside card, below icon shadow */
.fixed-tile-label {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-align: center;
    line-height: 1.25;
    padding: 2px 2px 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    min-height: calc(1.25em * 3 + 0.5rem);
}

/* Badge = podium-badge — sits OUTSIDE the card */
.fixed-tile-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--muted-foreground);
    text-align: center;
    margin-top: -0.1rem;
}

.fixed-tile-badge i {
    font-size: 0.5rem;
}

/* ---- Podium lift for fixed tiles based on letter-grade increase ---- */
.fixed-tile.fixed-tile-podium {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
    position: relative;
}
.fixed-tile.fixed-tile-podium-1 { transform: translateY(-4px); }
.fixed-tile.fixed-tile-podium-2 { transform: translateY(-10px); }
.fixed-tile.fixed-tile-podium-3 { transform: translateY(-16px); }
.fixed-tile.fixed-tile-podium-4 { transform: translateY(-22px); }

.fixed-tile.fixed-tile-podium .fixed-tile-icon {
    box-shadow: 0 6px 18px -3px rgba(0, 0, 0, 0.14);
}

@media (min-width: 1024px) {
    .fixed-tile {
        /* Match 1fr of an 8-col grid with 1rem gaps */
        width: calc((100% - 1rem * 7) / 8);
        max-width: calc((100% - 1rem * 7) / 8);
    }
}

/* Credentials Page Styles */
.credentials-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.credentials-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.credentials-header h2 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 600;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--foreground);
    border-color: var(--foreground);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--accent);
    border-color: var(--ring);
}

.credentials-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.credential-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.credential-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--ring);
}

.credential-card.active {
    border-color: var(--primary);
    background: var(--muted);
}

.credential-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.credential-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.credential-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
}

.active-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
}

.credential-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--foreground);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn-icon:hover {
    background: var(--accent);
    border-color: var(--ring);
    transform: translateY(-1px);
}

.btn-icon.btn-danger:hover {
    background: #fee2e2;
    border-color: #dc3545;
    color: #dc3545;
}

.credential-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.credential-field {
    display: flex;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.field-label {
    font-weight: 600;
    color: var(--muted-foreground);
    min-width: 80px;
}

.field-value {
    color: var(--foreground);
    word-break: break-all;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    z-index: 2000;
    padding: 1rem;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-size: 1rem;
}

.modal-close:hover {
    background: var(--accent);
    color: var(--foreground);
}

/* Show More divider */
.show-more-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.25rem 0 0.5rem;
    position: relative;
}

.show-more-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--border);
}

.show-more-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 1;
}

.show-more-btn:hover {
    color: var(--foreground);
    border-color: var(--ring);
    box-shadow: var(--shadow-sm);
}

.show-more-icon {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

#credential-form,
#setup-credential-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.form-group .required {
    color: #dc3545;
}

.form-group input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--background);
    color: var(--foreground);
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(9, 9, 11, 0.1);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 2.5rem;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.password-toggle:hover {
    color: var(--foreground);
    background: var(--accent);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
    .credentials-container {
        padding: 1.5rem 1rem;
    }
    
    .credential-card {
        padding: 1rem;
    }
    
    .credential-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .modal-content {
        max-width: 100%;
    }
    
    .modal-header,
    #credential-form,
    #setup-credential-form {
        padding: 1rem;
    }
}

/* Grade Breakdown Popup */
.grade-breakdown-popup {
    position: absolute;
    z-index: 1000;
    background: var(--card, #ffffff);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    min-width: 260px;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    font-size: 0.78rem;
    color: var(--card-foreground, var(--foreground));
    line-height: 1.5;
}
.grade-breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--foreground);
}
.grade-breakdown-close {
    background: none;
    border: none;
    color: var(--muted-foreground);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.grade-breakdown-close:hover {
    color: var(--foreground);
}
.grade-breakdown-mp {
    margin-bottom: 6px;
}
.grade-breakdown-mp-title {
    font-size: 0.8rem;
    color: var(--foreground);
    margin-bottom: 2px;
}
.grade-breakdown-cat {
    display: flex;
    justify-content: space-between;
    padding: 1px 0 1px 10px;
    font-size: 0.73rem;
    color: var(--muted-foreground);
}
.grade-breakdown-cat-name {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.grade-breakdown-cat-val {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.grade-breakdown-final {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--foreground);
}
.running-grade-cell:hover {
    text-decoration: underline;
    opacity: 0.85;
}

/* ============================================================
   Course Chart Detail Modal
   ============================================================ */
.chart-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 2000;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chart-modal-overlay.visible {
    opacity: 1;
}

.chart-modal-content {
    width: 100%;
    max-width: 800px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(12px) scale(0.97);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.chart-modal-overlay.visible .chart-modal-content {
    transform: translateY(0) scale(1);
}

.chart-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--muted);
    flex-shrink: 0;
    gap: 0.75rem;
}

.chart-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.chart-modal-header h3 i {
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.chart-modal-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.chart-modal-grade {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.chart-modal-body {
    padding: 1.25rem;
    flex: 1;
    overflow-y: auto;
}

.chart-modal-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
}

/* Chart Modal Data Table */
.chart-modal-data-section {
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.chart-modal-data-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem 1rem;
    background: var(--muted);
    border: none;
    color: var(--muted-foreground);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.chart-modal-data-toggle:hover {
    background: var(--accent);
    color: var(--foreground);
}

.chart-modal-data-toggle i {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.chart-modal-data-wrapper {
    max-height: 400px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    background: var(--card);
}

.chart-modal-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    color: var(--foreground);
}

.chart-modal-data-table th,
.chart-modal-data-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.chart-modal-data-table th {
    background: var(--muted);
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.65rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.chart-modal-data-table tr:last-child td {
    border-bottom: none;
}

.chart-modal-data-table tbody tr:hover {
    background: var(--accent);
}

.chart-modal-data-table tr.not-plotted {
    color: #ef4444;
    opacity: 0.7;
}

.chart-modal-data-table .data-cell-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-modal-data-table .data-cell-pct {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.chart-modal-data-table .data-cell-cat {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-modal-data-table .data-cell-rg {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.chart-modal-data-table .data-cell-rg:hover {
    text-decoration: underline;
    opacity: 0.85;
}

/* Medium screens */
@media (min-width: 640px) {
    .chart-modal-content {
        max-width: 800px;
    }

    .chart-modal-header {
        padding: 1.25rem 1.5rem;
    }

    .chart-modal-header h3 {
        font-size: 1.125rem;
    }

    .chart-modal-body {
        padding: 1.5rem;
    }

    .chart-modal-canvas-wrapper {
        height: 380px;
    }
}

/* Large screens */
@media (min-width: 1024px) {
    .chart-modal-content {
        max-width: 900px;
    }

    .chart-modal-canvas-wrapper {
        height: 440px;
    }
}

/* Small screens */
@media (max-width: 639px) {
    .chart-modal-overlay {
        padding: 0.5rem;
    }

    .chart-modal-header {
        padding: 0.75rem 1rem;
    }

    .chart-modal-header h3 {
        font-size: 0.875rem;
    }

    .chart-modal-grade {
        font-size: 1.25rem;
    }

    .chart-modal-body {
        padding: 0.75rem;
    }

    .chart-modal-canvas-wrapper {
        height: 260px;
    }
}
