/* app.css - theme tokens, app shell and shared components for the whole
   device inventory app. Page-specific styling (device table, ping modal,
   SSH log terminal) lives in inventory.css.

   Layout pattern shared with the team's other internal tools (isp-report,
   isam-monitor): dark sidebar, light content area, one accent used
   sparingly. Colours are the One brand's (1network.io): charcoal #2b2b2a
   and yellow #f8e042. Light is the default; dark is a per-browser choice
   stored in localStorage (see includes/layout.php). */

:root {
    --bg: #f6f6f4;
    --panel: #ffffff;
    --panel-alt: #fafaf8;
    --border: #e3e2de;
    --text: #2b2b2a;
    --text-dim: #6e6b6b;
    --brand: #2b2b2a;
    --brand-text: #ffffff;
    /* Brand yellow is too pale to read as text on white, so the light theme
       uses a dark gold of the same hue for links and highlights. */
    --accent: #7d6d00;
    --accent-contrast: #ffffff;
    --accent-soft: rgba(248, 224, 66, 0.28);
    --ok: #15803d;
    --error: #dc2626;
    --warn: #b45309;
    --hover: rgba(0, 0, 0, 0.035);
    --input-bg: #ffffff;
    --input-border: #d5d5d7;
    --shadow: rgba(0, 0, 0, 0.05);
    --terminal-bg: #0b1119;
    --terminal-text: #d7e2ee;

    --brand-yellow: #f8e042;
    --sidebar-bg: #2b2b2a;
    --sidebar-border: #3d3d3b;
    --sidebar-text: #b4b3b0;
    --sidebar-text-dim: #84837f;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: rgba(248, 224, 66, 0.13);
}
html[data-theme="dark"] {
    --sidebar-bg: #161615;
    --sidebar-border: #2e2e2d;
    --bg: #1c1c1b;
    --panel: #2b2b2a;
    --panel-alt: #323231;
    --border: #40403e;
    --text: #eaeaeb;
    --text-dim: #a9a8a4;
    --brand: #f8e042;
    --brand-text: #2b2b2a;
    --accent: #f8e042;
    --accent-contrast: #2b2b2a;
    --accent-soft: rgba(248, 224, 66, 0.14);
    --ok: #4fd48b;
    --error: #ff6b6b;
    --warn: #e8b339;
    --hover: rgba(255, 255, 255, 0.04);
    --input-bg: #353534;
    --input-border: #4a4a48;
    --shadow: rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
}
a { color: var(--accent); }
code, .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.muted { color: var(--text-dim); }

