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

body {
    background: #f5f5f5;
    color: #1a1a1a;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
    background: #111;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.navbar-brand {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 14px 0;
    text-decoration: none;
}
.navbar-nav { display: flex; list-style: none; gap: 0; }
.navbar-nav .nav-link {
    color: #888;
    padding: 14px 12px;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}
.navbar-nav .nav-link:hover { color: #fff; }

/* Container */
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }

/* Page title */
.page-title { text-align: center; margin-bottom: 28px; }
.page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.page-title p { font-size: 0.8rem; color: #999; }

/* Card */
.card {
    background: #fff;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}
.card-body { padding: 28px; }
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    font-weight: 600;
    font-size: 0.85rem;
    color: #111;
}

/* Steps */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    gap: 0;
}
.step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border: 1px solid #e0e0e0;
    background: #fafafa;
    transition: all 0.3s;
}
.step.active { background: #111; border-color: #111; }
.step .step-num {
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    background: #ddd;
    color: #fff;
    flex-shrink: 0;
}
.step.active .step-num { background: #fff; color: #111; }
.step .step-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: #999;
}
.step.active .step-text { color: #fff; }
.step-connector { width: 24px; height: 1px; background: #ddd; }

/* Selection panels */
.selection-step { display: none; }
.selection-step.active { display: block; animation: fadeUp 0.3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}
.form-hint { font-size: 0.78rem; color: #aaa; margin-bottom: 10px; }

select, .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    font-size: 0.9rem;
    background: #fff;
    color: #222;
    transition: border 0.2s;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}
select:focus, .form-control:focus { outline: none; border-color: #111; }
select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 22px;
    border: 1px solid #222;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    background: transparent;
    color: #222;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.4;
}
.btn:hover { background: #222; color: #fff; }
.btn-primary { background: #111; color: #fff; border-color: #111; }
.btn-primary:hover { background: #000; }
.btn-sm { padding: 4px 12px; font-size: 0.75rem; }
.btn-danger { border-color: #c00; color: #c00; }
.btn-danger:hover { background: #c00; color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.3; cursor: not-allowed; background: transparent !important; color: #999 !important; border-color: #ddd !important; }
.btn-primary:disabled { background: #eee !important; color: #bbb !important; border-color: #eee !important; }
.btn-next { min-width: 180px; }
.btn-group { display: flex; gap: 12px; margin-top: 24px; }
.btn-group .btn { flex: 1; }

/* Selected student info */
.selected-student-info {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    padding: 14px 18px;
    margin-bottom: 20px;
}
.ssi-label { font-size: 0.75rem; color: #888; letter-spacing: 1px; }
.ssi-name { font-weight: 700; color: #111; font-size: 0.95rem; }
.ssi-status { font-size: 0.78rem; margin-left: auto; }
.ssi-status.done { color: #090; }
.ssi-status.pending { color: #c00; }

/* Course grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.course-card {
    border: 1px solid #e0e0e0;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.course-card:active { background: #f5f5f5; }
.course-card.selected {
    border-color: #111;
    background: #fafafa;
    box-shadow: inset 0 0 0 1.5px #111;
}
.course-card.selected::after {
    content: "✓ 已选";
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #111;
    background: #fff;
    border: 1px solid #111;
    padding: 2px 8px;
}
.course-card.full { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.course-card .course-name {
    font-weight: 600;
    font-size: 1rem;
    color: #111;
    margin-bottom: 4px;
    padding-right: 60px;
}
.course-card .course-meta {
    font-size: 0.8rem;
    color: #999;
}
.course-card .course-capacity {
    font-size: 0.85rem;
    margin-top: 8px;
    font-weight: 500;
}
.course-card .course-capacity .cap-unit { font-weight: 400; color: #999; }
.course-card .course-capacity .cap-full { color: #c00; margin-left: 4px; }
.course-card .course-capacity.full { color: #c00; }
.course-card .course-capacity.available { color: #090; }
.course-card .course-selected-badge {
    display: none;
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 0.72rem;
    color: #999;
}

/* Alert */
.alert {
    padding: 14px 18px;
    border: 1px solid #ddd;
    margin-bottom: 16px;
    font-size: 0.85rem;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.alert-success { border-color: #090; color: #090; background: #f6fff6; }
.alert-danger { border-color: #c00; color: #c00; background: #fff6f6; }
.alert-warning { border-color: #960; color: #960; background: #fffdf6; }
.alert .btn-close {
    border: none;
    background: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 4px;
}
.alert .btn-close:hover { color: #000; }

/* Stats */
.stats-row { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-card {
    flex: 1;
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 20px 16px;
    text-align: center;
}
.stat-card .stat-number { font-size: 1.8rem; font-weight: 700; color: #111; line-height: 1.2; }
.stat-card .stat-label { font-size: 0.7rem; color: #999; letter-spacing: 1px; margin-top: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table th {
    background: #f7f7f7;
    border-bottom: 2px solid #222;
    padding: 10px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: #111;
    white-space: nowrap;
}
table td { padding: 10px; border-bottom: 1px solid #eee; color: #333; }
table tr:hover td { background: #fafafa; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 4px;
    margin-top: 16px;
}
.pagination .page-item .page-link {
    display: block;
    padding: 8px 14px;
    border: 1px solid #ddd;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
}
.pagination .page-item.active .page-link { background: #111; color: #fff; border-color: #111; }
.pagination .page-item .page-link:hover { border-color: #111; }

/* Progress */
.progress { height: 6px; background: #eee; }
.progress-bar { height: 100%; background: #222; transition: width 0.3s; }

/* Footer */
.footer {
    border-top: 1px solid #eee;
    padding: 20px 0;
    text-align: center;
    font-size: 0.72rem;
    color: #bbb;
}

/* Mobile first overrides */
@media (max-width: 640px) {
    .container { padding: 14px 10px; }
    .card-body { padding: 18px 14px; }

    /* Steps compact */
    .steps { margin-bottom: 20px; }
    .step { padding: 5px 10px; gap: 5px; flex: 1; justify-content: center; }
    .step .step-text { font-size: 0.68rem; white-space: nowrap; }
    .step .step-num { width: 18px; height: 18px; font-size: 0.6rem; }
    .step-connector { width: 8px; }

    /* Bigger touch targets on mobile */
    select { padding: 14px 12px; font-size: 1rem; min-height: 48px; padding-right: 32px; }
    .btn { min-height: 44px; padding: 12px 18px; font-size: 0.88rem; }
    .btn-sm { min-height: auto; padding: 6px 12px; font-size: 0.78rem; }
    .btn-next { min-width: unset; width: 100%; }
    .btn-group { gap: 8px; margin-top: 16px; }

    .course-grid { display: flex; flex-direction: column; gap: 8px; }
    .course-card { padding: 14px; }
    .course-card .course-name { font-size: 0.92rem; }
    .alert { padding: 10px 12px; font-size: 0.8rem; }

    .stats-row { gap: 6px; }
    .stat-card { padding: 12px 8px; }
    .stat-card .stat-number { font-size: 1.3rem; }

    table { font-size: 0.72rem; }
    table th, table td { padding: 6px 4px; }

    /* Filter tags wrap nicely */
    .filter-group { gap: 4px; }
    .filter-group .btn-sm { padding: 4px 10px; }
}

@media (max-width: 380px) {
    .step .step-text { display: none; }
    .step-connector { width: 8px; }
    .navbar-nav .nav-link { padding: 12px 8px; font-size: 0.72rem; }
}

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: #999; font-size: 0.85rem; }
.btn-tiny { padding: 2px 8px; font-size: 0.72rem; }
