/* FiberMap — light theme
   Concept: a clean network engineering plan. The fiber cable is the one bold element;
   everything around it stays quiet. */

:root {
    --canvas: #eef2f5;
    --dot: #c6d0da;
    --surface: #ffffff;
    --surface-2: #f6f8fa;
    --ink: #15212e;
    --ink-2: #3a4757;
    --muted: #5e6b7a;
    --rule: #d7dee5;
    --rule-strong: #c2ccd6;
    --accent: #1f5fd1;
    --accent-soft: #e6eefb;
    --ok: #109a5b;
    --ok-soft: #e3f4eb;
    --warn: #c77700;
    --warn-soft: #fdf1dc;
    --crit: #d23a2e;
    --crit-soft: #fce9e7;
    --passive: #8a96a3;
    --jacket: #d5dde5;

    --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --radius-s: 6px;
    --radius-m: 10px;
    --shadow-float: 0 1px 2px rgb(21 33 46 / .06), 0 8px 24px rgb(21 33 46 / .08);
    --topbar: 56px;
    --rail: 60px;
    --inspector: 400px;

    color-scheme: light;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
    color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--canvas); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; font-stretch: 87.5%; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 15px; height: 15px; }
/* ikon yang ditempatkan di dalam SVG peta (ukuran dari atribut width/height) */
.gi { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }

/* ---------------------------------------------------------------- top bar */
.topbar {
    position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 30;
    display: flex; align-items: center; gap: 16px; padding: 0 16px;
    background: var(--surface); border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-weight: 700; font-stretch: 112.5%; font-size: 17px; letter-spacing: -.2px; }

.search { position: relative; flex: 0 1 300px; }
.search .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
    width: 100%; height: 36px; padding: 0 12px 0 34px;
    border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--surface-2);
}
.search input:focus { background: var(--surface); border-color: var(--accent); outline: none; }

.topbar-status { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
    border: 1px solid var(--rule); border-radius: 999px; background: var(--surface);
    font-size: 13px; color: var(--ink-2); cursor: default; white-space: nowrap;
}
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--rule-strong); }
.chip.crit { background: var(--crit-soft); border-color: #f3c3be; color: #9e2219; }
.chip.warn { background: var(--warn-soft); border-color: #efd3a3; color: #8a5300; }
.chip b { font-weight: 650; font-variant-numeric: tabular-nums; }

.live { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); padding: 0 4px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--passive); }
.live.on .live-dot { background: var(--ok); animation: live 2.4s ease-out infinite; }
.live.connecting .live-dot { background: var(--warn); }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgb(16 154 91 / .45); } 70%, 100% { box-shadow: 0 0 0 7px rgb(16 154 91 / 0); } }

.user { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--rule); color: var(--ink-2); font-size: 13px; }
.user form { margin: 0; }

/* ---------------------------------------------------------------- buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 34px; padding: 0 12px; border-radius: var(--radius-s);
    border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
    font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--rule-strong); background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1a52b6; }
.btn.danger { color: var(--crit); }
.btn.danger:hover { background: var(--crit-soft); border-color: #f3c3be; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon { width: 34px; padding: 0; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn .spin { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- tool rail */
.rail {
    position: fixed; top: var(--topbar); left: 0; bottom: 0; width: var(--rail); z-index: 20;
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0;
    background: var(--surface); border-right: 1px solid var(--rule);
}
.rail-sep { width: 28px; height: 1px; background: var(--rule); margin: 6px 0; }
.tool {
    position: relative; width: 40px; height: 40px; display: grid; place-items: center;
    border: 0; border-radius: var(--radius-s); background: transparent; color: var(--ink-2); cursor: pointer;
}
.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool.active { background: var(--accent-soft); color: var(--accent); }
.tool .i { width: 20px; height: 20px; }
.tool[data-tip]:hover::after, .tool[data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; left: 48px; top: 50%; transform: translateY(-50%);
    background: var(--ink); color: #fff; font-size: 12px; padding: 5px 8px; border-radius: 5px; white-space: nowrap; pointer-events: none;
}

/* ---------------------------------------------------------------- map */
.stage { position: fixed; top: var(--topbar); left: var(--rail); right: 0; bottom: 0; }
#map { width: 100%; height: 100%; display: block; cursor: grab; user-select: none; touch-action: none; }
#map.panning { cursor: grabbing; }
#map.connecting { cursor: crosshair; }
.grid-dot { fill: var(--dot); }

