:root{--bg:#0b1016;--panel:#17212c;--border:#2f4259;--text:#edf6ff;--muted:#8fa5b8;--accent:#47c3ff;--ok:#4caf50;--warn:#ffc107;--bad:#e53935}*{box-sizing:border-box}body{margin:0;background:radial-gradient(circle at 15% 10%,rgba(71,195,255,.10),transparent 30%),linear-gradient(160deg,#0b1016,#11161d 55%,#0e151d);color:var(--text);font-family:Segoe UI,Arial,sans-serif;min-height:100vh}.shell{width:min(1500px,calc(100% - 28px));margin:14px auto}.header,.nav,.panel,.card,.footer{background:linear-gradient(180deg,rgba(28,38,50,.96),rgba(20,29,39,.94));border:1px solid rgba(91,122,156,.28);box-shadow:0 18px 60px rgba(0,0,0,.28)}.header{display:flex;justify-content:space-between;align-items:center;padding:22px 26px;border-radius:18px 18px 0 0}.header h1{margin:3px 0;font-size:2rem}.eyebrow{color:var(--accent);font-size:.72rem;letter-spacing:.22em;font-weight:800}.muted{color:var(--muted)}.status-pill{padding:10px 14px;border-radius:999px;background:rgba(76,175,80,.09);border:1px solid rgba(76,175,80,.25)}.dot{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:8px}.dot.up{background:var(--ok)}.dot.down{background:var(--bad)}.dot.warn{background:var(--warn)}.nav{display:flex;gap:7px;padding:10px 15px;border-top:0;border-radius:0 0 14px 14px;flex-wrap:wrap}.nav a{color:#bdccda;text-decoration:none;padding:10px 14px;border-radius:10px;font-weight:650}.nav a:hover,.nav a.active{background:rgba(71,195,255,.13);color:#fff}.panel{border-radius:18px;padding:20px;margin-top:18px}.cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:15px;margin-top:18px}.card{border-radius:16px;padding:18px}.card .value{font-size:2rem;font-weight:800;margin:8px 0}.button,button,input[type=submit]{display:inline-block;border:1px solid rgba(71,195,255,.35);background:rgba(71,195,255,.13);color:#fff;padding:10px 14px;border-radius:10px;text-decoration:none;font-weight:700;cursor:pointer}.button.secondary{background:rgba(255,255,255,.03);border-color:rgba(255,255,255,.10)}table{width:100%;border-collapse:collapse;font-size:.91rem}th,td{padding:10px 9px;border-bottom:1px solid rgba(255,255,255,.07);text-align:left;vertical-align:top}th{color:#9fcde3;font-size:.76rem;text-transform:uppercase;letter-spacing:.08em}tr:hover td{background:rgba(71,195,255,.025)}input,select,textarea{width:100%;padding:10px;border-radius:9px;border:1px solid var(--border);background:#0e151d;color:#fff}.form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:13px}.field label{display:block;color:var(--muted);font-size:.78rem;margin-bottom:5px}.badge{display:inline-block;padding:4px 8px;border-radius:999px;font-size:.72rem;font-weight:800}.badge.up{background:rgba(76,175,80,.13);color:#c9f7cb}.badge.down{background:rgba(229,57,53,.14);color:#ffd0cc}.badge.pending{background:rgba(255,193,7,.13);color:#ffe7a3}.message{padding:12px 14px;border-radius:11px;margin-bottom:14px;background:rgba(71,195,255,.08);border:1px solid rgba(71,195,255,.20)}.footer{margin-top:18px;border-radius:14px;padding:15px 18px;display:flex;justify-content:space-between;color:var(--muted);font-size:.84rem}@media(max-width:900px){.cards,.form-grid{grid-template-columns:1fr}.header{flex-direction:column;align-items:flex-start;gap:14px}.shell{width:calc(100% - 14px);margin:7px}.nav{overflow-x:auto;flex-wrap:nowrap}}

/* ============================================================
   HIM live dashboard tabs v0.3
   Append to assets/css/him.css
   ============================================================ */

.live-tabs-panel {
    padding: 0;
    overflow: hidden;
}

.live-tabs {
    display: flex;
    gap: 6px;
    padding: 12px 14px 0;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.075);
    background: rgba(7, 12, 18, 0.28);
}

