/* =========================================================
   NOC Center — dark operations theme
   ========================================================= */
:root {
    --bg: #070c16;
    --bg-soft: #0b1220;
    --panel: #0f1728;
    --panel-2: #131e33;
    --line: #1e2a44;
    --line-soft: #172238;
    --text: #e7eefb;
    --muted: #8b9bb8;
    --dim: #61718d;
    --cyan: #22d3ee;
    --cyan-soft: rgba(34, 211, 238, 0.12);
    --green: #22c55e;
    --green-soft: rgba(34, 197, 94, 0.14);
    --amber: #f59e0b;
    --amber-soft: rgba(245, 158, 11, 0.14);
    --red: #ef4444;
    --red-soft: rgba(239, 68, 68, 0.14);
    --violet: #a78bfa;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    background:
        radial-gradient(900px 500px at 12% -10%, rgba(34, 211, 238, 0.07), transparent 60%),
        radial-gradient(800px 460px at 100% 0%, rgba(139, 92, 246, 0.06), transparent 55%),
        var(--bg);
    min-height: 100vh;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #67e8f9; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ok { color: var(--green); }
.warn { color: var(--amber); }
.bad { color: var(--red); }
.link { color: var(--cyan); font-weight: 550; font-size: 12.5px; }
code {
    font-family: var(--mono);
    font-size: 12px;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid var(--line-soft);
    border-radius: 5px;
    padding: 1px 5px;
}

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

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: 22px 16px;
    border-right: 1px solid var(--line-soft);
    background: linear-gradient(180deg, #0a1220 0%, #080e1a 100%);
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: linear-gradient(140deg, var(--cyan), #0ea5e9 55%, var(--violet));
    color: #04101c;
    font-weight: 800;
    font-size: 19px;
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 8px 22px rgba(14, 165, 233, 0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: 0.02em; }
.brand-text small { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.09em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--dim);
    padding: 0 10px 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 550;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(148, 163, 184, 0.07); color: var(--text); }
.nav-item.active {
    background: var(--cyan-soft);
    border-color: rgba(34, 211, 238, 0.22);
    color: #a5f3fc;
}
.nav-item.active .icon { color: var(--cyan); }

.side-foot { margin-top: auto; padding: 12px 10px; border-top: 1px solid var(--line-soft); }
.side-foot p { color: var(--dim); font-size: 11.5px; margin-top: 8px; line-height: 1.45; }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 5px;
    padding: 2px 6px;
    border: 1px solid transparent;
}
.tag-live { color: #6ee7b7; background: var(--green-soft); border-color: rgba(34, 197, 94, 0.3); }
.tag-demo { color: #fcd34d; background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.3); }
.tag-muted { color: var(--muted); background: rgba(148, 163, 184, 0.1); border-color: var(--line); }
.tag-ok { color: #86efac; background: var(--green-soft); }
.tag-bad { color: #fca5a5; background: var(--red-soft); }
.tag-olt { color: #c4b5fd; background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.28); }
.tag-mikrotik { color: #7dd3fc; background: var(--cyan-soft); border-color: rgba(34, 211, 238, 0.24); }

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

/* ---------------- topbar ---------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 28px 14px;
}
.titles h1 { font-size: 21px; }
.titles p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.clock {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 5px 10px;
}
.user { display: flex; align-items: center; gap: 8px; }
.avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--cyan);
    font-weight: 700;
    font-size: 12px;
}
.user-name { font-size: 12.5px; color: var(--muted); }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--muted);
    cursor: pointer;
    padding: 0;
}
.icon-btn:hover { color: var(--text); border-color: #2a3a5a; background: var(--panel-2); }
.icon-btn.danger:hover { color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); background: var(--red-soft); }
.icon-btn .icon { width: 15px; height: 15px; }

.banner {
    margin: 0 28px 12px;
    padding: 10px 14px;
    border-radius: 9px;
    font-size: 12.5px;
    border: 1px solid var(--line);
    background: var(--panel);
}
.banner-info { background: rgba(34, 211, 238, 0.07); border-color: rgba(34, 211, 238, 0.25); color: #bae6fd; }
.banner-warn { background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.3); color: #fde68a; }
.banner-bad { background: var(--red-soft); border-color: rgba(239, 68, 68, 0.32); color: #fecaca; }
.banner-ok { background: var(--green-soft); border-color: rgba(34, 197, 94, 0.3); color: #bbf7d0; }

.main { padding: 4px 28px 28px; display: flex; flex-direction: column; gap: 14px; }
.foot {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 28px 20px;
    color: var(--dim);
    font-size: 11.5px;
    border-top: 1px solid var(--line-soft);
}

/* ---------------- toolbar ---------------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.toolbar-inline { padding: 2px 0 10px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.system-state {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12.5px; font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel);
}
.system-state i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.system-state.ok { color: #4ade80; border-color: rgba(34, 197, 94, 0.3); background: var(--green-soft); }
.system-state.warn { color: #fbbf24; border-color: rgba(245, 158, 11, 0.32); background: var(--amber-soft); }
.system-state.bad { color: #f87171; border-color: rgba(239, 68, 68, 0.34); background: var(--red-soft); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 13px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { border-color: #2b3d5f; background: var(--panel-2); color: var(--text); }
.btn .icon { width: 15px; height: 15px; }
.btn-primary {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    border-color: rgba(34, 211, 238, 0.45);
    color: #021018;
}
.btn-primary:hover { background: linear-gradient(135deg, #22d3ee, #06b6d4); color: #021018; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--panel); }
.btn-danger { border-color: rgba(239, 68, 68, 0.35); color: #fca5a5; background: var(--red-soft); }
.btn-block { width: 100%; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; }
.btn:disabled { opacity: 0.55; cursor: progress; }

/* ---------------- KPI ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi {
    background: linear-gradient(160deg, rgba(19, 30, 51, 0.9), rgba(13, 21, 37, 0.9));
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 14px 16px 12px;
    position: relative;
    overflow: hidden;
}
.kpi::after {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.35), transparent);
}
.kpi-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; }
.kpi-head .icon { width: 16px; height: 16px; color: var(--dim); }
.kpi-value { display: flex; align-items: baseline; gap: 7px; margin-top: 10px; }
.kpi-value b { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-value small { color: var(--dim); font-size: 11.5px; }
.kpi-foot { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 9px; font-size: 11px; color: var(--muted); }
.kpi-traffic .kpi-value b { font-size: 22px; color: var(--cyan); }

/* ---------------- panels & grid ---------------- */
.grid { display: grid; gap: 14px; }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.panel {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 16px 18px;
    min-width: 0;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 14.5px; }
.panel-head p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.panel-summary { cursor: pointer; display: flex; justify-content: space-between; gap: 12px; font-weight: 600; list-style: none; }
.panel-summary::-webkit-details-marker { display: none; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); margin: 18px 0 8px; }

.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.rx { background: var(--cyan); }
.dot.tx { background: var(--amber); }

.chart-wrap { position: relative; min-height: 220px; }
#traffic-chart { width: 100%; height: 220px; display: block; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 12.5px; text-align: center; padding: 20px; }

/* ---------------- feed ---------------- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 11px; padding: 9px 2px; border-bottom: 1px solid var(--line-soft); }
.feed-item:last-child { border-bottom: none; }
.feed-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: var(--muted); }
.sev-critical .feed-dot { background: var(--red); box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
.sev-warning .feed-dot { background: var(--amber); }
.sev-info .feed-dot { background: var(--cyan); }
.feed-body p { font-size: 12.5px; line-height: 1.45; }
.feed-meta { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 11px; margin-top: 3px; }

/* ---------------- devices ---------------- */
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.device-card {
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    padding: 13px 14px 10px;
    background: linear-gradient(165deg, rgba(19, 30, 51, 0.65), rgba(11, 18, 32, 0.65));
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.device-card.is-down { border-color: rgba(239, 68, 68, 0.32); background: linear-gradient(165deg, rgba(60, 20, 27, 0.35), rgba(11, 18, 32, 0.7)); }
.device-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.device-id { display: flex; gap: 10px; min-width: 0; }
.device-type {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 8px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--cyan);
    flex: 0 0 auto;
}
.device-type .icon { width: 16px; height: 16px; }
.device-id h3 { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-id span { font-size: 11px; color: var(--dim); display: block; }
.device-error { font-size: 11.5px; color: #fca5a5; background: var(--red-soft); border-radius: 7px; padding: 7px 9px; }

.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; }
.meter-label { display: contents; }
.meter-label span { font-size: 11px; color: var(--muted); }
.meter-label b { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.meter { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: rgba(148, 163, 184, 0.13); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--cyan); }
.meter i.ok { background: var(--green); }
.meter i.warn { background: var(--amber); }
.meter i.bad { background: var(--red); }
.device-stats { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 9px; }
.device-stats div { display: flex; flex-direction: column; min-width: 0; }
.device-stats span { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }
.device-stats b { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.device-stats small { color: var(--dim); font-weight: 400; }
.device-foot { display: flex; justify-content: space-between; color: var(--dim); font-size: 11px; }

/* ---------------- pills ---------------- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 650;
    border-radius: 999px;
    padding: 3px 9px 3px 8px;
    border: 1px solid var(--line);
    background: rgba(148, 163, 184, 0.08);
    color: var(--muted);
    white-space: nowrap;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { color: #4ade80; border-color: rgba(34, 197, 94, 0.28); background: var(--green-soft); }
.pill-bad { color: #f87171; border-color: rgba(239, 68, 68, 0.3); background: var(--red-soft); }
.pill-idle { color: var(--dim); }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--dim);
    background: rgba(9, 15, 27, 0.85);
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(34, 211, 238, 0.03); }
.table-compact td, .table-compact th { padding: 7px 10px; }
.table tr.row-bad { background: rgba(239, 68, 68, 0.05); }
.sev-row-critical td:first-child { box-shadow: inset 2px 0 0 var(--red); }

.rx { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.rx.ok { color: #86efac; }
.rx.warn { color: #fbbf24; }
.rx.bad { color: #f87171; }

.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.inline-form { display: inline; margin: 0; }

.sev { font-size: 10px; font-weight: 750; letter-spacing: 0.07em; padding: 2px 7px; border-radius: 4px; }
.sev-critical { color: #fca5a5; }
.sev.sev-critical { background: var(--red-soft); border: 1px solid rgba(239, 68, 68, 0.35); }
.sev.sev-warning { background: var(--amber-soft); border: 1px solid rgba(245, 158, 11, 0.3); color: #fcd34d; }
.sev.sev-info { background: var(--cyan-soft); border: 1px solid rgba(34, 211, 238, 0.25); color: #a5f3fc; }

.empty { padding: 22px 12px; text-align: center; color: var(--dim); font-size: 12.5px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 26px 16px; color: var(--muted); }

/* ---------------- stat chips ---------------- */
.stat-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat-chip {
    border: 1px solid var(--line-soft);
    background: var(--panel);
    border-radius: 10px;
    padding: 10px 13px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.stat-chip span { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-chip b { font-size: 18px; font-variant-numeric: tabular-nums; }
.stat-chip.ok b { color: #4ade80; }
.stat-chip.bad b { color: #f87171; }
.stat-chip.warn b { color: #fbbf24; }

/* ---------------- filters ---------------- */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input[type="text"], .filters input[type="search"] {
    font-family: inherit;
    font-size: 12.5px;
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    min-height: 34px;
}
.filters select:focus, .filters input:focus, .field input:focus, .field select:focus { outline: none; border-color: rgba(34, 211, 238, 0.55); }
.filters .short { width: 110px; }
.search {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 10px;
    min-width: 220px;
}
.search .icon { width: 15px; height: 15px; color: var(--dim); }
.search input { background: transparent !important; border: none !important; padding: 7px 0 !important; width: 100%; min-height: 32px; }
.search input:focus { outline: none; }

.page-links { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 14px; }

/* ---------------- forms ---------------- */
.form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11.5px; color: var(--muted); font-weight: 550; }
.field input, .field select {
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 36px;
    width: 100%;
}
.field input::placeholder { color: #51617c; }
.check-row { display: flex; gap: 18px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.check input { accent-color: var(--cyan); }
.form-actions { display: flex; gap: 10px; align-items: center; }

/* detail */
.detail-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; }
.info-list { display: flex; flex-direction: column; gap: 1px; background: var(--line-soft); border-radius: 9px; overflow: hidden; }
.info-list div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 11px; background: var(--panel); font-size: 12px; }
.info-list span { color: var(--muted); }
.info-list b { font-weight: 600; text-align: right; }
.mini-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mini { border: 1px solid var(--line-soft); border-radius: 9px; padding: 9px 11px; background: var(--bg-soft); }
.mini span { display: block; font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }
.mini b { font-size: 15px; }

/* ---------------- login ---------------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 26px; }
.login-wrap { width: 100%; max-width: 390px; display: flex; flex-direction: column; gap: 20px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand h1 { font-size: 18px; }
.login-brand p { font-size: 11.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.11em; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 13px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 16px; }
.login-sub { color: var(--muted); font-size: 12.5px; margin-top: -8px; }
.login-card .banner { margin: 0; }
.login-hint { font-size: 11.5px; color: var(--dim); border-top: 1px solid var(--line-soft); padding-top: 11px; }
.login-foot { text-align: center; color: var(--dim); font-size: 11px; }

/* ---------------- toast ---------------- */
.toast-stack { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: 360px; }
.toast {
    background: #101b2f;
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyan);
    border-radius: 9px;
    padding: 10px 13px;
    font-size: 12.5px;
    box-shadow: var(--shadow);
    animation: toast-in 0.18s ease-out;
}
.toast.ok { border-left-color: var(--green); }
.toast.bad { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- responsive ---------------- */
@media (max-width: 1280px) {
    .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
    .grid-main, .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex: none;
        height: auto;
        position: static;
        flex-direction: column;
        gap: 14px;
        padding: 14px 16px;
        border-right: none;
        border-bottom: 1px solid var(--line-soft);
    }
    .nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
    .nav-label, .side-foot { display: none; }
    .nav-item { padding: 8px 11px; white-space: nowrap; }
    .topbar { padding: 16px 16px 10px; flex-wrap: wrap; }
    .banner, .main { margin-left: 0; margin-right: 0; }
    .main { padding: 4px 16px 22px; }
    .banner { margin: 0 16px 10px; }
    .foot { padding: 12px 16px 18px; flex-direction: column; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .device-grid { grid-template-columns: minmax(0, 1fr); }
    .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .user-name { display: none; }
}

@media (max-width: 520px) {
    .kpi-grid { grid-template-columns: minmax(0, 1fr); }
    .clock { display: none; }
    .filters, .search { width: 100%; }
    .search { min-width: 0; }
}

/* =========================================================
   Tambahan: pencarian, chart histori, availability, maintenance
   ========================================================= */
.topsearch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 0 10px;
    min-width: 240px;
}
.topsearch .icon { width: 15px; height: 15px; color: var(--dim); }
.topsearch input {
    background: transparent;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 12.5px;
    padding: 7px 0;
    width: 100%;
    outline: none;
}
.topsearch input::placeholder { color: #51617c; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-panel { padding-bottom: 10px; }
.chart-box { position: relative; min-height: 150px; }
.js-chart { width: 100%; display: block; }
.chart-box .chart-empty { font-size: 12px; }

.perf-head { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.gauge {
    --pct: 0;
    width: 132px;
    height: 132px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: conic-gradient(var(--green) calc(var(--pct) * 1%), rgba(148, 163, 184, 0.13) 0);
    display: grid;
    place-items: center;
    position: relative;
}
.gauge::after {
    content: "";
    position: absolute;
    inset: 9px;
    border-radius: 50%;
    background: var(--panel);
    border: 1px solid var(--line-soft);
}
.gauge-inner { position: relative; z-index: 1; text-align: center; }
.gauge-inner b { display: block; font-size: 21px; font-variant-numeric: tabular-nums; }
.gauge-inner span { display: block; font-size: 9.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }

.perf-stats { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 10px 26px; flex: 1; }
.perf-stats div { display: flex; flex-direction: column; gap: 1px; }
.perf-stats span { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }
.perf-stats b { font-size: 14px; font-variant-numeric: tabular-nums; }
.perf-range { display: flex; gap: 6px; }

.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.tag-maint { color: #fcd34d; background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.32); }

.maintenance-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: var(--bg-soft);
}
.maintenance-box select {
    font-family: inherit;
    font-size: 12.5px;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 7px 9px;
}
.inline-flex { display: inline-flex; align-items: center; gap: 8px; }

.search-page-form { display: flex; gap: 10px; flex-wrap: wrap; }
.search-page-form .search { flex: 1; min-width: 280px; }

@media (max-width: 1280px) {
    .kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
    .chart-grid { grid-template-columns: minmax(0, 1fr); }
    .perf-stats { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
}
@media (max-width: 860px) {
    .topsearch { display: none; }
    .perf-head { gap: 16px; }
    .gauge { width: 108px; height: 108px; }
}

/* ---------------- wawasan pintar (insights) ---------------- */
.insight-list { display: flex; flex-direction: column; gap: 8px; }
.insight {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    background: var(--bg-soft);
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--dim);
    border-radius: var(--radius-sm);
}
.insight.sev-critical { border-left-color: var(--red); }
.insight.sev-warning { border-left-color: var(--amber); }
.insight.sev-info { border-left-color: var(--cyan); }
.insight-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; flex: 0 0 auto; background: var(--dim); }
.insight.sev-critical .insight-dot { background: var(--red); box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
.insight.sev-warning .insight-dot { background: var(--amber); }
.insight.sev-info .insight-dot { background: var(--cyan); }
.insight-body { flex: 1; min-width: 0; }
.insight-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.insight-head h3 { font-size: 13.5px; margin: 0; }
.insight-detail { color: var(--muted); font-size: 12.5px; margin: 3px 0 0; }
.insight-action { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; margin: 6px 0 0; }
.insight-action .icon { width: 13px; height: 13px; flex: 0 0 auto; margin-top: 2px; color: var(--amber); }
.insight > .btn { align-self: center; flex: 0 0 auto; }

.score {
    display: inline-flex;
    min-width: 34px;
    justify-content: center;
    font-family: var(--mono);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--muted);
}
.score.ok { color: #86efac; background: var(--green-soft); }
.score.warn { color: #fcd34d; background: var(--amber-soft); }
.score.bad { color: #fca5a5; background: var(--red-soft); }

.tag-crit { color: #fca5a5; background: var(--red-soft); border-color: rgba(239, 68, 68, 0.3); }
.tag-warn { color: #fcd34d; background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.3); }
.tag-info { color: #7dd3fc; background: var(--cyan-soft); border-color: rgba(34, 211, 238, 0.25); }
.btn.is-active { border-color: rgba(34, 211, 238, 0.55); color: var(--cyan); background: var(--cyan-soft); }

/* ---------------- NOC console (terminal) ---------------- */
.console-panel {
    padding: 0;
    overflow: hidden;
    background: #04080e;
    border-color: #16243a;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 0 60px rgba(34, 211, 238, 0.035);
    animation: console-glow 7s ease-in-out infinite;
}
.console-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: linear-gradient(#0d1727, #091220);
    border-bottom: 1px solid var(--line-soft);
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--muted);
}
.console-dots { display: inline-flex; gap: 5px; }
.console-dots i { width: 9px; height: 9px; border-radius: 50%; background: #334155; display: inline-block; }
.console-dots i:nth-child(1) { background: #ef4444; }
.console-dots i:nth-child(2) { background: #f59e0b; }
.console-dots i:nth-child(3) { background: #22c55e; }
.console-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0.02em; }
.console-live {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 9.5px; letter-spacing: 0.16em; color: #6ee7b7;
}
.live-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 9px var(--green);
    animation: console-pulse 1.8s ease-in-out infinite;
}
.console-screen {
    position: relative;
    padding: 16px 16px 4px;
    max-height: 64vh;
    overflow: auto;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.62;
    color: #c9f7e5;
    background:
        repeating-linear-gradient(to bottom, rgba(148, 163, 184, 0.05) 0 1px, transparent 1px 3px),
        radial-gradient(120% 90% at 50% 0%, rgba(34, 211, 238, 0.075), transparent 62%),
        #04080e;
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.16);
    scrollbar-color: #1e2a44 transparent;
}
.console-out { white-space: pre-wrap; word-break: break-word; }
.console-line { animation: console-in 0.22s ease-out both; }
.console-line-blank { height: 6px; }
.console-line-echo { margin-top: 6px; color: var(--muted); }

.psk { color: #6ee7b7; }
.psep, .pdollar { color: var(--dim); }
.ppath { color: var(--cyan); }
.c-cmd { color: #e7eefb; }
.c-head { color: var(--cyan); }
.c-ok { color: #6ee7b7; }
.c-warn { color: #fcd34d; }
.c-bad { color: #fca5a5; }
.c-cyan { color: #7dd3fc; }
.c-dim { color: #7b8aa5; }
.c-key { color: var(--cyan); }

.console-input {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 0 14px;
    font-family: var(--mono);
}
.console-field { position: relative; flex: 1; min-width: 0; display: block; }
.console-field input {
    width: 100%;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: #e7eefb;
    font: inherit;
    caret-color: transparent;
}
.console-field input::placeholder { color: rgba(123, 138, 165, 0.55); }
.caret {
    position: absolute;
    left: 0;
    top: 50%;
    width: 7.5px;
    height: 15px;
    margin-top: -8px;
    background: var(--cyan);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.85);
    pointer-events: none;
    animation: console-blink 1.05s steps(1, end) infinite;
    transition: transform 0.04s linear;
}
.console-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 8px 14px;
    border-top: 1px solid var(--line-soft);
    background: #060c16;
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--dim);
}
.console-foot kbd {
    display: inline-block;
    padding: 0 4px;
    margin-right: 2px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #0d1727;
    color: var(--muted);
    font-family: inherit;
    font-size: 10px;
}
.console-foot-right { margin-left: auto; color: var(--muted); }

@keyframes console-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}
@keyframes console-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}
@keyframes console-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.82); }
}
@keyframes console-glow {
    0%, 100% { box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 0 60px rgba(34, 211, 238, 0.03); }
    50% { box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 0 80px rgba(34, 211, 238, 0.07); }
}

@media (max-width: 720px) {
    .console-screen { font-size: 11px; max-height: 70vh; padding: 12px 10px 2px; }
    .console-foot { gap: 8px; font-size: 9.5px; }
    .console-foot-right { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .console-panel, .console-line, .console-live .live-dot, .console-screen { animation: none !important; }
    .caret { animation: none; }
}

/* ---------------- peta jaringan (map) ---------------- */
.map-panel { padding-bottom: 18px; }
.map-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }
.dot.maint { background: var(--amber); }

.map-wrap {
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    overflow: hidden;
    background: radial-gradient(70% 60% at 50% 12%, rgba(34, 211, 238, 0.07), transparent 70%), #060b14;
}
.netmap { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 640; max-height: 640px; }

.mlink { fill: none; stroke-width: 1.6; stroke-linecap: round; }
.mlink.is-ok { stroke: rgba(34, 197, 94, 0.5); stroke-dasharray: 5 9; animation: map-flow 1.6s linear infinite; }
.mlink.is-maint { stroke: rgba(245, 158, 11, 0.5); stroke-dasharray: 4 8; animation: map-flow 2.4s linear infinite; }
.mlink.is-down { stroke: rgba(239, 68, 68, 0.6); stroke-dasharray: 2 7; animation: map-flow 0.9s linear infinite; }
.packet { fill: #7dd3fc; filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.9)); }
.packet.delay { fill: #6ee7b7; opacity: 0.85; }

.map-hub .hub-ring {
    fill: none;
    stroke: rgba(34, 211, 238, 0.32);
    stroke-width: 1.4;
    stroke-dasharray: 4 7;
    transform-box: fill-box;
    transform-origin: center;
    animation: map-spin 24s linear infinite;
}
.map-hub .hub-core { fill: rgba(7, 16, 27, 0.96); stroke: rgba(34, 211, 238, 0.5); stroke-width: 1.4; }
.hub-icon { fill: #7dd3fc; font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; }
.hub-label { fill: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; }

.node { cursor: pointer; }
.node rect { fill: rgba(10, 18, 31, 0.97); stroke: rgba(148, 163, 184, 0.22); transition: stroke 0.2s ease, filter 0.2s ease; }
.node:hover rect { stroke: rgba(34, 211, 238, 0.65); filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.22)); }
.node text { font-family: var(--mono); }
.node-name { fill: #e7eefb; font-size: 11.5px; }
.node-type { fill: #7b8aa5; font-size: 8.5px; letter-spacing: 0.06em; }
.node-metrics { fill: #9fb2cf; font-size: 9.5px; }
.node-score { fill: #6ee7b7; font-size: 10px; font-weight: 700; }
.node-dot { fill: var(--muted); }
.node.is-ok .node-dot { fill: var(--green); filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.8)); }
.node.is-down rect { stroke: rgba(239, 68, 68, 0.6); }
.node.is-down .node-dot { fill: var(--red); animation: map-blink 1.3s ease-in-out infinite; }
.node.is-maint .node-dot { fill: var(--amber); }
.node-olt rect { fill: rgba(10, 22, 34, 0.97); }

.leaf { fill: rgba(148, 163, 184, 0.22); }
.leaf.is-on { fill: rgba(34, 197, 94, 0.85); }
.leaf.is-off { fill: rgba(239, 68, 68, 0.75); }

.tag-live.is-stale { color: #fca5a5; background: var(--red-soft); border-color: rgba(239, 68, 68, 0.35); }
.tag-live.is-stale .live-dot { background: var(--red); box-shadow: 0 0 9px var(--red); }

@keyframes map-flow { to { stroke-dashoffset: -28; } }
@keyframes map-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes map-spin { to { transform: rotate(360deg); } }

/* ---------------- komunikasi ---------------- */
.comms-grid { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 14px; align-items: start; }
.comms-list { display: flex; flex-direction: column; gap: 10px; max-height: 68vh; overflow: auto; padding-right: 4px; }
.comms-item {
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--amber);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    background: var(--bg-soft);
}
.comms-item.is-done { border-left-color: var(--green); opacity: 0.78; }
.comms-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.comms-time { margin-left: auto; color: var(--dim); font-size: 11px; font-family: var(--mono); }
.comms-message { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: #d7e2f3; }
.comms-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.field textarea {
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    resize: vertical;
    width: 100%;
}
.field textarea:focus { outline: none; border-color: rgba(34, 211, 238, 0.55); }

@media (max-width: 1080px) {
    .comms-grid { grid-template-columns: minmax(0, 1fr); }
    .comms-list { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
    .mlink, .map-hub .hub-ring, .node.is-down .node-dot, .tag-live .live-dot { animation: none !important; }
}
