@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg:             #f1f5f9;
    --bg-card:        #ffffff;
    --bg-dark:        #0f172a;
    --text:           #1e293b;
    --text-muted:     #64748b;
    --text-light:     #94a3b8;
    --border:         #e2e8f0;
    --border-hover:   #cbd5e1;
    --focus-ring:     rgba(59,130,246,0.25);

    --primary:        #3b82f6;
    --primary-hover:  #2563eb;
    --primary-soft:   #dbeafe;

    --success:        #16a34a;
    --success-soft:   #dcfce7;
    --success-border: #4ade80;

    --warning:        #ea580c;
    --warning-soft:   #fff7ed;
    --warning-border: #fb923c;

    --danger:         #ef4444;
    --danger-hover:   #dc2626;

    --ns-bg:          #ffffff;
    --ns-border:      #94a3b8;
    --reg-bg:         #fff7ed;
    --reg-border:     #f97316;
    --reg-text:       #9a3412;
    --comp-bg:        #f0fdf4;
    --comp-border:    #22c55e;
    --comp-text:      #166534;

    --radius:         8px;
    --radius-lg:      12px;
    --shadow-sm:      0 1px 2px rgba(0,0,0,.04);
    --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:      0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.04);
    --shadow-lg:      0 10px 25px -3px rgba(0,0,0,.12), 0 4px 6px -4px rgba(0,0,0,.06);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: .2s ease;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════════ */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
}

.auth-container { width: 100%; max-width: 420px; padding: 1.5rem; }

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.auth-card__header {
    text-align: center;
    padding: 2.5rem 2rem 1.5rem;
    color: var(--text);
}
.auth-card__header svg {
    color: var(--primary);
    margin-bottom: .5rem;
}
.auth-card__header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: .25rem;
}
.auth-card__header p {
    font-size: .875rem;
    color: var(--text-muted);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.auth-tab {
    flex: 1;
    padding: .75rem;
    font-family: var(--font);
    font-size: .875rem;
    font-weight: 600;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.auth-tab:hover { color: var(--text); }
.auth-tab--active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form {
    padding: 1.5rem 2rem 2rem;
}

.auth-error {
    font-size: .8125rem;
    color: var(--danger);
    min-height: 1.25rem;
    margin-bottom: .5rem;
}

.btn--full { width: 100%; justify-content: center; }

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */

.app-header {
    background: var(--bg-dark);
    color: #fff;
    padding: 1rem 2rem;
}
.app-header__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.app-header__left {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.app-header__icon { flex-shrink: 0; opacity: .85; }
.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -.01em;
}
.app-header__right {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.app-header__user {
    font-size: .8125rem;
    color: var(--text-light);
}
.btn--header {
    font-family: var(--font);
    font-size: .75rem;
    font-weight: 600;
    padding: .35rem .75rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.2);
    background: transparent;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    transition: all var(--transition);
}
.btn--header:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

/* ═══════════════════════════════════════════
   MAIN
   ═══════════════════════════════════════════ */

.app-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

/* ═══════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════ */

.dashboard__welcome h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -.01em;
}

/* ═══════════════════════════════════════════
   VIEW TABS
   ═══════════════════════════════════════════ */

.view-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.view-tab {
    font-family: var(--font);
    font-size: .875rem;
    font-weight: 600;
    padding: .75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .5rem;
    transition: all var(--transition);
}
.view-tab:hover { color: var(--text); }
.view-tab--active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.view-tab svg { flex-shrink: 0; }

.view-panel { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ═══════════════════════════════════════════
   STATS
   ═══════════════════════════════════════════ */

.stats-bar {
    display: flex;
    gap: .75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: .875rem 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-width: 120px;
    flex: 1;
}
.stat--wide { flex: 2; min-width: 200px; justify-content: center; gap: .4rem; }
.stat__value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}
.stat__value--completed { color: var(--success); }
.stat__value--registered { color: var(--warning); }
.stat__value--remaining { color: var(--text-muted); }
.stat__label {
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--bg);
    border-radius: 99px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #4ade80);
    border-radius: 99px;
    transition: width .5s ease;
    min-width: 0;
}

/* ═══════════════════════════════════════════
   SETTINGS BAR
   ═══════════════════════════════════════════ */