.live-tab {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 11px 11px 0 0;
    background: transparent;
    color: var(--muted);
    font-weight: 750;
    white-space: nowrap;
    box-shadow: none;
}

.live-tab:hover {
    color: var(--text);
    background: rgba(71, 195, 255, 0.06);
}

.live-tab.active {
    color: #ffffff;
    background: linear-gradient(
        180deg,
        rgba(71, 195, 255, 0.16),
        rgba(28, 38, 50, 0.96)
    );
    border-color: rgba(71, 195, 255, 0.22);
}

.live-tab-count {
    min-width: 24px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: #c9dae8;
    font-size: 0.71rem;
    text-align: center;
}

.live-tab.active .live-tab-count {
    background: rgba(71, 195, 255, 0.16);
    color: #e8f8ff;
}

.live-tab-content {
    display: none;
    padding: 22px;
    min-height: 480px;
}

.live-tab-content.active {
    display: block;
    animation: himTabFade 0.16s ease;
}

.live-placeholder {
    min-height: 420px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
    padding: 35px;
    border-radius: 15px;
    border: 1px dashed rgba(71, 195, 255, 0.2);
    background:
        radial-gradient(
            circle at center,
            rgba(71, 195, 255, 0.065),
            transparent 48%
        ),
        rgba(7, 12, 18, 0.22);
}

.live-placeholder h2 {
    margin-bottom: 8px;
}

.live-placeholder p {
    max-width: 620px;
}

@keyframes himTabFade {
    from {
        opacity: 0;
        transform: translateY(3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 760px) {
    .live-tabs {
        padding-left: 8px;
        padding-right: 8px;
    }

    .live-tab {
        padding: 11px 13px;
    }

    .live-tab-content {
        padding: 15px;
    }
}

/* ============================================================
   HIM Backbone Commissioning additions
   ============================================================ */

.backbone-path {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.backbone-media-fibre {
    color: var(--accent);
}

.backbone-media-copper {
    color: #d8aa6d;
}

.backbone-media-wifi {
    color: #b6a5ff;
}

.backbone-critical {
    border-left: 3px solid var(--bad);
}

/* ============================================================
   HIM Device Engineering Record
   ============================================================ */

.device-select-form {
    max-width: 720px;
    margin-top: 20px;
}

.device-editor-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.device-editor-section {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.device-editor-section h3 {
    margin-bottom: 16px;
}

.device-editor-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 18px;
}

.device-editor-checks label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.device-editor-checks input {
    width: auto;
}

.device-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.device-editor-lower-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.device-editor-mini-card {
    padding: 12px 13px;
    margin-top: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.028);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.device-editor-mini-card strong {
    margin-left: 6px;
}

.device-editor-subheading {
    margin-top: 22px;
}

.device-editor-time {
    margin-top: 6px;
    font-size: 0.78rem;
}

.device-editor-error {
    color: #ffd0cc;
    border-color: rgba(229, 57, 53, 0.30);
    background: rgba(229, 57, 53, 0.10);
}

@media (max-width: 1100px) {
    .device-editor-lower-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .device-editor-heading {
        flex-direction: column;
    }

    .device-editor-checks {
        flex-direction: column;
        gap: 10px;
    }
}


/* ============================================================
   HIM Topology v0.1
   ============================================================ */

.topology-summary-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.topology-panel {
    position: relative;
    overflow: hidden;
    padding: 0;
}

.topology-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.065);
}

.topology-toolbar h2 {
    margin-bottom: 0;
}

.topology-toolbar-actions {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.topology-toolbar-actions label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.055em;
}

.topology-toolbar-actions input,
.topology-toolbar-actions select {
    min-width: 190px;
}

.topology-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    padding: 12px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);
    background: rgba(7, 12, 18, 0.24);
    color: var(--muted);
    font-size: 0.8rem;
}

.topology-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.topology-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.topology-dot.up {
    background: #4caf50;
}

.topology-dot.degraded {
    background: #ffc107;
}

.topology-dot.down {
    background: #e53935;
}

.topology-dot.unknown {
    background: #7f91a5;
}

.topology-line {
    width: 28px;
    height: 0;
    border-top: 3px solid;
}

.topology-line.fibre {
    border-color: #47c3ff;
}

.topology-line.copper {
    border-color: #d7a96d;
}

.topology-line.backup {
    border-color: #b39ddb;
    border-top-style: dashed;
}

