/* ============================================================
   YT STUDY LAB — Design System
   Neobrutalist · Hanken Grotesk · Bricolage Grotesque
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500..800&family=Hanken+Grotesk:ital,wght@0,400;0,500;0,600;0,700;1,500&display=swap');

/* ── CSS Variables ── */
:root {
    --paper:       #fbf3e4;
    --paper-deep:  #f0e4cc;
    --paper-mid:   #f5ead2;
    --ink:         #1b1712;
    --ink-soft:    #5a5044;
    --ink-muted:   #8b7d6b;
    --red:         #ff3b2f;
    --red-deep:    #d52817;
    --yellow:      #ffce4a;
    --teal:        #36c2ad;
    --sky:         #74a7ff;
    --coral:       #ff9e86;
    --lilac:       #c8a8ff;
    --green:       #4caf7d;
    --shadow:      5px 5px 0 var(--ink);
    --shadow-sm:   3px 3px 0 var(--ink);
    --shadow-lg:   8px 8px 0 var(--ink);
    --radius:      14px;
    --radius-sm:   8px;
    --radius-pill: 999px;
    --border:      2px solid var(--ink);
    --transition:  0.14s ease;
    --font-head:   'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
    --font-body:   'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
    --topnav-h:    62px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--paper); color: var(--ink); font-family: var(--font-body); line-height: 1.55; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-body); }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; flex-shrink: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }

/* ── Top Nav ── */
.topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topnav-h);
    background: var(--ink);
    color: var(--paper);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    z-index: 100;
    border-bottom: 2px solid var(--ink);
}

.topnav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.brand-icon {
    font-size: 26px;
    line-height: 1;
}
.brand-name {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 700;
    color: var(--yellow);
    line-height: 1.2;
}
.brand-sub {
    font-size: 10px;
    color: rgba(251,243,228,.5);
    display: block;
    line-height: 1;
}

.topnav-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: rgba(251,243,228,.65);
    transition: background var(--transition), color var(--transition);
    position: relative;
    white-space: nowrap;
}
.nav-btn svg { width: 15px; height: 15px; stroke: currentColor; }
.nav-btn:hover { background: rgba(255,255,255,.1); color: var(--paper); }
.nav-btn.active { background: var(--yellow); color: var(--ink); }
.nav-btn.active svg { stroke: var(--ink); }

.nav-badge {
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 99px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.today-badge { background: var(--green); }

.topnav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

/* ── App Shell ── */
.app-shell { padding-top: var(--topnav-h); }
.main-content { max-width: 1300px; margin: 0 auto; padding: 28px 24px 60px; }

/* ── Content Panes ── */
.content-pane { display: none; }
.content-pane.active { display: block; }

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.page-title-area h1 {
    font-family: var(--font-head);
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 800;
    line-height: 1.1;
    color: var(--ink);
}
.page-title-area p {
    font-size: 14px;
    color: var(--ink-muted);
    margin-top: 4px;
}
.header-actions { display: flex; gap: 10px; align-items: center; }

/* ── Controls Bar ── */
.controls-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    box-shadow: var(--shadow-sm);
    flex: 1;
    min-width: 200px;
    max-width: 340px;
}
.search-box svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--ink-muted); }
.search-box input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: var(--ink);
    width: 100%;
    padding: 10px 0;
}
.search-box input::placeholder { color: var(--ink-muted); }

.filter-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.filter-pill {
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    border: var(--border);
    font-size: 12px;
    font-weight: 600;
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition);
    white-space: nowrap;
}
.filter-pill:hover { background: var(--paper-deep); }
.filter-pill.active { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-sm); }

.sort-select-wrap label { font-size: 12px; font-weight: 600; color: var(--ink-muted); margin-right: 4px; }
.sort-select {
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
    outline: none;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    border: var(--border);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.btn svg { width: 14px; height: 14px; stroke: currentColor; }

.btn-primary { background: var(--yellow); color: var(--ink); }
.btn-secondary { background: var(--paper); color: var(--ink); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink svg { stroke: var(--paper); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red-deep); }
.btn-danger:hover { box-shadow: 4px 4px 0 var(--red-deep); }

.btn-sm { padding: 6px 12px; font-size: 12px; box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ── Video Grid ── */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ── Video Card ── */
.video-card {
    background: var(--paper);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}
.video-card:hover {
    transform: translate(-2px,-2px);
    box-shadow: var(--shadow-lg);
}
.video-card.is-watched { opacity: .75; }
.video-card.is-pinned { border-color: var(--yellow); }

.video-thumb-wrap {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--ink);
}
.video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s;
}
.video-thumb-wrap:hover .video-thumb { opacity: .85; }

.thumb-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}
.video-thumb-wrap:hover .thumb-overlay { opacity: 1; }

