:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #111827;
    --danger: #b91c1c;
    --success: #047857;
    --warning: #b45309;
    --blue: #1d4ed8;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar strong { display: block; font-size: 18px; }
.muted { color: var(--muted); font-size: 14px; }
.logout { color: var(--danger); font-weight: 600; }

.layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}
.card.wide { grid-column: span 1; }
h1, h2 { margin: 0 0 16px; }
h2 { font-size: 18px; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 6px; }
input, select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
}
button {
    border: 0;
    border-radius: 12px;
    padding: 11px 14px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
}
button.secondary { background: #f3f4f6; color: var(--text); margin-top: 0; }
button.danger { background: var(--danger); }
button.small { padding: 7px 10px; font-size: 12px; margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.actions-cell form { display: inline-block; }

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    background: #eef2ff;
    color: #3730a3;
}
.badge.queued { background: #f3f4f6; color: #374151; }
.badge.running { background: #dbeafe; color: #1d4ed8; }
.badge.completed { background: #d1fae5; color: #047857; }
.badge.failed, .badge.cancelled { background: #fee2e2; color: #b91c1c; }

.progress {
    height: 8px;
    width: 100%;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 4px;
}
.progress span {
    display: block;
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
    display: inline-flex;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f9fafb;
    font-weight: 700;
}
.logs { padding-left: 0; list-style: none; margin: 0; }
.logs li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.logs span { color: var(--muted); margin-right: 8px; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: radial-gradient(circle at top, #ffffff, #eef2ff 45%, #f8fafc);
}
.login-card {
    width: min(420px, 100%);
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.13);
}
.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    margin-bottom: 18px;
}
.alert {
    padding: 12px;
    border-radius: 12px;
    margin: 15px 0;
    font-size: 14px;
    font-weight: 700;
}
.alert.error { background: #fee2e2; color: #991b1b; }

@media (max-width: 980px) {
    .layout { grid-template-columns: 1fr; padding: 14px; }
    .card.wide { grid-column: span 1; }
}

.section-header.stacked {
    gap: 14px;
    align-items: flex-start;
}
.mini {
    margin-top: 6px;
    font-size: 13px;
}
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.filter {
    display: inline-flex;
    align-items: center;
    padding: 8px 11px;
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
}
.filter.active {
    background: var(--primary);
    color: #fff;
}
.results-table td {
    font-size: 14px;
}
.result-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}
.result-pill.available {
    background: #d1fae5;
    color: #047857;
}
.result-pill.taken {
    background: #f3f4f6;
    color: #374151;
}
.result-pill.error {
    background: #fee2e2;
    color: #b91c1c;
}
