* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg:           #0e0e10;
    --surface:      #1a1a1f;
    --surface2:     #24242b;
    --border:       #2e2e38;
    --accent:       #7c6af7;
    --accent-dim:   #5b50c4;
    --text:         #e8e8f0;
    --text-muted:   #7a7a90;
    --green:        #4ade80;
    --yellow:       #facc15;
    --red:          #f87171;
    --sidebar-w:    220px;
    --header-h:     52px;
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
}

/* ── App layout ── */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: #141418;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
}

.sidebar-brand {
    height: var(--header-h);
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sidebar-title {
    display: block;
    font-weight: 700;
    font-size: 15px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.sidebar-sub {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 2px;
}

.nav-list {
    list-style: none;
    padding: 8px 6px;
    flex: 1;
    overflow-y: auto;
}

.nav-list::-webkit-scrollbar { width: 3px; }
.nav-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
}

.nav-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }

.nav-item:hover {
    background: var(--surface2);
    color: var(--text);
}

.nav-item.active {
    background: var(--surface2);
    border-color: var(--border);
    color: var(--text);
}

.sidebar-powered {
    padding: 12px 16px 10px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.sidebar-powered-label {
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: .6;
}
.sidebar-powered-logo {
    display: block;
    opacity: .75;
    transition: opacity .15s;
}
.sidebar-powered-logo:hover { opacity: 1; }
.sidebar-powered-logo img { display: block; }
.sidebar-version {
    font-size: 10px;
    color: var(--text-muted);
    opacity: .45;
    letter-spacing: .04em;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.sidebar-user {
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    flex-shrink: 0;
    transition: color 0.15s;
}

.logout-btn:hover { color: var(--red); }

/* ── Telemetry gap badge (in page header) ── */
.telemetry-gap-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 4px 10px;
    background: rgba(248,113,113,.12);
    border: 1px solid rgba(248,113,113,.3);
    border-radius: 6px;
    color: #f87171;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* ── Main content ── */

.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content--full {
    margin-left: 0;
    width: 100%;
}

.page-header {
    height: var(--header-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.page-body {
    flex: 1;
    padding: 24px;
}

.page-error {
    color: var(--red);
    padding: 20px;
}

/* ── Login ── */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-wrap {
    width: 100%;
    max-width: 380px;
    padding: 16px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px;
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand .sidebar-title {
    font-size: 22px;
    display: block;
    margin-bottom: 4px;
}

.login-error {
    background: #2a0a0a;
    border: 1px solid #4a1a1a;
    color: var(--red);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 18px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Forms ── */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    padding: 9px 12px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
    -webkit-appearance: none;
    appearance: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-danger {
    background: transparent;
    color: var(--red);
    border-color: #4a1a1a;
}

.btn-danger:hover { background: #2a0a0a; }

.btn-full { width: 100%; }

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
}

/* ── Cards ── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
}

.card-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ── Tables ── */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface2); }

/* ── Badges / severity ── */

.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 7px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-critical { background: #2a0a0a; color: var(--red);    border: 1px solid #4a1a1a; }
.badge-warning  { background: #2a2000; color: var(--yellow); border: 1px solid #4a3800; }
.badge-info     { background: #0a1a2a; color: #60a5fa;       border: 1px solid #1a3a5a; }
.badge-ok       { background: #0a1a0e; color: var(--green);  border: 1px solid #1a4025; }
.badge-admin    { background: #1a1530; color: #a78bfa;       border: 1px solid #2e2050; }
.badge-viewer   { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Utility ── */

.text-muted { color: var(--text-muted); font-size: 14px; }
.text-ok    { color: var(--green); }
.text-warn  { color: var(--yellow); }
.text-crit  { color: var(--red); }

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.gap-8 { gap: 8px; }

.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-8    { display: flex; gap: 8px; }
.flex-gap-12   { display: flex; gap: 12px; }

/* ── Status panel ── */

.status-panel {
    width: 260px;
    flex-shrink: 0;
    background: #13131a;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.status-panel-header {
    height: var(--header-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: #13131a;
    border-bottom: 1px solid var(--border);
}

.status-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.status-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-panel-body::-webkit-scrollbar { width: 3px; }
.status-panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.status-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
}

.status-block-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 4px;
}

.stat-name { color: var(--text-muted); }

.stat-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-val.ok   { color: var(--green); }
.stat-val.warn { color: var(--yellow); }
.stat-val.crit { color: var(--red); }

.bar-wrap {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
    transition: width 0.6s ease;
}

.bar-fill.ok   { background: var(--green); }
.bar-fill.warn { background: var(--yellow); }
.bar-fill.crit { background: var(--red); }

.status-placeholder {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.status-updated {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 4px 0 8px;
}

/* ── Icon button ── */

.icon-btn {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    font-size: 13px;
}

.icon-btn:hover { background: var(--surface2); color: var(--text); }

/* ── Status toggle/close (hidden on desktop, shown on mobile) ── */

.status-toggle-btn { margin-left: auto; display: none; }
.telemetry-gap-badge + .status-toggle-btn { margin-left: 8px; }
#status-close-btn  { display: none; }

/* ── Status overlay (mobile) ── */

.status-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.status-overlay.visible { display: block; }

/* ── Burger button (mobile only) ── */

.burger-btn {
    display: none;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.burger-btn:hover {
    background: var(--surface2);
    color: var(--text);
}

/* ── Overlay ── */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.visible { display: block; }

/* ── Mobile ── */

@media (max-width: 768px) {
    .burger-btn        { display: flex; }
    .status-toggle-btn { display: flex; }
    #status-close-btn  { display: flex; }

    .sidebar {
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: 260px;
    }

    .sidebar.open { transform: translateX(0); }

    .status-panel {
        position: fixed;
        right: 0; top: 0; bottom: 0;
        z-index: 100;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        width: 280px;
    }

    .status-panel.open { transform: translateX(0); }

    .main-content { margin-left: 0; }

    .page-body { padding: 16px; }
}

/* ── Connector page ── */

.connector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mapping-block {
    margin-bottom: 20px;
}

.mapping-block:last-child { margin-bottom: 0; }

.mapping-block-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--accent);
    margin-bottom: 8px;
}

.mapping-table {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.mapping-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 6px 12px;
    background: var(--surface2);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.mapping-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 4px 12px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.mapping-row:last-child { border-bottom: none; }
.mapping-row:hover { background: var(--surface2); }

.mapping-canonical {
    font-size: 13px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--text-muted);
}

.mapping-input {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 5px 0 !important;
    font-size: 13px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--text) !important;
    outline: none;
    width: 100%;
}

.mapping-input:focus {
    background: var(--surface2) !important;
    padding: 5px 8px !important;
    border-radius: 4px !important;
}

.mapping-input::placeholder { color: var(--border); }

@media (max-width: 900px) {
    .connector-grid  { grid-template-columns: 1fr; }
    .form-row-2      { grid-template-columns: 1fr; }
}

/* ── Modal ── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.modal-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-body {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── Group device cell ── */
.dev-group-cell { display: inline-flex; align-items: center; gap: 5px; flex-wrap: nowrap; }
.dev-tag {
    display: inline-block; font-size: 10px; font-weight: 700; line-height: 1.5;
    padding: 1px 5px; border-radius: 3px; white-space: nowrap; flex-shrink: 0;
}
.dev-tag-group { background: rgba(139,92,246,.15); border: 1px solid rgba(139,92,246,.3); color: var(--accent); }
.dev-tag-code  { background: var(--surface2); border: 1px solid var(--border); color: var(--text); font-family: var(--mono); }
.dev-group-name { font-size: inherit; color: inherit; white-space: nowrap; }

/* ════════════════════════════════════════════════════════════
   Shared utilities  (added during inline-style cleanup pass)
   ════════════════════════════════════════════════════════════ */

/* ---- Spacing helpers ---- */
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }

/* ---- Color/text utilities ---- */
.t-ok     { color: #4ade80; }
.t-warn   { color: #facc15; }
.t-crit   { color: #f87171; }
.t-info   { color: #60a5fa; }
.t-muted  { color: var(--text-muted); }
.t-small  { font-size: 11px; }
.t-mono   { font-family: var(--mono); }
.t-mono-sm{ font-family: var(--mono); font-size: 12px; }
.t-bold   { font-weight: 600; }

/* ---- Card flush (no padding) ---- */
.card-flush { padding: 0 !important; }

/* ---- Rule tooltip (shared: reports, alerts, alarm-log) ---- */
.rule-tip { position: relative; cursor: default; }
.rule-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: #e5e7eb;
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.4;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.08);
    width: max-content;
    max-width: 260px;
    white-space: normal;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .12s;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0,0,0,.5);
}
.rule-tip:hover::after { opacity: 1; }
@media print { .rule-tip::after { display: none !important; } }

/* ---- Animation ---- */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .3; }
}

/* ---- Severity badge driven by data-sev (alarm-log, alerts, …) ---- */
.sev-badge[data-sev=critical] { color: #f87171; background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.3); }
.sev-badge[data-sev=warning]  { color: #facc15; background: rgba(250,204,21,.12);  border-color: rgba(250,204,21,.3);  }
.sev-badge[data-sev=info]     { color: #60a5fa; background: rgba(96,165,250,.12);  border-color: rgba(96,165,250,.3);  }

/* ---- Severity filter buttons — tint inactive state ---- */
.filter-btn[data-sev=critical]:not(.active) { color: #f87171; }
.filter-btn[data-sev=warning]:not(.active)  { color: #facc15; }
.filter-btn[data-sev=info]:not(.active)     { color: #60a5fa; }

/* ---- Status badges (alerts / incidents) ---- */
.status-badge-open     { border: 1px solid rgba(248,113,113,.3); color: #f87171; background: rgba(248,113,113,.1); }
.status-badge-resolved { border: 1px solid rgba(74,222,128,.3);  color: #4ade80; background: rgba(74,222,128,.1);  }
.status-dot-open     { background: #f87171; animation: pulse 1.5s infinite; }
.status-dot-resolved { background: #4ade80; }

/* ---- Filter banner (incident / group active-filter notice) ---- */
.filter-banner {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(139,92,246,.08); border: 1px solid rgba(139,92,246,.25);
    border-radius: 8px; font-size: 12px;
}
.filter-banner-label { color: var(--text-muted); }
.filter-banner-value { font-weight: 600; color: var(--accent); }
.filter-banner-clear { margin-left: auto; color: var(--text-muted); text-decoration: none; font-size: 11px; }
.filter-banner-clear:hover { color: var(--text); }

/* ---- Type cell — alarm log event type column ---- */
.type-cell { display: flex; align-items: center; }
.type-cell[data-type=opened]       .type-dot { background: #f87171; }
.type-cell[data-type=escalated]    .type-dot { background: #fb923c; }
.type-cell[data-type=de-escalated] .type-dot { background: #a78bfa; }
.type-cell[data-type=resolved]     .type-dot { background: #4ade80; }
.type-cell[data-type=opened]       .type-text { color: #f87171; }
.type-cell[data-type=escalated]    .type-text { color: #fb923c; }
.type-cell[data-type=de-escalated] .type-text { color: #a78bfa; }
.type-cell[data-type=resolved]     .type-text { color: #4ade80; }
.type-text { font-size: 12px; }

/* ---- Incident ID link (alarm log) ---- */
.inc-id-link { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ---- Log arrow link (alerts) ---- */
.log-link { color: var(--text-muted); text-decoration: none; font-size: 11px; }
.log-link:hover { color: var(--text); }

/* ---- Dashboard ---- */
.dash-site-grid    { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chart-wrap-empty  { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; }
.dash-sev-grid     { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.dash-sev-header   { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.dash-sev-dot      { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dash-sev-label    { font-size: 12px; font-weight: 600; text-transform: capitalize; }
.dash-sev-count    { margin-left: auto; font-size: 20px; font-weight: 700; }
.dash-sev-bar-wrap { height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.dash-sev-bar      { height: 100%; border-radius: 3px; opacity: .6; }
.dash-sev-foot     { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.dash-empty        { text-align: center; padding: 32px 0; color: var(--text-muted); font-size: 13px; }
.dash-device-online{ color: #4ade80; }
.dash-device-late  { color: #facc15; }

/* ---- Config: flash banners ---- */
.flash-ok {
    display: flex; align-items: center; gap: 10px;
    background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.3);
    border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; font-size: 13px; color: #4ade80;
}
.flash-ok svg { flex-shrink: 0; }

/* ---- Config: section / subsection titles ---- */
.form-section-title    { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 16px; }
.form-subsection-title { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; }
.form-divider          { border-top: 1px solid var(--border); margin: 20px 0; }
.input-helper          { font-size: 12px; color: var(--text-muted); }
.input-row             { display: flex; align-items: center; gap: 10px; }
.input-row-sm          { display: flex; align-items: center; gap: 8px; }

/* ---- Config: engine state indicator ---- */
.engine-state-running  { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #4ade80; }
.engine-state-stopped  { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.engine-state-dot      { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.engine-state-dot-run  { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.engine-state-dot-stop { background: var(--text-muted); }

/* ---- Config: action buttons ---- */
.btn-muted       { background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); }
.btn-warn-lite   { background: rgba(251,146,60,.1);  border: 1px solid rgba(251,146,60,.3);  color: #fb923c; }
.btn-danger-lite { background: rgba(239,68,68,.1);   border: 1px solid rgba(239,68,68,.3);   color: #f87171; }

/* ---- Devices: type badge per device-type ---- */
.type-badge[data-type=runway_lamp]    { color: #7c6af7; border-color: rgba(124,106,247,.2); background: rgba(124,106,247,.09); }
.type-badge[data-type=taxi_lamp]      { color: #60a5fa; border-color: rgba(96,165,250,.2);  background: rgba(96,165,250,.09);  }
.type-badge[data-type=threshold_lamp] { color: #34d399; border-color: rgba(52,211,153,.2);  background: rgba(52,211,153,.09);  }
.type-badge[data-type=approach_lamp]  { color: #fb923c; border-color: rgba(251,146,60,.2);  background: rgba(251,146,60,.09);  }
.type-badge[data-type=solar_engine]   { color: #facc15; border-color: rgba(250,204,21,.2);  background: rgba(250,204,21,.09);  }
.type-badge[data-type=papi]           { color: #f87171; border-color: rgba(248,113,113,.2); background: rgba(248,113,113,.09); }

/* ---- Page header layout ---- */
.page-header       { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header-title { margin: 0; font-size: 18px; }
.page-header-sub   { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }

/* ---- Config: import progress ---- */
.cfg-forms-row      { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.import-ok          { margin-top: 12px; font-size: 12px; color: #4ade80; }
.import-err         { margin-top: 12px; font-size: 12px; color: #f87171; }
.import-prog-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.import-prog-pct    { font-size: 13px; color: var(--accent); }
.import-bar-wrap    { background: var(--surface2); border-radius: 4px; height: 6px; overflow: hidden; }
.import-bar         { background: var(--accent); height: 100%; transition: width .4s; }
.import-status-msg  { margin-top: 8px; font-size: 12px; min-height: 16px; }
.import-log-box {
    margin-top: 10px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
    padding: 8px 10px; font-family: var(--mono); font-size: 11px;
    color: var(--text-muted); max-height: 120px; overflow-y: auto;
}
.import-log-head  { margin-bottom: 4px; font-size: 10px; color: var(--text-muted); opacity: .6; }
.import-log-empty { opacity: .5; }

/* ---- Config: engine + form layout ---- */
.cfg-engine-wrap  { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.cfg-engine-state { flex: 1; min-width: 200px; }
.cfg-engine-btns  { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cfg-form-col     { flex: 1 1 calc(50% - 12px); min-width: 320px; }

/* ---- Config: threshold table ---- */
.thresh-table      { width: 100%; font-size: 13px; border-collapse: collapse; }
.thresh-col-label  { text-align: left; padding: 6px 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); width: 50%; }
.thresh-col-warn   { text-align: center; padding: 6px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.thresh-col-crit   { text-align: center; padding: 6px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.thresh-td-label   { padding: 8px 0; color: var(--text-muted); }
.thresh-td-val     { padding: 8px; text-align: center; }
.thresh-input {
    width: 70px; text-align: center;
    background: var(--surface2); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; padding: 6px;
}

/* ---- Config: import form label styles ---- */
.import-field-label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; }
.import-force-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