.play-btn {
    width: 52px; height: 52px;
    background: var(--yellow);
    border: var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: transform var(--transition);
}
.play-btn:hover { transform: scale(1.1); }
.play-btn svg { width: 20px; height: 20px; fill: var(--ink); stroke: var(--ink); margin-left: 2px; }

.card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--ink);
    line-height: 1.4;
}
.badge-new { background: var(--yellow); color: var(--ink); }
.badge-watched { background: var(--green); color: #fff; border-color: #3a9463; }
.badge-pin { background: var(--ink); color: var(--paper); top: 8px; left: auto; right: 8px; }
.badge-overdue { background: var(--red); color: #fff; border-color: var(--red-deep); }

.video-card-body {
    padding: 12px 14px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.video-channel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.video-channel {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.video-date { font-size: 11px; color: var(--ink-muted); flex-shrink: 0; }

.video-title {
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
}
.video-title:hover { text-decoration: underline; }

.video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}
.tag-chip {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    background: var(--paper-deep);
    border: 1.5px solid var(--ink);
    color: var(--ink-soft);
}

.video-schedule-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--sky);
    margin-top: 2px;
}
.video-schedule-row.overdue { color: var(--red); }

/* Card Footer */
.video-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-top: var(--border);
    background: var(--paper-mid);
    gap: 4px;
}

.watch-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--ink);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    background: transparent;
    color: var(--ink-muted);
}
.watch-toggle svg { width: 12px; height: 12px; stroke: currentColor; }
.watch-toggle.watched { background: var(--green); color: #fff; border-color: #3a9463; }
.watch-toggle:hover { background: var(--paper-deep); color: var(--ink); }
.watch-toggle.watched:hover { background: #3a9463; }

.card-actions { display: flex; align-items: center; gap: 2px; }

.icon-action {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    border: none;
    background: transparent;
    color: var(--ink-muted);
    position: relative;
}
.icon-action:hover { background: var(--paper-deep); transform: scale(1.15); color: var(--ink); }
.icon-action.active-like { color: var(--sky); }
.icon-action.active-dislike { color: var(--red); }
.icon-action.active-pin { color: var(--yellow); filter: drop-shadow(0 0 3px rgba(255,206,74,.8)); }
.icon-action.active-notes { color: var(--teal); }
.icon-action svg { width: 14px; height: 14px; }

/* ── Empty State ── */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}
.empty-icon { font-size: 56px; margin-bottom: 16px; line-height: 1; }
.empty-state h3 { font-family: var(--font-head); font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--ink-muted); margin-bottom: 20px; max-width: 380px; margin-left: auto; margin-right: auto; }

/* ── Courses Grid ── */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* ── Course Card ── */
.course-card {
    background: var(--paper);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: pointer;
}
.course-card:hover { transform: translate(-2px,-2px); box-shadow: var(--shadow-lg); }

.course-card-accent {
    height: 6px;
    width: 100%;
}
.course-card-header {
    padding: 16px 18px 10px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.course-emoji {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}
.course-info { flex: 1; min-width: 0; }
.course-name {
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.course-desc {
    font-size: 12px;
    color: var(--ink-muted);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.course-video-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-top: 4px;
}

.course-progress-wrap { padding: 0 18px 12px; }
.course-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    margin-bottom: 5px;
}
.progress-bar-track {
    height: 8px;
    background: var(--paper-deep);
    border-radius: 99px;
    border: 1.5px solid var(--ink);
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--green);
    transition: width 0.5s ease;
    min-width: 0;
}

.course-thumbs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin: 0 0 12px;
    border-top: var(--border);
    border-bottom: var(--border);
    overflow: hidden;
}
.course-thumb-img {
    aspect-ratio: 16/9;
    object-fit: cover;
    width: 100%;
    display: block;
}
.course-thumb-placeholder {
    aspect-ratio: 16/9;
    background: var(--paper-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--ink-muted);
}

.course-card-footer {
    padding: 10px 14px;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    border-top: var(--border);
    background: var(--paper-mid);
}

/* ── Course Detail ── */
.course-detail-header {
    background: var(--paper);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin: 16px 0 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.course-detail-emoji { font-size: 48px; line-height: 1; flex-shrink: 0; }
.course-detail-info { flex: 1; min-width: 200px; }
.course-detail-name { font-family: var(--font-head); font-size: 26px; font-weight: 800; }
.course-detail-desc { font-size: 14px; color: var(--ink-muted); margin-top: 4px; }
.course-detail-progress {
    flex: 1;
    min-width: 200px;
}
.course-detail-actions { display: flex; gap: 8px; }

.course-video-list { display: flex; flex-direction: column; gap: 12px; }

.course-video-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--paper);
    border: var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 10px 14px;
    transition: transform var(--transition);
}
.course-video-item:hover { transform: translateX(2px); }
.course-video-item.is-watched { opacity: .7; }

