﻿/* ========== Reset & Base ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-bg: #eff6ff;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --success: #10b981;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow:
        0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: 0.2s ease;
    --sidebar-width: 220px;
}
body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}
input,
button,
select {
    font-family: inherit;
    font-size: inherit;
}
button {
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
}
input {
    outline: none;
    transition: var(--transition);
}

/* ========== Header ========== */
header {
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-dark)
    );
    color: #fff;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 52px;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}
header .logo {
    font-size: 1.05rem;
    font-weight: 700;
    white-space: nowrap;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-right: 0.5rem;
}
.header-tabs {
    display: flex;
    gap: 0.25rem;
}
.header-tab {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    transition: 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
}
.header-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}
.header-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}
.header-spacer {
    flex: 1;
}
.header-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
}
.header-stats span {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    white-space: nowrap;
}
.header-stats span strong {
    font-size: 0.95rem;
}

/* ========== Layout: Sidebar + Main ========== */
.layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 52px);
    position: relative;
}

/* ========== Sidebar ========== */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding: 0.5rem 0 0 0.5rem;
    background: #fff;
    box-shadow: 2px 0 12px rgba(0,0,0,0.06);
    position: sticky;
    top: 52px;
    align-self: flex-start;
    height: calc(100vh - 52px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease;
}
.sidebar.collapsed {
    width: 36px;
    box-shadow: 1px 0 6px rgba(0,0,0,0.06);
}
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-item span:not(.icon),
.sidebar.collapsed .sidebar-item .sub-arrow,
.sidebar.collapsed .sidebar-subitem,
.sidebar.collapsed .sidebar-submenu {
    display: none;
}
.sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 0.55rem 0;
    font-size: 0;
}
.sidebar.collapsed .sidebar-item .icon {
    font-size: 1rem;
    margin: 0;
}

/* ========== Sidebar Popover (collapsed mode) ========== */
.sidebar-popover {
    display: none;
    position: fixed;
    z-index: 99;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 0.5rem 0;
    min-width: 160px;
    max-width: 220px;
    max-height: 60vh;
    overflow-y: auto;
    animation: fadeIn 0.15s ease;
}
.sidebar-popover.open {
    display: block;
}
.sidebar-popover .popover-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-400);
    padding: 0.25rem 0.75rem 0.35rem;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sidebar-popover .popover-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    color: var(--gray-600);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.sidebar-popover .popover-item:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}
.sidebar-popover .popover-item.active {
    color: var(--primary);
    font-weight: 600;
    background: var(--primary-bg);
}

/* ========== Sidebar Footer (collapse button) ========== */
.sidebar-footer {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    padding: 0.25rem 0;
    border-top: 1px solid var(--gray-100);
    background: #fff;
}
.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-footer .sidebar-collapse-btn {
    flex-direction: row-reverse;
}
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.35rem 0;
    background: none;
    border: none;
    color: var(--gray-300);
    cursor: pointer;
    font-size: 0.6rem;
    transition: var(--transition);
    line-height: 1;
}
.sidebar-collapse-btn:hover {
    color: var(--gray-500);
}
.sidebar.collapsed .sidebar-footer {
    border-top: none;
}

.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    padding: 0.5rem 0.75rem 0.3rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.4rem 0.55rem 0.75rem;
    border-radius: 0;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--gray-600);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
}
.sidebar-item:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}
.sidebar-item.active {
    background: #dbeafe;
    color: var(--primary-dark);
    font-weight: 700;
}
.sidebar-item .icon {
    font-size: 1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
}

/* ========== Sidebar Sub-menu ========== */
.sidebar-item.has-sub {
    position: relative;
}
.sidebar-item .sub-arrow {
    margin-left: auto;
    font-size: 0.6rem;
    transition: transform 0.2s ease;
    color: var(--gray-400);
}
.sidebar-item .sub-arrow.open {
    transform: rotate(90deg);
}
.sidebar-submenu {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    padding-left: 0.5rem;
}
.sidebar-submenu.open {
    max-height: 1000px;
}
.sidebar-subitem {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem 0.4rem 2.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--gray-500);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
}
.sidebar-subitem:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}
.sidebar-subitem.active {
    color: var(--primary);
    font-weight: 600;
    background: var(--primary-bg);
}
.sidebar-subitem .sub-icon {
    font-size: 0.75rem;
    flex-shrink: 0;
    opacity: 0.6;
}
.sidebar-add-btn {
    font-weight: 600 !important;
    color: var(--primary) !important;
    border: 1px dashed var(--primary);
    margin-bottom: 0.3rem;
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
    border-radius: 6px;
}
.sidebar-add-btn:hover {
    background: var(--primary-bg) !important;
    border-style: solid;
}

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 1rem 0.75rem 0;
    overflow: auto;
    max-height: calc(100vh - 52px);
}
.main-content .container {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* ========== Sidebar overlay (mobile) ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 98;
}

