body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #1a1a1a;
}

#map {
    position: absolute;
    top: 48px;
    bottom: 0;
    left: 0;
    right: 0;
}

.topbar {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: #0f2540;
    color: #fff;
    box-sizing: border-box;
}

.topbar .brand {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar .whoami {
    font-size: 13px;
    opacity: 0.85;
}

.topbar-link {
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.topbar-link:hover { background: rgba(255, 255, 255, 0.12); }

.popup-customer { color: #555; font-size: 12px; }

/* Friendly "wrong account" page (2026-09-14) instead of the Whitelabel 403. */
.denied-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f4f6f8; margin: 0; font-family: system-ui, sans-serif; }
.denied-card { background: #fff; border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); padding: 32px 36px; max-width: 480px; }
.denied-card h1 { margin: 0 0 8px; font-size: 22px; color: #0f2540; }
.denied-card p { color: #444; line-height: 1.5; }
.denied-card .actions { display: flex; gap: 12px; margin-top: 20px; align-items: center; }
.denied-card .btn { background: #0f2540; color: #fff; border: 0; border-radius: 6px; padding: 10px 16px; cursor: pointer; text-decoration: none; font-size: 14px; }
.denied-card .btn.secondary { background: #fff; color: #0f2540; border: 1px solid #0f2540; }

.logout-form button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: #f4f6f8;
}

.login-card {
    background: #fff;
    padding: 32px 40px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    width: 320px;
}

.login-card h1 {
    margin: 0 0 4px;
    font-size: 1.4rem;
}

.login-card .subtitle {
    margin: 0 0 24px;
    color: #666;
    font-size: 0.9rem;
}

.login-card label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #333;
}

.login-card input {
    width: 100%;
    padding: 8px;
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.login-card button {
    width: 100%;
    padding: 10px;
    background: #0f2540;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.login-card .hint {
    margin-top: 16px;
    font-size: 0.75rem;
    color: #888;
}

/* Map status markers */

.site-status-marker span {
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.popup-status {
    font-size: 0.8rem;
    color: #555;
}

/* Admin */

.admin-page {
    background: #f4f6f8;
    min-height: 100vh;
}

.admin-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 64px;
}

.admin-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.admin-card h2 {
    margin-top: 0;
}

.admin-card h3 {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #444;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
}

.account-list {
    margin: 0 0 16px;
    padding-left: 20px;
    font-size: 0.9rem;
}

.muted {
    color: #888;
    font-size: 0.9rem;
}

.inline-form,
.site-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-form input,
.site-form input[type="text"],
.site-form input[type="password"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    flex: 1 1 160px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #444;
    flex: 1 1 auto;
    white-space: nowrap;
}

.inline-form button,
.site-form button {
    padding: 8px 16px;
    background: #0f2540;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.flash {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.flash-ok {
    background: #e6f4ea;
    color: #1e4620;
    border: 1px solid #b7dfc0;
}

.flash-secret {
    background: #fff8e1;
    color: #6b5100;
    border: 1px solid #f0d878;
}

.flash-secret code {
    display: block;
    margin: 8px 0;
    padding: 8px;
    background: #fffdf5;
    border: 1px solid #f0d878;
    border-radius: 4px;
    word-break: break-all;
    font-size: 0.85rem;
}

.flash-secret p {
    margin: 8px 0 0;
    font-size: 0.8rem;
}

/* Admin: automatic registration UI (2026-09-14) */
.customer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.customer-head h2 { margin: 0; }
.portal-toggle { display: flex; align-items: center; gap: 10px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.pill-on { background: #e3f4e8; color: #1c7a45; }
.pill-off { background: #eceff3; color: #555; }
.btn-link { background: none; border: 0; color: #0f2540; text-decoration: underline; cursor: pointer; font-size: 14px; padding: 0; }
.btn-link.danger { color: #b3261e; }
.btn-small { padding: 4px 10px; font-size: 13px; }
.hint { color: #555; font-size: 13px; margin: 4px 0 12px; line-height: 1.45; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.inline { display: inline; margin: 0; }
.manual-add { margin: 10px 0 18px; }
.manual-add summary { cursor: pointer; color: #0f2540; font-size: 13px; }
.manual-add .site-form { margin-top: 10px; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: #9e9e9e; vertical-align: middle; }
.status-dot.status-ok, .status-dot.status-online { background: #2e7d32; }
.status-dot.status-offline { background: #c62828; }
.status-dot.status-unknown { background: #9e9e9e; }
.status-dot.status-degraded { background: #f9a825; }
.admin-table select, .inline-form select { padding: 6px 8px; border: 1px solid #ccd; border-radius: 4px; font-size: 14px; }

/* ---- Site cards page (2026-09-14) ---- */
.sites-page { background: #f4f6f8; margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: #1f2933; }
.sites-main { max-width: 1280px; margin: 0 auto; padding: 22px 20px 40px; }
.sites-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sites-head h1 { margin: 0; font-size: 22px; color: #0f2540; }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; }
.site-card { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(15,37,64,0.08), 0 8px 24px rgba(15,37,64,0.05); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; border-top: 4px solid #9e9e9e; }
.site-card.st-ok, .site-card.st-online { border-top-color: #2e7d32; }
.site-card.st-offline { border-top-color: #c62828; }
.site-card.st-degraded, .site-card.st-error { border-top-color: #f9a825; }
.site-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.site-card-head h2 { margin: 0; font-size: 18px; color: #0f2540; line-height: 1.25; }
.site-card-customer { color: #667; font-size: 12.5px; margin-top: 2px; }
.site-status { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; color: #334; }
.site-card-sub { color: #667; font-size: 12.5px; margin-top: -6px; }
.site-reason { color: #a15c00; }
.site-thumb { background: #0f2540; border-radius: 8px; overflow: hidden; position: relative; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; }
.site-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.site-thumb-empty { color: rgba(255,255,255,0.55); font-size: 13px; }
.site-thumb-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0)); color: #fff; font-size: 12px; }
.site-thumb-bar .muted { color: rgba(255,255,255,0.85); }
.site-thumb-bar .btn-small { background: rgba(255,255,255,0.92); color: #0f2540; border: 0; border-radius: 4px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.site-thumb-bar .btn-small:disabled { opacity: 0.5; cursor: default; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: #f4f6f8; border-radius: 8px; padding: 10px 10px 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile b { font-size: 20px; color: #0f2540; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile span { font-size: 11.5px; color: #667; text-transform: uppercase; letter-spacing: 0.03em; }
.tile.warn { background: #fff4e0; }
.tile.warn b { color: #a15c00; }
.site-classes { display: flex; flex-wrap: wrap; gap: 6px; }
.class-chip { background: #eef1f5; border-radius: 999px; padding: 3px 10px; font-size: 12px; color: #334; }
.class-chip b { color: #0f2540; }
.site-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13px; }
.site-facts div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed #e6e9ee; padding: 4px 0; }
.site-facts dt { color: #667; margin: 0; }
.site-facts dd { margin: 0; color: #1f2933; text-align: right; white-space: nowrap; }
.site-facts dd.bad { color: #b3261e; font-weight: 600; }
.update-pill { margin-left: 6px; background: #e3f4e8; color: #1c7a45; border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.site-card-actions { margin-top: auto; }
.btn-primary { display: inline-block; background: #0f2540; color: #fff; text-decoration: none; padding: 9px 14px; border-radius: 6px; font-size: 14px; }
.btn-primary:hover { background: #1b3a63; }
@media (max-width: 480px) { .tiles { grid-template-columns: repeat(2, 1fr); } .site-facts { grid-template-columns: 1fr; } }