.settings-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: .875rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
.settings-bar__inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.settings-bar__field {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.settings-bar__field label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}
.settings-bar__field input,
.settings-bar__field select {
    font-family: var(--font);
    font-size: .875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .4rem .65rem;
    color: var(--text);
    background: var(--bg);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.settings-bar__field input { width: 220px; font-weight: 600; }
.settings-bar__field select { cursor: pointer; }
.settings-bar__field input:focus,
.settings-bar__field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ═══════════════════════════════════════════
   SECTION HEADERS
   ═══════════════════════════════════════════ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.section-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -.01em;
}
.section-header__actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

/* Legend */
.legend { display: flex; gap: .875rem; align-items: center; }
.legend__item {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.legend__swatch {
    width: 14px; height: 14px;
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
}
.legend__swatch--not-started { background: var(--ns-bg); border: 2px solid var(--ns-border); }
.legend__swatch--registered  { background: var(--reg-bg); border: 2px solid var(--reg-border); }
.legend__swatch--completed   { background: var(--comp-bg); border: 2px solid var(--comp-border); }

/* ═══════════════════════════════════════════
   STUDY GRID
   ═══════════════════════════════════════════ */

.study-grid {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.grid-header {
    display: grid;
    grid-template-columns: 80px repeat(4, 1fr);
    background: var(--bg-dark);
    color: #fff;
}
.grid-header__label {
    padding: .625rem .75rem;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    text-align: center;
}
.grid-header__label:first-child { text-align: left; background: rgba(0,0,0,.15); }

.grid-row {
    display: grid;
    grid-template-columns: 80px repeat(4, 1fr);
    border-bottom: 1px solid var(--border);
}
.grid-row:last-child { border-bottom: none; }

.year-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
    color: var(--text-muted);
    background: #f8fafc;
    border-right: 1px solid var(--border);
    padding: .75rem .5rem;
}

.period-cell {
    border-right: 1px solid var(--border);
    padding: .5rem;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    gap: .375rem;
    position: relative;
    transition: background var(--transition);
}
.period-cell:last-child { border-right: none; }
.period-cell:hover { background: #f8fafc; }

.period-cell__add {
    position: absolute;
    bottom: 4px; right: 4px;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 1.5px dashed var(--text-light);
    background: transparent;
    color: var(--text-light);
    font-size: 14px; line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition), color var(--transition), border-color var(--transition);
}
.period-cell:hover .period-cell__add { opacity: 1; }
.period-cell__add:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

/* ═══════════════════════════════════════════
   COURSE BLOCK
   ═══════════════════════════════════════════ */

.course-block {
    border-radius: 6px;
    padding: .4rem .6rem;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    border-width: 2px;
    border-style: solid;
}
.course-block:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.course-block--not_started { background: var(--ns-bg); border-color: var(--ns-border); color: var(--text); }
.course-block--registered  { background: var(--reg-bg); border-color: var(--reg-border); color: var(--reg-text); }
.course-block--completed   { background: var(--comp-bg); border-color: var(--comp-border); color: var(--comp-text); }

.course-block--registered.course-block--hp-fill,
.course-block--not_started.course-block--hp-fill {
    position: relative;
    overflow: hidden;
}
.course-block__hpfill {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(135deg,
        rgba(220, 252, 231, 0.94) 0%,
        rgba(220, 252, 231, 0.94) var(--hp-progress-pct, 0%),
        transparent var(--hp-progress-pct, 0%));
}
.course-block__inner {
    position: relative;
    z-index: 1;
}

.course-block__code {
    font-size: .625rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
    opacity: .7; display: block; line-height: 1.3;
}
.course-block__name { font-size: .75rem; font-weight: 600; display: block; line-height: 1.3; word-break: break-word; }
.course-block__credits { font-size: .625rem; font-weight: 500; opacity: .6; display: block; margin-top: 2px; }

/* ═══════════════════════════════════════════
   KURS-MODAL: Delmoment
   ═══════════════════════════════════════════ */

.course-moments-rows { display: flex; flex-direction: column; gap: .5rem; margin: .5rem 0; }
.course-moment-row {
    display: grid;
    grid-template-columns: 1.5rem 1fr 5rem 2rem;
    gap: .5rem;
    align-items: center;
}
.course-moment-done {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--success);
    cursor: pointer;
    justify-self: center;
}
.course-moment-row .course-moment-name,
.course-moment-row .course-moment-weight {
    font-family: var(--font);
    font-size: .8125rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .375rem .5rem;
    color: var(--text);
}
.course-moment-row .course-moment-weight { text-align: right; }
.course-moment-row__remove {
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius);
    padding: .2rem;
    justify-self: center;
}
.course-moment-row__remove:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}
.form-hint-inline { font-weight: 400; color: var(--text-muted); font-size: .8125rem; }