/* ========== Tabs (page-internal) ========== */
.tabs {
    display: flex;
    gap: 0;
    background: #fff;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.5rem;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow);
}
.tab-btn {
    padding: 0.85rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    background: transparent;
    color: var(--gray-500);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}
.tab-btn:hover {
    color: var(--primary);
    background: var(--primary-bg);
}
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-bg);
}
.tab-content {
    display: none;
    animation: fadeIn 0.25s ease;
}
.tab-content.active {
    display: block;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Cards ========== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
}
.card-subtitle {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}
.btn-accent {
    background: var(--accent);
    color: #fff;
}
.btn-accent:hover {
    background: #d97706;
    box-shadow: var(--shadow-md);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-outline {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
}
.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}
.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}
.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

/* ========== Form ========== */
.form-group {
    margin-bottom: 0.75rem;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.3rem;
}
.form-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.form-row .form-group {
    margin-bottom: 0;
}
input[type="text"],
input[type="number"],
input[type="date"] {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: #fff;
    color: var(--gray-800);
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
input[type="number"] {
    width: 80px;
}
input[type="text"].input-full {
    flex: 1;
    min-width: 120px;
}
select {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: #fff;
    color: var(--gray-800);
    cursor: pointer;
    font-family: inherit;
}
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ========== Student Tags ========== */
.student-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}
.student-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--primary-bg);
    color: var(--primary);
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}
.student-tag .remove {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--gray-400);
    transition: var(--transition);
}
.student-tag .remove:hover {
    color: var(--danger);
}

/* ========== Student List ========== */
.student-list {
    margin-top: 0.5rem;
}

/* ========== Training List ========== */
.training-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.training-card {
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    min-width: 160px;
    flex: 1 1 180px;
    max-width: 240px;
    position: relative;
    display: flex;
    flex-direction: column;
}
.training-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}
.training-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.training-card .card-del {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 1rem;
    line-height: 1;
    padding: 0.2rem;
    transition: var(--transition);
}
.training-card .card-del:hover {
    color: var(--danger);
}
.training-card .card-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    padding-right: 1.2rem;
}
.training-card .card-stats {
    font-size: 0.8rem;
    color: var(--gray-500);
    line-height: 1.6;
}
.training-card .card-stats span {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}
.training-detail {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fff;
    padding: 1.25rem;
    margin-top: 0.5rem;
}
.training-students {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.75rem 0;
}
.training-students .badge {
    background: var(--primary-bg);
    color: var(--primary);
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* ========== Mock Competition ========== */
.mock-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0.75rem 0;
}
.mock-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}
.mock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.mock-title {
    font-weight: 600;
    font-size: 0.9rem;
}
.mock-title small {
    font-weight: 400;
    color: var(--gray-500);
    margin-left: 0.5rem;
}

/* ========== Score Table ========== */
.score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.score-table th {
    text-align: left;
    padding: 0.4rem 0.5rem;
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
}
.score-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.score-table tr:last-child td {
    border-bottom: none;
}
.score-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f1f5f9;
}
.score-table thead th {
    background: #f1f5f9;
    border-bottom: 2px solid var(--gray-300);
    padding: 0.55rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-700);
}
.score-table-wrap {
    max-width: 100%;
}
.score-input {
    width: 70px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
    appearance: none;
}
.score-input:focus,
.time-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.time-input {
    width: 90px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}
.time-input::-webkit-outer-spin-button,
.time-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
    appearance: none;
}
.time-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.rank-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}
.rank-1 {
    background: #fef3c7;
    color: #92400e;
}
.rank-2 {
    background: #e5e7eb;
    color: #374151;
}
.rank-3 {
    background: #fde68a;
    color: #92400e;
}

