/* Home Server ↔ Warehouse — demo jaringan interaktif
   Token warna: dark-first (konsol jaringan), varian terang untuk siang hari. */
:root {
  --bg: #0b1220;
  --bg-2: #0f172a;
  --panel: #131d33;
  --panel-2: #182440;
  --line: #24314f;
  --line-2: #33436a;
  --text: #e7edf8;
  --muted: #8d9dbd;
  --accent: #58c6f2;        /* cyan sinyal — pilihan, link, fokus */
  --accent-ink: #062033;
  --packet: #f6b34d;        /* amber — paket yang bergerak */
  --ok: #3ad889;
  --warn: #f6b34d;
  --bad: #f2647a;
  --wifi: #a78bfa;
  --antenna: #f6b34d;
  --public: #58c6f2;
  --zone-home: rgba(88, 198, 242, .06);
  --zone-wh: rgba(58, 216, 137, .06);
  --zone-public: rgba(246, 179, 77, .07);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 10px;
  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef2f9; --bg-2: #f7f9fd; --panel: #ffffff; --panel-2: #f2f5fb; --line: #d5dceb; --line-2: #b9c4dc;
  --text: #0f1b31; --muted: #5b6b8c; --accent: #0f7fb5; --accent-ink: #ffffff; --packet: #d98a10;
  --ok: #158a52; --warn: #c27a06; --bad: #c9364e; --wifi: #6d4fd6; --antenna: #d98a10; --public: #0f7fb5;
  --zone-home: rgba(15, 127, 181, .06); --zone-wh: rgba(21, 138, 82, .07); --zone-public: rgba(217, 138, 16, .08);
  --shadow: 0 10px 30px rgba(20, 40, 80, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef2f9; --bg-2: #f7f9fd; --panel: #ffffff; --panel-2: #f2f5fb; --line: #d5dceb; --line-2: #b9c4dc;
    --text: #0f1b31; --muted: #5b6b8c; --accent: #0f7fb5; --accent-ink: #ffffff; --packet: #d98a10;
    --ok: #158a52; --warn: #c27a06; --bad: #c9364e; --wifi: #6d4fd6; --antenna: #d98a10; --public: #0f7fb5;
    --zone-home: rgba(15, 127, 181, .06); --zone-wh: rgba(21, 138, 82, .07); --zone-public: rgba(217, 138, 16, .08);
    --shadow: 0 10px 30px rgba(20, 40, 80, .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  padding-inline: 16px;
  padding-block: 0 24px;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
a { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, pre, .mono { font-family: var(--font-mono); }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-block: 14px 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(140deg, var(--accent), var(--packet)); display: grid; place-items: center; color: #08131f; font-family: var(--font-display); font-weight: 700; }
.brand h1 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.brand p { margin: 0; color: var(--muted); font-size: 12px; }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 12px; color: var(--muted); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.chip.down .dot { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); }
.btn {
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px; padding: 7px 12px; cursor: pointer;
  font-weight: 500; transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { background: color-mix(in srgb, var(--bad) 18%, var(--panel-2)); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 14px; align-items: start; }
@media (max-width: 1080px) { .app { grid-template-columns: 1fr; } }
.stage { display: grid; gap: 12px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.panel-h h2 { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.panel-b { padding: 12px 14px; }

/* ---------- topology ---------- */
.topo-wrap { position: relative; }
.topo { width: 100%; height: auto; display: block; border-radius: var(--radius); background: radial-gradient(1200px 500px at 30% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%), var(--bg-2); }
.zone rect { fill: var(--zone-fill); stroke: var(--line-2); stroke-dasharray: 5 5; rx: 14; }
.zone text { font-family: var(--font-display); font-size: 11px; letter-spacing: .12em; fill: var(--muted); font-weight: 600; }
.link { stroke: var(--line-2); stroke-width: 2; fill: none; transition: stroke .2s; }
.link.trunk { stroke-width: 3; }
.link.wifi { stroke: var(--wifi); stroke-dasharray: 2 5; stroke-linecap: round; }
.link.antenna { stroke: var(--antenna); stroke-dasharray: 8 6; stroke-width: 2.5; }
.link.public { stroke: var(--public); stroke-dasharray: 1 4; stroke-linecap: round; stroke-width: 2.5; }
.link.active { stroke: var(--packet); stroke-dasharray: none; filter: drop-shadow(0 0 4px var(--packet)); }
.link.down { stroke: var(--bad); stroke-dasharray: 3 6; opacity: .55; }
.link-label { font-family: var(--font-mono); font-size: 9.5px; fill: var(--muted); }
.node { cursor: pointer; }
.node .body { fill: var(--panel); stroke: var(--line-2); stroke-width: 1.5; rx: 9; transition: stroke .15s, fill .15s; }
.node:hover .body, .node.selected .body { stroke: var(--accent); fill: var(--panel-2); }
.node.hit .body { stroke: var(--packet); filter: drop-shadow(0 0 6px var(--packet)); }
.node.dropped .body { stroke: var(--bad); filter: drop-shadow(0 0 6px var(--bad)); }
.node .glyph { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.node.server .glyph, .node.pc .glyph, .node.laptop .glyph, .node.printer .glyph { stroke: var(--text); }
.node.solar .glyph { stroke: var(--packet); }
.node.attacker .body { stroke: var(--bad); }
.node.attacker .glyph { stroke: var(--bad); }
.node .name { font-size: 10.5px; fill: var(--text); text-anchor: middle; font-weight: 500; }
.node .ip { font-family: var(--font-mono); font-size: 8px; fill: var(--muted); text-anchor: middle; }
.packet { fill: var(--packet); stroke: #0008; stroke-width: .5; filter: drop-shadow(0 0 5px var(--packet)); }
.packet.reply { fill: var(--ok); filter: drop-shadow(0 0 5px var(--ok)); }
.packet.dropped { fill: var(--bad); filter: drop-shadow(0 0 5px var(--bad)); }
.packet.flood { fill: var(--bad); r: 3; }
.xmark { stroke: var(--bad); stroke-width: 3; stroke-linecap: round; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--line-2); }
.legend i.trunk { border-top-width: 3px; }
.legend i.wifi { border-top: 2px dotted var(--wifi); }
.legend i.antenna { border-top: 2px dashed var(--antenna); }
.legend i.public { border-top: 2px dotted var(--public); }

/* ---------- event log ---------- */
.log { max-height: 190px; overflow: auto; font-family: var(--font-mono); font-size: 12px; padding: 8px 14px; display: flex; flex-direction: column; gap: 3px; }
.log .row { display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 3px 0; border-bottom: 1px dashed color-mix(in srgb, var(--line) 70%, transparent); }
.log .t { color: var(--muted); }
.log .ok { color: var(--ok); } .log .bad { color: var(--bad); } .log .warn { color: var(--warn); } .log .info { color: var(--accent); }
.log:empty::before { content: "Belum ada kejadian — jalankan simulasi."; color: var(--muted); }

/* ---------- side panel & tabs ---------- */
.side { position: sticky; top: 12px; display: grid; gap: 12px; }
@media (max-width: 1080px) { .side { position: static; } }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex: 1; background: none; border: 0; padding: 11px 6px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; font-family: var(--font-display); font-size: 13px; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabpanel[hidden] { display: none; }
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field select, .field input { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-block: 8px 10px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked { background: var(--bad); }
.switch input:checked::after { left: 16px; }
.speed { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.speed input { width: 90px; accent-color: var(--accent); }

.hops { display: grid; gap: 6px; }
.hop { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); border-left: 3px solid var(--line-2); font-size: 12.5px; }
.hop.ok { border-left-color: var(--ok); } .hop.bad { border-left-color: var(--bad); } .hop.warn { border-left-color: var(--warn); } .hop.info { border-left-color: var(--accent); }
.hop .n { font-family: var(--font-mono); color: var(--muted); }
.hop b { display: block; font-weight: 600; }
.hop small { color: var(--muted); }
.result { padding: 10px 12px; border-radius: 8px; font-weight: 600; margin-bottom: 10px; display: none; }
.result.ok { display: block; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.result.bad { display: block; background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.stat { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.stat .v { font-family: var(--font-display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- config / terminal ---------- */
.term { background: #070c16; color: #d8e2f2; border-radius: 8px; border: 1px solid var(--line); font-family: var(--font-mono); font-size: 12px; line-height: 1.55; padding: 10px 12px; height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
:root[data-theme="light"] .term { background: #0f1b31; }
.term .p { color: #8fd6ff; } .term .c { color: #ffd27a; } .term .x { color: #ffffff; } .term .e { color: #7fe0a8; font-style: italic; } .term .err { color: #ff8aa0; }
.term-in { display: flex; gap: 8px; margin-top: 8px; }
.term-in input { flex: 1; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font-family: var(--font-mono); }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.hint code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.cfg-explain { display: grid; gap: 6px; margin-top: 10px; max-height: 220px; overflow: auto; }
.cfg-explain .item { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 7px 10px; border-radius: 8px; background: var(--panel-2); border-left: 3px solid var(--accent); font-size: 12.5px; }
.cfg-explain .item code { font-size: 12px; }
.cfg-explain .item span { color: var(--muted); }

/* ---------- tests ---------- */
.tests { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tests th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 6px; border-bottom: 1px solid var(--line); }
.tests td { padding: 7px 6px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); vertical-align: top; }
.tests tr.running td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; font-family: var(--font-mono); }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.pill.wait { background: var(--panel-2); color: var(--muted); }
.pill.run { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.summary { display: flex; gap: 10px; align-items: center; margin-block: 10px; font-size: 13px; }
.bar { flex: 1; height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); width: 0; transition: width .3s; }

/* ---------- attack sim ---------- */
.guard { display: grid; gap: 10px; }
.guard-log { background: #070c16; color: #cfd9ea; border-radius: 8px; font-family: var(--font-mono); font-size: 11.5px; padding: 10px; height: 170px; overflow: auto; border: 1px solid var(--line); }
:root[data-theme="light"] .guard-log { background: #0f1b31; }
.guard-log .l-ok { color: #7fe0a8; } .guard-log .l-warn { color: #ffd27a; } .guard-log .l-bad { color: #ff8aa0; } .guard-log .l-dim { color: #7f8fb0; }
.meter { position: relative; height: 12px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--ok), var(--warn) 60%, var(--bad)); transition: width .15s linear; }
.meter b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); left: 60%; }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--panel); border: 1px solid var(--bad); border-left-width: 4px; border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); max-width: 340px; font-size: 13px; transform: translateY(20px); opacity: 0; transition: .25s; pointer-events: none; z-index: 10; }
.toast.show { transform: none; opacity: 1; }
.toast b { display: block; font-family: var(--font-display); }

.foot { color: var(--muted); font-size: 12px; margin-top: 16px; display: flex; gap: 14px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- hero & penjelasan ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: center; margin-bottom: 14px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 12%, var(--panel)), var(--panel) 55%, color-mix(in srgb, var(--packet) 10%, var(--panel))); }
.hero h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 6px; }
.hero p { margin: 0; color: var(--muted); max-width: 62ch; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.stats .stat { text-align: center; background: color-mix(in srgb, var(--panel-2) 80%, transparent); border: 1px solid var(--line); }
.stats .v { color: var(--accent); }
@media (max-width: 1080px) { .hero { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(3, 1fr); } }
.intro { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; line-height: 1.5; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); border-left: 3px solid var(--accent); }
.intro code { background: var(--bg-2); padding: 0 4px; border-radius: 4px; }
.about { padding: 6px 14px 10px; }
.about details { border-bottom: 1px solid var(--line); }
.about details:last-child { border-bottom: 0; }
.about summary { cursor: pointer; padding: 11px 0; font-family: var(--font-display); font-weight: 600; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 10px; }
.about summary::-webkit-details-marker { display: none; }
.about summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); transition: transform .15s; }
.about details[open] summary::before { transform: rotate(45deg); }
.about .body { padding: 0 0 14px 18px; color: var(--text); font-size: 13.5px; max-width: 78ch; }
.about .body p { margin: 6px 0; } .about .body ol { padding-left: 20px; margin: 6px 0; } .about .body li { margin: 4px 0; }
.about .body code { background: var(--panel-2); padding: 0 5px; border-radius: 4px; font-size: 12.5px; }
table.mini { border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 6px 0; }
table.mini th, table.mini td { border: 1px solid var(--line); padding: 5px 7px; text-align: left; vertical-align: top; }
table.mini th { background: var(--panel-2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.devcard:empty::before { content: "Belum ada perangkat dipilih — klik ikon di topologi."; color: var(--muted); font-size: 13px; }
.devcard .head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.devcard .badge { width: 44px; height: 44px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); display: grid; place-items: center; }
.devcard .badge svg { width: 30px; height: 30px; }
.devcard h3 { font-size: 16px; font-weight: 600; }
.devcard .role { color: var(--accent); font-size: 12.5px; }
.devcard dl { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; margin: 10px 0; font-size: 13px; }
.devcard dt { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.devcard dd { margin: 0; }
.devcard .iface { display: grid; gap: 3px; font-family: var(--font-mono); font-size: 12px; }
.devcard .iface span { display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; border-radius: 6px; background: var(--panel-2); }
.devcard .iface small { color: var(--muted); }
.devcard .real { padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--packet) 10%, var(--panel-2)); border-left: 3px solid var(--packet); font-size: 12.5px; }
.devcard .real b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }
.devcard .actions { margin-top: 12px; }
