/* ============================================================
   DISKOMINFO GOWA — Optical Signal Console
   A fiber-telemetry NOC skin. Chrome only: every class/id that
   app.js & topology.js rely on is preserved.
   ============================================================ */
:root {
  --void: #06110f;
  --void-2: #040b0a;
  --panel: #0a191b;
  --panel-2: #0f282b;
  --glass: rgba(20, 46, 49, 0.5);
  --line: #1c3940;
  --line-soft: #132528;

  /* signal language — light travelling through glass */
  --signal: #34e6d6;      /* primary aqua */
  --signal-2: #4bb6ff;    /* electric blue, heavy flow */
  --signal-deep: #0e6f72;
  --grad-signal: linear-gradient(100deg, #34e6d6 0%, #4bb6ff 100%);
  --fiber: #34e6d6;       /* alias kept for legacy rules */
  --fiber-dim: #14595c;

  --amber: #ffb14e;
  --mint: #4fe0a0;
  --rose: #ff5d6e;

  --ink: #e7f4f3;
  --muted: #6f9095;

  --up: #4fe0a0;
  --down: #ff5d6e;
  --warn: #ffb14e;

  --core: #34e6d6;
  --border: #7fe2ea;
  --dist: #8fc7a6;
  --access: #cbb072;
  --upstream: #ffb14e;
  --server: #a78bff;

  --radius: 6px;
  --radius-lg: 12px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --disp: "Chakra Petch", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
}

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

body {
  background:
    radial-gradient(1100px 560px at 72% -12%, #0f2c30 0%, transparent 62%),
    radial-gradient(900px 500px at 8% 110%, #0a1f22 0%, transparent 60%),
    var(--void);
  color: var(--ink);
  font-family: var(--body);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
/* faint optical-rack texture — barely-there vertical striping */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.014) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay; opacity: .5;
}

.grid {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 250px 1fr 350px;
  grid-template-rows: 66px 1fr;
  grid-template-areas:
    "top top top"
    "rail stage detail";
  height: 100vh;
  gap: 1px;
  background: var(--line-soft);
}

/* ---------- Topbar : the powered bus bar ---------- */
.topbar {
  grid-area: top; position: relative;
  background: linear-gradient(180deg, #081517 0%, var(--void-2) 100%);
  display: flex; align-items: center; gap: 30px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  animation: powerOn .5s ease both;
}
/* glowing conductor along the bottom edge */
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--signal-deep) 12%, var(--signal) 46%, var(--signal-2) 62%, var(--signal-deep) 84%, transparent 100%);
  opacity: .85; box-shadow: 0 0 14px rgba(52,230,214,.35);
}
/* travelling signal pulse */
.topbar::before {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 22%;
  background: linear-gradient(90deg, transparent, #d9fffb, transparent);
  filter: blur(1px); opacity: .9;
  animation: busSweep 6s linear infinite;
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-logo {
  width: 36px; height: 36px; object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(52,230,214,.25));
}
.brand-mark {
  width: 14px; height: 22px; border-radius: 7px;
  background: var(--grad-signal);
  box-shadow: 0 0 14px 1px var(--signal-deep); position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0; border-radius: 7px;
  background: linear-gradient(180deg, #fff, transparent 40%);
  opacity: .5; animation: pulse 2.6s ease-in-out infinite;
}
.brand-text h1 {
  font-family: var(--disp);
  font-size: 17px; font-weight: 600; letter-spacing: .14em;
  white-space: nowrap; color: #f2fbfa;
}
.brand-text p {
  font-family: var(--disp);
  font-size: 9px; letter-spacing: .34em; text-transform: uppercase;
  color: var(--muted); margin-top: 2px; font-weight: 500;
}

/* vitals — a segmented telemetry ribbon */
.vitals { display: flex; align-items: stretch; margin-left: 6px; }
.vital { display: flex; flex-direction: column; justify-content: center; padding: 6px 20px; position: relative; }
.vital + .vital::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 1px; height: 28px; background: linear-gradient(180deg, transparent, var(--line) 40%, var(--line) 60%, transparent);
}
.vital-num { font-family: var(--mono); font-size: 21px; font-weight: 700; line-height: 1; letter-spacing: -.01em; color: var(--ink); }
.vital-num.up { color: var(--up); text-shadow: 0 0 16px rgba(79,224,160,.4); }
.vital-num.down { color: var(--down); text-shadow: 0 0 16px rgba(255,93,110,.4); }
/* throughput hero — instrument readout in signal gradient */
#v-thru {
  background: var(--grad-signal); -webkit-background-clip: text; background-clip: text;
  color: transparent; text-shadow: none;
}
.vital-lbl { font-family: var(--disp); font-size: 9px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }

.conn {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em;
}
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--down); box-shadow: 0 0 8px var(--down); }
.conn.live .dot { background: var(--up); box-shadow: 0 0 10px var(--up); animation: breathe 2.4s ease-in-out infinite; }
.conn.live #conn-text::after { content: ""; }

/* auth chip */
.authchip { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.authchip + .conn { margin-left: 18px; }
.whoami { font-family: var(--mono); font-size: 11px; color: var(--signal); letter-spacing: .06em; }
.login-link {
  font-family: var(--disp); font-size: 11px; font-weight: 500; color: var(--muted);
  background: rgba(255,255,255,.02); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 20px; cursor: pointer; letter-spacing: .1em;
  text-transform: uppercase; transition: color .16s, border-color .16s, background .16s;
}
.login-link:hover { color: var(--ink); border-color: var(--signal-deep); background: rgba(52,230,214,.06); }

/* login card */
.login-card { width: min(360px, 92vw); text-align: left; }
.login-mark { width: 20px; height: 30px; border-radius: 10px; margin-bottom: 14px; background: var(--grad-signal); box-shadow: 0 0 20px 2px var(--signal-deep); }
.login-logo { width: 58px; height: 58px; object-fit: contain; margin-bottom: 16px; filter: drop-shadow(0 0 14px rgba(52,230,214,.3)); }

/* ---------- Left rail ---------- */
.rail { grid-area: rail; background: linear-gradient(180deg, var(--panel) 0%, #081416 100%); display: flex; flex-direction: column; overflow: hidden; animation: powerOn .6s ease both .06s; }
.rail-head, .stage-head, .alerts h2, .detail-body h2 {
  display: flex; align-items: center; justify-content: space-between;
}
.rail-head { padding: 18px 16px 12px; }
.rail-head h2, .stage-head h2 {
  font-family: var(--disp); font-size: 12px; font-weight: 600;
  letter-spacing: .24em; text-transform: uppercase; color: var(--muted);
}
.add-btn {
  font-family: var(--disp); font-size: 11px; font-weight: 500; color: var(--signal);
  background: rgba(52,230,214,.05); border: 1px solid var(--signal-deep);
  border-radius: 20px; padding: 5px 12px; cursor: pointer; letter-spacing: .06em;
  transition: background .15s, color .15s, box-shadow .15s;
}
.add-btn:hover { background: var(--signal); color: var(--void); box-shadow: 0 0 16px rgba(52,230,214,.4); }
.rail-actions { display: flex; align-items: center; gap: 8px; }
.admin-link { font-family: var(--disp); font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; letter-spacing: .08em; padding: 5px 8px; border-radius: 20px; transition: color .15s; }
.admin-link:hover { color: var(--signal); }

.node-list { list-style: none; overflow-y: auto; flex: 1; padding: 4px 10px 16px; }
.node-item {
  position: relative; display: grid; grid-template-columns: 10px 1fr auto; align-items: center;
  gap: 11px; padding: 11px 12px 11px 13px; border-radius: var(--radius);
  cursor: pointer; border: 1px solid transparent;
  transition: background .16s, border-color .16s;
}
/* the light conduit — a signal rail that ignites on hover/active */
.node-item::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px;
  background: transparent; transition: background .16s, box-shadow .16s;
}
.node-item:hover { background: rgba(255,255,255,.025); }
.node-item:hover::before { background: var(--signal-deep); }
.node-item.active { background: linear-gradient(90deg, rgba(52,230,214,.10), rgba(52,230,214,.02)); border-color: rgba(52,230,214,.22); }
.node-item.active::before { background: var(--grad-signal); box-shadow: 0 0 12px rgba(52,230,214,.6); }
.node-status { width: 8px; height: 8px; border-radius: 50%; }
.node-status.up { background: var(--up); box-shadow: 0 0 8px var(--up); }
.node-status.down { background: var(--down); box-shadow: 0 0 8px var(--down); animation: pulse 1.1s infinite; }
.node-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #eaf6f5; }
.node-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.node-bps { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--signal); text-align: right; }

/* ---------- Stage / topology ---------- */
.stage { grid-area: stage; background: radial-gradient(700px 500px at 50% 42%, #0a1e21 0%, var(--void) 70%); position: relative; display: flex; flex-direction: column; overflow: hidden; animation: powerOn .6s ease both .1s; }
.stage-head { padding: 15px 20px; position: absolute; top: 0; left: 0; right: 0; z-index: 3; pointer-events: none; }
.legend { display: flex; gap: 15px; align-items: center; font-family: var(--disp); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.legend .lg { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.lg.core { background: var(--core); box-shadow: 0 0 7px var(--core); } .lg.border { background: var(--border); }
.lg.dist { background: var(--dist); } .lg.access { background: var(--access); }
.lg.upstream { background: var(--upstream); } .lg.server { background: var(--server); border-radius: 2px; }
#topo { flex: 1; width: 100%; display: block; cursor: grab; }
#topo:active { cursor: grabbing; }
.stage-hint {
  position: absolute; bottom: 12px; left: 20px; z-index: 3;
  font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .04em;
}

/* ---------- Right detail ---------- */
.detail { grid-area: detail; background: linear-gradient(180deg, var(--panel) 0%, #081416 100%); display: flex; flex-direction: column; overflow: hidden; animation: powerOn .6s ease both .14s; }
.detail-body { flex: 1; overflow-y: auto; padding: 20px 18px; }
.detail-body h2 { font-family: var(--disp); font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); gap: 16px; padding: 20px; }
.empty-mark { width: 34px; height: 34px; border: 1px dashed var(--line); border-radius: 50%; position: relative; }
.empty-mark::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--signal-deep); opacity: .5; animation: pulse 2.4s ease-in-out infinite; }
.empty p { font-size: 13px; max-width: 210px; line-height: 1.5; }

.dev-head { margin-bottom: 18px; }
.dev-title { font-family: var(--disp); font-size: 21px; font-weight: 600; letter-spacing: .01em; color: #f2fbfa; }
.dev-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.dev-badges { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.badge { font-family: var(--mono); font-size: 10px; padding: 4px 9px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.badge.on { color: var(--up); border-color: rgba(79,224,160,.5); background: rgba(79,224,160,.07); }
.badge.off { color: var(--down); border-color: rgba(255,93,110,.5); background: rgba(255,93,110,.07); }
.badge.sim { color: var(--amber); border-color: rgba(255,177,78,.5); }
.badge.mtik { color: var(--amber); border-color: rgba(255,177,78,.5); background: rgba(255,177,78,.08); }
.badge.icmp { color: var(--up); border-color: rgba(79,224,160,.5); background: rgba(79,224,160,.08); }

.spark { width: 100%; height: 48px; margin: 6px 0 20px; display: block; }

/* live MRTG panel */
.live-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.live-head h2 { font-family: var(--disp); font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.atur-btn { font-family: var(--disp); font-size: 11px; font-weight: 500; color: var(--signal); background: rgba(52,230,214,.05); border: 1px solid var(--signal-deep); padding: 5px 13px; border-radius: 20px; cursor: pointer; letter-spacing: .06em; transition: background .15s, color .15s; }
.atur-btn:hover { background: var(--signal); color: var(--void); }
.atur-pop { background: var(--void-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.atur-title { font-family: var(--disp); font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-bottom: 9px; }
.atur-row { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; padding: 4px 0; cursor: pointer; }
.atur-row input { accent-color: var(--signal); }

.live-graphs { display: flex; flex-direction: column; gap: 12px; }
.lg-card { background: linear-gradient(180deg, var(--panel-2) 0%, var(--void-2) 100%); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 11px 11px 9px; transition: border-color .2s, box-shadow .2s; position: relative; overflow: hidden; }
.lg-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
.lg-card:hover { border-color: var(--signal-deep); box-shadow: 0 0 0 1px rgba(52,230,214,.12); }
.lg-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.lg-name { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.lg-name .st { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.lg-cur { font-family: var(--mono); font-size: 11px; }
.lg-cur .rate-in { color: var(--signal); } .lg-cur .rate-out { color: var(--amber); margin-left: 8px; }
.lg-cur .rate-in::before { content: "↓"; margin-right: 2px; } .lg-cur .rate-out::before { content: "↑"; margin-right: 2px; }
.lg-canvas { width: 100%; height: 84px; display: block; border-radius: 3px; }

.iface { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.iface:first-of-type { border-top: none; }
.iface-top { display: flex; justify-content: space-between; align-items: baseline; }
.iface-name { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.iface-name .st { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.st.up { background: var(--up); box-shadow: 0 0 6px var(--up); } .st.down { background: var(--down); box-shadow: 0 0 6px var(--down); }
.iface-speed { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.iface-rates { display: flex; gap: 16px; margin: 7px 0; font-family: var(--mono); font-size: 11px; }
.rate-in { color: var(--signal); } .rate-out { color: var(--amber); }
.rate-in::before { content: "↓ "; } .rate-out::before { content: "↑ "; }
.util-bar { height: 4px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.util-fill { height: 100%; background: var(--grad-signal); border-radius: 3px; transition: width .4s ease; }
.del-btn { margin-top: 18px; width: 100%; font-family: var(--disp); font-weight: 500; font-size: 11px; color: var(--down); background: transparent; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px; cursor: pointer; letter-spacing: .08em; text-transform: uppercase; transition: border-color .15s, background .15s; }
.del-btn:hover { border-color: var(--down); background: rgba(255,93,110,.08); }
.detail-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.detail-actions .del-btn { margin-top: 0; }
.mrtg-btn, .edit-btn { font-family: var(--disp); font-weight: 500; font-size: 11px; text-align: center; padding: 9px; border-radius: var(--radius); border: 1px solid var(--line); cursor: pointer; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; transition: background .15s, color .15s, border-color .15s; }
.mrtg-btn { color: var(--signal); border-color: var(--signal-deep); display: block; }
.mrtg-btn:hover { background: var(--signal); color: var(--void); }
.edit-btn { color: var(--ink); background: transparent; }
.edit-btn:hover { border-color: var(--amber); color: var(--amber); }

/* ---------- Alerts ---------- */
.alerts { border-top: 1px solid var(--line); padding: 15px 18px 16px; max-height: 40%; display: flex; flex-direction: column; }
.alerts h2 { font-family: var(--disp); font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.alert-list { list-style: none; overflow-y: auto; }
.alert-item { display: grid; grid-template-columns: 3px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.alert-bar { border-radius: 2px; }
.alert-item.critical .alert-bar { background: var(--down); box-shadow: 0 0 8px var(--down); }
.alert-item.warn .alert-bar { background: var(--warn); }
.alert-item.info .alert-bar { background: var(--up); }
.alert-msg { line-height: 1.35; }
.alert-dev { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.alert-time { font-family: var(--mono); font-size: 10px; color: var(--muted); white-space: nowrap; }
.alert-empty { font-size: 12px; color: var(--muted); }

/* ---------- SLA monitor ---------- */
.sla { border-top: 1px solid var(--line); padding: 15px 18px 6px; display: flex; flex-direction: column; max-height: 55%; }
.sla-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.sla-head h2 { font-family: var(--disp); font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.sla-add-btn { font-family: var(--disp); font-weight: 500; font-size: 11px; color: var(--signal); background: rgba(52,230,214,.05); border: 1px solid var(--signal-deep); padding: 5px 13px; border-radius: 20px; cursor: pointer; letter-spacing: .06em; transition: background .15s, color .15s; }
.sla-add-btn:hover { background: var(--signal); color: var(--void); }
.sla-list { list-style: none; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.sla-empty { font-size: 12px; color: var(--muted); line-height: 1.5; }
.sla-card { background: linear-gradient(180deg, var(--panel-2) 0%, var(--void-2) 100%); border: 1px solid var(--line-soft); border-left: 2px solid var(--muted); border-radius: var(--radius); padding: 11px 13px; transition: box-shadow .2s; }
.sla-card.ok { border-left-color: var(--up); }
.sla-card.ok:hover { box-shadow: 0 0 0 1px rgba(79,224,160,.14); }
.sla-card.bad { border-left-color: var(--down); box-shadow: 0 0 0 1px rgba(255,93,110,.14); }
.sla-top { display: flex; align-items: center; gap: 9px; }
.sla-top .st { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.sla-id { flex: 1; min-width: 0; }
.sla-name { display: block; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sla-node { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 2px; }
.sla-del { font-family: var(--mono); font-size: 15px; line-height: 1; color: var(--muted); background: transparent; border: none; cursor: pointer; padding: 0 2px; transition: color .15s; }
.sla-del:hover { color: var(--down); }
.sla-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 8px; }
.sla-metric { text-align: center; background: rgba(0,0,0,.25); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 7px 2px; }
.sla-val { display: block; font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--ink); }
.sla-val.ok { color: var(--up); }
.sla-val.bad { color: var(--down); }
.sla-lbl { display: block; font-family: var(--disp); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.sla-foot { font-family: var(--mono); font-size: 10px; color: var(--muted); }

/* ---------- Modal ---------- */
.modal-scrim { position: fixed; inset: 0; background: rgba(3,8,8,.74); display: flex; align-items: center; justify-content: center; z-index: 20; backdrop-filter: blur(4px); }
.modal-scrim[hidden] { display: none; }
.modal { position: relative; background: linear-gradient(180deg, var(--panel) 0%, #071214 100%); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; width: min(420px, 92vw); box-shadow: 0 30px 90px rgba(0,0,0,.65); animation: modalRise .28s cubic-bezier(.2,.8,.2,1) both; }
.modal::before { content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 1px; background: linear-gradient(90deg, transparent, var(--signal), transparent); opacity: .55; }
.modal h3 { font-family: var(--disp); font-size: 18px; font-weight: 600; letter-spacing: .04em; }
.modal-sub { font-size: 12px; color: var(--muted); margin: 7px 0 18px; line-height: 1.5; }
.modal label { display: block; font-family: var(--disp); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 13px; }
.modal input, .modal select { display: block; width: 100%; margin-top: 6px; background: var(--void); border: 1px solid var(--line); color: var(--ink); font-family: var(--mono); font-size: 13px; padding: 10px; border-radius: var(--radius); transition: border-color .15s, box-shadow .15s; }
.modal input:focus, .modal select:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px rgba(52,230,214,.12); }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* agent picker */
.field-label { font-family: var(--disp); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 2px 0 8px; }
.agent-pick { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.agent-opt { position: relative; display: block; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--void); cursor: pointer; text-transform: none; letter-spacing: 0; transition: border-color .15s, background .15s; }
.agent-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.agent-name { display: block; font-family: var(--disp); font-size: 14px; font-weight: 600; color: var(--ink); }
.agent-desc { display: block; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 3px; letter-spacing: .04em; }
.agent-opt:has(input:checked) { border-color: var(--signal); background: rgba(52,230,214,.07); box-shadow: 0 0 0 1px var(--signal-deep) inset; }
.agent-opt:has(input:checked) .agent-name { color: var(--signal); }
.agent-opt.mtik:has(input:checked) { border-color: var(--amber); background: rgba(255,177,78,.08); box-shadow: 0 0 0 1px rgba(255,177,78,.4) inset; }
.agent-opt.mtik:has(input:checked) .agent-name { color: var(--amber); }
.agent-opt.icmp:has(input:checked) { border-color: var(--up); background: rgba(79,224,160,.08); box-shadow: 0 0 0 1px rgba(79,224,160,.4) inset; }
.agent-opt.icmp:has(input:checked) .agent-name { color: var(--up); }
.agent-fields[hidden] { display: none; }
.modal .check { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink); }
.modal .check input { width: auto; margin: 0; accent-color: var(--signal); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.modal-actions button { font-family: var(--disp); font-weight: 500; font-size: 12px; padding: 10px 18px; border-radius: var(--radius); cursor: pointer; border: 1px solid var(--line); letter-spacing: .06em; text-transform: uppercase; }
.ghost { background: transparent; color: var(--muted); }
.ghost:hover { color: var(--ink); }
.primary { background: var(--grad-signal); color: #041413; border-color: transparent; font-weight: 700; box-shadow: 0 0 20px rgba(52,230,214,.3); }
.primary:hover { filter: brightness(1.08); }
.modal-err { color: var(--down); font-size: 12px; margin-top: 10px; min-height: 14px; }

/* focus + motion + scrollbars */
button:focus-visible, .node-item:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--signal-deep); }
::-webkit-scrollbar-track { background: transparent; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes breathe { 0%,100% { box-shadow: 0 0 6px var(--up); } 50% { box-shadow: 0 0 14px var(--up); } }
@keyframes busSweep { 0% { left: -25%; } 100% { left: 100%; } }
@keyframes powerOn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes modalRise { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  .topbar::before { display: none; }
}

/* Responsive */
@media (max-width: 1000px) {
  body { overflow: auto; }
  .grid { grid-template-columns: 1fr; grid-template-rows: 66px 260px 320px auto; grid-template-areas: "top" "stage" "rail" "detail"; height: auto; min-height: 100vh; }
  .vitals { margin-left: 0; }
  .vital { padding: 6px 14px; }
  .topbar { gap: 14px; overflow-x: auto; }
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px); z-index: 60;
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--ink);
  background: rgba(6, 18, 16, 0.94); border: 1px solid var(--signal-deep); border-radius: var(--radius);
  padding: 10px 17px; box-shadow: 0 10px 34px rgba(0,0,0,.5), 0 0 0 1px rgba(52,230,214,.08);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); margin-right: 9px; vertical-align: middle; box-shadow: 0 0 8px var(--signal); }
.toast.warn { border-color: var(--amber); }
.toast.warn::before { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity .2s ease; transform: translate(-50%, 0); }
}

/* ============================================================
   Login gate — wajib masuk sebelum konsol tampil
   ============================================================ */
body.gate-open { overflow: hidden; }

.login-gate {
  position: fixed; inset: 0; z-index: 200; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(1200px 620px at 74% -14%, #103034 0%, transparent 60%),
    radial-gradient(900px 520px at 6% 116%, #0a2124 0%, transparent 58%),
    var(--void-2);
  transition: opacity .5s ease, visibility .5s ease;
}
.login-gate.gate-hide { opacity: 0; visibility: hidden; pointer-events: none; }

/* signature: a slow travelling signal beam behind the card */
.gate-aurora {
  position: absolute; width: 640px; height: 640px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(52,230,214,.20), rgba(75,182,255,.10) 40%, transparent 70%);
  filter: blur(18px); animation: gateFloat 14s ease-in-out infinite;
}
.gate-scan {
  position: absolute; left: 0; right: 0; height: 1px; top: 0;
  background: linear-gradient(90deg, transparent, var(--signal) 50%, transparent);
  opacity: .5; box-shadow: 0 0 14px var(--signal);
  animation: gateScan 6s linear infinite;
}

.gate-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 384px;
  display: flex; flex-direction: column; gap: 14px;
  padding: 38px 34px 30px;
  background: linear-gradient(180deg, rgba(16,40,43,.86), rgba(8,20,19,.92));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(52,230,214,.06) inset, 0 -1px 0 rgba(52,230,214,.12) inset;
  animation: powerOn .5s ease both;
  transition: opacity .3s ease;
}
.gate-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: var(--grad-signal); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 0 18px rgba(52,230,214,.5);
}
.login-gate.gate-checking .gate-card { opacity: 0; pointer-events: none; }

.gate-logo { width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(0,0,0,.5)); }
.gate-eyebrow {
  font-family: var(--disp); font-size: 11px; font-weight: 600; letter-spacing: .28em;
  text-transform: uppercase; color: var(--signal); margin-top: 2px;
}
.gate-title {
  font-family: var(--disp); font-size: 26px; font-weight: 700; letter-spacing: .02em;
  line-height: 1.05; color: var(--ink); margin-top: -6px;
}
.gate-sub { font-family: var(--body); font-size: 13px; color: var(--muted); margin-bottom: 4px; line-height: 1.45; }

.gate-field { display: flex; flex-direction: column; gap: 6px; }
.gate-field span {
  font-family: var(--disp); font-size: 10px; font-weight: 500; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.gate-field input {
  font-family: var(--mono); font-size: 14px; color: var(--ink);
  background: rgba(4,11,10,.6); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 13px; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.gate-field input::placeholder { color: #3f5a5e; }
.gate-field input:focus {
  outline: none; border-color: var(--signal);
  background: rgba(52,230,214,.05); box-shadow: 0 0 0 3px rgba(52,230,214,.14);
}

.gate-submit {
  margin-top: 6px; font-family: var(--disp); font-weight: 700; font-size: 13px;
  letter-spacing: .1em; text-transform: uppercase; color: #041413;
  background: var(--grad-signal); border: none; border-radius: var(--radius);
  padding: 13px 16px; cursor: pointer; position: relative; overflow: hidden;
  box-shadow: 0 8px 24px rgba(52,230,214,.28);
  transition: filter .15s ease, transform .1s ease;
}
.gate-submit:hover { filter: brightness(1.08); }
.gate-submit:active { transform: translateY(1px); }
.gate-submit:disabled { cursor: progress; filter: saturate(.6) brightness(.9); }
.gate-submit.loading span { opacity: .35; }
.gate-submit.loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 15px; height: 15px;
  margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid rgba(4,20,19,.4); border-top-color: #041413;
  animation: gateSpin .6s linear infinite;
}

.gate-err { color: var(--down); font-family: var(--mono); font-size: 12px; min-height: 15px; margin-top: 2px; }
.gate-foot {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: #4a666a;
  text-align: center; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line-soft);
}

/* loader shown while verifying stored token */
.gate-loader { position: absolute; display: flex; gap: 8px; opacity: 0; transition: opacity .2s ease; }
.login-gate.gate-checking .gate-loader { opacity: 1; }
.gate-loader span {
  width: 9px; height: 9px; border-radius: 50%; background: var(--signal);
  box-shadow: 0 0 10px var(--signal); animation: gateBlink 1s ease-in-out infinite;
}
.gate-loader span:nth-child(2) { animation-delay: .18s; }
.gate-loader span:nth-child(3) { animation-delay: .36s; }

@keyframes gateFloat { 0%,100% { transform: translateY(-12px) scale(1); } 50% { transform: translateY(12px) scale(1.05); } }
@keyframes gateScan { 0% { top: 0; } 100% { top: 100%; } }
@keyframes gateSpin { to { transform: rotate(360deg); } }
@keyframes gateBlink { 0%,100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .gate-aurora, .gate-scan { animation: none; }
  .gate-scan { display: none; }
}
@media (max-width: 480px) {
  .gate-card { padding: 30px 22px 24px; }
  .gate-title { font-size: 22px; }
}

/* ============================================================
   Role: akun akses terbatas (viewer) — sembunyikan kontrol admin
   ============================================================ */
body.role-viewer #add-btn,
body.role-viewer .admin-link,
body.role-viewer #sla-add { display: none !important; }

.authchip .role-tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--amber); border: 1px solid rgba(255,177,78,.4); background: rgba(255,177,78,.08);
  padding: 2px 7px; border-radius: 20px; white-space: nowrap;
}

/* ============================================================
   AI Insights — launcher pill + drawer analitik jaringan
   ============================================================ */
.ai-launch {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--disp); font-size: 12px; font-weight: 600; letter-spacing: .08em;
  color: var(--ink); cursor: pointer;
  padding: 7px 13px; border-radius: 20px;
  background: linear-gradient(100deg, rgba(52,230,214,.10), rgba(75,182,255,.10));
  border: 1px solid rgba(52,230,214,.35);
  transition: border-color .2s, box-shadow .2s, transform .1s;
}
.ai-launch:hover { border-color: var(--signal); box-shadow: 0 0 18px -4px rgba(52,230,214,.5); }
.ai-launch:active { transform: translateY(1px); }
.ai-spark {
  background: var(--grad-signal); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; font-size: 14px;
}
.ai-health-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 8px currentColor; }
.ai-health-dot.ok { background: var(--up); color: var(--up); }
.ai-health-dot.warn { background: var(--amber); color: var(--amber); }
.ai-health-dot.crit { background: var(--rose); color: var(--rose); animation: aiPulse 1.4s ease-in-out infinite; }
@keyframes aiPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.ai-scrim { position: fixed; inset: 0; background: rgba(3,8,8,.55); backdrop-filter: blur(2px); z-index: 60; animation: aiFade .2s ease both; }
@keyframes aiFade { from { opacity: 0; } to { opacity: 1; } }

.ai-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 94vw); z-index: 61;
  background: linear-gradient(180deg, var(--panel) 0%, #06110f 100%);
  border-left: 1px solid rgba(52,230,214,.28);
  box-shadow: -30px 0 80px -30px rgba(0,0,0,.8);
  display: flex; flex-direction: column;
  animation: aiSlide .28s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes aiSlide { from { transform: translateX(100%); } to { transform: translateX(0); } }
.ai-drawer::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--grad-signal); opacity: .8;
}

.ai-head { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line-soft); }
.ai-title { display: flex; align-items: center; gap: 11px; }
.ai-title .ai-spark { font-size: 20px; }
.ai-title h2 { font-family: var(--disp); font-size: 15px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); margin: 0; }
.ai-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); margin: 2px 0 0; letter-spacing: .04em; }
.ai-score { text-align: right; line-height: 1; }
.ai-score-num { font-family: var(--disp); font-size: 26px; font-weight: 700; background: var(--grad-signal); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ai-score-lbl { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.ai-score.warn .ai-score-num { background: none; -webkit-text-fill-color: var(--amber); color: var(--amber); }
.ai-score.crit .ai-score-num { background: none; -webkit-text-fill-color: var(--rose); color: var(--rose); }
.ai-close { background: none; border: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; transition: color .15s; }
.ai-close:hover { color: var(--ink); }

.ai-body { flex: 1; overflow-y: auto; padding: 16px 18px 8px; }
.ai-summary { font-family: var(--body); font-size: 13px; line-height: 1.65; color: var(--ink); margin: 0 0 16px; }
.ai-summary b, .ai-summary strong { color: var(--signal); font-weight: 600; }

.ai-sec-h { font-family: var(--disp); font-size: 10px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.ai-actions-wrap { margin-bottom: 18px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: rgba(52,230,214,.03); }
.ai-actions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.ai-actions li { position: relative; padding-left: 18px; font-size: 12.5px; color: var(--ink); line-height: 1.5; }
.ai-actions li::before { content: "▸"; position: absolute; left: 0; color: var(--signal); }

.ai-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); margin-bottom: 12px; }
.ai-tab { flex: 1; background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); font-family: var(--disp); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 9px 4px; cursor: pointer; transition: color .15s, border-color .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ai-tab:hover { color: var(--ink); }
.ai-tab.is-active { color: var(--signal); border-bottom-color: var(--signal); }
.ai-badge { font-family: var(--mono); font-size: 9px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--line); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.ai-tab.is-active .ai-badge { background: rgba(52,230,214,.18); color: var(--signal); }

.ai-pane { display: none; }
.ai-pane.is-active { display: block; animation: aiFade .2s ease both; }
.ai-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ai-list li { display: grid; grid-template-columns: 3px 1fr; gap: 11px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--glass); font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.ai-list li::before { content: ""; border-radius: 2px; background: var(--muted); }
.ai-list li.sev-critical::before { background: var(--rose); box-shadow: 0 0 8px var(--rose); }
.ai-list li.sev-warn::before { background: var(--amber); }
.ai-list li.sev-info::before { background: var(--signal-2); }
.ai-li-meta { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 3px; letter-spacing: .03em; }
.ai-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 22px 0; font-style: italic; }

.ai-ask { border-top: 1px solid var(--line-soft); padding: 12px 18px 16px; background: rgba(6,17,15,.6); }
.ai-answer { font-size: 12.5px; line-height: 1.6; color: var(--ink); background: rgba(52,230,214,.05); border: 1px solid rgba(52,230,214,.2); border-left: 2px solid var(--signal); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.ai-chip { font-family: var(--mono); font-size: 10px; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 14px; padding: 4px 10px; cursor: pointer; transition: color .15s, border-color .15s; }
.ai-chip:hover { color: var(--signal); border-color: rgba(52,230,214,.4); }
.ai-ask-form { display: grid; grid-template-columns: 1fr 40px; gap: 8px; }
.ai-ask-form input { background: var(--void-2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-family: var(--body); font-size: 13px; padding: 10px 12px; outline: none; transition: border-color .15s; }
.ai-ask-form input:focus { border-color: var(--signal); }
.ai-ask-form button { background: var(--grad-signal); border: none; border-radius: var(--radius); color: #05201f; font-size: 18px; font-weight: 700; cursor: pointer; transition: filter .15s; }
.ai-ask-form button:hover { filter: brightness(1.12); }
.ai-drawer[hidden], .ai-scrim[hidden] { display: none; }

/* viewer tetap boleh melihat AI Insights (hanya-baca) — jangan sembunyikan */
@media (max-width: 900px) {
  .ai-launch-txt { display: none; }
  .ai-drawer { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-drawer, .ai-scrim, .ai-pane { animation: none; }
  .ai-health-dot.crit { animation: none; }
}

/* ---------- Network Throughput Overview ---------- */
.overview {
  background: linear-gradient(180deg, rgba(16,42,46,.6), rgba(15,30,34,.4));
  border: 1px solid var(--line);
  border-radius: var(--radius, 4px);
  padding: 12px 13px 10px;
  margin-bottom: 12px;
}
.ov-head {
  display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px;
}
.ov-head h2 {
  font-family: var(--disp, sans-serif); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.ov-live {
  font-family: var(--mono, monospace); font-size: 15px; font-weight: 700; color: var(--fiber);
  text-shadow: 0 0 10px rgba(52,230,214,.35);
}
.ov-canvas { width: 100%; height: 92px; display: block; }
.ov-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px;
  border-top: 1px solid var(--line-soft); padding-top: 8px;
}
.ov-stat { display: flex; flex-direction: column; gap: 2px; }
.ov-k { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ov-v { font-family: var(--mono, monospace); font-size: 13px; font-weight: 600; color: var(--ink); }
.ov-v.up { color: var(--up); }