/* cable: jacket + core + light pulses */
.link-hit { stroke: transparent; stroke-width: 18; fill: none; cursor: pointer; }
.jacket { fill: none; stroke: var(--jacket); stroke-width: 7; stroke-linecap: round; pointer-events: none; }
.core { fill: none; stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.pulse { fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 1.5 30; pointer-events: none; animation: pulse var(--dur, 2s) linear infinite; }
.pulse.rev { animation-direction: reverse; opacity: .55; }
@keyframes pulse { to { stroke-dashoffset: -31.5; } }
.cable.s-ok .core, .cable.s-ok .pulse { stroke: var(--ok); }
.cable.s-warning .core, .cable.s-warning .pulse { stroke: var(--warn); }
.cable.s-critical .core, .cable.s-critical .pulse { stroke: var(--crit); }
.cable.s-down .core { stroke: var(--crit); stroke-dasharray: 6 5; }
.cable.s-down .jacket { stroke: #f1cdc9; }
.cable.s-disabled .core, .cable.s-unknown .core { stroke: var(--passive); stroke-dasharray: 2 4; }
.cable.s-passive .core { stroke: #7d8a98; }
.cable.m-utp .jacket { stroke-width: 5; stroke: #dfe4ea; }
.cable.m-wireless .jacket { stroke: none; }
.cable.m-wireless .core { stroke-dasharray: 2 5; }
.cable.selected .jacket { stroke: #b9cdf2; stroke-width: 10; }

.tag rect { fill: var(--surface); stroke: var(--rule-strong); }
.tag text { font-size: 11px; font-weight: 600; fill: var(--ink-2); font-stretch: 87.5%; font-variant-numeric: tabular-nums; }
.tag .ti { color: var(--muted); }
.tag .t-warning { fill: #9b5c00; }
.tag .t-critical { fill: var(--crit); }
.tag .t-ok { fill: var(--ok); }
.tag .t-label { fill: var(--ink); font-weight: 650; }

.ghost-link { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 5; pointer-events: none; }

.node { cursor: pointer; }
.node.draggable { cursor: grab; }
.node .tile { fill: var(--surface); stroke: var(--rule-strong); stroke-width: 1.2; filter: drop-shadow(0 1px 1.5px rgb(21 33 46 / .12)); }
.node .glyph { color: var(--ink); }
.node.type-client .glyph { color: var(--ink-2); }
.node .pip { stroke: var(--surface); stroke-width: 2.5; }
.node .pip.up { fill: var(--ok); }
.node .pip.warning { fill: var(--warn); }
.node .pip.down { fill: var(--crit); }
.node .pip.unknown { fill: var(--passive); }
.node.st-warning .tile { stroke: var(--warn); stroke-width: 1.8; }
.node.st-down .tile { stroke: var(--crit); stroke-width: 1.8; fill: var(--crit-soft); }
.node.st-passive .tile { stroke-dasharray: 3 3; }
.node.selected .tile { stroke: var(--accent); stroke-width: 2.4; stroke-dasharray: none; }
.node.link-source .tile { stroke: var(--accent); stroke-width: 2.4; stroke-dasharray: 4 3; }
.node .name { font-size: 12.5px; font-weight: 650; font-stretch: 87.5%; fill: var(--ink); text-anchor: middle; paint-order: stroke; stroke: var(--canvas); stroke-width: 4px; stroke-linejoin: round; }
.node .sub { font-size: 11px; font-stretch: 87.5%; fill: var(--muted); text-anchor: middle; paint-order: stroke; stroke: var(--canvas); stroke-width: 4px; stroke-linejoin: round; font-variant-numeric: tabular-nums; }
.node .sub.alert { fill: var(--crit); font-weight: 600; }
.node .sub.warn { fill: #9b5c00; font-weight: 600; }
.node.dim { opacity: .25; }
.node.flash .tile { animation: flash 1s ease-out; }
@keyframes flash { 0% { stroke: var(--accent); stroke-width: 3.5; } }

.banner {
    position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 5;
    display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; max-width: calc(100% - 24px);
    background: var(--ink); color: #fff; border-radius: var(--radius-m); box-shadow: var(--shadow-float); font-size: 13px;
}
.banner .btn { height: 28px; background: transparent; color: #fff; border-color: #ffffff40; }
.banner .btn:hover { background: #ffffff1a; }

.zoom {
    position: absolute; right: 16px; bottom: 16px; z-index: 5;
    display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); box-shadow: var(--shadow-float); overflow: hidden;
}
.zoom button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.zoom button + button { border-top: 1px solid var(--rule); }
.zoom button:hover { background: var(--surface-2); color: var(--ink); }

.legend {
    position: absolute; left: 16px; bottom: 16px; z-index: 5;
    display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 12px; font-size: 12px; color: var(--ink-2);
    background: rgb(255 255 255 / .94); border: 1px solid var(--rule); border-radius: var(--radius-m);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { width: 26px; height: 10px; }

.empty-map { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.empty-map > div { pointer-events: auto; text-align: center; max-width: 340px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 24px; box-shadow: var(--shadow-float); }
.empty-map h2 { margin: 0 0 6px; font-size: 17px; }
.empty-map p { margin: 0 0 14px; color: var(--muted); }

/* ---------------------------------------------------------------- inspector */
.inspector {
    position: fixed; top: calc(var(--topbar) + 12px); right: 12px; bottom: 12px; width: var(--inspector); z-index: 25;
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-float);
    overflow: hidden;
}
.sheet-handle { display: none; }
.insp-head { position: relative; padding: 16px 16px 14px; border-bottom: 1px solid var(--rule); }
.insp-close { position: absolute; top: 10px; right: 10px; }
.insp-title { display: flex; align-items: flex-start; gap: 12px; padding-right: 36px; }
.insp-icon { width: 42px; height: 42px; flex: none; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--rule); display: grid; place-items: center; color: var(--ink); }
.insp-icon .i { width: 22px; height: 22px; }
.insp-name { flex: 1; min-width: 0; }
.insp-name h2 { margin: 0 0 4px; font-size: 18px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.insp-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.insp-meta span { display: inline-flex; align-items: center; gap: 4px; }
.insp-meta .i { width: 13px; height: 13px; }
.insp-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.insp-body { flex: 1; overflow: auto; padding: 0 16px 20px; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok, .badge.up { background: var(--ok-soft); color: var(--ok); }
.badge.warning { background: var(--warn-soft); color: #9b5c00; }
.badge.critical, .badge.down { background: var(--crit-soft); color: var(--crit); }
.badge.passive, .badge.unknown, .badge.disabled { background: var(--surface-2); color: var(--muted); }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 12px; margin: 14px 0 4px; border-top: 1px solid var(--rule); }
.facts div { padding: 9px 0 8px; border-bottom: 1px solid var(--rule); min-width: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 1px 0 0; font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.facts.two { grid-template-columns: repeat(2, 1fr); }

.notice { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; padding: 10px 12px; border-radius: var(--radius-s); font-size: 13px; }
.notice .i { margin-top: 1px; }
.notice.error { background: var(--crit-soft); color: #8f2017; }
.notice.info { background: var(--surface-2); color: var(--ink-2); }
.notice pre { margin: 0; white-space: pre-wrap; font: inherit; overflow-wrap: anywhere; }

.tabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 2px; padding-top: 8px; background: var(--surface); border-bottom: 1px solid var(--rule); }
.tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 550; cursor: pointer; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-color: var(--accent); }
.tabs .count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.toolbar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 6px; font-size: 13px; color: var(--ink-2); }
.toolbar-row .spacer { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* port list */
.ports { list-style: none; margin: 0; padding: 0; }
.port { border-bottom: 1px solid var(--rule); }
.port > button { width: 100%; display: grid; grid-template-columns: minmax(0, 1.25fr) 1.1fr .9fr 16px; gap: 10px; align-items: center; padding: 10px 2px; border: 0; background: none; text-align: left; cursor: pointer; }
.port > button:hover { background: var(--surface-2); }
.port > button .chev { color: var(--muted); transition: transform .15s; }
.port.open > button .chev { transform: rotate(90deg); }
.port-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.port-name > div { min-width: 0; }
.port-name b { display: block; font-weight: 650; font-stretch: 87.5%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.port-name small { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.led { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--passive); }
.led.ok { background: var(--ok); } .led.warning { background: var(--warn); } .led.critical, .led.down { background: var(--crit); }
.traffic { font-size: 12px; color: var(--ink-2); line-height: 1.4; font-variant-numeric: tabular-nums; font-stretch: 87.5%; }
.traffic span { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.traffic .i { width: 12px; height: 12px; color: var(--muted); }
.port-detail { padding: 0 2px 12px; }
.port-detail .facts { margin-top: 0; }
.port-detail .btn { margin-top: 10px; }

/* optical power meter: -40 .. 0 dBm */
.meter { font-size: 12px; font-variant-numeric: tabular-nums; font-stretch: 87.5%; min-width: 0; }
.meter-val { font-weight: 650; }
.meter-val.ok { color: var(--ok); } .meter-val.warning { color: #9b5c00; } .meter-val.critical { color: var(--crit); }
.meter-track { position: relative; height: 5px; margin-top: 4px; border-radius: 3px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--rule); }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.meter-fill.ok { background: var(--ok); } .meter-fill.warning { background: var(--warn); } .meter-fill.critical { background: var(--crit); }
.meter-mark { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--ink-2); opacity: .45; }
.muted { color: var(--muted); }

/* neighbors */
.nb { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.nb-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.nb-main { flex: 1; min-width: 0; }
.nb-main b { display: block; font-weight: 650; overflow-wrap: anywhere; }
.nb-main small { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); font-size: 12px; }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); }
.empty .i { width: 28px; height: 28px; color: var(--rule-strong); margin-bottom: 6px; }

/* charts */
.chart-block { margin-top: 14px; }
.chart-block h3 { margin: 0 0 6px; font-size: 13px; font-weight: 650; }
.chart-wrap { position: relative; height: 190px; }

select, input[type=text], input[type=number], input[type=password], input[type=email], input:not([type]), textarea {
    height: 36px; padding: 0 10px; border: 1px solid var(--rule-strong); border-radius: var(--radius-s); background: var(--surface); min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=range] { accent-color: var(--accent); }

/* link ends */
.end { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule); }
.end-head { display: flex; align-items: center; gap: 8px; font-weight: 650; flex-wrap: wrap; }
.end-head small { color: var(--muted); font-weight: 500; }
.end .facts { margin-top: 8px; }

/* ---------------------------------------------------------------- dialog */
dialog {
    width: min(580px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0;
    border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); color: var(--ink);
    box-shadow: 0 24px 64px rgb(21 33 46 / .22);
}
dialog::backdrop { background: rgb(21 33 46 / .32); }
dialog form { margin: 0; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--rule); }
.dlg-head h3 { margin: 0; font-size: 17px; font-weight: 650; }
.dlg-body { padding: 4px 20px; overflow: auto; max-height: calc(100vh - 170px); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--rule); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.form-sec { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.form-sec:last-child { border-bottom: 0; }
.form-sec h4 { margin: 0 0 10px; font-size: 13.5px; font-weight: 650; }
.form-sec p.help { margin: -6px 0 10px; color: var(--muted); font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.field input, .field select, .field textarea { font-weight: 400; color: var(--ink); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg label { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border: 1px solid var(--rule-strong); border-radius: var(--radius-s); cursor: pointer; font-size: 13px; font-weight: 600; }
.seg label small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.type-pick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.type-pick label { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border: 1px solid var(--rule-strong); border-radius: var(--radius-s); cursor: pointer; font-size: 11.5px; font-weight: 550; text-align: center; }
.type-pick input { position: absolute; opacity: 0; pointer-events: none; }
.type-pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.type-pick label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.type-pick .i { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- alarm */
.alarm-wrap { position: relative; }
.alarm-btn { position: relative; color: var(--ink-2); }
.alarm-btn.ringing { color: var(--crit); }
.alarm-btn.ringing .i { animation: ring 1.6s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes ring { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } }
.alarm-count {
    position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
    background: var(--passive); color: #fff; font-size: 11px; font-weight: 650; line-height: 17px; text-align: center;
    font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--surface);
}
.alarm-btn.ringing .alarm-count { background: var(--crit); }

.alarm-panel {
    position: absolute; top: calc(100% + 10px); right: -8px; z-index: 50; width: 380px; max-height: min(520px, calc(100vh - 90px));
    display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule);
    border-radius: var(--radius-m); box-shadow: var(--shadow-float);
}
.alarm-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
.alarm-panel-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.alarm-list { overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.alarm-panel .alarm-item { border: 0; box-shadow: none; border-radius: var(--radius-s); }
.alarm-panel .alarm-item:hover { background: var(--surface-2); }
.alarm-panel-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--rule); }
.alarm-panel-foot .spacer { flex: 1; }
.alarm-setting { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.alarm-setting.on { color: var(--ok); }
.alarm-empty { display: flex; align-items: center; gap: 10px; padding: 18px 10px; color: var(--muted); }
.alarm-empty .i { color: var(--ok); }

.alarm-stack {
    position: absolute; top: 14px; left: 16px; z-index: 6; width: 360px; max-width: calc(100% - 32px);
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.alarm-stack > * { pointer-events: auto; }
.alarm-item {
    display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px;
    background: var(--surface); border: 1px solid #f3c3be; border-radius: var(--radius-m);
    box-shadow: inset 3px 0 0 var(--crit), var(--shadow-float);
}
.alarm-stack .alarm-item { animation: alarm-in .22s ease-out; }
@keyframes alarm-in { from { transform: translateX(-10px); opacity: 0; } }
.alarm-ic {
    grid-row: span 2; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
    background: var(--crit-soft); color: var(--crit);
}
.alarm-stack .alarm-ic { animation: alarm-ping 1.8s ease-out infinite; }
@keyframes alarm-ping { 0% { box-shadow: 0 0 0 0 rgb(210 58 46 / .45); } 70%, 100% { box-shadow: 0 0 0 9px rgb(210 58 46 / 0); } }
.alarm-body { display: flex; flex-direction: column; min-width: 0; font-size: 13px; color: var(--ink-2); }
.alarm-body strong { font-size: 14px; font-weight: 650; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alarm-time { display: inline-flex; align-items: center; gap: 5px; margin-top: 2px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.alarm-actions { grid-column: 2; display: flex; gap: 6px; margin-top: 6px; }
.alarm-item.acked { box-shadow: inset 3px 0 0 var(--rule-strong); border-color: var(--rule); }
.alarm-item.acked .alarm-ic { background: var(--surface-2); color: var(--muted); }
.alarm-more, .alarm-unlock {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-m);
    border: 1px solid var(--rule); background: var(--surface); box-shadow: var(--shadow-float); font-size: 13px; color: var(--ink-2);
}
.alarm-more { cursor: pointer; width: fit-content; }
.alarm-more:hover { border-color: var(--rule-strong); }
.alarm-unlock { background: var(--ink); color: #fff; border-color: var(--ink); }
.alarm-unlock span { flex: 1; }
.alarm-unlock .btn { background: transparent; color: #fff; border-color: #ffffff40; }
.alarm-unlock .btn:hover { background: #ffffff1a; }

.node .halo { fill: none; stroke: var(--crit); stroke-width: 3; opacity: .7; animation: halo 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes halo { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(1.45); opacity: 0; } }
.node.alarming .tile { stroke: var(--crit); stroke-width: 2; }

/* ---------------------------------------------------------------- VLAN */
.notice.warn { background: var(--warn-soft); color: #7a4a00; }
.sec-title { margin: 18px 0 8px; font-size: 13.5px; font-weight: 650; }
.small { font-size: 12px; }
.help-text { margin: 12px 0 4px; color: var(--muted); font-size: 13px; }
.plan-form { margin: 10px 0 4px; }
.linkish { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; text-align: left; }
.linkish:hover { text-decoration: underline; }

.vid {
    display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 24px; padding: 0 7px;
    border: 1px solid #c9d8f3; border-radius: var(--radius-s); background: var(--accent-soft); color: var(--accent);
    font-weight: 650; font-size: 12.5px; font-variant-numeric: tabular-nums; cursor: pointer;
}
button.vid:hover { border-color: var(--accent); }
.vid.static { cursor: inherit; }
.vids { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 10px; }
.vgroup { margin: 10px 0 0; font-size: 13px; }
.vgroup.warn b { color: #8a5300; }

.vlan-list { list-style: none; margin: 4px 0 0; padding: 0; }
.vlan-row {
    width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto 16px; gap: 12px; align-items: center;
    padding: 10px 2px; border: 0; border-bottom: 1px solid var(--rule); background: none; text-align: left; cursor: pointer;
}
.vlan-row:hover { background: var(--surface-2); }
.vlan-row .chev { color: var(--muted); transform: rotate(-90deg); }
.vlan-row-main { min-width: 0; }
.vlan-row-main b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vlan-row-main small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vlan-issue { display: inline-flex; align-items: center; gap: 4px; color: #9b5c00; font-size: 12.5px; font-weight: 600; }

.vrows { list-style: none; margin: 0; padding: 0; }
.vrow { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.vrow.off { opacity: .6; }
.vrow-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.vrow-head b { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.vports { list-style: none; margin: 0; padding: 0; }
.vport { display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr); gap: 8px; align-items: center; padding: 4px 0; font-size: 12.5px; }
.vport-name { font-weight: 600; font-stretch: 87.5%; overflow-wrap: anywhere; }
.vport-dest { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.vport-dest .i { color: var(--muted); }
.role { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.role.r-tagged { background: var(--accent-soft); color: var(--accent); }
.role.r-untagged { background: #efe7fb; color: #6a3fb5; }
.role.r-l3 { background: #e2f3f1; color: #0f766e; }
.role.r-all { background: var(--warn-soft); color: #8a5300; }
.role.r-no, .role.r-noport { background: var(--crit-soft); color: var(--crit); }
.role.r-ok { background: var(--ok-soft); color: var(--ok); }
.role.inactive { opacity: .55; text-decoration: line-through; }

.vdev { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.vdev-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13.5px; }
.vdev-head .muted { margin-left: auto; font-size: 12px; }
.note { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.note.ok { color: var(--ok); }

.issue { margin: 8px 0; padding: 10px 12px; border-radius: var(--radius-s); border: 1px solid var(--rule); font-size: 13px; }
.issue p { margin: 4px 0 0; color: var(--ink-2); }
.issue.warn { background: var(--warn-soft); border-color: #efd3a3; }
.issue.info { background: var(--surface-2); }
.issue.ok { background: var(--ok-soft); border-color: #bfe3cf; }
.issue .btn { margin-top: 8px; }

.cmd { position: relative; margin-top: 8px; background: var(--ink); border-radius: var(--radius-s); }
.cmd pre { margin: 0; padding: 10px 12px; padding-right: 74px; color: #e6edf3; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmd .btn { position: absolute; top: 6px; right: 6px; color: #fff; }
.cmd .btn:hover { background: #ffffff1a; }

.legend-inline { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 8px; font-size: 12px; color: var(--ink-2); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline .sw { width: 22px; height: 4px; border-radius: 2px; background: var(--accent); }
.legend-inline .sw.partial { background: repeating-linear-gradient(90deg, var(--warn) 0 6px, transparent 6px 9px); }
.legend-inline .sw.half { background: repeating-linear-gradient(90deg, var(--passive) 0 6px, transparent 6px 9px); }

.vlan-banner { top: 14px; background: var(--accent); }
.cable.v-none, .tag.v-none { opacity: .14; }
.cable.v-ok .core, .cable.v-plan .core { stroke: var(--accent); stroke-width: 4; stroke-dasharray: none; }
.cable.v-ok .jacket, .cable.v-plan .jacket { stroke: #c9d8f3; stroke-width: 12; }
.cable.v-plan .core { stroke-dasharray: 10 6; animation: plan-flow 1s linear infinite; }
@keyframes plan-flow { to { stroke-dashoffset: -16; } }
.cable.v-partial .core, .cable.v-mode .core { stroke: var(--warn); stroke-width: 4; stroke-dasharray: 7 5; }
.cable.v-partial .jacket, .cable.v-mode .jacket { stroke: #f3dcb2; stroke-width: 12; }
.cable.v-half .core { stroke: var(--passive); stroke-width: 3; stroke-dasharray: 7 5; }
.cable[class*=" v-"] .pulse { display: none; }

/* ---------------------------------------------------------------- lacak jalur */
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.port-detail .btn-row .btn { margin-top: 0; }
.path-form { align-items: flex-end; }
.hops { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--accent); }
.hops li { position: relative; padding: 8px 0 10px 12px; }
.hops li::before { content: ""; position: absolute; left: -21px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.hop-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.hop-head .muted { margin-left: auto; }
.hop-ports { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.hop-ports b { font-weight: 600; font-stretch: 87.5%; }
.hops li p { margin: 4px 0 0; font-size: 12.5px; }
.hop-end.gateway::before { background: var(--ok); border-color: var(--ok); }
.hop-cust::before { background: var(--accent); }
.hop-end.exit::before { background: var(--accent); }
.hop-end.notfound::before, .hop-end.unknown::before, .hop-end.error::before, .hop-end.loop::before { background: var(--warn); border-color: var(--warn); }
.legend-inline .sw.active { background: var(--ok); }
.legend-inline .sw.backup { background: repeating-linear-gradient(90deg, #7aa2e8 0 6px, transparent 6px 9px); }
.cable.v-active .core { stroke: var(--ok); stroke-width: 4.5; stroke-dasharray: 10 6; animation: plan-flow 1s linear infinite; }
.cable.v-active .jacket { stroke: #bfe3cf; stroke-width: 13; }
.cable.v-backup .core { stroke: #7aa2e8; stroke-width: 3; stroke-dasharray: 6 5; }
.cable.v-backup .jacket { stroke: #dbe6f8; stroke-width: 10; }

.path-now { margin: 14px 0 4px; padding: 12px; border: 1px solid #bfe3cf; border-radius: var(--radius-m); background: linear-gradient(var(--ok-soft), var(--surface) 70%); }
.path-now-head { display: flex; align-items: center; gap: 8px; }
.path-now-head .i { color: var(--ok); }
.path-now-head .btn { margin-left: auto; }
.path-now .vids { margin: 8px 0 2px; }
.path-now > p { margin: 6px 0 8px; }
.vid.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.hops.compact li { padding: 5px 0 6px 12px; }
.hops.compact li::before { top: 10px; }
.hops.compact .hop-end p { color: var(--ink-2); }

/* ---------------------------------------------------------------- scan perangkat */
dialog.wide { width: min(820px, calc(100vw - 24px)); }
.scan-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.scan-group { padding: 12px 0 4px; }
.scan-group h4 { margin: 0; font-size: 13.5px; font-weight: 650; }
.scan-group > p { margin: 2px 0 6px; }
.scan-group summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; padding: 4px 0; }
.scan-list { list-style: none; margin: 0; padding: 0; }
.scan-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.scan-item > input { width: 17px; height: 17px; margin: 8px 0 0; accent-color: var(--accent); }
.scan-item:has(.scan-pick:not(:checked)) .scan-main { opacity: .6; }
.scan-row1 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.scan-row1 input[type=text] { flex: 1 1 220px; min-width: 0; height: 32px; }
.scan-row1 select { flex: 0 0 130px; height: 32px; }
.scan-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.scan-ports { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.scan-ports .check { font-weight: 400; font-size: 12.5px; align-items: flex-start; }
.scan-ports .check > span { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.scan-ports .i { color: var(--muted); }

/* ---------------------------------------------------------------- notifikasi */
.notify-opts { display: flex; flex-direction: column; gap: 8px; }
.notify-num { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); padding-left: 23px; }
.notify-num input { width: 72px; height: 30px; }
.notify-log { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; }
.notify-log li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.notify-log .led { margin-top: 6px; }
.notify-log small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- halaman detail (grafik MRTG) */
.detail { position: fixed; inset: var(--topbar) 0 0 0; z-index: 45; overflow: auto; background: var(--canvas); scroll-behavior: smooth; }
.d-wrap { max-width: 1240px; margin: 0 auto; padding: 14px 24px 56px; }

/* kepala */
.d-head { display: flex; align-items: flex-start; gap: 18px; padding: 6px 0 18px; }
.d-back { margin-top: 6px; color: var(--ink-2); }
.d-title { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.d-icon { width: 46px; height: 46px; flex: none; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center; }
.d-icon .i { width: 24px; height: 24px; }
.d-title-text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }
.d-title-text h2 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 700; font-stretch: 112.5%; letter-spacing: -.4px; overflow-wrap: anywhere; }
.d-meta { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); }
.d-meta span { display: inline-flex; align-items: center; gap: 5px; }
.d-meta .i { width: 14px; height: 14px; }

/* panel depan: port sebagai LED */
.faceplate { background: linear-gradient(#26313d, #1b2530); border-radius: 12px; padding: 14px 16px 12px; color: #c9d3dd; box-shadow: inset 0 1px 0 rgb(255 255 255 / .06); }
.fp-body { display: flex; flex-wrap: wrap; gap: 14px 26px; }
.fp-group { display: flex; flex-direction: column; gap: 6px; }
.fp-label { font-size: 11.5px; color: #8fa0b1; letter-spacing: .2px; }
.fp-ports { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); gap: 5px; }
.fp-group:only-child .fp-ports, .fp-ports:has(> :nth-child(-n+4):last-child) { grid-template-rows: auto; }
.fp-port { width: 38px; height: 38px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 1px solid #3a4756; border-radius: 6px; background: #121a22; color: #c9d3dd; cursor: pointer; padding: 0; }
.fp-port:hover { border-color: #6d8199; }
.fp-port.sel { border-color: #7fb0ff; box-shadow: 0 0 0 2px rgb(127 176 255 / .35); }
.fp-led { width: 9px; height: 9px; border-radius: 2px; background: #3a4756; }
.fp-no { font-size: 11px; font-weight: 600; font-stretch: 87.5%; font-variant-numeric: tabular-nums; }
.h-ok .fp-led, .fp-legend .h-ok { background: #2fd08a; box-shadow: 0 0 6px rgb(47 208 138 / .6); }
.h-warning .fp-led, .fp-legend .h-warning { background: #f2a93b; box-shadow: 0 0 6px rgb(242 169 59 / .6); }
.h-critical .fp-led, .h-down .fp-led, .fp-legend .h-critical { background: #ff5a4d; box-shadow: 0 0 6px rgb(255 90 77 / .6); }
.h-off .fp-led, .h-disabled .fp-led, .h-unknown .fp-led, .fp-legend .h-off { background: #3a4756; box-shadow: none; }
.fp-sel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #33404e; font-size: 13px; }
.fp-sel b { color: #fff; font-weight: 600; }
.fp-sel span { display: inline-flex; align-items: center; gap: 5px; }
.fp-sel .meter-val { padding: 1px 7px; border-radius: 4px; background: rgb(255 255 255 / .08); }
.fp-sel .meter-val.ok { color: #2fd08a; } .fp-sel .meter-val.warning { color: #f2a93b; } .fp-sel .meter-val.critical { color: #ff7a6e; }
.fp-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; font-size: 11.5px; color: #8fa0b1; }
.fp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fp-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* kabel (detail link) */
.cable-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 1.3fr) minmax(0, 1fr); align-items: stretch; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.ch-end { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px; }
.ch-end:last-child { text-align: right; align-items: flex-end; }
.ch-side { font-size: 12px; color: var(--muted); }
.ch-dev { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.ch-dev b { font-weight: 650; overflow-wrap: anywhere; }
.ch-port { font-size: 13px; font-weight: 600; font-stretch: 87.5%; color: var(--ink-2); overflow-wrap: anywhere; }
.ch-state { font-size: 12.5px; color: var(--muted); }
.ch-power { font-size: 13px; }
.ch-end .btn { margin-top: 6px; }
.ch-wire { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 14px 8px; background: var(--surface-2); border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); }
.ch-line { height: 10px; border-radius: 5px; background: var(--jacket); position: relative; margin: 2px 0; }
.ch-line i { position: absolute; left: 0; right: 0; top: 4px; height: 2px; background: var(--ok); }
.cable-hero.s-warning .ch-line i { background: var(--warn); }
.cable-hero.s-critical .ch-line i { background: var(--crit); }
.cable-hero.s-down .ch-line { background: #f1cdc9; }
.cable-hero.s-down .ch-line i { background: repeating-linear-gradient(90deg, var(--crit) 0 7px, transparent 7px 12px); }
.cable-hero.s-passive .ch-line i, .cable-hero.s-unknown .ch-line i { background: var(--passive); }
.ch-rate { display: flex; align-items: baseline; justify-content: center; gap: 6px; flex-wrap: wrap; color: var(--accent); }
.ch-rate.up { color: #0f766e; }
.ch-rate .i { align-self: center; }
.ch-rate span { font-size: 12px; font-weight: 650; }
.ch-rate b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.3px; color: var(--ink); }
.ch-rate small { flex-basis: 100%; text-align: center; font-size: 11.5px; color: var(--muted); }

/* strip pembacaan */
.d-readout { display: flex; flex-wrap: wrap; margin: 12px 0 18px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
.d-readout > div { flex: 1 1 140px; padding: 10px 16px; border-left: 1px solid var(--rule); }
.d-readout > div:first-child { border-left: 0; }
.d-readout dt { font-size: 12px; color: var(--muted); }
.d-readout dd { margin: 2px 0 0; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.2px; overflow-wrap: anywhere; }
.d-readout .s-down dd { color: var(--crit); }
.d-readout .s-warning dd, .d-readout .s-critical dd { color: #9b5c00; }
.d-readout .s-up dd, .d-readout .s-ok dd { color: var(--ok); }

/* navigasi + isi */
.d-layout { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 22px; align-items: start; }
.d-nav { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.d-nav a { padding: 6px 10px; border-left: 2px solid var(--rule); color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 550; }
.d-nav a:hover { color: var(--ink); }
.d-nav a.on { color: var(--accent); border-left-color: var(--accent); }
.d-main { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; min-width: 0; }
.d-sec { padding: 20px 22px 22px; border-top: 1px solid var(--rule); scroll-margin-top: 12px; }
.d-sec:first-child { border-top: 0; }
.d-main > .notice { margin: 16px 22px; }
.d-sec-head { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.d-sec-head h3 { margin: 0 auto 0 0; font-size: 17px; font-weight: 650; font-stretch: 106%; letter-spacing: -.2px; }
.d-hint { font-size: 12.5px; color: var(--muted); }
.d-note { margin: -4px 0 14px; font-size: 12.5px; color: var(--muted); max-width: 72ch; }
.d-sec figure { margin: 0; }
.d-sec figcaption { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline select { height: 32px; min-width: 220px; }
.seg-periods { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius-s); overflow: hidden; background: var(--surface-2); }
.seg-periods button { border: 0; background: none; padding: 6px 12px; font-size: 13px; font-weight: 550; color: var(--ink-2); cursor: pointer; }
.seg-periods button + button { border-left: 1px solid var(--rule); }
.seg-periods button.active { background: var(--surface); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.d-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.d-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.d-gap-top { margin-top: 20px; }
.d-chart { position: relative; height: 180px; }
.d-chart.tall { height: 280px; }
.d-empty { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; min-height: 110px; color: var(--muted); font-size: 13px; text-align: center; padding: 0 12px; }
.d-empty .spin { animation: spin .9s linear infinite; }

/* grafik MRTG 2x2 */
.mrtg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 28px; }
.mrtg { margin: 0; }
.mrtg figcaption { font-size: 13px; font-weight: 600; color: var(--ink); }
.mrtg-chart { position: relative; height: 190px; }
.mrtg-stats { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mrtg-stats th { text-align: right; font-weight: 500; color: var(--muted); padding: 3px 0 3px 12px; border-bottom: 1px solid var(--rule); }
.mrtg-stats th:first-child, .mrtg-stats td:first-child { text-align: left; padding-left: 0; }
.mrtg-stats td { text-align: right; padding: 3px 0 3px 12px; }
.mrtg-stats td:first-child { font-weight: 650; display: flex; align-items: center; gap: 6px; }
.mrtg-stats .sw { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.mrtg-stats .sw.down { background: var(--accent); }
.mrtg-stats .sw.up { background: #0f766e; }

/* tabel */
.d-table-wrap { overflow: auto; margin: 0 -2px; }
.d-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.d-table th { position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 7px 12px 7px 0; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
.d-table td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.d-table td:first-child { font-weight: 600; font-stretch: 87.5%; }
.d-table td:first-child .led { display: inline-block; margin-right: 7px; }
.d-table td small { display: block; color: var(--muted); font-weight: 400; }
.d-table tbody tr[data-dport] { cursor: pointer; }
.d-table tbody tr:hover { background: var(--surface-2); }
.d-table tbody tr.sel { background: var(--accent-soft); }

body.detail-open .rail, body.detail-open .inspector { visibility: hidden; }

@media (max-width: 1100px) { .mrtg-grid { grid-template-columns: 1fr; } }
@media (max-width: 980px) {
    .d-layout { grid-template-columns: 1fr; }
    .d-nav { position: sticky; top: 0; z-index: 3; flex-direction: row; overflow-x: auto; gap: 0; padding: 6px 0; background: var(--canvas); }
    .d-nav a { border-left: 0; border-bottom: 2px solid var(--rule); white-space: nowrap; }
    .d-nav a.on { border-bottom-color: var(--accent); }
    .d-grid3, .d-grid2 { grid-template-columns: 1fr; }
    .cable-hero { grid-template-columns: 1fr; }
    .ch-end:last-child { text-align: left; align-items: flex-start; }
    .ch-wire { border: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
}
@media (max-width: 760px) {
    .d-wrap { padding: 10px 12px 32px; }
    .d-head { flex-direction: column; gap: 8px; }
    .d-back { margin: 0; }
    .d-title-text h2 { font-size: 21px; }
    .d-sec { padding: 16px 14px; }
    .field.inline select { min-width: 0; max-width: 60vw; }
    .mrtg-chart { height: 170px; }
    .d-readout > div { flex-basis: 45%; border-left: 0; border-top: 1px solid var(--rule); }
}
@media (prefers-reduced-motion: reduce) { .detail { scroll-behavior: auto; } }

/* ---------------------------------------------------------------- alokasi VLAN di halaman detail */
.dv-search { height: 32px; min-width: 240px; }
.dv-table td { vertical-align: top; white-space: normal; }
.dv-table td:first-child { width: 64px; }
.dv-name { min-width: 120px; max-width: 220px; font-weight: 500; }
.dv-ports { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.dv-ports li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.dv-ports b { font-weight: 600; font-stretch: 87.5%; }
.dv-ports .i { color: var(--muted); }
.dv-reach { min-width: 260px; }
.reach-route { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.reach-route .i { color: var(--muted); }
.reach-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.reach-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border: 1px solid var(--rule); border-radius: 999px; font-size: 12px; background: var(--surface); }
.reach-chip.passive { color: var(--ink-2); background: var(--surface-2); }
.reach-exit { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--ink-2); }
.reach-exit span { display: inline-flex; align-items: center; gap: 4px; }
.dv-sub { margin: 16px 0 6px; }
.d-table tbody tr[data-v] { cursor: default; }
@media (max-width: 760px) { .dv-search { min-width: 0; flex: 1; } }

/* ---------------------------------------------------------------- alokasi port */
.bp-table td:first-child { min-width: 170px; }
.bp-table td:first-child small { display: block; color: var(--muted); font-weight: 400; }
.bp-table td:nth-child(2) { white-space: nowrap; }
.br-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.br-list li { display: grid; grid-template-columns: 150px minmax(90px, 160px) minmax(0, 1fr); gap: 8px; align-items: start; padding: 4px 0; border-top: 1px dashed var(--rule); font-size: 12.5px; }
.br-list li:first-child { border-top: 0; }
.br-vid { display: inline-flex; align-items: center; gap: 5px; }
.br-name { color: var(--ink-2); overflow-wrap: anywhere; }
.br-to { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.br-route, .br-leaf, .br-exit { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.br-route { font-weight: 600; }
.br-to .i { color: var(--muted); }
@media (max-width: 900px) { .br-list li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------------------------------------------------------------- tooltip & popup port */
.port-tip { position: fixed; z-index: 70; max-width: 320px; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px;
    background: var(--ink); color: #e6edf3; border-radius: 9px; box-shadow: 0 10px 28px rgb(21 33 46 / .28); font-size: 12.5px; pointer-events: none; }
.port-tip b { color: #fff; font-size: 13.5px; font-weight: 650; font-stretch: 87.5%; }
.port-tip .tip-sub { color: #aab7c4; }
.port-tip .tip-row { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.port-tip .tip-row em { font-style: normal; color: #aab7c4; }
.port-tip small, .port-tip .muted { color: #8fa0b1; }
.port-tip .i { color: #8fa0b1; }
.port-tip .meter-val.ok { color: #2fd08a; } .port-tip .meter-val.warning { color: #f2a93b; } .port-tip .meter-val.critical { color: #ff7a6e; }
.port-tip .tip-hint { margin-top: 4px; color: #7fb0ff; font-size: 11.5px; }
dialog.port-modal { width: min(760px, calc(100vw - 24px)); }
.pm-body { padding-top: 14px; padding-bottom: 16px; }
.pm-body section { margin-top: 16px; }
.pm-body h4 { margin: 0 0 6px; font-size: 13.5px; font-weight: 650; }
.pm-body h4 .muted { font-weight: 500; font-size: 12px; }
.pm-comment { margin: 0 0 10px; color: var(--ink-2); }
.pm-peer { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); }
.pm-peer > .i { color: var(--accent); margin-top: 2px; }
.pm-peer > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13.5px; }
.pm-peer b { font-weight: 650; }
.pm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.pm-grid .pm-wide { grid-column: 1 / -1; }
.pm-grid .facts { margin-top: 4px; }
.pm-vid { display: inline-flex; align-items: center; gap: 4px; }
.pm-chart { position: relative; height: 170px; }
@media (max-width: 640px) { .pm-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- riwayat kejadian */
.ev-summary { display: flex; flex-wrap: wrap; margin: 0 0 14px; border: 1px solid var(--rule); border-radius: 10px; }
.ev-summary > div { flex: 1 1 120px; padding: 8px 14px; border-left: 1px solid var(--rule); }
.ev-summary > div:first-child { border-left: 0; }
.ev-summary dt { font-size: 12px; color: var(--muted); }
.ev-summary dd { margin: 2px 0 0; font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ev-summary .bad dd { color: var(--crit); }
.ev-summary .warn dd { color: #9b5c00; }
.ev-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.ev-filters button { height: 30px; padding: 0 11px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); font-size: 13px; color: var(--ink-2); cursor: pointer; }
.ev-filters button span { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 2px; }
.ev-filters button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.ev-day { margin-top: 12px; }
.ev-day h4 { margin: 0 0 4px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.ev-list { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: auto; }
.ev { display: grid; grid-template-columns: 70px 26px minmax(0, 1fr); gap: 10px; align-items: start; padding: 7px 0; border-top: 1px solid var(--rule); }
.ev:first-child { border-top: 0; }
.ev time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 3px; }
.ev-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.ev.sev-crit .ev-dot { background: var(--crit-soft); color: var(--crit); }
.ev.sev-warn .ev-dot { background: var(--warn-soft); color: #9b5c00; }
.ev.sev-ok .ev-dot { background: var(--ok-soft); color: var(--ok); }
.ev-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 13px; min-width: 0; }
.ev-body b { font-weight: 650; }
.ev-body span { color: var(--ink-2); overflow-wrap: anywhere; }
.ev-body small { flex-basis: 100%; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- kuota & 95th */
#dUsage .d-readout { margin-top: 0; }
.d-readout .s-bill dd { color: var(--accent); }
.u-chart { margin: 6px 0 16px; }
.u-chart .d-chart { height: 220px; }
.u-table tr.cur td { background: var(--accent-soft); }
.u-table td:first-child small { display: inline; margin-left: 6px; color: var(--accent); font-weight: 500; }

/* ---------------------------------------------------------------- jalur dengan beberapa gateway */
.cable.v-gw .core { stroke: var(--accent); stroke-width: 3.5; stroke-dasharray: none; }
.cable.v-gw .jacket { stroke: #c9d8f3; stroke-width: 11; }
.legend-inline .sw.gw { background: var(--accent); }
.gw-list { margin: 6px 0 10px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface-2); }
.gw-list h5 { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.gw-item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 5px 0; font-size: 13px; border-top: 1px solid var(--rule); }
.gw-item:first-of-type { border-top: 0; }
.gw-item small { flex-basis: 100%; color: var(--muted); font-size: 12px; padding-left: 23px; }
.gw-item.on b { color: var(--ok); }

/* ---------------------------------------------------------------- copyright */
.credit { position: absolute; right: 66px; bottom: 18px; z-index: 4; margin: 0; font-size: 11.5px; color: var(--muted); letter-spacing: .1px; pointer-events: none; }
.login-credit { position: static; margin-top: 28px; text-align: center; }

/* ---------------------------------------------------------------- toast */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: var(--radius-m); box-shadow: var(--shadow-float); font-size: 13px; animation: toast-in .18s ease-out; max-width: calc(100vw - 32px); }
.toast.err { background: var(--crit); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------------------------------------------------------------- login */
body.login-page { overflow: auto; display: grid; grid-template-columns: 1.15fr 1fr; min-height: 100%; }
.login-art { position: relative; background: var(--canvas); border-right: 1px solid var(--rule); overflow: hidden; min-height: 100vh; }
.login-art > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-side { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { margin: 22px 0 0; font-size: 24px; font-weight: 650; letter-spacing: -.3px; }
.login-card > p { margin: -8px 0 4px; color: var(--muted); }
.login-card .btn { height: 40px; }
.alert { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--radius-s); background: var(--crit-soft); color: #8f2017; font-size: 13px; }

/* ---------------------------------------------------------------- mode teknisi (hanya-baca, tanpa traffic) */
body.readonly .edit-only { display: none !important; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
    .user-name { display: none; }
    .chip .chip-label { display: none; }
}

@media (max-width: 760px) {
    :root { --topbar: 52px; --rail: 0px; }
    .topbar { gap: 8px; padding: 0 10px; }
    .brand-name { display: none; }
    .search { flex: 1; }
    .live-label { display: none; }
    .user { padding-left: 6px; }
    .rail {
        top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 60px;
        flex-direction: row; justify-content: space-around; padding: 0 8px env(safe-area-inset-bottom);
        border-right: 0; border-top: 1px solid var(--rule);
    }
    .rail-sep { display: none; }
    .tool[data-tip]:hover::after, .tool[data-tip]:focus-visible::after { display: none; }
    .stage { bottom: 60px; }
    .legend { display: none; }
    .alarm-stack { left: 12px; right: 12px; top: 10px; width: auto; max-width: none; }
    .alarm-wrap { position: static; }
    .alarm-panel { position: fixed; top: calc(var(--topbar) + 8px); left: 8px; right: 8px; width: auto; }
    .zoom { right: 12px; bottom: 12px; }
    .inspector {
        top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 74vh;
        border-radius: 16px 16px 0 0; border-bottom: 0; z-index: 40;
    }
    .sheet-handle { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--rule-strong); margin: 8px auto 0; }
    .facts { grid-template-columns: repeat(2, 1fr); }
    .type-pick { grid-template-columns: repeat(4, 1fr); }
    .seg, .grid2 { grid-template-columns: 1fr; }
    .vport { grid-template-columns: minmax(0, 1fr) auto; }
    .vport-dest { grid-column: 1 / -1; }
    body.login-page { grid-template-columns: 1fr; }
    .login-art { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .pulse { animation: none; opacity: 0; }
    .live.on .live-dot, .node.flash .tile, .toast, .btn .spin,
    .alarm-btn.ringing .i, .alarm-stack .alarm-item, .alarm-stack .alarm-ic { animation: none; }
    .node .halo { animation: none; opacity: .5; }
    .cable.v-plan .core, .cable.v-active .core { animation: none; }
}
