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

:root {
    --primary:       #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --success:       #16a34a;
    --success-light: #f0fdf4;
    --warning:       #d97706;
    --warning-light: #fffbeb;
    --danger:        #dc2626;
    --danger-light:  #fef2f2;
    --bg:            #f8fafc;
    --card:          #ffffff;
    --text:          #111827;
    --text-muted:    #6b7280;
    --border:        #e5e7eb;
    --radius:        8px;
    --shadow-sm:     0 1px 2px rgba(0,0,0,.05);
    --shadow:        0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

/* ── Header ──────────────────────────────────────────────────────────── */
header {
    background: var(--primary);
    padding: 0;
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo {
    width: 28px; height: 28px;
    background: rgba(255,255,255,.15);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.header-logo svg { width: 14px; height: 14px; fill: #fff; }

.header-titles { flex: 1; }

.header-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
}

.header-subtitle {
    font-size: 0.72rem;
    color: rgba(255,255,255,.6);
}

.header-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: rgba(255,255,255,.7);
    border: 1px solid rgba(255,255,255,.25);
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
}

/* ── Layout ──────────────────────────────────────────────────────────── */
main.container {
    max-width: 900px;
    margin: 1.75rem auto;
    padding: 0 1.5rem;
    flex: 1;
}

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
    gap: 0;
}

.tab-btn {
    padding: 0.6rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tab-btn:hover { color: var(--primary); }

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
}

.card-body { padding: 1.25rem; }

/* ── Launch section ───────────────────────────────────────────────────── */
.launch-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.launch-info h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.launch-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-launch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    background: var(--primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(79,70,229,.3);
}

.btn-launch:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(79,70,229,.35);
}

.btn-launch:disabled { opacity: .65; cursor: not-allowed; }

/* ── Status box ───────────────────────────────────────────────────────── */
.status-box {
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.status-box.running  { background: var(--warning-light); border: 1px solid #fde68a; }
.status-box.success  { background: var(--success-light); border: 1px solid #bbf7d0; }
.status-box.failed   { background: var(--danger-light);  border: 1px solid #fecaca; }

.status-label {
    font-size: 0.8rem;
    font-weight: 700;
}

.status-box.running .status-label { color: #92400e; }
.status-box.success .status-label { color: #14532d; }
.status-box.failed  .status-label { color: #7f1d1d; }

.progress-track {
    height: 4px;
    background: rgba(0,0,0,.08);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--warning);
    animation: indeterminate 1.6s ease infinite;
}

.status-box.success .progress-fill {
    width: 100% !important;
    background: var(--success);
    animation: none;
}

@keyframes indeterminate {
    0%   { width: 0%;  margin-left: 0%; }
    50%  { width: 55%; margin-left: 22%; }
    100% { width: 0%;  margin-left: 100%; }
}

.run-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.run-stat-value { font-size: 1.1rem; font-weight: 800; color: var(--primary); line-height: 1; }
.run-stat-label { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    background: var(--success);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s;
}

.btn-download:hover { background: #15803d; }

/* ── Table ────────────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.data-table thead th {
    padding: 0 1rem 0.6rem;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table thead th:last-child { text-align: right; }

.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #fafafa; }

.data-table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.data-table td:last-child { text-align: right; }

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.78rem;
}

.dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-success { background: var(--success); }
.dot-running { background: var(--warning); box-shadow: 0 0 0 2px rgba(217,119,6,.2); animation: pulse .9s ease infinite; }
.dot-failed  { background: var(--danger); }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217,119,6,.4); }
    50%       { box-shadow: 0 0 0 4px rgba(217,119,6,.15); }
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}

.tag-primary { background: var(--primary-light); color: var(--primary); }

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.file-ext {
    width: 28px; height: 28px;
    background: var(--success-light);
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--success);
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: .02em;
}

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

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-sm-dl {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    text-decoration: none;
    transition: all .15s;
}

.btn-sm-dl:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem 0;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

.pagination-info { font-size: 0.75rem; color: var(--text-muted); }

.pagination-btns { display: flex; align-items: center; gap: 0.2rem; }

.page-btn {
    min-width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── Empty / Skeleton ─────────────────────────────────────────────────── */
.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.skeleton {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite;
    display: inline-block;
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    background: #111827;
    color: #fff;
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    z-index: 9999;
    font-size: 0.82rem;
    font-weight: 500;
    max-width: 320px;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    animation: slideUp .25s ease;
}

@keyframes slideUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

.toast button { background:none; border:none; color:rgba(255,255,255,.5); font-size:1rem; cursor:pointer; margin-left:auto; line-height:1; }
.toast button:hover { color:#fff; }
.toast.toast-success { background: #14532d; }
.toast.toast-error   { background: #7f1d1d; }

/* ── Spinner ──────────────────────────────────────────────────────────── */
.spinner {
    width: 13px; height: 13px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ───────────────────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
