/* ============================================================
   Smart Study Planner — Premium UI Design System
   ============================================================ */
:root {
    --sidebar-bg: #1a1c2c;
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.1);
    --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
    --gradient-btn: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img { max-width: 100%; }

body.mobile-nav-open { overflow: hidden; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ===== APP SHELL ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

body.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed);
}

.page-content {
    flex: 1;
    padding: 0 28px 32px;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: width 0.3s ease;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* ===== MOBILE NAV TOGGLE (hamburger) ===== */
.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    box-shadow: var(--shadow);
    cursor: pointer;
    padding: 0;
}
.mobile-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 0.25s ease, opacity 0.2s ease;
}
body.mobile-nav-open .mobile-nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.mobile-nav-open .mobile-nav-toggle span:nth-child(2) { opacity: 0; }
body.mobile-nav-open .mobile-nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 190;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
}
.sidebar-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.sidebar-mobile-close {
    display: none;
    margin-left: auto;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.sidebar-mobile-close:hover { background: rgba(255,255,255,0.16); }

.brand-icon {
    width: 42px;
    height: 42px;
    background: var(--gradient-purple);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.brand-text { line-height: 1.2; }
.brand-title {
    display: block;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}
.brand-sub {
    display: block;
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav-link span:not(.nav-icon):not(.nav-dot),
body.sidebar-collapsed .sidebar-user-name {
    display: none;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.nav-group-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    padding: 16px 12px 8px;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.65);
    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    text-decoration: none;
}

.nav-link.active {
    background: var(--gradient-purple);
    color: #fff;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}

.nav-link.sub-active {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.nav-link.nav-muted { color: rgba(255,255,255,0.4); font-size: 0.8rem; }
.nav-link.nav-subject { padding-left: 14px; font-size: 0.82rem; }

.nav-icon { font-size: 0.9rem; width: 18px; text-align: center; flex-shrink: 0; }

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.nav-dot.sub-purple { background: #a78bfa; }
.nav-dot.sub-blue   { background: #60a5fa; }
.nav-dot.sub-orange { background: #fb923c; }
.nav-dot.sub-green  { background: #4ade80; }
.nav-dot.sub-pink   { background: #f472b6; }
.nav-dot.sub-cyan   { background: #22d3ee; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-theme-btn,
.sidebar-collapse-btn {
    background: rgba(255,255,255,0.08);
    border: none;
    color: rgba(255,255,255,0.6);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
    flex-shrink: 0;
}
.sidebar-theme-btn:hover,
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.14); }

.sidebar-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-user-name {
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== PAGE TOPBAR ===== */
.page-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    gap: 20px;
    flex-wrap: wrap;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.topbar-greeting h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}
.topbar-greeting p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 14px;
    height: 42px;
    min-width: 260px;
    box-shadow: var(--shadow);
}

.search-icon { color: var(--text-muted); margin-right: 8px; font-size: 0.9rem; }

.search-input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 0.88rem;
    background: transparent;
    color: var(--text);
}

.search-kbd {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.topbar-icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: var(--shadow);
    transition: background 0.2s;
}
.topbar-icon-btn:hover { background: var(--bg); }

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px 14px 6px 6px;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}
.topbar-profile:hover { box-shadow: var(--shadow-lg); text-decoration: none; }

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--gradient-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    overflow: hidden;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.topbar-profile-info { line-height: 1.3; }
.profile-name {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}
.profile-role {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.profile-chevron { color: var(--text-muted); font-size: 0.7rem; }

.topbar-profile-dropdown {
    position: relative;
}

.topbar-profile {
    cursor: pointer;
    font: inherit;
    color: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.topbar-profile-dropdown.is-open .topbar-profile {
    box-shadow: var(--shadow-lg);
}

.topbar-profile-dropdown.is-open .profile-chevron {
    transform: rotate(180deg);
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 200;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}

.profile-dropdown-item:hover {
    background: var(--bg);
    text-decoration: none;
}

.profile-dropdown-icon {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 6px;
}

.profile-dropdown-logout {
    color: #ef4444;
}

.profile-dropdown-logout:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-back:hover {
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

/* ===== CARDS ===== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    border: 1px solid var(--border);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

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

/* ===== STAT CARDS ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    border-radius: var(--radius);
    padding: 24px 28px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    min-height: 130px;
}

.stat-card.blue { background: var(--gradient-blue); }
.stat-card.purple { background: var(--gradient-purple); }

.stat-card::after {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

.stat-info { position: relative; z-index: 1; }
.stat-info h3 {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 6px;
}
.stat-info .stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}
.stat-sub {
    font-size: 0.82rem;
    opacity: 0.85;
    margin-top: 6px;
}

.stat-icon {
    font-size: 2.8rem;
    opacity: 0.35;
    position: relative;
    z-index: 1;
}

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 22px;
}

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.data-table th {
    text-align: left;
    padding: 12px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.data-table td {
    padding: 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s;
}
.data-table tbody tr:hover {
    background: #f8fafc;
}

.task-type-icon { margin-right: 10px; font-size: 1rem; }
.task-name { font-weight: 600; color: var(--text); }

.subject-tag.sub-purple { background: #f5f3ff; color: #7c3aed; }
.subject-tag.sub-blue   { background: #eff6ff; color: #2563eb; }
.subject-tag.sub-orange { background: #fff7ed; color: #ea580c; }
.subject-tag.sub-green  { background: #f0fdf4; color: #16a34a; }
.subject-tag.sub-pink   { background: #fdf2f8; color: #db2777; }
.subject-tag.sub-cyan   { background: #ecfeff; color: #0891b2; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.priority-high    { background: #fef2f2; color: #dc2626; }
.priority-moderate,
.priority-medium  { background: #fff7ed; color: #ea580c; }
.priority-low     { background: #f0fdf4; color: #16a34a; }

.difficulty-easy   { background: #f0fdf4; color: #16a34a; }
.difficulty-medium { background: #fffbeb; color: #d97706; }
.difficulty-hard   { background: #fef2f2; color: #dc2626; }

.status-pending     { background: #eff6ff; color: #2563eb; }
.status-in_progress { background: #fff7ed; color: #ea580c; }
.status-completed   { background: #f0fdf4; color: #16a34a; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary, .btn-gradient {
    background: var(--gradient-btn);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover, .btn-gradient:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    color: white;
    text-decoration: none;
}

.btn-save {
    background: var(--sidebar-bg);
    color: white;
}
.btn-save:hover { background: #252840; color: white; text-decoration: none; }

.btn-sm { padding: 8px 16px; font-size: 0.8rem; }

.btn-view-details {
    padding: 6px 14px;
    background: var(--gradient-btn);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}
.btn-view-details:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.task-action-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 118px;
}
.task-action-btns .btn-view-details,
.task-action-btns .btn-complete-task {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 8px;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
}
.task-action-btns .btn-complete-task {
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.filter-select {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    background: var(--card);
    color: var(--text);
    font-family: inherit;
}

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

.icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.icon-btn:hover { background: var(--bg); }

.dash-view-all {
    text-align: center;
    padding: 16px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.dash-view-all a {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
}

/* ===== WORKLOAD CARD ===== */
.workload-card { text-align: center; }

.workload-level {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 12px 0 16px;
}
.workload-high     { color: #dc2626; }
.workload-moderate { color: #d97706; }
.workload-low      { color: #16a34a; }
.workload-empty    { color: #64748b; }

.workload-gauge {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin: 12px 0;
    position: relative;
}

.gauge-segment { flex: 1; }
.gauge-segment.low      { background: #22c55e; }
.gauge-segment.moderate { background: #eab308; }
.gauge-segment.high     { background: #ef4444; }

.gauge-marker {
    position: absolute;
    top: -5px;
    width: 4px;
    height: 20px;
    background: var(--text);
    border-radius: 2px;
    transform: translateX(-50%);
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.dash-wl-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 18px 0;
}
.dash-wl-stat {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
    border: 1px solid var(--border);
}
.dash-wl-stat .lbl {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.dash-wl-stat .val {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.dash-wl-tip {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 0.82rem;
    line-height: 1.55;
    color: #1e40af;
    text-align: left;
    margin-bottom: 16px;
}

.dash-wl-btn { width: 100%; }

.wl-card-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f8fafc;
    font-family: inherit;
    color: var(--text);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: #fff;
}

textarea.form-control { resize: vertical; min-height: 100px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.form-grid .full-width { grid-column: 1 / -1; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    gap: 10px;
}

.input-icon-wrap { position: relative; }
.input-icon-wrap .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.input-icon-wrap .form-control { padding-left: 42px; }
.form-control.no-icon { padding-left: 14px; }

.difficulty-auto-note {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 0.85rem;
    color: #1e40af;
}

/* ===== TASK TYPE SIDEBAR (Add Task) ===== */
.add-task-page.main-with-panel {
    position: relative;
}

.task-type-field {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.task-type-field .form-control { flex: 1; }

.task-type-other-input {
    margin-top: 8px;
}

.task-type-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 92vw;
    height: 100vh;
    background: #fff;
    box-shadow: -8px 0 30px rgba(15, 23, 42, 0.12);
    z-index: 1200;
    padding: 24px 20px;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
}
.task-type-sidebar.is-open {
    transform: translateX(0);
}

.task-type-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.task-type-sidebar-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text);
}
.task-type-sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
}
.task-type-sidebar-close:hover { color: var(--text); }

.task-type-sidebar-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.5;
}

.task-type-add-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.task-type-add-form .form-control { flex: 1; }

.task-type-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-type-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
}
.task-type-item.is-editing {
    background: #fff;
    border-color: var(--primary);
}
.task-type-edit-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px !important;
    font-size: 0.88rem;
}
.task-type-item-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}
.task-type-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-icon {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all 0.15s;
}
.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-icon.task-type-delete {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}
.btn-icon.task-type-delete:hover {
    background: #fee2e2;
    border-color: #f87171;
    color: #b91c1c;
}

.btn-icon.task-type-save {
    color: #16a34a;
    border-color: #bbf7d0;
    background: #f0fdf4;
}
.btn-icon.task-type-save:hover {
    background: #dcfce7;
    border-color: #4ade80;
    color: #15803d;
}

.task-type-item.is-removing {
    opacity: 0;
    transform: translateX(12px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.task-type-message {
    margin-top: 12px;
    font-size: 0.82rem;
    min-height: 1.2em;
}
.task-type-message.is-success { color: #16a34a; }
.task-type-message.is-error { color: #dc2626; }

.task-type-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1190;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.task-type-sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

body.task-type-sidebar-open { overflow: hidden; }

.page-heading { margin-bottom: 24px; }
.page-heading h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}
.page-heading p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ===== PREDICTION VIEW ===== */
.pv-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.pv-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
}

.pv-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.pv-panel-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.pv-desc {
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 18px;
}

.pv-subtitle {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    margin: 18px 0 12px;
}

.pv-result-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    margin-bottom: 8px;
    border: 2px solid;
}

.pv-result-box.pv-level-high {
    background: #fff7ed;
    border-color: #fb923c;
    color: #c2410c;
}
.pv-result-box.pv-level-moderate {
    background: #fffbeb;
    border-color: #fbbf24;
    color: #b45309;
}
.pv-result-box.pv-level-low {
    background: #f0fdf4;
    border-color: #4ade80;
    color: #15803d;
}
.pv-result-box.pv-level-empty {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

.pv-result-heading { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.pv-result-reason { font-size: 0.8rem; line-height: 1.45; opacity: 0.9; }
.pv-result-value { font-size: 2.2rem; font-weight: 800; letter-spacing: 1px; flex-shrink: 0; margin-left: 16px; }

.pv-factor { margin-bottom: 14px; }
.pv-factor-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.86rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.pv-factor-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
}
.pv-factor-fill {
    height: 100%;
    background: var(--gradient-blue);
    border-radius: 5px;
    transition: width 0.6s ease;
}

.pv-actions-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
}
.pv-actions-list {
    list-style: disc;
    padding-left: 20px;
    font-size: 0.86rem;
    line-height: 1.85;
}

.pv-schedule-wrap {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    overflow-x: auto;
}

.pv-schedule-grid {
    display: grid;
    grid-template-columns: 48px repeat(6, 1fr);
    gap: 3px;
    min-width: 580px;
}

.pv-day-head {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    padding: 8px 4px;
    background: #eef2ff;
    border-radius: 6px;
}

.pv-time-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
    padding: 6px 4px;
}

.pv-cell {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 5px;
    min-height: 48px;
    position: relative;
    padding: 2px;
}

.pv-block {
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text);
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s;
}
.pv-block:hover { transform: scale(1.02); }

.pv-block.block-blue   { background: #dbeafe; border-left: 3px solid #3b82f6; }
.pv-block.block-pink   { background: #fce7f3; border-left: 3px solid #ec4899; }
.pv-block.block-green  { background: #dcfce7; border-left: 3px solid #22c55e; }
.pv-block.block-yellow { background: #fef9c3; border-left: 3px solid #eab308; }
.pv-block.block-purple { background: #ede9fe; border-left: 3px solid #8b5cf6; }

.pv-schedule-footer {
    margin-top: 12px;
    background: #eff6ff;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* ===== OVERVIEW PANEL ===== */
.main-with-panel {
    display: flex;
    gap: 22px;
}
.content-area { flex: 1; min-width: 0; }

.right-panel { width: 280px; flex-shrink: 0; }

.overview-card {
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    text-align: center;
    margin-bottom: 10px;
}
.overview-card h4 { font-size: 0.78rem; font-weight: 600; margin-bottom: 4px; }
.overview-card .value { font-size: 1.05rem; font-weight: 700; }
.weekly-mini .day-cell { min-height: 48px; }
.overview-card.classes { background: #eff6ff; color: #1d4ed8; }
.overview-card.pending { background: #f0fdf4; color: #15803d; }
.overview-card.urgent-today     { background: #fff7ed; color: #c2410c; }
.overview-card.urgent-tomorrow { background: #fef3c7; color: #b45309; }
.overview-cards { display: flex; flex-direction: column; gap: 10px; }

/* ===== TIMELINE ===== */
.timeline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 0;
    position: relative;
}
.timeline::before {
    content: '';
    position: absolute;
    top: 28px;
    left: 5%;
    right: 5%;
    height: 3px;
    background: var(--border);
}
.timeline-item { text-align: center; position: relative; z-index: 1; flex: 1; }
.timeline-dot {
    width: 14px; height: 14px;
    background: var(--primary);
    border-radius: 50%;
    margin: 20px auto 8px;
    border: 3px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}
.timeline-time { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.timeline-activity { font-size: 0.84rem; font-weight: 600; color: var(--text); }

/* ===== TASK DETAIL MODAL ===== */
.task-detail-modal { display: none; position: fixed; inset: 0; z-index: 1000; }
.task-detail-modal.open { display: block; }
.tdm-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px); }
.tdm-dialog {
    position: relative;
    background: #fff;
    max-width: 560px;
    width: 92%;
    max-height: 88vh;
    overflow-y: auto;
    margin: 6vh auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 28px;
}
.task-detail-modal:not(.calendar-modal) .tdm-dialog {
    max-width: 520px;
    overflow: hidden;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(99, 102, 241, 0.06);
    display: flex;
    flex-direction: column;
}
.task-detail-modal:not(.calendar-modal) .tdm-dialog::before {
    content: '';
    display: block;
    height: 4px;
    background: var(--gradient-btn);
    flex-shrink: 0;
}
.task-detail-modal:not(.calendar-modal) .tdm-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.tdm-close {
    position: absolute; top: 14px; right: 18px;
    background: none; border: none;
    font-size: 1.5rem; color: #94a3b8; cursor: pointer;
}
.task-detail-modal:not(.calendar-modal) .tdm-close {
    top: 16px; right: 16px; z-index: 2;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: #f1f5f9; border: none; border-radius: 10px;
    font-size: 1.25rem; color: #64748b;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}
.task-detail-modal:not(.calendar-modal) .tdm-close:hover {
    background: #e2e8f0;
    color: #334155;
    transform: scale(1.05);
}
.tdm-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; margin-bottom: 14px; padding-right: 24px;
}
.tdm-header h2 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.tdm-diff-badge { padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; }
.tdm-diff-easy     { background: #f0fdf4; color: #16a34a; }
.tdm-diff-moderate { background: #fffbeb; color: #d97706; }
.tdm-diff-hard     { background: #fef2f2; color: #dc2626; }
.tdm-meta {
    display: flex; flex-wrap: wrap; gap: 10px 18px;
    font-size: 0.82rem; color: var(--text-muted);
    margin-bottom: 16px; padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.tdm-summary-box {
    background: #f8fafc;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 18px;
}
.tdm-factor {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
}
.tdm-factor-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.tdm-factor-name { font-weight: 700; font-size: 0.85rem; }
.tdm-factor-badge { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 8px; }
.tdm-impact-low    { background: #f0fdf4; color: #16a34a; }
.tdm-impact-medium { background: #fffbeb; color: #d97706; }
.tdm-impact-high   { background: #fef2f2; color: #dc2626; }
.tdm-factor-value { font-size: 0.8rem; color: var(--primary); font-weight: 600; }
.tdm-factor-detail { font-size: 0.8rem; color: var(--text-muted); }
.tdm-recommend {
    background: #eff6ff;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.85rem;
    margin-top: 14px;
}
.tdm-loading, .tdm-error { text-align: center; padding: 48px 28px; color: var(--text-muted); }

.tdm-notes-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: calc(88vh - 4px);
    padding: 24px 24px 20px;
}
.tdm-notes-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    padding-right: 36px;
    flex-shrink: 0;
}
.tdm-notes-header-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #ede9fe 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}
.tdm-notes-header-text { min-width: 0; }
.tdm-notes-eyebrow {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary-light);
    margin-bottom: 4px;
}
.tdm-notes-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
}
.tdm-notes-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 18px;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}
.tdm-notes-scroll::-webkit-scrollbar { width: 5px; }
.tdm-notes-scroll::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.25);
    border-radius: 10px;
}
.tdm-notes-card {
    position: relative;
    background: linear-gradient(160deg, #fafbff 0%, #f5f3ff 55%, #faf5ff 100%);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    padding: 26px 24px 26px 32px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 4px 20px rgba(99, 102, 241, 0.07);
}
.tdm-notes-card::before {
    content: '\201C';
    position: absolute;
    top: 10px;
    left: 16px;
    font-size: 3rem;
    line-height: 1;
    font-family: Georgia, 'Times New Roman', serif;
    color: rgba(99, 102, 241, 0.12);
    pointer-events: none;
}
.tdm-notes-card::after {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 4px;
    background: var(--gradient-btn);
    border-radius: 0 4px 4px 0;
}
.tdm-notes-text {
    position: relative;
    z-index: 1;
    font-size: 0.92rem;
    line-height: 1.8;
    color: #475569;
    white-space: pre-wrap;
    word-break: break-word;
    letter-spacing: 0.01em;
}
.tdm-notes-card.is-empty {
    background: linear-gradient(160deg, #f8fafc 0%, #f1f5f9 100%);
    border-color: var(--border);
    box-shadow: none;
    padding: 32px 24px;
}
.tdm-notes-card.is-empty::before { display: none; }
.tdm-notes-card.is-empty::after { background: #cbd5e1; top: 0; bottom: 0; border-radius: 16px 0 0 16px; }
.tdm-notes-empty {
    text-align: center;
    color: var(--text-muted);
}
.tdm-notes-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    width: 64px;
    height: 64px;
    background: #fff;
    border-radius: 50%;
    color: #94a3b8;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.tdm-notes-empty p {
    margin: 0;
    font-size: 0.88rem;
    font-style: italic;
}
.tdm-notes-footer {
    flex-shrink: 0;
    padding-top: 4px;
}
.tdm-notes-error {
    margin: 0 0 10px;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #dc2626;
    font-size: 0.82rem;
    text-align: center;
}
.tdm-complete-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 12px;
    letter-spacing: 0.01em;
}
.tdm-complete-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}
.tdm-complete-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tdm-spin 0.7s linear infinite;
}
@keyframes tdm-spin { to { transform: rotate(360deg); } }
.tdm-completed-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    color: #15803d;
    font-size: 0.92rem;
    font-weight: 600;
}
.tdm-completed-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #16a34a;
    color: #fff;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 0.88rem;
    font-weight: 500;
}
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.35; }

/* ===== LOGIN PAGE ===== */
body.login-body {
    background: #eef2f7;
}

.login-page-v2 {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px 20px;
    background: linear-gradient(180deg, #f4f7fb 0%, #eef2f7 100%);
}

.login-shell {
    display: flex;
    width: 100%;
    max-width: 1120px;
    min-height: 640px;
    background: #fff;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12), 0 8px 24px rgba(15, 23, 42, 0.06);
}

/* --- Hero (left panel) --- */
.login-hero {
    position: relative;
    flex: 1.05;
    min-width: 0;
    padding: 36px 40px 28px;
    background: linear-gradient(145deg, #edf4ff 0%, #e8f0fe 45%, #dbeafe 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.login-hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hero-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
}

.hero-circle-1 { width: 180px; height: 180px; top: -40px; right: 60px; }
.hero-circle-2 { width: 120px; height: 120px; bottom: 120px; left: -30px; background: rgba(37, 99, 235, 0.08); }
.hero-circle-3 { width: 90px; height: 90px; top: 45%; right: -20px; background: rgba(37, 99, 235, 0.06); }

.login-hero-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.hero-tsu-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.hero-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

.hero-brand-text strong {
    font-size: 0.98rem;
    font-weight: 800;
    color: #1e3a8a;
    letter-spacing: -0.01em;
}

.login-hero-copy {
    position: relative;
    z-index: 1;
    margin-bottom: 24px;
}

.login-hero-copy h1 {
    font-size: clamp(1.55rem, 2.4vw, 2rem);
    font-weight: 800;
    color: #0f172a;
    line-height: 1.25;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.login-hero-copy p {
    font-size: 0.92rem;
    color: #64748b;
    max-width: 360px;
    line-height: 1.55;
}

.login-hero-scene {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 280px;
    margin-top: auto;
}

.hero-laptop {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-42%);
    width: min(92%, 380px);
}

.hero-laptop-screen {
    background: #1e293b;
    border-radius: 12px 12px 0 0;
    padding: 8px 8px 0;
    box-shadow: 0 -2px 0 #334155 inset;
}

.hero-dashboard {
    display: flex;
    height: 180px;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
    background: #f8fafc;
}

.hero-dash-sidebar {
    width: 52px;
    background: #1e3a8a;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hero-dash-sidebar span {
    display: block;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.25);
}

.hero-dash-sidebar span:first-child {
    height: 14px;
    background: rgba(255, 255, 255, 0.45);
    margin-bottom: 4px;
}

.hero-dash-main {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hero-dash-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hero-dash-top strong {
    font-size: 0.62rem;
    color: #1e293b;
}

.hero-dash-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.hero-dash-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.hero-dash-card {
    border-radius: 6px;
    padding: 6px 7px;
    color: #fff;
}

.hero-dash-card small {
    display: block;
    font-size: 0.45rem;
    opacity: 0.9;
    margin-bottom: 2px;
}

.hero-dash-card strong {
    font-size: 0.72rem;
    font-weight: 800;
}

.hero-dash-card-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.hero-dash-card-green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.hero-dash-card-orange { background: linear-gradient(135deg, #f97316, #ea580c); }

.hero-dash-chart {
    flex: 1;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 8px 4px;
    display: flex;
    flex-direction: column;
}

.hero-dash-chart small {
    font-size: 0.48rem;
    color: #64748b;
    margin-bottom: 2px;
}

.hero-dash-chart svg {
    flex: 1;
    width: 100%;
    min-height: 48px;
}

.hero-laptop-base {
    height: 12px;
    background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
    border-radius: 0 0 8px 8px;
    margin: 0 8px;
}

.hero-laptop-shadow {
    height: 18px;
    margin: 0 20px;
    background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.18) 0%, transparent 70%);
}

.hero-prop {
    position: absolute;
    z-index: 2;
}

.hero-books {
    left: 8%;
    bottom: 18%;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transform: rotate(-8deg);
}

.hero-books span {
    display: block;
    height: 10px;
    border-radius: 2px;
}

.hero-books span:nth-child(1) { width: 52px; background: #2563eb; }
.hero-books span:nth-child(2) { width: 48px; background: #3b82f6; margin-left: 4px; }
.hero-books span:nth-child(3) { width: 44px; background: #60a5fa; margin-left: 8px; }

.hero-plant {
    left: 22%;
    bottom: 8%;
}

.hero-plant-pot {
    display: block;
    width: 28px;
    height: 16px;
    background: #2563eb;
    border-radius: 0 0 8px 8px;
}

.hero-plant-leaf {
    position: absolute;
    width: 18px;
    height: 28px;
    background: #22c55e;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

.hero-plant-leaf-1 { bottom: 14px; left: -4px; transform: rotate(-25deg); }
.hero-plant-leaf-2 { bottom: 18px; left: 6px; transform: rotate(0deg); background: #16a34a; }
.hero-plant-leaf-3 { bottom: 14px; left: 14px; transform: rotate(25deg); }

.hero-mug {
    right: 18%;
    bottom: 10%;
}

.hero-mug-body {
    display: block;
    width: 34px;
    height: 30px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: 4px 4px 8px 8px;
    box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.12);
}

.hero-mug-handle {
    position: absolute;
    right: -8px;
    top: 6px;
    width: 12px;
    height: 16px;
    border: 3px solid #2563eb;
    border-left: none;
    border-radius: 0 8px 8px 0;
}

.hero-notebook {
    right: 6%;
    bottom: 22%;
    transform: rotate(12deg);
}

.hero-notebook-body {
    display: block;
    width: 42px;
    height: 52px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.hero-notebook-spiral {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 34px;
    height: 6px;
    background: repeating-linear-gradient(90deg, #94a3b8 0 3px, transparent 3px 6px);
}

.hero-pen {
    position: absolute;
    right: -10px;
    top: 18px;
    width: 28px;
    height: 4px;
    background: linear-gradient(90deg, #2563eb 0%, #2563eb 70%, #fbbf24 70%, #fbbf24 100%);
    border-radius: 2px;
    transform: rotate(-35deg);
}

/* --- Form (right panel) --- */
.login-form-panel {
    flex: 0 0 440px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 44px;
    background: #fff;
}

.login-form-inner {
    width: 100%;
    max-width: 340px;
}

.login-form-header {
    margin-bottom: 28px;
}

.login-form-header h2 {
    font-size: 1.65rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.login-form-header p {
    font-size: 0.88rem;
    color: #64748b;
}

.login-alert {
    margin-bottom: 18px;
    font-size: 0.84rem;
}

.login-field {
    margin-bottom: 18px;
}

.login-field label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    display: flex;
    pointer-events: none;
}

.login-input {
    width: 100%;
    height: 46px;
    padding: 0 44px 0 44px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.88rem;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input::placeholder { color: #94a3b8; }

.login-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-password-toggle {
    position: absolute;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.login-password-toggle:hover {
    color: #64748b;
    background: #f1f5f9;
}

.login-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 12px;
}

.login-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    color: #475569;
    cursor: pointer;
    user-select: none;
}

.login-remember input {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
}

.login-forgot {
    font-size: 0.84rem;
    font-weight: 600;
    color: #2563eb;
    white-space: nowrap;
}

.login-forgot:hover { color: #1d4ed8; }

.login-submit-btn {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.login-submit-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}

.login-submit-btn:active { transform: translateY(1px); }

.login-divider {
    display: flex;
    align-items: center;
    margin: 22px 0 18px;
    color: #94a3b8;
    font-size: 0.82rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.login-divider span { padding: 0 14px; }

.login-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.login-google-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    text-decoration: none;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.login-form-inner--google {
    text-align: center;
}

.login-form-inner--google .login-form-header {
    margin-bottom: 36px;
}

.login-google-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.login-google-btn--primary {
    height: 52px;
    padding: 0 28px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #1e293b;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.login-google-btn--primary:hover {
    background: #fff;
    border-color: #cbd5e1;
    color: #0f172a;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

.login-google-btn--primary:active {
    transform: translateY(0);
}

.login-google-hint {
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.5;
    max-width: 260px;
}

.login-signup {
    margin-top: 22px;
    text-align: center;
    font-size: 0.86rem;
    color: #64748b;
}

.login-signup a {
    color: #2563eb;
    font-weight: 700;
}

.login-signup a:hover { color: #1d4ed8; }

.login-page-footer {
    margin-top: 22px;
    font-size: 0.78rem;
    color: #94a3b8;
    text-align: center;
}

@media (max-width: 960px) {
    .login-shell {
        flex-direction: column;
        max-width: 520px;
        min-height: auto;
    }

    .login-hero {
        padding: 32px 28px 0;
        min-height: 340px;
    }

    .login-hero-scene {
        min-height: 220px;
    }

    .hero-laptop {
        width: 88%;
        transform: translateX(-50%);
    }

    .login-form-panel {
        flex: none;
        padding: 36px 28px 40px;
    }
}

@media (max-width: 480px) {
    .login-page-v2 { padding: 16px 12px; }
    .login-shell { border-radius: 20px; }
    .login-hero-copy h1 { font-size: 1.45rem; }
    .login-form-panel { padding: 28px 20px 32px; }
    .hero-books, .hero-notebook { display: none; }
    .login-hero-brand { flex-wrap: wrap; gap: 10px; }
    .hero-brand-text strong { font-size: 0.88rem; }
    .hero-tsu-logo { width: 38px; height: 38px; }
}

/* Legacy login helpers (used elsewhere) */
.btn-google {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    width: 100%;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.btn-google:hover { background: #f8fafc; }

.btn-primary { width: 100%; }

.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.divider span { padding: 0 12px; }

.login-links {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    font-size: 0.84rem;
}

/* ===== WEEKLY CALENDAR (Modern) ===== */
.cal-modern-card {
    padding: 0;
    overflow: hidden;
    border: none;
    box-shadow: var(--shadow-lg);
}

.cal-modern-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
    color: white;
    flex-wrap: wrap;
}

.cal-modern-title .cal-month-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
    margin-bottom: 2px;
}

.cal-modern-title h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.cal-week-nav-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
}

.cal-nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    transition: background 0.2s;
    text-decoration: none;
}
.cal-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.cal-nav-today {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    transition: background 0.2s;
}
.cal-nav-today.is-active {
    background: rgba(255, 255, 255, 0.25);
}
.cal-nav-today:not(.is-active):hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.cal-summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 20px 24px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.cal-summary-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}
.cal-summary-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
    color: inherit;
    text-decoration: none;
}
.cal-chip-pending { border-left-color: #3b82f6; }
.cal-chip-urgent { border-left-color: #ea580c; }
.cal-chip-classes { border-left-color: #22c55e; }
.cal-chip-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.cal-chip-pending .cal-chip-icon { background: #eff6ff; }
.cal-chip-urgent .cal-chip-icon { background: #fff7ed; }
.cal-chip-classes .cal-chip-icon { background: #f0fdf4; }

.cal-chip-body strong {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
}
.cal-chip-body span {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}
.cal-chip-body small {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.cal-chip-urgent .cal-chip-body strong { color: #ea580c; }

.weekly-calendar-modern {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    padding: 0;
    border-top: 1px solid var(--border);
}

.cal-day-modern {
    border-right: 1px solid var(--border);
    min-height: 280px;
    display: flex;
    flex-direction: column;
    background: white;
    transition: background 0.2s;
}
.cal-day-modern:last-child { border-right: none; }
.cal-day-modern.is-weekend { background: #fafbfc; }

/* Day cell status colors */
.cal-day-modern.cal-day-status-complete {
    background: linear-gradient(180deg, #ecfdf5 0%, #f0fdf4 100%);
}
.cal-day-modern.cal-day-status-pending {
    background: linear-gradient(180deg, #fefce8 0%, #fffbeb 100%);
}
.cal-day-modern.cal-day-status-urgent {
    background: linear-gradient(180deg, #fef2f2 0%, #fff1f2 100%);
}

.cal-day-modern.cal-day-status-complete .cal-day-head {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}
.cal-day-modern.cal-day-status-pending .cal-day-head {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}
.cal-day-modern.cal-day-status-urgent .cal-day-head {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.cal-day-modern.is-today:not([class*="cal-day-status-complete"]):not(.cal-day-status-pending):not(.cal-day-status-urgent) {
    background: linear-gradient(180deg, #eef2ff 0%, #ffffff 120px);
}
.cal-day-modern.is-today:not([class*="cal-day-status-complete"]):not(.cal-day-status-pending):not(.cal-day-status-urgent) .cal-day-head {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.cal-day-modern.cal-day-status-complete .cal-day-short,
.cal-day-modern.cal-day-status-pending .cal-day-short,
.cal-day-modern.cal-day-status-urgent .cal-day-short,
.cal-day-modern.is-today .cal-day-short {
    color: rgba(255, 255, 255, 0.85);
}

.cal-day-clickable { cursor: pointer; }
.cal-day-clickable:hover {
    box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.25);
}
.cal-class-clickable,
.cal-task-clickable {
    cursor: pointer;
    position: relative;
    z-index: 2;
}

.cal-day-empty-modern {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 80px;
    color: var(--text-muted);
    font-size: 0.72rem;
    opacity: 0.65;
    pointer-events: none;
}
.cal-day-empty-modern span {
    padding: 8px 12px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: rgba(255,255,255,0.6);
}

.cdm-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 16px;
}
.cdm-empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}
.cdm-empty p { margin-bottom: 12px; }

.cdm-section-block {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.cdm-section-block:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.cdm-section-title {
    font-size: 0.88rem;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--text);
}
.cdm-section-title .cdm-count {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.cdm-section-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

.ccm-dialog .cdm-task-list,
.cdm-dialog .cdm-task-list {
    max-height: 280px;
    overflow-y: auto;
}

.cal-day-done-badge {
    text-align: center;
    padding: 10px 8px;
    margin-top: 8px;
    background: #dcfce7;
    color: #15803d;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid #bbf7d0;
}

.cal-tag-done { background: #dcfce7; color: #15803d; }

.cal-legend-cell {
    width: 18px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}
.cal-legend-cell-green { background: #22c55e; }
.cal-legend-cell-yellow { background: #f59e0b; }
.cal-legend-cell-red { background: #ef4444; }

/* Calendar day & class modals */
.calendar-modal .tdm-dialog,
.calendar-modal .cdm-dialog,
.calendar-modal .ccm-dialog {
    max-width: 620px;
}
.cdm-header h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 4px; }
.cdm-header p { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 16px; }
.cdm-header p { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 16px; }
.cdm-task-list { display: flex; flex-direction: column; gap: 10px; }
.cdm-task-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
}
.cdm-task-item.is-done {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.cdm-task-main strong {
    display: block;
    font-size: 0.88rem;
    margin-bottom: 2px;
}
.cdm-task-main > span {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.cdm-task-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.cdm-view-btn,
.cdm-complete-btn {
    width: 100px;
    text-align: center;
    box-sizing: border-box;
}
.cdm-empty { text-align: center; color: var(--text-muted); padding: 24px; }

.ccm-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.ccm-info-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}
.ccm-info-item span {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.ccm-info-item strong { font-size: 0.9rem; }
.ccm-note { font-size: 0.8rem; color: var(--text-muted); }

.tdm-actions {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.tdm-complete-btn { width: 100%; }

.cal-day-head {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    position: relative;
    background: #f8fafc;
}
.cal-day-short {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.cal-day-modern.is-today .cal-day-short { color: rgba(255,255,255,0.85); }
.cal-day-num {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
}
.cal-today-dot {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #fbbf24;
}
.cal-day-urgent-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ea580c;
    color: white;
    font-size: 0.62rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-day-body {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    max-height: 320px;
    cursor: pointer;
}

.cal-section { margin-bottom: 8px; }
.cal-section-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding: 0 2px;
}

.cal-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cal-dot-class { background: #6366f1; }
.cal-dot-task { background: #3b82f6; }
.cal-dot-pending { background: #3b82f6; }
.cal-dot-urgent { background: #ea580c; }
.cal-dot-overdue { background: #dc2626; }

.cal-event-modern {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 0.74rem;
    border: 1px solid transparent;
    transition: transform 0.15s, box-shadow 0.15s;
}
.cal-event-modern:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}
.cal-event-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.cal-event-class {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border-color: #c7d2fe;
}
.cal-event-class .cal-event-icon { background: rgba(99, 102, 241, 0.15); }

.cal-event-task-pending {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-color: #bfdbfe;
    cursor: pointer;
}
.cal-event-task-pending .cal-event-icon { background: rgba(59, 130, 246, 0.15); }

.cal-event-task-urgent {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border-color: #fed7aa;
    cursor: pointer;
    animation: cal-urgent-pulse 2.5s ease-in-out infinite;
}
.cal-event-task-urgent .cal-event-icon { background: rgba(234, 88, 12, 0.15); }

.cal-event-task-overdue {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-color: #fecaca;
    cursor: pointer;
}
.cal-event-task-overdue .cal-event-icon { background: rgba(220, 38, 38, 0.12); }

@keyframes cal-urgent-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0); }
    50% { box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12); }
}

.cal-event-content {
    flex: 1;
    min-width: 0;
}
.cal-event-content strong {
    display: block;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-event-content > span {
    display: block;
    font-size: 0.66rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-event-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    align-items: center;
}
.cal-event-tags .badge {
    font-size: 0.58rem;
    padding: 2px 6px;
}

.cal-tag {
    font-size: 0.58rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.cal-tag-pending { background: #dbeafe; color: #2563eb; }
.cal-tag-urgent { background: #ffedd5; color: #ea580c; }
.cal-tag-overdue { background: #fee2e2; color: #dc2626; }

.cal-legend-modern {
    padding: 14px 24px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    gap: 20px;
}

.cal-empty-state { padding: 48px 24px; }

/* Legacy calendar (kept for compatibility) */
.weekly-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}
.cal-day {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 12px;
    min-height: 120px;
    border: 1px solid var(--border);
}
.cal-day.today { border-color: var(--primary); background: #eef2ff; }
.cal-day .day-name { font-weight: 700; font-size: 0.84rem; margin-bottom: 8px; color: var(--text); }
.cal-event {
    background: #eef2ff;
    border-left: 3px solid var(--primary);
    padding: 6px 8px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 0.78rem;
}
.cal-event-class { background: #eef2ff; border-left-color: var(--primary); }
.cal-event-task {
    background: #fef2f2;
    border-left-color: var(--danger, #dc2626);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.cal-event-task:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}
.cal-day-empty {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    margin-top: 24px;
    opacity: 0.5;
}
.cal-week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.cal-week-current {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    padding: 8px 14px;
}
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 0.76rem;
    color: var(--text-muted);
}
.cal-legend-item { display: flex; align-items: center; gap: 6px; }
.cal-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}
.cal-legend-class { background: var(--primary); }
.cal-legend-task { background: #dc2626; }
.cal-legend-count { margin-left: auto; font-weight: 600; color: var(--text); }

@media (max-width: 1100px) {
    .weekly-calendar-modern {
        grid-template-columns: repeat(4, 1fr);
    }
    .cal-day-modern { min-height: 220px; border-bottom: 1px solid var(--border); }
    .cal-summary-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .weekly-calendar-modern {
        grid-template-columns: 1fr;
    }
    .cal-modern-top { flex-direction: column; align-items: flex-start; }
    .cal-day-modern { min-height: auto; border-right: none; }
    .cal-day-body { max-height: none; }
}

.weekly-mini {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}
.weekly-mini .day-header { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); }
.day-cell .class-block {
    border-radius: 4px;
    padding: 2px 4px;
    color: white;
    font-weight: 600;
    font-size: 0.6rem;
}
.class-block.color-1 { background: #6366f1; }
.class-block.color-2 { background: #f59e0b; }
.class-block.color-3 { background: #22c55e; }

.profile-info-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.profile-info-row .label { width: 160px; font-weight: 600; color: var(--text-muted); font-size: 0.9rem; }
.profile-info-row .value { flex: 1; font-size: 0.9rem; }

.profile-avatar-large {
    width: 100px; height: 100px;
    border-radius: 50%;
    background: var(--gradient-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0 auto 16px;
    overflow: hidden;
}
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }

/* ===== ACCOUNT SETTINGS ===== */
.settings-page.main-with-panel {
    display: grid;
    grid-template-columns: 1fr minmax(0, 820px) 1fr 280px;
    gap: 22px;
    align-items: start;
}
.settings-page .content-area {
    grid-column: 2;
    max-width: none;
    width: 100%;
}
.settings-page .right-panel {
    grid-column: 4;
    width: 280px;
}

@media (max-width: 1100px) {
    .settings-page.main-with-panel {
        grid-template-columns: 1fr minmax(0, 720px) 1fr 260px;
    }
    .settings-page .right-panel { width: 260px; }
}

@media (max-width: 900px) {
    .settings-page.main-with-panel {
        display: flex;
        flex-direction: column;
    }
    .settings-page .content-area,
    .settings-page .right-panel {
        grid-column: auto;
        width: 100%;
    }
}

.settings-hero {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid rgba(99, 102, 241, 0.12);
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.1);
}
.settings-hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #a78bfa 100%);
    opacity: 1;
}
.settings-hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 20%, rgba(255,255,255,0.18) 0%, transparent 45%),
        radial-gradient(circle at 10% 90%, rgba(255,255,255,0.1) 0%, transparent 40%);
}
.settings-hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 28px 30px;
}
.settings-avatar {
    flex-shrink: 0;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
}
.settings-avatar img { width: 100%; height: 100%; object-fit: cover; }
.settings-hero-text h2 {
    margin: 0 0 4px;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
}
.settings-hero-text p {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.88);
}
.settings-login-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.settings-login-badge.is-google {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}
.settings-login-badge.is-email {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.settings-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px 24px;
    box-shadow: var(--shadow);
}
.settings-card-wide { grid-column: 1 / -1; }
.settings-card-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}
.settings-card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.2rem;
}
.settings-card-icon-profile { background: #eef2ff; }
.settings-card-icon-reminder { background: #fff7ed; }
.settings-card-icon-actions { background: #f5f3ff; }
.settings-card-head h3 {
    margin: 0 0 2px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.settings-card-head p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.settings-card-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 18px;
}

.settings-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.settings-info-item {
    background: linear-gradient(160deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}
.settings-info-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.settings-info-value {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

.settings-reminder-form { display: flex; flex-direction: column; gap: 16px; }
.settings-toggle {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.2s, background 0.2s;
}
.settings-toggle:hover {
    border-color: rgba(99, 102, 241, 0.25);
    background: #f5f3ff;
}
.settings-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.settings-toggle-track {
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
    margin-top: 2px;
}
.settings-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.15);
    transition: transform 0.2s;
}
.settings-toggle input:checked + .settings-toggle-track {
    background: var(--primary);
}
.settings-toggle input:checked + .settings-toggle-track::after {
    transform: translateX(20px);
}
.settings-toggle input:focus-visible + .settings-toggle-track {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}
.settings-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.settings-toggle-text strong {
    font-size: 0.9rem;
    color: var(--text);
}
.settings-toggle-text small {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.settings-save-btn {
    width: fit-content;
    padding: 10px 22px;
    border-radius: 10px;
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.settings-action-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.settings-action-link:hover {
    background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.1);
    text-decoration: none;
    color: inherit;
}
.settings-action-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 10px;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.settings-action-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.settings-action-text strong {
    font-size: 0.92rem;
    color: var(--text);
}
.settings-action-text small {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.settings-action-arrow {
    flex-shrink: 0;
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 700;
    transition: transform 0.2s;
}
.settings-action-link:hover .settings-action-arrow { transform: translateX(3px); }

.settings-google-note {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
}
.settings-google-note-icon { font-size: 1.1rem; }
.settings-google-note p {
    margin: 0;
    font-size: 0.85rem;
    color: #15803d;
}

@media (max-width: 768px) {
    .settings-grid { grid-template-columns: 1fr; }
    .settings-info-grid { grid-template-columns: 1fr; }
    .settings-hero-content {
        flex-direction: column;
        text-align: center;
        padding: 24px 20px;
    }
}

/* ===== RANDOM FOREST UI ===== */
.rf-inline-badge {
    display: inline-block;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
}
.rf-panel { margin-top: 22px; }
.rf-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.rf-badge {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 7px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.rf-confidence {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    background: #eef2ff;
    padding: 6px 14px;
    border-radius: 20px;
}
.rf-meta {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.rf-meta-item {
    text-align: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 8px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.rf-meta-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: rgba(99, 102, 241, 0.25);
}
.rf-meta-icon {
    display: block;
    font-size: 1.15rem;
    margin-bottom: 4px;
}
.rf-meta-item strong {
    display: block;
    font-size: 1.3rem;
    color: var(--primary);
    line-height: 1.2;
}
.rf-meta-item span:not(.rf-meta-icon) {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}
.rf-subtitle {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text);
}
.rf-votes { margin-bottom: 12px; }
.rf-vote-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.rf-vote-row.winner .rf-vote-label { font-weight: 800; color: var(--primary); }
.rf-vote-label { width: 72px; font-size: 0.82rem; font-weight: 600; }
.rf-vote-bar-wrap {
    flex: 1;
    height: 10px;
    background: var(--bg);
    border-radius: 5px;
    overflow: hidden;
}
.rf-vote-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}
.rf-vote-bar.vote-low { background: #22c55e; }
.rf-vote-bar.vote-moderate { background: #f59e0b; }
.rf-vote-bar.vote-high { background: #ef4444; }
.rf-vote-count { width: 48px; text-align: right; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.rf-agreement {
    font-size: 0.82rem;
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 8px;
}
.rf-agreement.rf-agree { background: #ecfdf5; color: #065f46; }
.rf-agreement.rf-disagree { background: #fef3c7; color: #92400e; }
.rf-factors-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}
.rf-actions-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.rf-actions-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 12px;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}
.rf-actions-list li:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.rf-actions-list li.rf-action-urgency-overdue  { border-left-color: #dc2626; }
.rf-actions-list li.rf-action-urgency-critical { border-left-color: #ea580c; }
.rf-actions-list li.rf-action-urgency-soon     { border-left-color: #ca8a04; }
.rf-actions-list li.rf-action-urgency-normal   { border-left-color: #0ea5e9; }
.rf-actions-list li.rf-action-item-summary {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    border-left-color: var(--primary);
}
.rf-action-body {
    flex: 1;
    min-width: 0;
}
.rf-action-item-summary .rf-action-message {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
}
.rf-action-task-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.rf-action-task-title {
    font-size: 0.95rem;
    color: var(--text);
}
.rf-action-task-subject {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 999px;
}
.rf-action-task-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.rf-action-deadline {
    font-size: 0.76rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
}
.rf-action-urgency-overdue {
    background: #fee2e2;
    color: #b91c1c;
}
.rf-action-urgency-critical {
    background: #ffedd5;
    color: #c2410c;
}
.rf-action-urgency-soon {
    background: #fef9c3;
    color: #a16207;
}
.rf-action-urgency-normal {
    background: #e0f2fe;
    color: #0369a1;
}
.rf-action-difficulty {
    font-size: 0.74rem;
    color: var(--text-muted);
}
.rf-action-message {
    margin: 0;
    line-height: 1.55;
    color: var(--text);
}
.rf-action-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient-purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}
.dash-rf-confidence {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 6px 0 12px;
    text-align: center;
}
.dash-rf-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wl-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}
.pv-toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
body.dark-theme .rf-agreement.rf-agree { background: #064e3b; color: #6ee7b7; }
body.dark-theme .rf-agreement.rf-disagree { background: #78350f; color: #fcd34d; }

/* ===== DARK THEME ===== */
body.dark-theme {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

body.dark-theme .data-table th { background: #0f172a; }
body.dark-theme .form-control { background: #0f172a; color: #f1f5f9; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .pv-layout { grid-template-columns: 1fr; }
    .rf-factors-grid { grid-template-columns: 1fr; }
    .rf-meta { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(15, 23, 42, 0.25);
    }
    .app-main { margin-left: 0 !important; }
    .mobile-nav-toggle { display: flex; }
    .sidebar-mobile-close { display: flex; }
    .sidebar-collapse-btn { display: none; }
    .search-box { min-width: 180px; }
    .stats-row { grid-template-columns: 1fr; }
    .main-with-panel { flex-direction: column; }
    .right-panel { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .topbar-greeting h1 { font-size: 1.15rem; }
    .rf-meta { grid-template-columns: repeat(2, 1fr); }

    /* Keep hamburger + back button on their own row, title on the next —
       prevents the title from stretching tall and looking "floated" beside them. */
    .topbar-left {
        flex-wrap: wrap;
        row-gap: 8px;
        column-gap: 12px;
    }
    .mobile-nav-toggle { order: 1; }
    .btn-back { order: 2; }
    .topbar-greeting {
        order: 3;
        flex: 1 1 100%;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .page-content { padding: 0 18px 28px; }
    .page-topbar { padding: 16px 18px; }
    .card { padding: 18px 16px; }
    .cal-summary-row { grid-template-columns: 1fr; }
    .ccm-info-grid { grid-template-columns: 1fr; }
    .dash-wl-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .dash-wl-stat { padding: 10px 4px; }
    .dash-wl-stat .val { font-size: 0.8rem; }
    .settings-page.main-with-panel { display: flex; }
}

/* ----- Stacked "card" tables for narrow screens ----- */
@media (max-width: 700px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td {
        display: block;
        width: 100%;
    }
    .data-table {
        border-spacing: 0;
    }
    .data-table tbody tr {
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 4px 14px;
        background: var(--card);
        box-shadow: var(--shadow);
    }
    .data-table tbody tr:hover { background: var(--card); }
    .data-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 0;
        border-bottom: 1px dashed var(--border);
        text-align: right;
    }
    .data-table td:last-child { border-bottom: none; }
    .data-table td::before {
        content: attr(data-label);
        font-size: 0.68rem;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        text-align: left;
        margin-right: auto;
        flex-shrink: 0;
    }
    .data-table td:first-child {
        justify-content: flex-start;
        font-size: 0.95rem;
    }
    .data-table td:first-child::before { display: none; }
    .data-table .task-action-btns {
        width: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .data-table .task-action-btns .btn-view-details,
    .data-table .task-action-btns .btn-complete-task { width: auto; }
}

@media (max-width: 640px) {
    .page-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        position: static;
    }
    .topbar-left { width: 100%; }
    .topbar-right { width: 100%; justify-content: space-between; }
    .search-box { flex: 1; min-width: 0; }
    .search-kbd { display: none; }
    .topbar-profile-info { display: none; }
    .topbar-profile { padding: 6px; }
    .profile-chevron { display: none; }
    .btn-back { font-size: 0.8rem; padding: 8px 12px; }

    .card-header-row { flex-direction: column; align-items: stretch; }
    .card-actions { width: 100%; justify-content: space-between; }
    .filter-select { flex: 1; }

    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; }

    .settings-hero-content { flex-direction: column; text-align: center; padding: 22px 18px; }
    .settings-info-grid { grid-template-columns: 1fr; }
    .rf-meta { grid-template-columns: repeat(2, 1fr); }
    .rf-panel-header { flex-direction: column; align-items: flex-start; }
    .rf-confidence { align-self: flex-start; }

    .pv-toolbar { flex-direction: column; align-items: stretch; }
    .pv-toolbar-actions { flex-direction: column; }
    .pv-toolbar-actions .btn { width: 100%; }
    .rf-actions-list li { padding: 14px; gap: 10px; }
    .rf-action-num { width: 24px; height: 24px; font-size: 0.7rem; }

    .task-action-btns { width: auto; }

    .cal-modern-top { flex-direction: column; align-items: stretch; }
    .cal-legend { gap: 10px 16px; }

    .tdm-dialog { padding: 20px; width: 94%; }
    .task-detail-modal:not(.calendar-modal) .tdm-dialog { padding: 0; }
    .tdm-header { padding-right: 20px; }
}

@media (max-width: 480px) {
    .page-content { padding: 0 14px 24px; }
    .page-topbar { padding: 14px 14px; }
    .sidebar-brand { padding: 20px 16px; }

    .stat-card { padding: 20px 18px; min-height: 110px; }
    .stat-info .stat-value { font-size: 1.6rem; }
    .stat-icon { font-size: 2.2rem; }

    .card { padding: 16px 14px; }
    .card-title { font-size: 0.94rem; }
    .page-heading h1 { font-size: 1.2rem; }
    .page-heading { display: block !important; }
    .page-heading > a { display: inline-block; margin-top: 10px; }

    .dash-wl-stats { grid-template-columns: 1fr 1fr; }
    .dash-wl-stats .dash-wl-stat:last-child { grid-column: 1 / -1; }

    .rf-meta { grid-template-columns: 1fr 1fr; }
    .cal-summary-chip { padding: 12px; }
    .cal-chip-icon { width: 36px; height: 36px; font-size: 1rem; }

    .settings-avatar, .profile-avatar-large { width: 76px; height: 76px; }

    .btn { padding: 10px 16px; font-size: 0.85rem; }
    .dash-rf-links { gap: 8px; }

    .task-type-field { flex-wrap: wrap; }
    .task-type-field .btn { flex: 1 1 100%; }
    .task-type-add-form { flex-wrap: wrap; }
    .task-type-add-form .btn { flex: 1 1 100%; }
    .task-type-sidebar { padding: 20px 16px; }

    .pv-result-box { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 18px; }
    .pv-result-value { margin-left: 0; align-self: flex-end; }
    .pv-panel { padding: 18px 16px; }
}

@media (max-width: 380px) {
    .brand-title { font-size: 0.85rem; }
    .topbar-greeting h1 { font-size: 1.02rem; }
    .topbar-greeting p { font-size: 0.8rem; }
    .stat-info .stat-value { font-size: 1.4rem; }
    .search-box { height: 38px; }
    .topbar-icon-btn { width: 38px; height: 38px; }
    .toast-container { left: 12px; right: 12px; top: 12px; }
    .toast { text-align: center; }
}

/* ===== INSTANT ACTION TOASTS ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: auto;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.toast-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
body.dark-theme .toast-success { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
body.dark-theme .toast-error   { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
.btn-complete-task.is-loading,
.btn-delete-subject.is-loading { opacity: 0.7; pointer-events: none; }