.topology-stage {
    position: relative;
    min-height: 680px;
    max-height: calc(100vh - 260px);
    overflow: auto;
    background:
        linear-gradient(
            rgba(71, 195, 255, 0.025) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(71, 195, 255, 0.025) 1px,
            transparent 1px
        ),
        radial-gradient(
            circle at 50% 8%,
            rgba(71, 195, 255, 0.055),
            transparent 35%
        ),
        rgba(5, 10, 16, 0.34);
    background-size: 32px 32px, 32px 32px, auto, auto;
}

.topology-canvas {
    position: relative;
    min-width: 1200px;
    min-height: 700px;
    transition: transform 0.18s ease;
}

.topology-svg {
    position: absolute;
    inset: 0;
    overflow: visible;
    pointer-events: none;
}

.topology-nodes {
    position: absolute;
    inset: 0;
}

.topology-link {
    fill: none;
    stroke-width: 4;
    opacity: 0.78;
    filter: drop-shadow(0 0 5px rgba(71, 195, 255, 0.10));
}

.topology-link.fibre {
    stroke: #47c3ff;
}

.topology-link.copper {
    stroke: #d7a96d;
}

.topology-link.wifi {
    stroke: #85d69b;
    stroke-dasharray: 8 7;
}

.topology-link.wan {
    stroke: #f58a6d;
}

.topology-link.backup {
    stroke: #b39ddb;
    stroke-dasharray: 12 9;
}

.topology-link.down {
    stroke: #e53935;
    stroke-dasharray: 7 6;
    animation: topologyFaultPulse 1.25s ease-in-out infinite;
}

.topology-link.unknown {
    stroke: #718499;
    stroke-dasharray: 5 7;
}

.topology-node {
    position: absolute;
    width: 238px;
    min-height: 118px;
    padding: 14px 15px 13px;
    display: grid;
    align-content: start;
    gap: 5px;
    border-radius: 14px;
    border: 1px solid rgba(118, 151, 184, 0.23);
    background:
        linear-gradient(
            180deg,
            rgba(28, 39, 52, 0.97),
            rgba(15, 24, 33, 0.97)
        );
    color: var(--text);
    text-align: left;
    cursor: pointer;
    box-shadow:
        0 17px 38px rgba(0, 0, 0, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.035);
    transition:
        transform 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease;
}

.topology-node:hover {
    z-index: 5;
    transform: translateY(-3px);
    border-color: rgba(71, 195, 255, 0.48);
    box-shadow:
        0 22px 48px rgba(0, 0, 0, 0.32),
        0 0 0 1px rgba(71, 195, 255, 0.08);
}

.topology-node::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 14px 0 0 14px;
    background: #7f91a5;
}

.topology-node.status-up::before {
    background: #4caf50;
}

.topology-node.status-degraded::before {
    background: #ffc107;
}

.topology-node.status-down::before {
    background: #e53935;
}

.topology-node.critical {
    box-shadow:
        0 17px 38px rgba(0, 0, 0, 0.26),
        inset 0 0 0 1px rgba(229, 57, 53, 0.13);
}

.topology-node-type {
    color: var(--accent);
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.085em;
}

.topology-node strong {
    overflow: hidden;
    color: #f4f9ff;
    font-size: 0.96rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topology-node-ip,
.topology-node-location {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topology-node-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 3px;
    color: #c9d7e4;
    font-size: 0.73rem;
    font-weight: 750;
}

.topology-node-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7f91a5;
}

.status-up .topology-node-status i {
    background: #4caf50;
}

.status-degraded .topology-node-status i {
    background: #ffc107;
}

.status-down .topology-node-status i {
    background: #e53935;
}

.topology-detail {
    position: absolute;
    top: 132px;
    right: 18px;
    z-index: 20;
    width: min(360px, calc(100% - 36px));
    max-height: calc(100% - 155px);
    overflow: auto;
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(71, 195, 255, 0.25);
    background:
        linear-gradient(
            180deg,
            rgba(25, 36, 48, 0.985),
            rgba(12, 20, 28, 0.985)
        );
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

.topology-detail-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 1.2rem;
}

.topology-detail h3 {
    margin: 5px 38px 10px 0;
}

.topology-detail-status {
    margin-bottom: 17px;
}

.topology-detail dl {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 9px 12px;
    margin: 0 0 18px;
}

