/* ============================================================
   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; }

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;
}

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;
    min-width: 0;
    max-width: 100%;
}

/* ===== 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);
}

.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 {
    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 { 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;
    min-width: 0;
    max-width: 100%;
}

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

.mobile-menu-btn {
    display: none;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow);
    cursor: pointer;
    padding: 0;
}

.mobile-menu-icon,
.mobile-menu-icon::before,
.mobile-menu-icon::after {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    position: relative;
}

.mobile-menu-icon::before,
.mobile-menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
}

.mobile-menu-icon::before { top: -5px; }
.mobile-menu-icon::after { top: 5px; }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    z-index: 180;
}

.sidebar-backdrop[hidden] { display: none; }

.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;
    min-width: 0;
}

.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;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: inherit;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: var(--shadow);
    transition: background 0.2s;
}
.topbar-icon-btn:hover { background: var(--bg); }

.notif-dropdown { position: relative; flex-shrink: 0; }

.notif-dropdown.is-open .notification-btn {
    background: var(--bg);
    box-shadow: var(--shadow-lg);
}

.notif-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(340px, calc(100vw - 24px));
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 220;
    overflow: hidden;
}

.notif-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
}

.notif-dropdown-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.notif-dropdown-head strong {
    font-size: 0.88rem;
    color: #0f172a;
}

.notif-dropdown-head span {
    font-size: 0.72rem;
    color: #64748b;
    white-space: nowrap;
}

.notif-mark-read {
    border: none;
    background: transparent;
    color: #4f46e5;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
}

.notif-mark-read:hover { text-decoration: underline; }

.notif-mark-read:disabled {
    color: #94a3b8;
    cursor: default;
    text-decoration: none;
}

.notif-list {
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    border-radius: 0;
    background: #fff;
    color: #0f172a;
    cursor: default;
    pointer-events: none;
}

.notif-item:last-child { border-bottom: none; }

.notif-item:hover { background: #fff; }

.notif-item-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    font-size: 0.95rem;
}

.notif-item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.notif-item-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: #0f172a;
    overflow-wrap: anywhere;
}

.notif-item-meta {
    font-size: 0.75rem;
    color: #64748b;
    overflow-wrap: anywhere;
}

.notif-unread-dot {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
}

.notif-empty {
    padding: 22px 16px;
    text-align: center;
    font-size: 0.84rem;
    color: #64748b;
    background: #fff;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    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;
}
#taskTable {
    border-collapse: separate;
    border-spacing: 0;
}
.data-table tbody tr.row-due td {
    background: #dc2626;
    color: #fff;
    border-top: 5px solid var(--card);
    border-bottom: 5px solid var(--card);
    padding-top: 12px;
    padding-bottom: 12px;
}
.data-table tbody tr.row-due td:first-child {
    box-shadow: inset 4px 0 0 #fff;
    border-radius: 12px 0 0 12px;
    padding-left: 18px;
}
.data-table tbody tr.row-due td:last-child {
    border-radius: 0 12px 12px 0;
}
.data-table tbody tr.row-due .task-name {
    color: #fff;
    font-weight: 700;
}
.data-table tbody tr.row-due .subject-tag {
    white-space: nowrap;
}
.data-table tbody tr.row-due .badge {
    background: #fff;
    box-shadow: 0 1px 2px rgba(127, 29, 29, 0.16);
}
.data-table tbody tr.row-due .btn-view-details,
.data-table tbody tr.row-due .btn-edit {
    background: #fff;
    color: #b91c1c;
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(127, 29, 29, 0.16);
}
.data-table tbody tr.row-due .btn-view-details:hover,
.data-table tbody tr.row-due .btn-edit:hover {
    background: #fff;
    color: #7f1d1d;
    transform: translateY(-1px);
}
.data-table tbody tr.row-due:hover td {
    background: #dc2626;
}
.due-date-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #fff;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.due-date-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
}

.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);
}

.btn-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    background: #fff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
    text-decoration: none;
    box-sizing: border-box;
}
.btn-edit:hover {
    background: #eef2ff;
    color: #4338ca;
    text-decoration: none;
    transform: translateY(-1px);
}

.task-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.task-action-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 118px;
}
.task-action-btns .btn-view-details,
.task-action-btns .btn-edit,
.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;
}

.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; }

.custom-task-type {
    margin-top: 10px;
}
.custom-task-type[hidden] {
    display: none;
}

.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;
}

.page-heading { margin-bottom: 24px; }
.page-heading-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.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  { background: #fff7ed; color: #c2410c; }
.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;
}
.tdm-close {
    position: absolute; top: 14px; right: 18px;
    background: none; border: none;
    font-size: 1.5rem; color: #94a3b8; cursor: pointer;
}
.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-medium,
.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: 40px; color: var(--text-muted); }

/* ===== 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: safe 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-input--error {
    border-color: #dc2626;
}

.login-input--error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.login-field-error {
    margin: 6px 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: #dc2626;
    line-height: 1.4;
}

.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--auth {
    max-width: 360px;
}

.login-form-panel--signup {
    padding: 28px 36px;
}

.login-form-panel--signup .login-form-header {
    margin-bottom: 16px;
}

.login-name-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.login-field-compact {
    margin-bottom: 12px;
}

.login-input--plain {
    padding-left: 14px;
    padding-right: 14px;
}

.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; }
    .login-name-grid { grid-template-columns: 1fr; }
    .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);
    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-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: 680px;
}
.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-edit-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); }

.ccm-add-btn { margin: 4px 0 16px; }
.ccm-task-form {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
}
.ccm-form-title {
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 700;
}
.ccm-subject-lock {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: -4px 0 12px;
}
.ccm-subject-lock strong { color: var(--text); }
.ccm-task-form .form-grid { gap: 10px; }
.ccm-task-form .form-group { margin-bottom: 0; }
.ccm-task-form .form-group label { font-size: 0.78rem; margin-bottom: 4px; }
.ccm-task-form .form-control { padding: 9px 12px; font-size: 0.86rem; }
.ccm-task-form textarea.form-control { min-height: 68px; }
.ccm-task-form .form-actions { margin-top: 12px; }
.ccm-form-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.82rem;
    margin-bottom: 12px;
}
.ccm-form-error[hidden] { display: none; }
.cdm-task-item.is-editing {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
button.ccm-edit-btn { font-family: inherit; }
.ccm-dialog .cdm-task-list,
.cdm-dialog .cdm-task-list {
    max-height: none;
    overflow: visible;
}

.tdm-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.tdm-actions .btn-edit,
.tdm-complete-btn { width: 100%; }
.tdm-actions .btn-edit {
    padding: 11px 22px;
    font-size: 0.88rem;
}
.tdm-section-title { font-size: 0.92rem; margin-bottom: 10px; }

.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; }
    .cal-event-content strong,
    .cal-event-content > span {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        overflow-wrap: anywhere;
    }
    .cdm-task-item { flex-wrap: wrap; }
    .cdm-task-main { min-width: 0; flex: 1 1 160px; overflow-wrap: anywhere; }
    .cdm-task-actions { flex-direction: row; width: 100%; }
    .cdm-view-btn,
    .cdm-edit-btn,
    .cdm-complete-btn { flex: 1; width: auto; }
    .ccm-info-grid { grid-template-columns: 1fr; }
}

.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; }

/* ===== 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: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.rf-badge {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
}
.rf-confidence {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
}
.rf-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
.rf-meta-item {
    text-align: center;
    background: var(--bg);
    border-radius: 10px;
    padding: 12px 8px;
}
.rf-meta-item strong {
    display: block;
    font-size: 1.3rem;
    color: var(--primary);
}
.rf-meta-item span {
    font-size: 0.72rem;
    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;
}
.rf-actions-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.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;
}
.wl-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}
.pv-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}
body.dark-theme .rf-agreement.rf-agree { background: #064e3b; color: #6ee7b7; }
body.dark-theme .rf-agreement.rf-disagree { background: #78350f; color: #fcd34d; }
body.dark-theme .notif-dropdown-menu,
body.dark-theme .notif-dropdown-head,
body.dark-theme .notif-list,
body.dark-theme .notif-item,
body.dark-theme .notif-empty,
body.dark-theme .notif-item-icon { background: #fff; }
body.dark-theme .notif-item-title,
body.dark-theme .notif-dropdown-head strong { color: #0f172a; }
body.dark-theme .notif-item-meta,
body.dark-theme .notif-dropdown-head span,
body.dark-theme .notif-empty { color: #64748b; }

/* ===== 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; }
body.dark-theme .btn-edit {
    background: #1e293b;
    color: #c7d2fe;
    border-color: #4338ca;
}
body.dark-theme .btn-edit:hover {
    background: #312e81;
    color: #e0e7ff;
}
body.dark-theme .data-table tbody tr.row-due .btn-edit,
body.dark-theme .data-table tbody tr.row-due .btn-edit:hover {
    background: #fff;
    color: #b91c1c;
    border-color: transparent;
}

/* ===== 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(-105%);
        width: min(84vw, 280px);
        box-shadow: none;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.28);
    }
    body.sidebar-collapsed .sidebar { width: min(84vw, 280px); }
    body.sidebar-collapsed .sidebar .brand-text,
    body.sidebar-collapsed .sidebar .nav-group-label,
    body.sidebar-collapsed .sidebar .sidebar-user-name { display: block; }
    body.sidebar-collapsed .sidebar .nav-link span:not(.nav-icon):not(.nav-dot) { display: inline; }

    .mobile-menu-btn { display: inline-flex; }
    .app-main { margin-left: 0 !important; }
    body.nav-open { overflow: hidden; }

    .page-topbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 10px;
        padding: 14px 14px 12px;
    }
    .topbar-left,
    .topbar-right {
        display: flex;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    .topbar-left { align-items: flex-start; gap: 10px; flex-wrap: wrap; }
    .topbar-right { align-items: center; gap: 8px; }
    .btn-back {
        flex: 1 1 100%;
        max-width: 100%;
        white-space: normal;
    }
    .topbar-greeting { flex: 1; min-width: 0; }
    .topbar-greeting h1,
    .topbar-greeting p { overflow-wrap: anywhere; }
    .topbar-greeting h1 {
        font-size: 1.05rem;
        line-height: 1.25;
    }
    .topbar-greeting p { font-size: 0.8rem; line-height: 1.35; }
    .search-box {
        flex: 1;
        min-width: 0;
        width: auto;
        height: 44px;
    }
    .search-input { min-width: 0; width: 100%; }
    .search-kbd { display: none; }
    .topbar-profile-dropdown { flex-shrink: 0; }
    .topbar-profile { padding: 4px; gap: 0; }
    .topbar-profile-info,
    .profile-chevron { display: none; }
    .profile-dropdown-menu { right: 0; left: auto; }

    .page-content { padding: 0 14px 28px; width: 100%; }
    .app-main, .page-topbar, .dashboard-grid, .card, .table-wrap, .stats-row { max-width: 100%; }
    .stats-row { grid-template-columns: 1fr; gap: 14px; }
    .stat-card { padding: 18px 18px; min-height: 112px; }
    .stat-info { min-width: 0; }
    .stat-info h3 { overflow-wrap: anywhere; }
    .stat-info .stat-value { font-size: 1.7rem; }
    .stat-icon { font-size: 2.2rem; }

    .card { padding: 16px; }
    .card-header-row { align-items: stretch; }
    .card-actions { width: 100%; }
    .filter-select { flex: 1; min-width: 0; max-width: 100%; }

    .main-with-panel { flex-direction: column; }
    .content-area,
    .right-panel { width: 100%; min-width: 0; max-width: 100%; }
    .dashboard-grid > .card,
    .stats-row > .stat-card { min-width: 0; }

    .form-grid { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column; align-items: stretch; }
    .form-actions .btn { width: 100%; }

    .page-heading-bar { flex-direction: column; align-items: stretch; }
    .page-heading h1 { overflow-wrap: anywhere; }

    .table-wrap { overflow: visible; }
    .data-table thead { display: none; }
    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td { display: block; width: 100%; }
    .data-table { font-size: 0.9rem; }
    .data-table tr {
        background: #f8fafc;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 4px 14px;
        margin-bottom: 12px;
    }
    .data-table tbody tr:hover { background: #f8fafc; }
    .data-table td {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px 12px;
        padding: 10px 0;
        border-bottom: 1px solid var(--border);
        text-align: right;
        min-width: 0;
        overflow-wrap: anywhere;
    }
    .data-table td:last-child { border-bottom: none; }
    .data-table td::before {
        content: attr(data-label);
        flex: 1 1 92px;
        max-width: 46%;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--text-muted);
        text-align: left;
        overflow-wrap: anywhere;
    }
    .data-table td > * {
        margin-left: auto;
        max-width: 100%;
        min-width: 0;
    }
    .data-table td:has(.task-name) { align-items: flex-start; }
    .data-table td:has(.task-name)::before { flex: 1 1 100%; max-width: none; }
    .data-table td:has(.task-name) .task-type-icon,
    .data-table td:has(.task-name) .task-name { margin-left: 0; }
    .data-table td .task-name {
        flex: 1;
        min-width: 0;
        text-align: left;
        font-size: 0.98rem;
    }
    .data-table tbody tr.row-due,
    .data-table tbody tr.row-due:hover {
        background: #dc2626;
        border-color: #7f1d1d;
        box-shadow: 0 8px 18px rgba(185, 28, 28, 0.22);
    }
    .data-table tbody tr.row-due td,
    .data-table tbody tr.row-due:hover td {
        background: transparent;
        border-top: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.22);
        border-radius: 0;
        box-shadow: none;
        padding-left: 0;
    }
    .data-table tbody tr.row-due td::before {
        color: rgba(255, 255, 255, 0.82);
    }
    body.dark-theme .data-table tr,
    body.dark-theme .data-table tbody tr:hover { background: #0f172a; }
    body.dark-theme .data-table tbody tr.row-due,
    body.dark-theme .data-table tbody tr.row-due:hover {
        background: #dc2626;
        border-color: #991b1b;
    }
    body.dark-theme .data-table td { border-bottom-color: #334155; }
    .data-table td .task-type-icon { margin-right: 4px; }
    .task-action-btns {
        width: auto;
        max-width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .dash-view-all .btn { width: 100%; }

    .dash-rf-confidence { overflow-wrap: anywhere; }
    .gauge-labels { gap: 6px; }
    .gauge-labels span { flex: 1; text-align: center; line-height: 1.3; }
    .wl-card-icon { text-align: center; }

    .profile-info-row { flex-direction: column; gap: 2px; align-items: flex-start; }
    .profile-info-row .label { width: auto; }
    .profile-info-row .value { overflow-wrap: anywhere; }

    .pv-toolbar > div { display: flex; flex-wrap: wrap; gap: 8px; }
    .pv-toolbar .btn { flex: 1 1 140px; }
    .pv-result-box { flex-direction: column; align-items: flex-start; gap: 8px; }
    .pv-result-value { margin-left: 0; font-size: 1.8rem; }
    .pv-panel { padding: 16px; }
    .rf-meta { grid-template-columns: 1fr 1fr; }

    .tdm-dialog {
        width: calc(100% - 20px);
        margin: 12px auto;
        padding: 22px 16px 18px;
        max-height: calc(100vh - 24px);
    }
    .tdm-header { flex-wrap: wrap; padding-right: 28px; }
    .tdm-header h2 { overflow-wrap: anywhere; font-size: 1.05rem; }

    .cal-summary-row,
    .cal-modern-top { padding-left: 14px; padding-right: 14px; }
    .toast-container { left: 12px; right: 12px; top: 12px; }
    .toast { overflow-wrap: anywhere; }
}

@media (max-width: 480px) {
    .page-topbar { padding: 12px 12px 10px; }
    .page-content { padding: 0 12px 24px; }
    .topbar-greeting h1 { font-size: 0.98rem; }
    .stat-card { padding: 16px; }
    .stat-info .stat-value { font-size: 1.5rem; }
    .dash-wl-stats { grid-template-columns: 1fr; }
    .data-table td::before { flex-basis: 34%; }
    .rf-vote-label { width: auto; min-width: 64px; }
}

/* ===== 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; }

/* ===== PAGE LOADER (display only) ===== */
body.dark-theme #pageLoader { background: rgba(15, 23, 42, 0.72); }
body.dark-theme .page-loader-card { background: #1e293b; border-color: #334155; }
body.dark-theme .page-loader-text { color: #e2e8f0; }
body.dark-theme .page-loader-spin { border-color: #334155; border-top-color: #818cf8; }