/* ═══════════════════════════════════════════
   DAILY PLANNER (pluggdag)
   ═══════════════════════════════════════════ */

.daily-planner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem 1.5rem;
    margin-bottom: 1.5rem;
}
.daily-planner .section-header {
    margin-bottom: 1rem;
}
.daily-planner .section-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: .35rem;
}
.daily-planner__intro {
    font-size: .875rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}
.daily-planner__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem 1rem;
    margin-bottom: 1.25rem;
}
.daily-planner__date label {
    display: block;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: .25rem;
}
.daily-planner__date input[type="date"] {
    font-family: var(--font);
    font-size: .875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .4rem .65rem;
    color: var(--text);
    background: var(--bg);
}
.daily-planner__form {
    margin-bottom: 1.25rem;
}
.daily-planner__form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem 1rem;
}
.daily-planner__field {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.daily-planner__field label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-muted);
}
.daily-planner__field input[type="time"],
.daily-planner__field input[type="text"] {
    font-family: var(--font);
    font-size: .875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .45rem .65rem;
    min-width: 0;
}
.daily-planner__field--grow {
    flex: 1;
    min-width: 180px;
}
.daily-planner__field--btn {
    flex-shrink: 0;
}
.daily-planner__label-spacer {
    visibility: hidden;
    font-size: .8125rem;
}
.daily-planner__empty {
    font-size: .875rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem 1rem;
    margin: 0;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

.daily-task-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.daily-task {
    display: flex;
    align-items: stretch;
    gap: .5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    transition: opacity var(--transition), border-color var(--transition);
}
.daily-task--done {
    opacity: .72;
    border-color: var(--success-border);
    background: var(--success-soft);
}
.daily-task__row {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    margin: 0;
}
.daily-task__check {
    width: 20px;
    height: 20px;
    margin-top: .1rem;
    flex-shrink: 0;
    border-radius: 5px;
    border: 2px solid var(--border, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s ease;
    background: #fff;
}
.daily-task__row:hover .daily-task__check {
    border-color: var(--primary, #2563eb);
}
.daily-task__check--done {
    background: var(--success, #22c55e);
    border-color: var(--success, #22c55e);
    color: #fff;
}
.daily-task__time {
    flex-shrink: 0;
    font-size: .8125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--primary-hover);
    min-width: 5.5rem;
}
.daily-task--done .daily-task__time {
    color: var(--text-muted);
}
.daily-task__title {
    font-size: .875rem;
    line-height: 1.4;
    word-break: break-word;
}
.daily-task--done .daily-task__title {
    text-decoration: line-through;
    color: var(--text-muted);
}
.daily-task__actions {
    display: flex;
    align-items: flex-start;
    gap: .125rem;
    flex-shrink: 0;
}
.daily-task__edit,
.daily-task__del {
    flex-shrink: 0;
    align-self: flex-start;
    padding: .2rem .45rem !important;
    min-width: auto;
    line-height: 1;
    color: var(--text-muted);
}
.daily-task__edit:hover {
    color: var(--primary);
    background: var(--primary-soft) !important;
}
.daily-task__del {
    font-size: 1.1rem !important;
}
.daily-task__del:hover {
    color: var(--danger);
    background: #fef2f2 !important;
}

.daily-celebration {
    text-align: center;
    max-width: 380px;
    padding: 2rem 1.75rem 1.75rem;
}
.daily-celebration__icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: .75rem;
}
.daily-celebration h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: .5rem;
    color: var(--success);
}
.daily-celebration__text {
    font-size: .9375rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
#daily-celebration-modal .modal {
    border: 2px solid var(--success-border);
    box-shadow: 0 20px 50px rgba(34, 197, 94, 0.15);
}

/* ═══════════════════════════════════════════
   CALENDAR
   ═══════════════════════════════════════════ */

.calendar-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    /* Låt kalendern scrolla horisontellt vid smal vy — undvik att kolumner klipper veckodagar */
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.calendar-nav h2 {
    font-size: 1.0625rem;
    font-weight: 700;
    min-width: 180px;
    text-align: center;
}

.calendar-grid {
    padding: 0;
    /* Tvingar minsta totalbredd så veckodagar inte klipps — scroll på smal skärm */
    min-width: calc(7 * 2.75rem);
}

/* Minsta kolumnbredd så tre bokstäver alltid ryms */
.cal-header {
    display: grid;
    grid-template-columns: repeat(7, minmax(2.75rem, 1fr));
    background: var(--bg-dark);
    color: #fff;
}
.cal-header__day {
    padding: .5rem .25rem;
    font-size: .75rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    text-align: center;
    white-space: nowrap;
    overflow: visible;
    min-width: 0;
}
.cal-header__day--weekend { color: rgba(255,255,255,.5); }

.cal-body {
    display: grid;
    grid-template-columns: repeat(7, minmax(2.75rem, 1fr));
}

.cal-day {
    min-height: 90px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: .25rem;
    position: relative;
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    flex-direction: column;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: #f8fafc; }

.cal-day--outside { background: #f8fafc; opacity: .4; pointer-events: none; }
.cal-day--today { background: var(--primary-soft); }
.cal-day--today:hover { background: #bfdbfe; }
.cal-day--weekend { background: #fafafa; }

.cal-day__num {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: .125rem .375rem;
    display: inline-block;
}
.cal-day--today .cal-day__num {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
}

.cal-event {
    font-size: .625rem;
    font-weight: 500;
    padding: .125rem .375rem;
    border-radius: 4px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    background: var(--primary-soft);
    color: var(--primary-hover);
    border-left: 2px solid var(--primary);
    transition: opacity var(--transition);
}
.cal-event:hover { opacity: .8; }
.cal-day__more {
    font-size: .625rem;
    color: var(--text-muted);
    padding: .125rem .375rem;
    cursor: pointer;
}
.cal-day__more:hover { color: var(--primary); text-decoration: underline; }

/* iCal event badge — dashed border to distinguish from manual events */
.cal-event--ical {
    border-left-style: dashed;
}

/* ─── iCal Feeds Panel ─── */
.ical-feeds-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
}
.ical-feeds__form-row {
    display: flex;
    gap: .5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.ical-feeds__url-input {
    flex: 2 1 200px;
    min-width: 0;
}
.ical-feeds__label-input {
    flex: 1 1 120px;
    min-width: 0;
}
.ical-feeds__color-pick {
    flex: 0 0 auto;
}
.ical-feeds__color-input {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2px;
    cursor: pointer;
    background: none;
}
.ical-feeds__list {
    list-style: none;
    padding: 0;
    margin: .75rem 0 0;
    display: flex;
    flex-direction: column;
    gap: .375rem;
}
.ical-feeds__item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .375rem .5rem;
    background: #f8fafc;
    border-radius: var(--radius);
    font-size: .8125rem;
}
.ical-feeds__swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}
.ical-feeds__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ical-feeds__del {
    flex-shrink: 0;
    font-size: 1.125rem;
    color: var(--danger);
    padding: 0 .25rem;
    line-height: 1;
}
.ical-feeds__empty {
    color: var(--text-muted);
    font-size: .8125rem;
    margin: .5rem 0 0;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ─── Day Detail Modal ─── */
.modal--day-detail {
    max-width: 420px;
}
.day-detail__body {
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.day-detail__event {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .5rem;
    border-radius: var(--radius);
    background: #f8fafc;
    cursor: pointer;
    transition: background var(--transition);
}
.day-detail__event:hover { background: #f1f5f9; }
.day-detail__event--ical { cursor: default; }
.day-detail__event--ical:hover { background: #f8fafc; }
.day-detail__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: .25rem;
}
.day-detail__info {
    display: flex;
    flex-direction: column;
    gap: .125rem;
    min-width: 0;
}
.day-detail__title {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text);
}
.day-detail__meta {
    font-size: .75rem;
    color: var(--text-muted);
}
.day-detail__feed {
    font-size: .6875rem;
    color: var(--text-muted);
    font-style: italic;
}
.day-detail__empty {
    color: var(--text-muted);
    font-size: .875rem;
    text-align: center;
    padding: 1rem 0;
}
.modal--day-detail > .modal__footer {
    padding: .75rem 1.5rem 1.25rem;
    margin-top: 0;
}

/* Color select (event modal) */
.color-select { display: flex; gap: .5rem; flex-wrap: wrap; }
.color-option { cursor: pointer; }
.color-option input { position: absolute; opacity: 0; pointer-events: none; }
.color-dot {
    width: 28px; height: 28px; border-radius: 50%;
    display: block; border: 2px solid var(--border);
    transition: all var(--transition);
}
.color-dot--default { background: var(--bg); }
.color-option input:checked + .color-dot {
    border-color: var(--text);
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--text);
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */

.btn {
    font-family: var(--font);
    font-size: .8125rem;
    font-weight: 600;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn--secondary:hover { background: var(--border); }
.btn--ghost { background: transparent; color: var(--danger); border: none; padding: .5rem .75rem; }
.btn--ghost:hover { background: #fef2f2; }
.btn--small { font-size: .75rem; padding: .3rem .6rem; }

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.45);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.modal-overlay.is-open { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    animation: modalIn .2s ease;
}

/* Kursmodal: långt formulär (delmoment) ska scrolla på korta skärmar */
#course-modal .modal {
    max-height: min(92vh, 680px);
    display: flex;
    flex-direction: column;
}
#course-modal .modal__body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.modal__header h3 { font-size: 1.0625rem; font-weight: 700; }
.modal__close {
    width: 32px; height: 32px; border: none;
    background: transparent; font-size: 1.25rem;
    color: var(--text-muted); cursor: pointer;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.modal__close:hover { background: var(--bg); color: var(--text); }

.modal__body { padding: 1.25rem 1.5rem; }

.modal__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: .5rem;
}
.modal__footer-right { display: flex; gap: .5rem; }

/* ═══════════════════════════════════════════
   FORM
   ═══════════════════════════════════════════ */

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block; font-size: .8125rem; font-weight: 500;
    color: var(--text-muted); margin-bottom: .3rem;
}
.form-group .required { color: var(--danger); }
.form-group input,
.form-group select {
    width: 100%; font-family: var(--font); font-size: .875rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: .5rem .75rem; color: var(--text); background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.form-group input::placeholder { color: var(--text-light); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.form-hint {
    font-size: .75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin: .35rem 0 .25rem;
    display: block;
}
.course-credits-custom-wrap { margin-top: .5rem; }
.course-credits-custom__input { margin-top: .25rem; }

/* Status radio pills */
.status-select { display: flex; gap: .5rem; flex-wrap: wrap; }
.status-option { cursor: pointer; }
.status-option input { position: absolute; opacity: 0; pointer-events: none; }
.status-option__pill {
    display: inline-block; padding: .375rem .875rem;
    border-radius: 99px; font-size: .8125rem; font-weight: 500;
    border: 2px solid var(--border); background: #fff;
    color: var(--text-muted); transition: all var(--transition);
}
.status-option input:checked + .status-option__pill--not-started {
    border-color: var(--ns-border); background: var(--ns-bg); color: var(--text);
    box-shadow: 0 0 0 2px rgba(148,163,184,.2);
}
.status-option input:checked + .status-option__pill--registered {
    border-color: var(--reg-border); background: var(--reg-bg); color: var(--reg-text);
    box-shadow: 0 0 0 2px rgba(249,115,22,.15);
}
.status-option input:checked + .status-option__pill--completed {
    border-color: var(--comp-border); background: var(--comp-bg); color: var(--comp-text);
    box-shadow: 0 0 0 2px rgba(34,197,94,.15);
}

/* ═══════════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════════ */

.page-header {
    margin-bottom: 1.5rem;
}
.page-header h2 {
    font-size: 1.375rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .5rem;
    letter-spacing: -.01em;
}
.page-header h2 svg { color: var(--text-muted); }

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.settings-section__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}
.settings-section__header h3 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .25rem;
}
.settings-section__header h3 svg { color: var(--primary); flex-shrink: 0; }
.settings-section__header p {
    font-size: .8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.settings-section__body {
    padding: 1.25rem 1.5rem;
    transition: opacity var(--transition);
}

.settings-row {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.settings-row:last-child { margin-bottom: 0; }

.settings-field {
    flex: 1;
    min-width: 200px;
}
.settings-field label {
    display: block;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: .3rem;
}
.settings-field select {
    width: 100%;
    font-family: var(--font);
    font-size: .875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    color: var(--text);
    background: #fff;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.settings-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.settings-field input[type="email"],
.settings-field input[type="password"],
.settings-field input[type="text"] {
    width: 100%;
    font-family: var(--font);
    font-size: .875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    color: var(--text);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.settings-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.settings-field input::placeholder { color: var(--text-light); }
.settings-field--grow {
    flex: 2;
    min-width: 220px;
}
.settings-field--notif-email {
    max-width: 28rem;
}
.settings-row--email {
    align-items: flex-end;
}
.settings-inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: .25rem;
}

.settings-info-box {
    font-size: .8125rem;
    line-height: 1.55;
    color: var(--text-muted);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}
.settings-info-box strong { color: var(--text); }

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__slider {
    position: absolute;
    inset: 0;
    background: var(--border-hover);
    border-radius: 99px;
    cursor: pointer;
    transition: background var(--transition);
}
.toggle__slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.toggle input:checked + .toggle__slider { background: var(--primary); }
.toggle input:checked + .toggle__slider::before { transform: translateX(22px); }

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    color: var(--text);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Save bar */
.settings-save-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.settings-save-bar__status {
    font-size: .8125rem;
    font-weight: 500;
    min-height: 1.25rem;
}
.settings-save-bar__status.is-ok { color: var(--success); }
.settings-save-bar__status.is-error { color: var(--danger); }

/* Export cards */
.export-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.export-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: box-shadow var(--transition);
}
.export-card:hover { box-shadow: var(--shadow-md); }

.export-card__icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.export-card__icon--blue { background: var(--primary-soft); color: var(--primary); }
.export-card__icon--orange { background: var(--warning-soft); color: var(--warning); }

.export-card__info { flex: 1; min-width: 0; }
.export-card__info h4 {
    font-size: .9375rem;
    font-weight: 600;
    margin-bottom: .125rem;
}
.export-card__info p {
    font-size: .75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.btn--header {
    text-decoration: none;
}

/* ─── Danger button ─── */
.btn--danger {
    background: #ef4444;
    color: #fff;
    border: none;
}
.btn--danger:hover {
    background: #dc2626;
}

/* ─── GDPR / Account cards ─── */
.gdpr-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}
.gdpr-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: box-shadow var(--transition);
}
.gdpr-card:hover { box-shadow: var(--shadow-md); }

.gdpr-card__icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gdpr-card__icon--blue { background: var(--primary-soft); color: var(--primary); }
.gdpr-card__icon--red { background: #fef2f2; color: #ef4444; }

.gdpr-card__info { flex: 1; min-width: 0; }
.gdpr-card__info h4 {
    font-size: .9375rem;
    font-weight: 600;
    margin-bottom: .125rem;
}
.gdpr-card__info p {
    font-size: .75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.gdpr-links {
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}
.gdpr-links a {
    font-size: .8125rem;
    color: var(--primary);
    text-decoration: none;
}
.gdpr-links a:hover {
    text-decoration: underline;
}

/* ─── Privacy page ─── */
.privacy-page { max-width: 800px; margin: 0 auto; }
.privacy-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
}
.privacy-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .25rem;
}
.privacy-meta {
    font-size: .8125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}
.privacy-content section {
    margin-bottom: 1.75rem;
}
.privacy-content h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    margin-bottom: .5rem;
    color: var(--text);
}
.privacy-content p,
.privacy-content li {
    font-size: .875rem;
    line-height: 1.7;
    color: var(--text-muted);
}
.privacy-content ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin-top: .5rem;
}
.privacy-content li {
    margin-bottom: .35rem;
}
.privacy-content strong {
    color: var(--text);
    font-weight: 600;
}

/* ─── Auth footer (login page) ─── */
.auth-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 1.25rem;
}
.auth-footer a {
    font-size: .75rem;
    color: var(--text-muted);
    text-decoration: none;
}
.auth-footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ─── Consent checkbox (registration) ─── */
.form-group--consent {
    margin-top: .25rem;
}
.form-group--consent .checkbox-label {
    font-size: .8125rem;
}
.form-group--consent a {
    color: var(--primary);
    text-decoration: underline;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
    .app-main { padding: 1rem .75rem 3rem; }
    .app-header { padding: .75rem 1rem; }
    .app-header__user { display: none; }
    .app-header h1 { font-size: 1.0625rem; }
    .app-header__icon { width: 22px; height: 22px; }

    .settings-bar__field input { width: 160px; }
    .stats-bar { gap: .5rem; }
    .stat { padding: .65rem .875rem; min-width: 90px; }
    .stat__value { font-size: 1.25rem; }
    .section-header { flex-direction: column; gap: .75rem; }
    .section-header__actions { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .grid-header__label { font-size: .625rem; padding: .5rem .375rem; }
    .grid-header, .grid-row { grid-template-columns: 50px repeat(4, 1fr); }
    .year-label { font-size: .75rem; }
    .course-block { padding: .3rem .4rem; }
    .course-block__name { font-size: .6875rem; }
    .course-block__code { font-size: .5625rem; }
    .course-block__credits { font-size: .5625rem; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .legend { gap: .5rem; flex-wrap: wrap; }
    .legend__item { font-size: .6875rem; }

    /* Calendar mobile */
    .calendar-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: .5rem;
        padding: .75rem 1rem;
    }
    .calendar-nav h2 { min-width: 0; font-size: .9375rem; order: -1; width: 100%; text-align: center; }
    .calendar-nav .btn { font-size: .75rem; padding: .35rem .625rem; }
    .cal-day { min-height: 60px; padding: .125rem; }
    .cal-day__num { font-size: .625rem; padding: .125rem .25rem; }
    .cal-event { font-size: .5rem; padding: .1rem .25rem; border-left-width: 1.5px; }
    .cal-day__more { font-size: .5rem; padding: .05rem .25rem; font-weight: 600; }
    .cal-header__day { font-size: .625rem; padding: .375rem .125rem; }

    .ical-feeds__form-row { flex-direction: column; }
    .ical-feeds__url-input, .ical-feeds__label-input { flex: 1 1 100%; }

    .daily-planner__form-row { flex-direction: column; align-items: stretch; }
    .daily-planner__field--btn .btn { width: 100%; justify-content: center; }

    .export-cards { grid-template-columns: 1fr; }
    .gdpr-cards { grid-template-columns: 1fr; }
    .settings-row { flex-direction: column; gap: .75rem; }
    .settings-section__header { flex-direction: column; }
    .privacy-content { padding: 1.5rem; }

    /* Auth page mobile */
    .auth-container { padding: 1rem .75rem; }
    .auth-card__header { padding: 2rem 1.25rem 1.25rem; }
    .auth-card__header h1 { font-size: 1.25rem; }
    .auth-form { padding: 1.25rem 1.25rem 1.5rem; }

    /* Modals */
    .modal { max-width: 100%; border-radius: var(--radius); }
    .modal__header { padding: 1rem 1.25rem; }
    .modal__body { padding: 1rem 1.25rem; }
}

@media (max-width: 480px) {
    .stats-bar { display: grid; grid-template-columns: 1fr 1fr; }
    .stat--wide { grid-column: 1 / -1; }
    .settings-bar__inner { gap: .75rem; }
    .settings-bar__field { flex-direction: column; align-items: flex-start; gap: .2rem; }
    .settings-bar__field input { width: 100%; }
    .grid-header, .grid-row { grid-template-columns: 36px repeat(4, 1fr); }
    .period-cell { padding: .25rem; min-height: 55px; }
    .view-tab { font-size: .8125rem; padding: .625rem .75rem; }
    .view-tab svg { width: 14px; height: 14px; }

    /* Calendar very small */
    .cal-day { min-height: 50px; }
    .cal-day__num { font-size: .5625rem; }
    .cal-event { font-size: .4375rem; line-height: 1.2; }
    .cal-day__more { font-size: .4375rem; }
    .cal-header__day { font-size: .5625rem; padding: .3rem .1rem; letter-spacing: 0; }

    /* Course grid very small */
    .course-block { padding: .2rem .3rem; }
    .course-block__name { font-size: .625rem; line-height: 1.25; }
    .course-block__code { display: none; }
    .course-block__credits { font-size: .5rem; }

    /* Remaining cards */

    /* Settings */
    .settings-section__body { padding: 1rem; }
    .settings-section__header { padding: 1rem; }
    .settings-info-box { font-size: .75rem; padding: .75rem 1rem; }

    /* Export/GDPR cards */
    .export-card, .gdpr-card { flex-direction: column; align-items: flex-start; text-align: left; }
    .export-card__icon, .gdpr-card__icon { width: 40px; height: 40px; border-radius: 10px; }
    .export-card .btn, .gdpr-card .btn { width: 100%; justify-content: center; }

    /* Page header */
    .page-header h2 { font-size: 1rem; }
    .page-header h2 svg { width: 18px; height: 18px; }
}

@media (max-width: 360px) {
    .app-header h1 { font-size: .9375rem; }
    .btn--header { font-size: .6875rem; padding: .3rem .5rem; }
    .grid-header, .grid-row { grid-template-columns: 30px repeat(4, 1fr); }
    .year-label { font-size: .625rem; }
    .course-block__name { font-size: .5625rem; }
}

/* Study time stats + log modal */
.study-stats__intro {
    color: var(--text-muted);
    font-size: .9375rem;
    margin: .25rem 0 0;
    max-width: 42rem;
}
.study-stats__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin: 1.25rem 0 1.5rem;
}
.study-stats__week-label {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    min-width: 12rem;
    text-align: center;
}
.study-stats__total {
    background: var(--surface-elevated, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius, 12px);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.study-stats__total-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary, #2563eb);
    letter-spacing: -0.02em;
}
.study-stats__total-label {
    font-size: .8125rem;
    color: var(--text-muted);
}
.study-stats__subhead {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 .75rem;
}
.study-stats__by-course {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.study-stats__course-row {
    max-width: 36rem;
}
.study-stats__course-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .75rem;
    margin-bottom: .35rem;
    font-size: .875rem;
}
.study-stats__course-name {
    font-weight: 500;
    color: var(--text, #0f172a);
}
.study-stats__course-mins {
    color: var(--text-muted);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.study-stats__bar {
    height: 8px;
    background: var(--border, #e2e8f0);
    border-radius: 999px;
    overflow: hidden;
}
.study-stats__bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary, #2563eb), #60a5fa);
    border-radius: 999px;
    min-width: 4px;
    transition: width .25s ease;
}
.study-stats__entries {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 40rem;
}
.study-stats__entry {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .25rem .75rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border, #e2e8f0);
    font-size: .875rem;
}
.study-stats__entry-date {
    grid-row: 1 / 3;
    color: var(--text-muted);
    font-size: .8125rem;
    font-variant-numeric: tabular-nums;
    align-self: start;
    padding-top: .1rem;
}
.study-stats__entry-title {
    font-weight: 500;
}
.study-stats__entry-meta {
    grid-column: 2;
    color: var(--text-muted);
    font-size: .8125rem;
}
.study-stats__empty {
    color: var(--text-muted);
    font-size: .875rem;
    margin: .5rem 0 1rem;
}
.study-log__preview {
    font-size: .9375rem;
    font-weight: 500;
    margin: 0 0 1rem;
    padding: .75rem 1rem;
    background: var(--surface-elevated, #f8fafc);
    border-radius: var(--radius, 8px);
    border: 1px solid var(--border, #e2e8f0);
}
.study-log__hint {
    margin: .75rem 0 0;
    font-size: .8125rem;
}
.form-error {
    color: var(--danger, #dc2626);
    font-size: .875rem;
    margin: .5rem 0 0;
}