.topology-detail dt {
    color: var(--muted);
    font-size: 0.77rem;
}

.topology-detail dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.topology-detail-links {
    display: grid;
    gap: 9px;
    margin-top: 18px;
}

.topology-detail-links article {
    display: grid;
    gap: 3px;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.025);
}

.topology-detail-links span,
.topology-detail-links small {
    color: var(--muted);
}

.topology-empty {
    min-height: 500px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
}

@keyframes topologyFaultPulse {
    0%,
    100% {
        opacity: 0.45;
    }

    50% {
        opacity: 1;
    }
}

@media (max-width: 1180px) {
    .topology-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .topology-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 680px) {
    .topology-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .topology-toolbar-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .topology-toolbar-actions label,
    .topology-toolbar-actions input,
    .topology-toolbar-actions select,
    .topology-toolbar-actions button {
        width: 100%;
    }

    .topology-stage {
        min-height: 560px;
    }

    .topology-detail {
        top: 175px;
    }
}

.topology-discovery-summary{grid-template-columns:repeat(6,minmax(0,1fr))}.topology-discovery-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:20px}.topology-discovery-heading h2{margin-bottom:7px}.topology-discovery-device-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px;margin-top:18px}.topology-discovery-device-list article{display:grid;gap:3px;padding:12px 13px;border-radius:11px;border:1px solid rgba(255,255,255,.06);background:rgba(255,255,255,.024)}.topology-discovery-device-list span,.topology-discovery-device-list small{color:var(--muted)}.topology-discovery-filters{display:flex;flex-wrap:wrap;gap:9px}.topology-discovery-filters input,.topology-discovery-filters select{width:auto;min-width:150px}.topology-discovery-list{display:grid;gap:13px;margin-top:18px}.topology-discovery-card{display:grid;grid-template-columns:110px minmax(0,1fr) auto;gap:16px;padding:16px;border-radius:14px;border:1px solid rgba(255,255,255,.065);background:rgba(255,255,255,.024)}.topology-discovery-score{display:grid;align-content:center;justify-items:center;min-height:92px;border-radius:12px;border:1px solid rgba(255,255,255,.07)}.topology-discovery-score.high{background:rgba(76,175,80,.09);color:#a7e0aa}.topology-discovery-score.medium{background:rgba(255,193,7,.09);color:#ffe08a}.topology-discovery-score.low{background:rgba(127,145,165,.10);color:#c4cfda}.topology-discovery-score strong{font-size:1.35rem}.topology-discovery-score span{color:var(--muted);font-size:.72rem}.topology-discovery-route{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:15px;align-items:center}.topology-discovery-route div:not(.topology-discovery-arrow){display:grid;gap:4px}.topology-discovery-route small{color:var(--muted)}.topology-discovery-arrow{color:var(--accent);font-size:1.4rem}.topology-discovery-evidence{display:flex;align-content:flex-start;justify-content:flex-end;flex-wrap:wrap;gap:7px}.topology-discovery-meta{grid-column:2/4;display:flex;flex-wrap:wrap;gap:10px 20px;color:var(--muted);font-size:.8rem}.topology-discovery-meta strong{color:var(--text)}.topology-discovery-actions{grid-column:2/4;display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px}.topology-discovery-actions form{margin:0}.topology-discovery-error{color:#ffd0cc;border-color:rgba(229,57,53,.3);background:rgba(229,57,53,.1)}.topology-discovery-empty{min-height:220px;display:grid;place-items:center;border-radius:13px;border:1px dashed rgba(71,195,255,.16);color:var(--muted)}@media(max-width:1180px){.topology-discovery-summary{grid-template-columns:repeat(3,minmax(0,1fr))}.topology-discovery-card{grid-template-columns:100px minmax(0,1fr)}.topology-discovery-evidence,.topology-discovery-meta,.topology-discovery-actions{grid-column:1/3}.topology-discovery-evidence{justify-content:flex-start}}@media(max-width:720px){.topology-discovery-summary{grid-template-columns:1fr 1fr}.topology-discovery-heading{flex-direction:column}.topology-discovery-card,.topology-discovery-route{grid-template-columns:1fr}.topology-discovery-arrow{transform:rotate(90deg)}.topology-discovery-evidence,.topology-discovery-meta,.topology-discovery-actions{grid-column:1}.topology-discovery-actions{justify-content:flex-start}}
