:root {
    --bg: #0f1115;
    --card: #171a21;
    --border: #2a2f3a;
    --text: #e6e8ee;
    --muted: #8b93a5;
    --accent: #4f9cf9;
    --ok: #3dd68c;
    --warn: #f5a623;
    --danger: #f0616d;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar-right { display: flex; gap: 12px; align-items: center; }
main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
.card h2 { margin-top: 0; font-size: 17px; }
.count { color: var(--muted); font-size: 14px; font-weight: normal; }
.muted { color: var(--muted); }
.block { display: block; }

.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.full { grid-column: 1 / -1; }
.grid-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select {
    width: 100%;
    padding: 9px 11px;
    background: #0d1016;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }

.btn {
    display: inline-block;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #222736;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.warn { border-color: var(--warn); color: var(--warn); background: transparent; }
.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn.tiny { padding: 4px 9px; font-size: 12px; }

table.mirrors { width: 100%; border-collapse: collapse; }
table.mirrors th, table.mirrors td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}
table.mirrors th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.actions { white-space: nowrap; }
.actions form { display: inline; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-running, .status-queued { background: rgba(79,156,249,.15); color: var(--accent); }
.status-finished { background: rgba(61,214,140,.15); color: var(--ok); }
.status-failed { background: rgba(240,97,109,.15); color: var(--danger); }
.status-stopped, .status-unknown { background: rgba(139,147,165,.15); color: var(--muted); }

.progress { width: 130px; height: 6px; background: #0d1016; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #7cc0ff); border-radius: 4px; transition: width .5s; }
.progtext { font-size: 11px; }

.alert { padding: 10px 14px; border-radius: 7px; margin-bottom: 14px; font-size: 14px; }
.alert.error { background: rgba(240,97,109,.12); border: 1px solid var(--danger); color: var(--danger); }

.logview {
    background: #0a0c10;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 14px;
    overflow-x: auto;
    font-size: 12.5px;
    max-height: 70vh;
    overflow-y: auto;
    font-family: ui-monospace, "Cascadia Mono", Menlo, monospace;
    white-space: pre;
}

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.login-card h1 { font-size: 22px; margin: 0; text-align: center; }
.login-card p { text-align: center; margin: 0; }