:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #dcdfe4;
    --text: #1c1e21;
    --muted: #656d76;
    --primary: #c62828;
    --primary-dark: #9b1c1c;
    --ok: #2e7d32;
    --warn: #ef6c00;
    --info: #1565c0;
    --danger: #c62828;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

a { color: var(--info); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: #1f2430;
    color: #e8eaed;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar .brand {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar a {
    color: #c9ced6;
    text-decoration: none;
    padding: 9px 12px;
    border-radius: 8px;
    display: block;
}

.sidebar a:hover { background: #2b313f; color: #fff; }
.sidebar a.active { background: var(--primary); color: #fff; }

.sidebar .spacer { flex: 1; }
.sidebar .user { font-size: 13px; color: #98a0ab; padding: 0 12px 8px; }

.content { flex: 1; padding: 26px 30px; max-width: 1200px; }

h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 26px 0 10px; }
.subtitle { color: var(--muted); margin: 0 0 22px; }

/* ---------- Cards & tables ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
}

table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr:hover { background: #fafbfc; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

input[type=text], input[type=email], input[type=password], input[type=number], select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    color: var(--text);
}

input:focus, select:focus { outline: 2px solid #b9d4f5; border-color: #7fa9dd; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 150px; }
.field { margin-bottom: 14px; }

.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: #e8b4b4; }
.btn-danger:hover { background: #fdf0f0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.badge-ready { background: var(--ok); }
.badge-enroute { background: var(--warn); }
.badge-onsite { background: var(--info); }
.badge-unable { background: var(--muted); }
.badge-unavailable { background: #757575; }
.badge-outofzone { background: #90a4ae; }
.badge-atstation { background: var(--info); }
.badge-notconfigured { background: #8e6a00; }

/* A manual declaration left untouched for hours may simply have been forgotten. */
.stale-status { color: #b45309; font-weight: 600; }

.qual {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 4px;
    border-radius: 6px;
    background: #eef1f5;
    color: #40474f;
    font-size: 12px;
}

/* ---------- Map ---------- */
.map { height: 340px; border-radius: var(--radius); border: 1px solid var(--border); }

/* ---------- Misc ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.alert-error { background: #fdecea; color: #8c1d18; border: 1px solid #f5c6c2; }
.alert-info { background: #e8f1fb; color: #10457f; border: 1px solid #c2d9f2; }
.alert-ok { background: #e8f5e9; color: #1b5e20; border: 1px solid #c3e6c8; }
.muted { color: var(--muted); }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.stat { font-size: 30px; font-weight: 700; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stats .card { flex: 1; min-width: 170px; margin-bottom: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Public dashboard (wall display) ---------- */
.public {
    min-height: 100vh;
    background: #12151c;
    color: #f2f4f7;
    padding: 26px 30px;
}

.public-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #2a303c;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.public-title { font-size: 30px; font-weight: 800; }
.public-sub { color: #98a0ab; margin-top: 2px; }
.public-clock { font-size: 26px; font-weight: 700; color: #98a0ab; font-variant-numeric: tabular-nums; }

.public-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}

.public-card {
    background: #1b202b;
    border: 1px solid #2a303c;
    border-left: 8px solid #6b7280;
    border-radius: 12px;
    padding: 20px;
}

.public-card.ok { border-left-color: #2e7d32; }
.public-card.bad { border-left-color: #9e2b2b; }

.public-name { font-size: 21px; font-weight: 700; margin-bottom: 6px; }
.public-status { font-size: 14px; font-weight: 700; letter-spacing: .06em; color: #b9c0cb; margin-bottom: 16px; }
.public-card.ok .public-status { color: #66bb6a; }
.public-card.bad .public-status { color: #ef7c7c; }

.public-metrics { display: flex; gap: 26px; }
.public-metric { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.public-of { font-size: 19px; color: #7d8694; font-weight: 600; }
.public-label { font-size: 12px; color: #98a0ab; text-transform: uppercase; letter-spacing: .05em; }

.public-empty { padding: 60px; text-align: center; color: #98a0ab; font-size: 18px; }
.public-footer { margin-top: 28px; color: #6f7885; font-size: 12px; }

/* ---------- APK download page ---------- */
.dl-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.dl-box {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}
.dl-brand { font-size: 24px; font-weight: 800; text-align: center; }
.dl-sub { text-align: center; color: var(--muted); margin-bottom: 22px; }
.dl-button { display: block; text-align: center; font-size: 16px; padding: 15px; }
.dl-meta { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; }
.dl-qr { display: flex; flex-direction: column; align-items: center; margin: 22px 0 4px; }
/* The white border is part of the code: a QR needs a quiet zone around it to scan. */
.dl-qr img { border: 8px solid #fff; border-radius: 8px; }
.dl-h2 { font-size: 16px; margin: 24px 0 8px; }
.dl-steps { margin: 0; padding-left: 20px; color: var(--text); line-height: 1.6; font-size: 14px; }
.dl-steps li { margin-bottom: 8px; }
.dl-note {
    margin-top: 20px;
    padding: 12px 14px;
    background: #eef4ff;
    border: 1px solid #c2d9f2;
    border-radius: 8px;
    font-size: 13px;
    color: #10457f;
}

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 380px; }
.login-box .brand { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: var(--muted); margin-bottom: 20px; font-size: 14px; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after { content: "Wystąpił błąd." }
