:root {
    --bg: #101218;
    --bg-2: #171b24;
    --card: #1d2330;
    --line: #2c3446;
    --text: #eef2f8;
    --muted: #93a0b8;
    --accent: #f5a623;
    --accent-2: #ffce70;
    --danger: #ff5a4e;
    --ok: #3ddc97;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(245, 166, 35, 0.12), transparent 28%),
        var(--bg);
    color: var(--text);
}

a { color: var(--accent-2); text-decoration: none; }
code { font-family: Consolas, monospace; }

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 28px;
    background: rgba(16, 18, 24, 0.92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}
.topbar nav { display: flex; flex-wrap: wrap; gap: 8px 16px; flex: 1; }
.topbar nav a { color: var(--muted); font-weight: 600; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); }
.brand { font-size: 22px; font-weight: 800; letter-spacing: 0.08em; }
.brand span, .brand.large span { color: var(--accent); }
.brand.large { font-size: 36px; }
.user { color: var(--muted); display: flex; gap: 12px; align-items: center; }
.location-switch { margin: 0; }
.location-switch select { width: auto; min-width: 140px; padding: 6px 10px; }

.wrap { width: min(1180px, calc(100% - 40px)); margin: 28px auto 64px; }
.hero { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 20px; }
.hero > div:first-child { flex: 1; min-width: 0; }
.hero-actions { flex-shrink: 0; }
h1 { margin: 0 0 8px; font-size: 34px; }
h2 { margin: 0 0 16px; font-size: 20px; }
p { color: var(--muted); line-height: 1.5; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.grid.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.stack { display: grid; gap: 12px; }
.label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; }
.session-state { font-size: 32px; font-weight: 800; margin: 6px 0; }
.session-card { display: flex; justify-content: space-between; gap: 16px; align-items: center; }

.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: #242b3a;
    color: var(--text);
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.btn.primary { background: var(--accent); color: #1a1204; border-color: var(--accent); }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(255, 90, 78, 0.45); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.button-row.wrap { margin-top: 10px; }

label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
label small { font-weight: 500; }
input, select {
    width: 100%;
    border: 1px solid var(--line);
    background: #121620;
    color: var(--text);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
}
.muted { color: var(--muted); }
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
.flash.ok { background: rgba(61, 220, 151, 0.12); color: var(--ok); }
.flash.error { background: rgba(255, 90, 78, 0.12); color: var(--danger); }

.score-row, .mock-bin-head {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}
.swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.weight { font-variant-numeric: tabular-nums; font-weight: 800; }
.mock-bin { padding: 14px 0; border-top: 1px solid var(--line); }
.mock-bin:first-child { border-top: 0; padding-top: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.row-actions select { width: auto; min-width: 140px; padding: 6px 10px; }
.pill { font-size: 11px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; margin-left: 6px; color: var(--muted); }
.pill.ok { color: var(--ok); border-color: rgba(61, 220, 151, 0.45); }
.device-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.device-card h3 { margin: 8px 0 4px; font-size: 15px; }
.token { display: block; margin-top: 8px; color: var(--text); word-break: break-all; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.settings-grid small { font-weight: 500; }
.pit-slot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.pit-slot:last-of-type { border-bottom: 0; }
.pit-slot .btn { margin-left: 8px; }
.inline-form { margin-top: 16px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

.login-body { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(420px, calc(100% - 32px)); }
.login-card .btn { width: 100%; margin-top: 8px; }

@media (max-width: 800px) {
    .topbar { flex-wrap: wrap; }
    .session-card, .hero { flex-direction: column; align-items: stretch; }
}
