/* ── GradeBlaster Web App ── */

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-input: #252830;
    --bg-hover: #2a2d38;
    --border: #2e3140;
    --text: #e4e5ea;
    --text-muted: #8b8fa3;
    --text-dim: #5c6078;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-bg: rgba(99, 102, 241, 0.1);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --sidebar-w: 240px;
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 32px; height: 32px;
    border-radius: 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--primary-bg); color: var(--primary); }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 8px;
}

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name { font-size: 13px; font-weight: 500; }
.user-mode {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}
.user-mode.live { color: var(--success); }
.user-mode.draft { color: var(--warning); }
.user-mode.local { color: var(--info); }

.nav-item.logout { color: var(--text-dim); }
.nav-item.logout:hover { color: var(--danger); }

/* ── Main Content ── */
main {
    padding: 32px;
    min-height: 100vh;
}

main.with-sidebar {
    margin-left: var(--sidebar-w);
}

main.full-width {
    max-width: 1200px;
    margin: 0 auto;
}

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: -12px;
    margin-bottom: 16px;
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Content Grid ── */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .content-grid { grid-template-columns: 1fr; }
}

/* ── Distribution Bars ── */
.distribution { display: flex; flex-direction: column; gap: 8px; }
.dist-bar { display: flex; align-items: center; gap: 10px; }
.dist-label { width: 24px; font-weight: 600; font-size: 14px; }
.dist-track { flex: 1; height: 24px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.dist-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.dist-count { width: 30px; text-align: right; font-size: 13px; color: var(--text-muted); }
.dist-A { background: var(--success); }
.dist-B { background: #4ade80; }
.dist-C { background: var(--warning); }
.dist-D { background: #fb923c; }
.dist-F { background: var(--danger); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: var(--bg-hover); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--primary-bg);
    color: var(--primary);
}

.grade-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
}
.grade-a { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.grade-b { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.grade-c { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.grade-d { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.grade-f { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}
.status-posted { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.status-draft { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-local { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.status-error { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: #fbbf24; color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #f87171; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-ghost.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }
.btn.disabled { opacity: 0.4; pointer-events: none; }

/* ── Forms ── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.form-group small {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="number"], select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-lg { font-size: 20px; padding: 12px 16px; }

.form-row {
    display: flex;
    gap: 16px;
}

.flex-1 { flex: 1; }

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

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

/* ── Auth Pages ── */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px;
}

.auth-card, .setup-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 440px;
}

.setup-card { max-width: 520px; }

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 56px; height: 56px;
    border-radius: 14px;
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 22px;
    margin-bottom: 4px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.auth-form { margin-bottom: 16px; }

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, box-shadow 0.15s;
}

.btn-google:hover {
    background: #f7f8f8;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-google svg {
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 12px;
}

.auth-footer {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

.form-link {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
}

.form-link a {
    color: var(--text-muted);
}

.form-link a:hover {
    color: var(--primary);
}

.reset-link-box {
    margin-top: 20px;
    padding: 16px;
    background: var(--primary-bg);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius);
    text-align: center;
    font-size: 14px;
}

.reset-link-box p {
    margin-bottom: 12px;
    color: var(--text-muted);
}

/* ── Setup Steps ── */
.setup-steps {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.step {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--bg-input);
    color: var(--text-dim);
}

.step.active { background: var(--primary); color: #fff; }
.step.done { background: rgba(34, 197, 94, 0.15); color: var(--success); }

/* ── Flash Messages ── */
.flash-messages { margin-bottom: 20px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.flash-success { background: rgba(34, 197, 94, 0.1); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }
.flash-error { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.flash-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.flash-info { background: rgba(59, 130, 246, 0.1); color: var(--info); border: 1px solid rgba(59, 130, 246, 0.3); }
.flash-close { background: none; border: none; color: inherit; font-size: 18px; cursor: pointer; opacity: 0.7; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.2); color: var(--warning); }
.alert a { text-decoration: underline; }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 64px 32px;
}

.empty-icon {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    color: var(--text-dim);
}

.empty-state h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ── Profiles ── */
.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.profile-card .profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.profile-header h3 { font-size: 16px; font-weight: 600; }
.profile-actions { display: flex; gap: 4px; }

.profile-weights {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.weight {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.weight-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.weight-value { font-size: 14px; font-weight: 600; }

.profile-criteria {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

/* ── Criteria Editor ── */
.criteria-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.criteria-row {
    display: grid;
    grid-template-columns: 1fr 2fr 80px auto;
    gap: 8px;
    align-items: center;
}

.criteria-row input { margin-bottom: 0; }

/* ── Grading Layout ── */
.grading-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1100px) {
    .grading-layout { grid-template-columns: 1fr; }
}

/* ── Student Nav ── */
.student-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
}

.student-selector {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-selector select {
    flex: 1;
    margin-bottom: 0;
}

.nav-counter {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── File Preview ── */
.file-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.file-tab {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
}

.file-tab.active { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }

.preview-frame {
    background: var(--bg);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 400px;
}

.preview-iframe {
    width: 100%;
    height: 500px;
    border: none;
    background: #fff;
}

/* ── AI Results ── */
.ai-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.ai-results { font-size: 14px; }
.ai-section { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.ai-section h4 { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; }

.deduction-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.deduction-name { font-weight: 500; }
.deduction-value { font-weight: 600; text-align: right; }
.deduction-value.has-deduction { color: var(--danger); }
.deduction-reason { grid-column: 1 / -1; font-size: 12px; color: var(--text-muted); }

.ai-feedback {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 8px;
    background: var(--bg);
    border-radius: var(--radius);
}

/* ── Progress Bar ── */
.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.progress-bar {
    height: 12px;
    background: var(--bg-input);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.progress-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.step-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: var(--primary-bg);
    color: var(--primary);
    text-transform: uppercase;
}

/* ── Error List ── */
.error-list {
    list-style: none;
    padding: 0;
}

.error-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--danger);
}

/* ── Weights Row ── */
.weights-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ── Utilities ── */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    main.with-sidebar { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; }
    .weights-row { grid-template-columns: 1fr; }
    .criteria-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

/* ── Trial / License ── */
.sidebar-trial {
    padding: 12px 16px;
    margin: 8px 12px;
    background: var(--bg-hover);
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.trial-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--warning);
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 13px;
}
.trial-upgrade-link {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.2s;
}
.trial-upgrade-link:hover {
    background: var(--primary);
    color: #fff;
}
.sidebar-license {
    padding: 8px 16px;
    margin: 8px 12px;
    text-align: center;
}
.license-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--success);
    letter-spacing: 0.5px;
}

/* Settings page license status */
.license-status {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.license-status div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.license-status span {
    font-size: 13px;
    color: var(--text-muted);
}
.license-status strong {
    color: inherit;
    font-size: 14px;
}
.license-active { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.license-trial { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.license-expired { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* ── Sidebar Sections ── */
.sidebar-section {
    padding: 8px 16px;
    margin: 0 12px;
    border-top: 1px solid var(--border);
}
.sidebar-section:first-of-type { margin-top: 4px; }
.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.sidebar-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}
.sidebar-info-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sidebar-info-dot.connected { background: var(--success); }
.sidebar-info-dot.disconnected { background: var(--text-dim); }
.sidebar-info-text {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-info-text.small { font-size: 11px; }
.sidebar-info-text.muted { color: var(--text-dim); }

/* ── Mode Toggle ── */
.mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
    font-family: inherit;
}
.mode-toggle:hover { border-color: var(--text-muted); }
.mode-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    transition: background 0.15s;
}
.mode-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}
.mode-toggle.mode-live .mode-dot { background: var(--success); }
.mode-toggle.mode-live .mode-label { color: var(--success); }
.mode-toggle.mode-draft .mode-dot { background: var(--warning); }
.mode-toggle.mode-draft .mode-label { color: var(--warning); }
.mode-toggle.mode-local .mode-dot { background: var(--info); }
.mode-toggle.mode-local .mode-label { color: var(--info); }

/* ── Download App Link ── */
.sidebar-download {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    padding: 4px 0;
}
.sidebar-download:hover { color: var(--primary-hover); }

/* ── Blast All Button ── */
.btn-blast {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-weight: 600;
}
.btn-blast:hover {
    background: linear-gradient(135deg, #818cf8, #a78bfa);
    color: #fff;
}
.btn-blast svg { stroke: currentColor; }

/* ── Blast Progress ── */
.blast-student-status {
    min-height: 48px;
    display: flex;
    align-items: center;
}
.student-status-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}
.student-status-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.blast-spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.blast-complete-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
    padding: 8px 0;
}
.blast-complete-icon { font-size: 24px; }
.elapsed-timer {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: 12px;
    font-variant-numeric: tabular-nums;
}

/* ── Blast Stats ── */
.blast-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.blast-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
}
.blast-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}
.blast-stat-errors { color: var(--danger); }
.blast-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Blast Results Table ── */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.results-actions { display: flex; gap: 6px; }

.blast-table { width: 100%; }
.blast-row { cursor: pointer; }
.blast-row:hover td { background: var(--bg-hover); }
.col-expand { width: 30px; text-align: center; }
.expand-icon { color: var(--text-dim); font-size: 10px; transition: transform 0.15s; }
.col-score { text-align: center; width: 80px; }
.col-status { width: 80px; }

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}
.sortable:hover { color: var(--text); }
.sortable.sort-asc::after { content: " ▲"; font-size: 10px; }
.sortable.sort-desc::after { content: " ▼"; font-size: 10px; }

/* ── Blast Detail Row ── */
.blast-detail-row td {
    padding: 0 !important;
    border-bottom: 2px solid var(--primary);
}
.blast-detail {
    padding: 16px 20px;
    background: var(--bg);
}
.score-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.score-item {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
}
.score-total {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 700;
}

/* ── Criteria Table ── */
.criteria-section {
    margin-bottom: 16px;
}
.criteria-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.criteria-table {
    width: 100%;
    font-size: 13px;
}
.criteria-table th {
    font-size: 11px;
    padding: 6px 8px;
}
.criteria-table td {
    padding: 6px 8px;
}
.ded-input, .reason-input {
    padding: 4px 8px !important;
    font-size: 13px !important;
    border-radius: 4px !important;
}
.ded-input {
    width: 60px !important;
    text-align: center;
}
.reason-input {
    width: 100% !important;
    min-width: 200px;
}
.blast-comment {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}
.blast-comment:focus {
    outline: none;
    border-color: var(--primary);
}

/* ── Save Bar ── */
.blast-save-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.save-status {
    font-size: 12px;
    font-weight: 500;
}
.save-status.saving { color: var(--info); }
.save-status.saved { color: var(--success); }
.save-status.error { color: var(--danger); }
.save-status.unsaved { color: var(--warning); }

/* ── Progress Right ── */
#progress-right {
    display: flex;
    align-items: center;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Responsive: Blast ── */
@media (max-width: 768px) {
    .blast-stats { grid-template-columns: repeat(2, 1fr); }
    .col-score { display: none; }
}