.course-video-num {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 800;
    color: var(--ink-muted);
    min-width: 28px;
    text-align: center;
    flex-shrink: 0;
}
.course-video-thumb {
    width: 90px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 6px;
    border: var(--border);
    flex-shrink: 0;
}
.course-video-info { flex: 1; min-width: 0; }
.course-video-title {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.course-video-channel { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.course-video-status {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
    border: 1.5px solid;
    margin-top: 4px;
    display: inline-block;
}
.status-watched { background: var(--green); color: #fff; border-color: #3a9463; }
.status-unwatched { background: var(--paper-deep); color: var(--ink-muted); border-color: var(--ink-muted); }

.course-video-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.reorder-btn {
    width: 28px; height: 28px;
    border: var(--border);
    border-radius: 6px;
    background: var(--paper-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: background var(--transition);
}
.reorder-btn:hover { background: var(--paper-mid); }
.reorder-btn:disabled { opacity: .3; cursor: not-allowed; }

/* ── Schedule View ── */
.schedule-view { display: flex; flex-direction: column; gap: 28px; }

.schedule-section {}
.schedule-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: var(--border);
}
.schedule-section-title {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 800;
}
.schedule-section-count {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--ink);
    color: var(--paper);
}
.section-today .schedule-section-title { color: var(--ink); }
.section-today .schedule-section-count { background: var(--yellow); color: var(--ink); }
.section-overdue .schedule-section-title { color: var(--red); }
.section-overdue .schedule-section-count { background: var(--red); color: #fff; }

.schedule-items { display: flex; flex-direction: column; gap: 10px; }

.schedule-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--paper);
    border: var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 10px 14px;
    transition: transform var(--transition);
}
.schedule-item:hover { transform: translateX(2px); }
.schedule-item.overdue-item { border-color: var(--red); }

.schedule-thumb {
    width: 100px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 6px;
    border: var(--border);
    flex-shrink: 0;
    cursor: pointer;
}
.schedule-info { flex: 1; min-width: 0; }
.schedule-title {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.schedule-title:hover { text-decoration: underline; }
.schedule-channel { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.schedule-date-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
    border: 1.5px solid var(--ink-muted);
    color: var(--ink-muted);
    margin-top: 4px;
    display: inline-block;
}
.overdue-item .schedule-date-tag { border-color: var(--red); color: var(--red); }
.schedule-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ── Settings ── */
.settings-panel { max-width: 680px; display: flex; flex-direction: column; gap: 20px; }

.settings-section {
    background: var(--paper);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.settings-section-header {
    padding: 16px 20px 12px;
    border-bottom: var(--border);
    background: var(--paper-mid);
}
.settings-section-header h3 {
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 700;
}
.settings-section-header p { font-size: 13px; color: var(--ink-muted); margin-top: 3px; }
.settings-section-body { padding: 16px 20px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}
.stat-item {
    background: var(--paper-deep);
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    text-align: center;
}
.stat-num {
    font-family: var(--font-head);
    font-size: 30px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1;
}
.stat-label { font-size: 11px; font-weight: 600; color: var(--ink-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }

.action-buttons-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Form Elements ── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 700; color: var(--ink); }
.form-input {
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 14px;
    background: var(--paper);
    color: var(--ink);
    outline: none;
    transition: box-shadow var(--transition);
    width: 100%;
}
.form-input:focus { box-shadow: 0 0 0 3px rgba(27,23,18,.15); }
.form-select {
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 14px;
    background: var(--paper);
    color: var(--ink);
    outline: none;
    cursor: pointer;
    width: 100%;
}
.help-text { font-size: 11px; color: var(--ink-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.url-input-row { display: flex; gap: 8px; }
.url-input-row .form-input { flex: 1; }

/* ── Video Preview Card ── */
.video-preview-card {
    display: flex;
    gap: 14px;
    background: var(--paper-deep);
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 12px 0;
    box-shadow: var(--shadow-sm);
}
.video-preview-card img {
    width: 120px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 6px;
    border: var(--border);
    flex-shrink: 0;
}
.video-preview-info { flex: 1; min-width: 0; }
.preview-title { font-weight: 700; font-size: 14px; line-height: 1.3; color: var(--ink); }
.preview-channel { font-size: 12px; color: var(--ink-soft); margin-top: 5px; font-weight: 600; }
.preview-id { font-size: 11px; color: var(--ink-muted); margin-top: 4px; font-family: monospace; }

.divider { height: 1px; background: var(--paper-deep); margin: 16px 0; border-top: var(--border); }

/* Fetch states */
.fetch-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: var(--paper-deep);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--ink-soft);
    margin: 10px 0;
}
.fetch-error {
    padding: 12px 14px;
    background: #fff0ef;
    border: 1.5px solid var(--red);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--red);
    margin: 10px 0;
}

.spinner {
    width: 18px; height: 18px;
    border: 2.5px solid var(--paper-deep);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Emoji Picker ── */
.emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-btn {
    width: 38px; height: 38px;
    border: var(--border);
    border-radius: 8px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--paper);
    transition: background var(--transition), box-shadow var(--transition);
}
.emoji-btn:hover { background: var(--paper-deep); }
.emoji-btn.active { background: var(--yellow); box-shadow: var(--shadow-sm); }

/* ── Color Swatches ── */
.color-swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid var(--ink);
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--ink);
    transition: transform var(--transition), box-shadow var(--transition);
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-width: 3px; box-shadow: 3px 3px 0 var(--ink); transform: scale(1.15); }