/* ---- App shell: collapsible sidebar + content ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar-backdrop { display: none; }
.sidebar {
    width: 220px;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    color: var(--sidebar-text);
}
.sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 16px 14px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--sidebar-border);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar .brand > div { min-width: 0; overflow: hidden; flex: 1; }
.sidebar .brand h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar .brand .sub {
    font-size: 10.5px;
    color: var(--sidebar-text-dim);
    margin: 2px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-toggle {
    background: transparent;
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    border-radius: 6px;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.sidebar-toggle:hover { color: #fff; border-color: var(--sidebar-text-dim); }
.sidebar-toggle svg { width: 15px; height: 15px; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: var(--sidebar-text);
    border-left: 3px solid transparent;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.sidebar nav a:hover { color: #fff; background: var(--sidebar-hover); }
.sidebar nav a.active {
    color: var(--brand-yellow);
    border-left-color: var(--brand-yellow);
    background: var(--sidebar-active-bg);
}
.nav-icon { flex-shrink: 0; width: 18px; display: inline-flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 16px; height: 16px; }
.nav-section-label {
    padding: 14px 16px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-text-dim);
    white-space: nowrap;
    overflow: hidden;
}
.nav-section-label:first-child { padding-top: 2px; }

.sidebar .user-box {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid var(--sidebar-border);
    font-size: 12px;
    color: var(--sidebar-text);
    line-height: 1.6;
}
.user-box-role {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    background: var(--sidebar-active-bg);
    color: var(--brand-yellow);
    text-transform: capitalize;
}
.user-box a.logout-link { color: #f87171; text-decoration: none; }
.user-box a.logout-link:hover { text-decoration: underline; }
.user-box-name-btn { color: #fff; text-decoration: none; border-bottom: 1px dashed var(--sidebar-text-dim); }
.user-box-name-btn:hover { color: var(--brand-yellow); border-bottom-color: var(--brand-yellow); }
.user-box-icon { display: none; align-items: center; justify-content: center; color: var(--sidebar-text); text-decoration: none; }
.user-box-icon:hover { color: #fff; }
.user-box-icon svg { width: 17px; height: 17px; }

html.sidebar-collapsed .sidebar { width: 56px; }
html.sidebar-collapsed .sidebar .brand > div,
html.sidebar-collapsed .nav-section-label,
html.sidebar-collapsed .nav-label,
html.sidebar-collapsed .user-box-full { display: none; }
html.sidebar-collapsed .sidebar .brand { justify-content: center; padding: 0 0 14px; }
html.sidebar-collapsed .sidebar nav a { justify-content: center; padding: 10px 0; }
html.sidebar-collapsed .user-box-icon { display: flex; }
html.sidebar-collapsed .sidebar .user-box { display: flex; justify-content: center; }

.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Top bar: quick search, alert bell, theme switch */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 15;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    padding: 0;
}
.topbar-btn:hover { border-color: var(--border); color: var(--text); }
.topbar-btn.active { color: var(--accent); }
.topbar-btn[hidden] { display: none; }
.topbar-btn svg { width: 17px; height: 17px; }
.topbar-menu { display: none; }
html[data-theme="dark"] .theme-icon-dark, html:not([data-theme="dark"]) .theme-icon-light { display: none; }
.theme-icon-dark, .theme-icon-light { display: inline-flex; }

/* Quick search (includes/layout.php's #quickSearchInput -- per-page behavior
   defined by each page's own window.quickSearchHandler) */
.topbar-search { position: relative; display: flex; align-items: center; flex: 0 1 320px; min-width: 0; }
.topbar-search-icon { position: absolute; left: 10px; color: var(--text-dim); display: inline-flex; pointer-events: none; }
.topbar-search-icon svg { width: 15px; height: 15px; }
.topbar-search input[type="text"] {
    width: 100%;
    padding: 8px 28px 8px 32px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}
.topbar-search input[type="text"]:focus { outline: none; border-color: var(--brand); background: var(--input-bg); }
.topbar-search-clear {
    position: absolute;
    right: 4px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
}
.topbar-search-clear:hover { color: var(--text); }
.topbar-search-clear[hidden] { display: none; }

@media (max-width: 900px) {
    .sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 2001; width: 230px; box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5); }
    html:not(.sidebar-collapsed) .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 2000; }
    /* On a phone the collapsed sidebar is hidden entirely; the top bar's menu button brings it back. */
    html.sidebar-collapsed .sidebar { display: none; }
    .topbar-menu { display: inline-flex; }
    .topbar { padding: 10px 16px; }
}

/* Page container */
.page {
    /* Full width of the content area: these are data pages, and the tables use the room. */
    width: 100%;
    padding: 24px 24px 60px;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}
@media (max-width: 900px) { .page { padding: 16px 16px 48px; } }

/* Cards */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px var(--shadow);
    /* Wide tables scroll inside their card instead of stretching the page. */
    overflow-x: auto;
}
.card + .card { margin-top: 20px; }
.card h2 {
    margin: 0 0 14px;
    font-size: 15px;
}