/* ========== Stats ========== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}
.stat-card.full {
    grid-column: 1 / -1;
}
.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}
.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
}
.ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.ranking-table th {
    text-align: left;
    padding: 0.6rem 0.5rem;
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
.ranking-table td {
    padding: 0.55rem 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}
.ranking-table tr:hover td {
    background: var(--gray-50);
}
.medal {
    font-size: 1.2rem;
}
.score-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    min-width: 80px;
}
.score-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(
        90deg,
        var(--primary-light),
        var(--primary)
    );
    transition: width 0.4s ease;
}

/* ========== Modal ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}
.modal-overlay.open {
    display: flex;
}
.modal-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem 2rem;
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: fadeIn 0.2s ease;
}
.modal-box h3 {
    margin-bottom: 1rem;
    font-size: 1.15rem;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* ========== Checkbox Grid ========== */
.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}
.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    background: var(--gray-100);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}
.checkbox-grid label:hover {
    background: var(--primary-bg);
}
.checkbox-grid label:has(input:checked) {
    background: var(--primary-bg);
    border: 1px solid var(--primary-light);
}

/* ========== Student Picker (Dual List) ========== */
.student-picker {
    display: flex;
    gap: 0;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
    min-height: 240px;
}
.student-picker-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.student-picker-divider {
    width: 1px;
    background: var(--gray-200);
    flex-shrink: 0;
}
.student-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.65rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-600);
    gap: 0.5rem;
}
.student-picker-count {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--gray-400);
}
.student-picker-filter {
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.78rem;
    background: #fff;
    color: var(--gray-800);
    max-width: 130px;
}
.student-picker-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.3rem;
    min-height: 180px;
    max-height: 260px;
}
.student-picker-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.55rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.12s;
    user-select: none;
}
.student-picker-item:hover {
    background: var(--gray-100);
}
.student-picker-item.is-selected {
    background: var(--primary-bg);
}
.student-picker-item.is-selected:hover {
    background: #dbeafe;
}
.student-picker-item.is-selected .picker-item-name {
    font-weight: 600;
    color: var(--primary);
}
.student-picker-item.is-selected .picker-item-action {
    color: var(--danger);
}
.student-picker-item .picker-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.student-picker-item .picker-item-group {
    font-size: 0.7rem;
    color: var(--gray-400);
    flex-shrink: 0;
}
.student-picker-item .picker-item-action {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--gray-400);
    transition: color 0.12s;
}
.student-picker-item:hover .picker-item-action {
    color: var(--primary);
}
.student-picker-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 160px;
    color: var(--gray-300);
    font-size: 0.85rem;
}

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toast {
    background: var(--gray-800);
    color: #fff;
    padding: 0.65rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.25s ease;
    max-width: 320px;
}
.toast.success {
    background: var(--success);
}
.toast.error {
    background: var(--danger);
}
.toast.warning {
    background: var(--accent);
}
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--gray-400);
}
.empty-state .icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}
.empty-state p {
    font-size: 0.9rem;
}

/* ========== Type Badge (tasks) ========== */
.type-badge {
    display: inline-flex;
    font-size: 0.72rem;
    padding: 0.12rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}
.type-basic {
    background: #dbeafe;
    color: #1d4ed8;
}
.type-challenge {
    background: #fef3c7;
    color: #92400e;
}

/* ========== Task Group ========== */
.task-group {
    margin-bottom: 0.75rem;
}
.task-group:last-child {
    margin-bottom: 0;
}
.task-group-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-600);
    padding: 0.4rem 0.6rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.task-group-count {
    font-weight: 400;
    color: var(--gray-400);
    font-size: 0.8rem;
    margin-left: auto;
}
.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--gray-100);
}
.task-item:last-child {
    border-bottom: none;
}
.task-name {
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.task-locked {
    font-size: 0.75rem;
    color: var(--gray-400);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    header {
        padding: 0 1rem;
    }
    .header-stats {
        display: none;
    }
    .sidebar-toggle {
        display: block;
    }
    .sidebar-subitem {
        padding: 0.35rem 0.75rem 0.35rem 2rem;
        font-size: 0.8rem;
    }
    .sidebar {
        position: fixed;
        top: 52px;
        left: -260px;
        width: 240px;
        height: calc(100vh - 52px);
        background: #fff;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
        z-index: 99;
        padding: 0.75rem 0.5rem;
        transition: left 0.25s ease;
        max-height: none;
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar-overlay.open {
        display: block;
    }
    .layout {
        flex-direction: column;
        padding-top: 0.75rem;
    }
    .main-content {
        padding: 0 1rem;
    }
    .tab-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .card {
        padding: 1rem;
    }
    header .logo {
        font-size: 0.95rem;
    }
    .header-tab {
        font-size: 0.82rem;
        padding: 0.3rem 0.7rem;
    }
}