/* ── Course Picker List (Add to Course modal) ── */
.course-picker-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.course-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--paper);
    transition: background var(--transition);
}
.course-picker-item:hover { background: var(--paper-deep); }
.course-picker-item.in-course { background: #e8f7ee; border-color: var(--green); }
.picker-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: var(--border);
    flex-shrink: 0;
}
.picker-name { font-size: 13px; font-weight: 600; flex: 1; }
.picker-check { color: var(--green); font-size: 14px; font-weight: 700; }

/* ── Scheduler ── */
.scheduler-video-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Modals ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(27,23,18,.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
    backdrop-filter: blur(3px);
}
.modal-overlay.active { display: flex; }

.modal-content {
    background: var(--paper);
    border: var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-wide { max-width: 640px; }
.modal-sm { max-width: 380px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: var(--border);
    background: var(--paper-mid);
    flex-shrink: 0;
}
.modal-title { font-family: var(--font-head); font-size: 17px; font-weight: 800; }
.modal-close {
    width: 30px; height: 30px;
    border: var(--border);
    border-radius: 8px;
    background: var(--paper);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition);
}
.modal-close:hover { background: var(--red); color: #fff; border-color: var(--red-deep); }

.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.modal-footer {
    padding: 14px 20px;
    border-top: var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: var(--paper-mid);
    flex-shrink: 0;
}

/* ── Player Modal ── */
.player-modal { max-width: 860px; }
.player-header { background: var(--ink); border-bottom-color: rgba(255,255,255,.12); }
.player-header .modal-title { color: var(--paper); font-size: 14px; }
.video-player-container { aspect-ratio: 16/9; background: #000; }
.video-player-container iframe { width: 100%; height: 100%; border: none; }
.player-footer {
    padding: 10px 16px;
    background: var(--ink);
    display: flex;
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,.1);
}

/* ── Notes Panel ── */
.notes-panel {
    position: fixed;
    top: var(--topnav-h);
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 95vw;
    background: var(--paper);
    border-left: var(--border);
    box-shadow: -6px 0 24px rgba(27,23,18,.18);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(.4,0,.2,1);
    z-index: 150;
}
.notes-panel.open { transform: translateX(0); }

.notes-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: var(--border);
    background: var(--paper-mid);
    flex-shrink: 0;
}
.notes-panel-thumb {
    width: 60px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 6px;
    border: var(--border);
    flex-shrink: 0;
}
.notes-panel-title-area { flex: 1; min-width: 0; }
.notes-panel-title { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-panel-channel { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }
.notes-panel-close {
    width: 28px; height: 28px;
    border: var(--border);
    border-radius: 6px;
    background: var(--paper);
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.notes-panel-close:hover { background: var(--red); color: #fff; }

.notes-panel-label {
    padding: 10px 14px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-muted);
}
.notes-textarea {
    flex: 1;
    resize: none;
    border: none;
    outline: none;
    background: var(--paper);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.65;
    color: var(--ink);
    padding: 8px 14px;
}
.notes-textarea::placeholder { color: var(--ink-muted); }
.notes-panel-footer {
    padding: 10px 14px;
    border-top: var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--paper-mid);
    flex-shrink: 0;
}
.notes-save-status { font-size: 11px; color: var(--ink-muted); }

/* ── Toasts ── */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
    pointer-events: none;
    align-items: center;
}
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid rgba(255,255,255,.15);
    box-shadow: var(--shadow);
    pointer-events: auto;
    animation: toastIn .25s ease;
}
.toast.success { background: var(--green); color: #fff; }
.toast.error   { background: var(--red);   color: #fff; }
.toast.info    { background: var(--sky);   color: var(--ink); }
.toast.fade-out { animation: toastOut .3s ease forwards; }

@keyframes toastIn  { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { to   { opacity:0; transform:translateY(6px); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--paper-deep); border-radius: 4px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .topnav-nav .nav-btn span { display: none; }
    .topnav-brand .brand-sub { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .courses-grid { grid-template-columns: 1fr; }
    .main-content { padding: 16px 12px 40px; }
}

/* ── Utility ── */
.hidden { display: none !important; }