/* Forms */
label {
    display: block;
    margin: 14px 0 6px;
    color: var(--text-dim);
    font-size: 12px;
}
input[type="text"], input[type="password"], input[type="number"], input[type="file"], select, textarea {
    width: 100%;
    padding: 9px 10px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent);
}
/* Browser autofill ignores our background/colour; the inset shadow puts the theme back. */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
}
input[type="checkbox"], input[type="radio"] { margin-right: 6px; accent-color: var(--brand-yellow); }
.checkbox-row { display: flex; align-items: center; margin: 14px 0 6px; font-size: 13px; color: var(--text-dim); }
.field-hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    text-decoration: none;
    text-align: center;
}
.btn:hover { border-color: var(--text-dim); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.btn-primary:hover { opacity: 0.9; border-color: var(--brand); }
/* Outlined, filling only on hover: still reads as destructive without a
   solid red block clashing with the palette. */
.btn-danger { border-color: var(--error); color: var(--error); background: transparent; }
.btn-danger:hover { background: var(--error); color: #fff; border-color: var(--error); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; }

/* Alerts */
.alert {
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
}
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-ok { background: #dcfce7; color: #166534; }
html[data-theme="dark"] .alert-error { background: #7f1d1d; color: #fecaca; }
html[data-theme="dark"] .alert-ok { background: #14532d; color: #bbf7d0; }

/* Data tables (admin lists) */
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data-table thead th {
    text-align: left;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--hover); }
.actions-cell { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }

/* Role badge */
.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.role-badge.admin { background: var(--accent-soft); color: var(--accent); }
.role-badge.operator { background: var(--panel-alt); color: var(--text-dim); border: 1px solid var(--border); }

/* Status badges (upgrade history) */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.status-badge.status-running,
.status-badge.status-awaiting_verification { background: var(--accent-soft); color: var(--accent); }
.status-badge.status-verified { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.status-badge.status-unverified { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.status-badge.status-verify_failed,
.status-badge.status-failed { background: color-mix(in srgb, var(--error) 13%, transparent); color: var(--error); }

/* Upgrade history log viewer (reuses the terminal look from inventory.css's #sshLog) */
details.upgrade-log-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 12px;
    user-select: none;
}
pre.upgrade-log {
    margin: 8px 0 0;
    padding: 12px;
    background: var(--terminal-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--terminal-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre;
    overflow-x: auto;
    max-height: 360px;
    overflow-y: auto;
}

/* Coverage bar (scan coverage page) */
.coverage-bar {
    width: 120px;
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
    margin-bottom: 4px;
}
.coverage-fill {
    height: 100%;
    border-radius: 999px;
}
.coverage-fill.ok { background: var(--ok); }
.coverage-fill.warn { background: var(--warn); }
.coverage-fill.error { background: var(--error); }

/* Signed-out pages (login, first-run setup): centred box on black */
body.auth-body { background: #2b2b2a; min-height: 100vh; }
.auth-wrap {
    max-width: 360px;
    margin: 0 auto;
    padding: 12vh 20px 40px;
}
.auth-wrap h1 {
    text-align: center;
    font-size: 18px;
    margin: 0 0 20px;
}
body.auth-body .auth-wrap > h1 { color: #fff; }
body.auth-body .card { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
/* The same wrapper is reused inside the shell (change password, setup as admin). */
.main-content .auth-wrap { margin: 0; padding: 0; }

footer.app-footer {
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    padding: 20px;
}

/* Wordmark: the brand's yellow "1" ahead of white lettering */
.brand-one { color: var(--brand-yellow); }
body.auth-body .auth-wrap > h1 { font-size: 22px; letter-spacing: -0.01em; }

/* Settings page: keep form fields to a readable width inside a wide card */
.settings-card form { max-width: 560px; }

/* Jobs page */
table.jobs-table td { vertical-align: top; }
table.jobs-table .job-message {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    color: var(--text-dim);
    max-width: 380px;
    overflow-wrap: anywhere;
}
table.jobs-table tr.job-detail-row td { padding-top: 0; }
table.jobs-table tr.job-detail-row:hover { background: transparent; }
table.jobs-table details { margin-bottom: 6px; }
table.jobs-table details summary { cursor: pointer; color: var(--accent); font-size: 12px; user-select: none; }
.job-schedule-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }
.job-schedule-form input[type="text"] { width: 180px; padding: 6px 8px; font-size: 13px; }
table.job-history { margin-top: 6px; }
table.job-history td { padding: 4px 10px; font-size: 12px; }

/* Network page: By site / By firmware switch */
.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.view-switch a { padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--text-dim); text-decoration: none; }
.view-switch a + a { border-left: 1px solid var(--border); }
.view-switch a:hover { color: var(--text); }
.view-switch a.active { background: var(--brand); color: var(--brand-text); }
.site-figures { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge.badge-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge.badge-alert { background: color-mix(in srgb, var(--error) 13%, transparent); color: var(--error); }
table.device-table tr.ap-row { background: var(--panel-alt); font-weight: 600; }
table.device-table tr.no-panel { cursor: default; }
table.device-table tr.no-panel:hover { background: transparent; }

/* Sites page */
.site-ap-form, .site-inline-form { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.site-ap-form > span { flex: 1; min-width: 140px; }
.site-ap-form select, .site-inline-form select { width: auto; max-width: 170px; padding: 5px 8px; font-size: 12px; }
.site-inline-form input[type="text"] { width: 160px; padding: 5px 8px; font-size: 13px; }
table.device-table tr.ap-row + tr:not(.ap-row) td:first-child,
table.device-table tr.link-far-end td { border-top: none; }

/* Shared towers page */
.signal-good { color: var(--ok); font-weight: 600; }
.signal-fair { color: var(--warn); font-weight: 600; }
.signal-poor { color: var(--error); font-weight: 600; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.dot-ok { background: var(--ok); }
.status-dot.dot-down { background: var(--error); }

/* Network page: attention tiles and actions */
.net-toolbar { margin-bottom: 18px; }
.net-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); grid-auto-rows: min-content; align-items: stretch; gap: 10px; }
.net-tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--panel); color: var(--text); cursor: pointer; text-align: left;
    box-shadow: 0 1px 3px var(--shadow); font-family: inherit;
    height: auto; min-height: 60px; justify-content: center;
}
.net-tile:hover { border-color: var(--text-dim); }
.net-tile.active { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 35%, transparent); }
.net-tile-count { font-size: 22px; font-weight: 700; line-height: 1.1; }
.net-tile-label { font-size: 12px; color: var(--text-dim); }
.net-tile.tile-alert .net-tile-count { color: var(--error); }
.net-tile.tile-warn .net-tile-count { color: var(--warn); }
.net-tile.is-zero { opacity: 0.55; }
.net-tile.is-zero .net-tile-count { color: var(--text-dim); }
.net-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.net-actions #netShowing { margin-right: auto; font-size: 13px; }

/* Scanner notes on the Network page: one closed line instead of two banners */
details.net-notes { margin-bottom: 14px; font-size: 13px; }
details.net-notes > summary { cursor: pointer; color: var(--text-dim); user-select: none; }
details.net-notes .alert { margin: 8px 0 0; }

/* Customers page: fixed columns, text wraps inside its cell */
/* min-width keeps the two flexible columns readable; on a narrow screen the card scrolls instead. */
table.cust-table { table-layout: fixed; min-width: 1110px; }
table.cust-table td.mono { font-size: 12.5px; }
table.cust-table td.mono .field-hint { white-space: nowrap; }
table.cust-table td, table.cust-table th { overflow-wrap: break-word; padding-left: 8px; padding-right: 8px; }
table.cust-table td:last-child, table.cust-table th:last-child { text-align: right; }

/* "Viewing as" banner, shown on every page during a view-as session */
.view-as-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 8px 24px; background: var(--brand-yellow); color: #2b2b2a; font-size: 13px;
}
.view-as-banner form { margin: 0; }
.view-as-banner .btn { background: #2b2b2a; color: #fff; border-color: #2b2b2a; }

/* Tabs for pages that share one menu item */
.page-tabs { display: flex; gap: 2px; padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--border); overflow-x: auto; }
.page-tabs a { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--text-dim); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.page-tabs a:hover { color: var(--text); }
.page-tabs a.active { color: var(--text); border-bottom-color: var(--brand-yellow); }
.sidebar .brand h1 a.brand-link { color: inherit; text-decoration: none; }

/* Dashboard */
.dash-heading { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 18px 0 8px; }
.dash-heading:first-of-type { margin-top: 0; }
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 6px; }
.dash-kpi {
    display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--panel); color: var(--text); text-decoration: none;
    box-shadow: 0 1px 3px var(--shadow);
}
.dash-kpi:hover { border-color: var(--text-dim); color: var(--text); }
.dash-kpi-value { font-size: 24px; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.dash-kpi-label { font-size: 12px; color: var(--text-dim); }
.dash-kpi.kpi-alert .dash-kpi-value { color: var(--error); }
.dash-kpi.kpi-warn .dash-kpi-value { color: var(--warn); }
.dash-columns { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.dash-columns .card + .card { margin-top: 20px; }
.dash-columns svg { max-width: 100%; height: auto; }
@media (max-width: 1100px) { .dash-columns { grid-template-columns: minmax(0, 1fr); } }

/* Network view tables: fixed column widths so every access point's table lines
   up with the next, and long names wrap instead of widening the page. */
table.net-table { table-layout: fixed; width: 100%; }
details.firmware-group > table.net-table { width: calc(100% - 8px); }
table.net-table { min-width: 1040px; }
table.net-table td, table.net-table th { overflow-wrap: break-word; padding-left: 10px; padding-right: 10px; }
table.net-table td:nth-last-child(1), table.net-table th:nth-last-child(1) { text-align: right; }

/* Latency history (SmokePing) button on access point and link rows, and its popup */
.sp-btn {
    display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
    width: 22px; height: 22px; margin-left: 6px; padding: 0; border-radius: 5px; cursor: pointer;
    border: 1px solid var(--border); background: var(--input-bg); color: var(--accent);
}
.sp-btn:hover { border-color: var(--accent); }
.sp-btn svg { width: 13px; height: 13px; }
.sp-overlay { position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto; }
.sp-overlay[hidden] { display: none; }
.sp-modal { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; width: 100%; max-width: 780px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4); }
.sp-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sp-head h3 { margin: 0 auto 0 0; font-size: 15px; }
.sp-body { padding: 14px 16px 18px; color: var(--text-dim); font-size: 13px; }
/* SmokePing draws on white; keep that so the charts read the same in the dark theme. */
.sp-body img { display: block; max-width: 100%; height: auto; margin: 0 auto 12px; background: #fff; border-radius: 6px; }

/* --- Network: site list and site page (includes/network_site_list.php, network_site_page*.php) --- */
.site-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 1px 3px var(--shadow); }
.site-back { color: var(--text-dim); text-decoration: none; }
.site-back:hover { color: var(--text); text-decoration: underline; }
.site-list-bar { margin: 0 0 10px; }
.site-kind-chips, .ap-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ap-chips { margin: 0 0 10px; }
.ap-chip {
    background: var(--panel); border: 1px solid var(--border); border-radius: 999px; color: var(--text);
    padding: 4px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.ap-chip:hover { border-color: var(--text-dim); }
.ap-chip.active { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); font-weight: 600; }
table.site-list, table.site-table { width: 100%; }
table.site-list td, table.site-list th, table.site-table td, table.site-table th { padding-left: 12px; padding-right: 12px; vertical-align: middle; }
table.site-list th.num, table.site-list td.num, table.site-table th.num, table.site-table td.num { text-align: right; }
table.site-list tr.site-row { cursor: pointer; }
table.site-list tr.site-row:hover td { background: var(--panel-alt); }
table.site-list tr[hidden] { display: none; }
table.site-list .site-name { font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; }
table.site-list tr.site-row:hover .site-name { text-decoration: underline; }
.site-attention { line-height: 1.9; }
.site-attention a.badge { text-decoration: none; }
.site-attention a.badge.dim { opacity: 0.4; }
.site-attention .badge:not(.badge-warn):not(.badge-alert) { background: var(--panel-alt); color: var(--text-dim); border: 1px solid var(--border); }
.site-match { display: block; font-size: 12px; }
.site-meter { display: flex; align-items: center; gap: 8px; }
.site-meter-bar { flex: 1 1 auto; min-width: 50px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.site-meter-bar > span { display: block; height: 100%; background: var(--success, #2e9e62); }
.site-meter-bar > span.mid { background: var(--warn); }
.site-meter-bar > span.low { background: var(--error); }
.site-meter-text { white-space: nowrap; font-size: 13px; color: var(--text-dim); }
.site-meter-text strong { color: var(--text); }
.pick-btn { display: block; width: 100%; background: none; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; margin: -4px -6px; cursor: pointer; font: inherit; color: inherit; }
.pick-btn:hover { border-color: var(--border); background: var(--panel); }

.site-page { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; margin-bottom: 14px; }
.site-side { padding: 12px; }
.site-map { height: 250px; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; z-index: 0; }
.site-map-none { display: flex; align-items: center; justify-content: center; text-align: center; padding: 18px; color: var(--text-dim); font-size: 13px; background: var(--panel-alt); height: 120px; }
.site-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0 0; font-size: 13px; }
.site-facts dt { color: var(--text-dim); }
.site-facts dd { margin: 0; text-align: right; }
.site-main { display: grid; gap: 14px; min-width: 0; }
.site-section { padding: 14px 16px 12px; margin-bottom: 14px; min-width: 0; }
.site-main .site-section { margin-bottom: 0; }
.site-section > h2 { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 10px; color: var(--text); }
.site-section > h2 .muted { font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 12.5px; }
.site-section .table-wrap { overflow-x: auto; }
.site-section table.site-table { min-width: 760px; }
.site-section table.device-table tr.device-row { cursor: pointer; }
@media (max-width: 1100px) { .site-page { grid-template-columns: 1fr; } }

a.sp-btn { text-decoration: none; }

/* --- Header filters, sorting and paging (assets/table-tools.js) --- */
th.tt-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.tt-sortable::after { content: " ↕"; opacity: 0.35; font-size: 11px; }
th.tt-sortable.tt-asc::after { content: " ▲"; opacity: 1; color: var(--accent); }
th.tt-sortable.tt-desc::after { content: " ▼"; opacity: 1; color: var(--accent); }
th.tt-sortable:hover { color: var(--text); }
tr.tt-filters th { padding-top: 0; padding-bottom: 8px; font-weight: 400; text-transform: none; letter-spacing: 0; }
tr.tt-filters input, tr.tt-filters select {
    width: 100%; min-width: 0; box-sizing: border-box; height: 26px; padding: 2px 6px; font-size: 12px;
    border: 1px solid var(--border); border-radius: 5px; background: var(--input-bg); color: var(--text); font-family: inherit;
}
tr.tt-filters input:focus, tr.tt-filters select:focus { outline: none; border-color: var(--brand); }
.tt-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 12px 4px 2px; font-size: 13px; color: var(--text-dim); border-top: 1px solid var(--border); margin-top: 6px; }
.tt-pager .tt-nav { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 0 auto; }
.tt-pager .tt-size { display: inline-flex; gap: 14px; align-items: center; }
.tt-page {
    min-width: 30px; height: 28px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--panel); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer;
}
.tt-page:hover:not(:disabled) { border-color: var(--text-dim); }
.tt-page:disabled { opacity: 0.4; cursor: default; }
.tt-page.active { background: var(--brand); border-color: var(--brand); color: var(--brand-text); font-weight: 600; }
.tt-gap { padding: 0 2px; }
.tt-pager select, .tt-pager input[type="number"] {
    height: 28px; padding: 2px 6px; margin-left: 4px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--input-bg); color: var(--text); font: inherit; font-size: 12.5px;
}
.tt-pager input[type="number"] { width: 64px; }

.btn[hidden] { display: none; }
