/* ============ Token ============ */
:root {
  --ground: #0f1a22;
  --sunken: #0b141b;
  --surface: #15232d;
  --raised: #1b2d39;
  --line: #2a3f4e;
  --line-soft: #213441;

  --ink: #e9f0f4;
  --ink-dim: #93a8b6;
  --ink-faint: #60768a;

  --ok: #3ddc97;
  --warn: #ffb454;
  --bad: #ff6b6b;
  --idle: #6f8696;
  --tunnel: #f38020;

  --ok-bg: rgba(61, 220, 151, 0.12);
  --warn-bg: rgba(255, 180, 84, 0.13);
  --bad-bg: rgba(255, 107, 107, 0.13);
  --tunnel-bg: rgba(243, 128, 32, 0.13);

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 9px;
  --font: 'Bricolage Grotesque', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.6);
  --dots: rgba(147, 168, 182, 0.13);
}

:root[data-theme='light'] {
  --ground: #e9eff2;
  --sunken: #dde7ec;
  --surface: #ffffff;
  --raised: #f3f7f9;
  --line: #c6d4dd;
  --line-soft: #dbe5eb;

  --ink: #12232d;
  --ink-dim: #4a6272;
  --ink-faint: #7b909e;

  --ok: #0f9d6b;
  --warn: #b86e00;
  --bad: #d23b3b;
  --idle: #6d8394;
  --tunnel: #d4640a;

  --ok-bg: rgba(15, 157, 107, 0.1);
  --warn-bg: rgba(184, 110, 0, 0.11);
  --bad-bg: rgba(210, 59, 59, 0.1);
  --tunnel-bg: rgba(212, 100, 10, 0.1);
  --shadow: 0 24px 50px -28px rgba(18, 35, 45, 0.35);
  --dots: rgba(18, 35, 45, 0.1);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); min-height: 100vh; }
body { font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select { font-family: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
i[data-lucide], svg.lucide { width: 1.1em; height: 1.1em; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--sunken); color: var(--ink-dim); }

:focus-visible { outline: 2px solid var(--tunnel); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

/* ============ Buttons ============ */
.btn-primary {
  width: 100%; padding: 12px; border: 0; border-radius: var(--r-sm);
  background: var(--tunnel); color: #1a0f05; font-weight: 700; font-size: 14.5px;
  transition: filter .15s, transform .1s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }

.btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: transparent; transition: border-color .15s, background .15s, color .15s;
}
.btn-ghost:hover { border-color: var(--tunnel); color: var(--tunnel); background: var(--tunnel-bg); }
.btn-danger { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #1b0808; }
.btn-ghost:disabled, .btn-danger:disabled { opacity: .45; cursor: not-allowed; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line-soft); background: var(--surface); color: var(--ink-dim);
  transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line); }
.icon-btn.spin i, .icon-btn.spin svg { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Login ============ */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden; }
.login-lines { position: absolute; inset: 0; display: grid; align-content: center; gap: 90px; opacity: .55; }
.login-lines span {
  height: 2px; width: 100%;
  background: repeating-linear-gradient(90deg, var(--tunnel) 0 10px, transparent 10px 22px);
  background-size: 22px 2px; animation: flow 1.4s linear infinite;
  mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
}
.login-lines span:nth-child(2) { animation-duration: 2s; opacity: .6; }
.login-lines span:nth-child(3) { animation-duration: 2.6s; opacity: .35; }
.login-card {
  position: relative; width: 100%; max-width: 360px; padding: 34px 30px 30px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  display: grid; gap: 12px;
}
.mark { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--tunnel); color: #1a0f05; font-size: 22px; }
.login-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.login-sub { color: var(--ink-dim); margin-bottom: 8px; }
#passwordInput {
  width: 100%; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--sunken); color: var(--ink); font-size: 15px; outline: none;
}
#passwordInput:focus { border-color: var(--tunnel); }
.login-error { color: var(--bad); font-size: 13px; }
.login-card.shake { animation: shake .4s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

/* ============ Shell ============ */
.dash { max-width: 1400px; margin: 0 auto; padding: 18px 24px 48px; }

.bar { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--tunnel); color: #1a0f05; font-size: 16px; }
.palette-trigger {
  flex: 1; max-width: 460px; margin: 0 auto 0 12px; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line-soft); background: var(--surface);
  color: var(--ink-faint); font-size: 13.5px; text-align: left; transition: border-color .15s;
}
.palette-trigger:hover { border-color: var(--line); }
.palette-trigger span { flex: 1; }
.bar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.clock { font-family: var(--mono); font-size: 13px; color: var(--ink-dim); padding-right: 6px; }

/* ============ Hero: peta jalur ============ */
.hero { display: grid; grid-template-columns: 1fr 270px; gap: 14px; margin-bottom: 22px; }

.topo {
  position: relative; display: grid; align-items: stretch;
  grid-template-columns: minmax(0, 1.15fr) 56px minmax(0, 1fr) 56px minmax(0, 1fr);
  padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background-color: var(--surface);
  background-image: radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: 18px 18px;
}
.node { background: var(--raised); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 14px 15px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.node-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--ink-dim); }
.node-note { font-size: 12px; color: var(--ink-faint); }
.node-tunnel { border-color: color-mix(in srgb, var(--tunnel) 38%, var(--line-soft)); }
.node-tunnel .node-title i, .node-tunnel .node-title svg { color: var(--tunnel); }

.domain-list { display: grid; gap: 7px; }
.domain-list a, .domain-list .none {
  display: flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 12.5px;
  color: var(--ink); text-decoration: none; padding: 6px 9px; border-radius: 8px; background: var(--sunken); overflow: hidden;
}
.domain-list a:hover { color: var(--tunnel); }
.domain-list span.d { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-list .none { color: var(--ink-faint); }

.tunnel-state { display: flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.node-tunnel .btn-ghost { align-self: flex-start; margin-top: auto; padding: 6px 11px; font-size: 12.5px; }

.link { align-self: center; height: 2px; background: repeating-linear-gradient(90deg, var(--tunnel) 0 8px, transparent 8px 16px); background-size: 16px 2px; animation: flow 1s linear infinite; }
.link.is-down { background: repeating-linear-gradient(90deg, var(--bad) 0 3px, transparent 3px 12px); animation: none; opacity: .6; }
@keyframes flow { to { background-position: 16px 0; } }

.gauges { display: flex; gap: 14px; }
.gauge { position: relative; width: 76px; height: 76px; flex-shrink: 0; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 6; }
.g-bg { stroke: var(--line-soft); }
.g-val { stroke: var(--ok); stroke-linecap: round; stroke-dasharray: 163.36; stroke-dashoffset: 163.36; transition: stroke-dashoffset .6s ease, stroke .3s; }
.gauge[data-level='warn'] .g-val { stroke: var(--warn); }
.gauge[data-level='bad'] .g-val { stroke: var(--bad); }
.g-num { position: absolute; inset: 0; display: grid; place-items: center; padding-bottom: 8px; font-family: var(--mono); font-size: 14px; font-weight: 600; }
.g-lab { position: absolute; left: 0; right: 0; bottom: 17px; text-align: center; font-size: 10.5px; color: var(--ink-faint); }

/* ring kesehatan */
.health { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ring-wrap { position: relative; width: 132px; height: 132px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: var(--line-soft); }
.ring-seg { stroke-linecap: butt; transition: stroke-dasharray .6s ease, stroke-dashoffset .6s ease; }
.seg-ok { stroke: var(--ok); } .seg-idle { stroke: var(--idle); } .seg-bad { stroke: var(--bad); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center strong { font-size: 34px; line-height: 1; font-weight: 800; letter-spacing: -.03em; }
.ring-center span { font-size: 12px; color: var(--ink-dim); margin-top: 3px; }
.legend { display: grid; gap: 6px; width: 100%; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; color: var(--ink-dim); }
.legend b { margin-left: auto; font-family: var(--mono); color: var(--ink); font-weight: 600; }

/* ============ Layout utama ============ */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.side { display: grid; gap: 14px; position: sticky; top: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 16px; }
.panel-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.panel-foot { font-size: 12px; color: var(--ink-faint); margin-top: 10px; }

.spark-row + .spark-row { margin-top: 12px; }
.spark-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-dim); margin-bottom: 4px; }
.spark-head strong { font-family: var(--mono); color: var(--ink); font-weight: 600; }
.spark { width: 100%; height: 40px; display: block; overflow: visible; }
.spark path.area { fill: var(--tunnel-bg); }
.spark path.line { fill: none; stroke: var(--tunnel); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }

.events { display: grid; gap: 0; max-height: 330px; overflow-y: auto; }
.events li { display: grid; grid-template-columns: 62px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.events li:first-child { border-top: 0; padding-top: 0; }
.events time { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); padding-top: 2px; }
.events li[data-kind='good'] .ev { color: var(--ok); }
.events li[data-kind='bad'] .ev { color: var(--bad); }
.events li[data-kind='warn'] .ev { color: var(--warn); }
.events .empty { display: block; color: var(--ink-faint); font-size: 12.5px; border: 0; }

/* ============ Jaringan ============ */
.spark-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.spark-pair .spark-row + .spark-row { margin-top: 0; }

.net-live { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.net-rate { display: grid; gap: 2px; }
.net-k { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-dim); }
.net-rate strong { display: flex; align-items: baseline; gap: 5px; }
.net-rate b { font-family: var(--mono); font-size: 25px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.net-rate small { font-size: 12px; color: var(--ink-faint); }
.net-rate.down .net-k i, .net-rate.down .net-k svg { color: var(--tunnel); }
.net-rate.up .net-k i, .net-rate.up .net-k svg { color: var(--ok); }
.spark path.line.tx { stroke: var(--ok); }
.spark path.area.tx { fill: var(--ok-bg); }
#sparkNet { height: 44px; }

.net-inline { display: flex; gap: 14px; font-family: var(--mono); font-size: 12.5px; }
.net-inline span { display: inline-flex; align-items: center; gap: 4px; }
.net-inline .d svg, .net-inline .d i { color: var(--tunnel); }
.net-inline .u svg, .net-inline .u i { color: var(--ok); }
.net-inline b { font-weight: 600; }

.st { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.st-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.st-head h3 { font-size: 13px; font-weight: 700; }
.st-head span { font-size: 12px; color: var(--ink-faint); }
.st-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.st-grid div { background: var(--raised); border: 1px solid var(--line-soft); border-radius: 9px; padding: 6px 8px; min-width: 0; }
.st-grid .k { display: block; font-size: 10.5px; color: var(--ink-faint); }
.st-grid b { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.st-bars { display: flex; align-items: flex-end; gap: 2px; height: 22px; margin-top: 9px; }
.st-bars i { flex: 1; min-width: 2px; background: var(--tunnel); opacity: .55; border-radius: 2px 2px 0 0; }
.st-bars i:last-child { opacity: 1; }
.st-bars i.fail { background: var(--bad); }
.st-meta { font-size: 12px; color: var(--ink-faint); margin-top: 8px; min-height: 1em; }
.st-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--ink-faint); }
.st-foot .btn-ghost { padding: 6px 11px; font-size: 12.5px; flex-shrink: 0; }
.st-foot .btn-ghost.busy svg, .st-foot .btn-ghost.busy i { animation: spin 1s linear infinite; }

/* ============ Perhatian + toolbar ============ */
.attention {
  display: grid; gap: 6px; margin-bottom: 14px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--warn-bg); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.attention h2 { font-size: 13.5px; font-weight: 700; color: var(--warn); display: flex; align-items: center; gap: 8px; }
.attention button { text-align: left; background: none; border: 0; padding: 2px 0; font-size: 13px; color: var(--ink); }
.attention button:hover { color: var(--warn); text-decoration: underline; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line-soft); background: transparent; font-size: 13px; font-weight: 500; color: var(--ink-dim); transition: all .15s; }
.chip:hover { color: var(--ink); border-color: var(--line); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--ground); font-weight: 600; }
.tool-right { display: flex; gap: 8px; align-items: center; }
.select { padding: 7px 10px; border-radius: var(--r-sm); border: 1px solid var(--line-soft); background: var(--surface); color: var(--ink); font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.seg-btn { border: 0; background: transparent; padding: 7px 10px; color: var(--ink-faint); display: grid; place-items: center; }
.seg-btn.txt { font-family: var(--mono); font-size: 12px; padding: 6px 12px; }
.seg-btn.active { background: var(--raised); color: var(--tunnel); }

/* ============ Grup + tile ============ */
.group + .group { margin-top: 26px; }
.group-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 11px; }
.group-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.group-head span { font-size: 12.5px; color: var(--ink-faint); }

.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }

.tile {
  position: relative; display: flex; flex-direction: column; gap: 11px;
  padding: 15px 16px 14px 20px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line-soft);
  cursor: pointer; transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--line); transform: translateY(-1px); }
.tile::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--idle); }
.tile.s-ok::before { background: var(--ok); box-shadow: 0 0 14px var(--ok); }
.tile.s-bad::before { background: var(--bad); box-shadow: 0 0 14px var(--bad); }
.tile.s-warn::before { background: var(--warn); box-shadow: 0 0 12px var(--warn); }
.tile.s-none::before { background: var(--line); }
.tile[data-busy='1'] { opacity: .7; pointer-events: none; }

.t-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.t-name { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-cat { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; flex-shrink: 0; }
.t-cat.Produksi { background: var(--tunnel-bg); color: var(--tunnel); }
.t-cat.Internal { background: var(--ok-bg); color: var(--ok); }
.t-cat.Dev { background: color-mix(in srgb, var(--idle) 16%, transparent); color: var(--ink-dim); }

.t-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-dim); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--idle); flex-shrink: 0; }
.s-ok .dot, .dot.ok { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: beat 2.4s infinite; }
.s-bad .dot, .dot.bad { background: var(--bad); }
.s-warn .dot, .dot.warn { background: var(--warn); }
@keyframes beat { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70%,100% { box-shadow: 0 0 0 7px transparent; } }

.t-links { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  font-family: var(--mono); font-size: 12px; padding: 4px 9px; border-radius: 8px;
  background: var(--sunken); border: 1px solid var(--line-soft); color: var(--ink-dim); text-decoration: none;
  transition: color .15s, border-color .15s;
}
.pill:hover { color: var(--tunnel); border-color: var(--tunnel); }
.pill i, .pill svg { width: 12px; height: 12px; }
.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.muted { color: var(--ink-faint); pointer-events: none; }

.t-metrics { display: flex; gap: 18px; }
.m { display: grid; gap: 1px; min-width: 0; }
.m-k { font-size: 11px; color: var(--ink-faint); }
.m-v { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.m.warn .m-v { color: var(--warn); }
.m-mem { flex: 1; }
.bar-mini { display: block; height: 4px; border-radius: 4px; background: var(--line-soft); margin-top: 4px; overflow: hidden; }
.bar-mini b { display: block; height: 100%; width: 0; background: var(--tunnel); border-radius: 4px; transition: width .5s ease; }

.t-actions { display: flex; gap: 6px; margin-top: 2px; }
.act {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 8px; border-radius: var(--r-sm); border: 1px solid var(--line-soft);
  background: var(--raised); font-size: 12.5px; font-weight: 600; color: var(--ink-dim); transition: all .15s;
}
.act i, .act svg { width: 14px; height: 14px; }
.act:disabled { opacity: .35; cursor: not-allowed; }
.act[data-action='start']:hover:not(:disabled) { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.act[data-action='restart']:hover:not(:disabled) { color: var(--tunnel); border-color: var(--tunnel); background: var(--tunnel-bg); }
.act[data-action='stop']:hover:not(:disabled) { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
.t-note { font-size: 12px; color: var(--ink-faint); }

/* daftar */
.apps.list { grid-template-columns: 1fr; gap: 6px; }
.apps.list .tile {
  display: grid; align-items: center; gap: 14px; padding: 10px 14px 10px 20px;
  grid-template-columns: minmax(170px, 1.2fr) 130px minmax(160px, 1.3fr) minmax(190px, 1.4fr) auto;
}
.apps.list .t-main { justify-content: flex-start; }
.apps.list .t-cat { display: none; }
.apps.list .t-links { min-height: 0; }
.apps.list .t-actions { margin: 0; }
.apps.list .act { flex: none; padding: 7px 9px; }
.apps.list .act span { display: none; }
.apps.list .tile::before { top: 8px; bottom: 8px; }

/* ============ Modal ============ */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(5, 10, 14, 0.66); backdrop-filter: blur(5px); }
:root[data-theme='light'] .overlay { background: rgba(18, 35, 45, 0.4); }
.overlay-top { place-items: start center; padding-top: 12vh; }

.modal { width: 100%; max-width: 620px; max-height: 86vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.modal-titles { display: flex; align-items: center; gap: 10px; }
.modal-titles h2 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.tabs { display: flex; gap: 4px; padding: 0 18px; border-bottom: 1px solid var(--line-soft); }
.tab { border: 0; background: none; padding: 10px 12px; font-size: 13.5px; font-weight: 600; color: var(--ink-faint); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ink); border-bottom-color: var(--tunnel); }
.modal-body { padding: 18px; overflow-y: auto; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.detail-item { background: var(--raised); border: 1px solid var(--line-soft); border-radius: 10px; padding: 9px 12px; min-width: 0; }
.detail-item.wide { grid-column: span 2; }
.detail-item .k { font-size: 11.5px; color: var(--ink-faint); margin-bottom: 2px; }
.detail-item .v { font-family: var(--mono); font-size: 12.5px; word-break: break-all; display: flex; align-items: center; gap: 8px; }
.detail-item .v button { margin-left: auto; border: 0; background: none; color: var(--ink-faint); padding: 0; display: grid; }
.detail-item .v button:hover { color: var(--tunnel); }
.modal-actions { display: flex; gap: 8px; }

.log-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.log-live { font-size: 12px; color: var(--ink-faint); font-family: var(--mono); }
.log-view {
  margin: 0; background: var(--sunken); border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6; height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-all; color: #9fe3c8;
}
:root[data-theme='light'] .log-view { color: #0b6a47; }
.log-view .err { color: var(--bad); }
.log-view .empty { color: var(--ink-faint); font-style: italic; }

/* ============ Palet ============ */
.palette { width: 100%; max-width: 580px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); color: var(--ink-faint); }
.palette-input input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; }
.palette-list { max-height: 340px; overflow-y: auto; padding: 6px; }
.palette-list li { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; font-size: 14px; cursor: pointer; color: var(--ink-dim); }
.palette-list li i, .palette-list li svg { color: var(--ink-faint); }
.palette-list li small { margin-left: auto; font-size: 12px; color: var(--ink-faint); }
.palette-list li.sel { background: var(--raised); color: var(--ink); }
.palette-list li.sel i, .palette-list li.sel svg { color: var(--tunnel); }
.palette-list .none { cursor: default; color: var(--ink-faint); }

/* ============ Konfirmasi + toast ============ */
.confirm { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; text-align: center; box-shadow: var(--shadow); }
.overlay:has(.confirm) { z-index: 150; }
.confirm-icon { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 13px; display: grid; place-items: center; background: var(--warn-bg); color: var(--warn); font-size: 20px; }
.confirm-message { white-space: pre-line; margin-bottom: 18px; font-size: 14px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions > * { flex: 1; }

.toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 200; }
.toast { display: flex; gap: 10px; align-items: flex-start; min-width: 240px; max-width: 350px; padding: 11px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; animation: toast-in .22s ease; }
.toast.success { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.toast.success svg { color: var(--ok); }
.toast.error { border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.toast.error svg { color: var(--bad); }
.toast.out { animation: toast-out .22s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

.foot { margin-top: 28px; text-align: center; font-size: 12px; color: var(--ink-faint); font-family: var(--mono); }

/* ============ Responsif ============ */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: 1fr 1fr; }
  .hero { grid-template-columns: 1fr; }
  .health { flex-direction: row; justify-content: space-around; }
  .legend { width: auto; min-width: 180px; }
}
@media (max-width: 820px) {
  .topo { grid-template-columns: 1fr; padding: 14px; }
  .link { width: 2px; height: 30px; justify-self: center; background: repeating-linear-gradient(180deg, var(--tunnel) 0 8px, transparent 8px 16px); background-size: 2px 16px; animation: flow-v 1s linear infinite; }
  .link.is-down { background: repeating-linear-gradient(180deg, var(--bad) 0 3px, transparent 3px 12px); }
  .apps.list .tile { grid-template-columns: 1fr; gap: 10px; padding: 14px 16px 14px 20px; }
  .apps.list .t-cat { display: inline-block; }
  .apps.list .act { flex: 1; }
  .apps.list .act span { display: inline; }
}
@keyframes flow-v { to { background-position: 0 16px; } }
@media (max-width: 640px) {
  .dash { padding: 12px 12px 40px; }
  .brand-name, .clock, .palette-trigger kbd { display: none; }
  .palette-trigger { margin-left: 0; }
  .side { grid-template-columns: 1fr; }
  .apps { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item.wide { grid-column: span 1; }
  .toasts { left: 12px; right: 12px; }
  .toast { max-width: none; }
  .health { flex-direction: column; }
}
/* Kunci tata letak: header, peta jalur, toolbar, dan sidebar diam di tempat;
   hanya daftar aplikasi yang scroll. Di layar kecil/pendek kembali scroll normal. */
@media (min-width: 1101px) and (min-height: 640px) {
  html, body { height: 100%; overflow: hidden; }
  .dash { height: 100vh; display: flex; flex-direction: column; padding-bottom: 12px; }
  .bar, .hero { flex: none; }
  .hero { margin-bottom: 16px; }
  .layout { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  .main { display: flex; flex-direction: column; min-height: 0; }
  .attention { flex: none; max-height: 96px; overflow-y: auto; }
  .toolbar { flex: none; }
  #appGroups { flex: 1; min-height: 0; overflow-y: auto; padding-right: 8px; margin-right: -8px; overscroll-behavior: contain; }
  .side { position: static; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 2px; }
  .side .panel { flex: none; }
  .side .events-panel { flex: 1 1 auto; min-height: 150px; display: flex; flex-direction: column; }
  .events { flex: 1; min-height: 0; max-height: none; }
  .foot { flex: none; margin-top: 6px; }

  /* bagian atas dibuat ringkas supaya daftar aplikasi punya ruang */
  .bar { margin-bottom: 12px; }
  .hero { margin-bottom: 12px; }
  .topo { padding: 12px; }
  .node { padding: 10px 12px; gap: 7px; }
  .domain-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  .domain-list a, .domain-list .none { font-size: 11.5px; padding: 4px 7px; gap: 6px; }
  .tunnel-state { font-size: 17px; }
  .node-tunnel .node-note { display: none; }
  .gauge { width: 62px; height: 62px; }
  .g-num { font-size: 12.5px; padding-bottom: 6px; }
  .g-lab { bottom: 12px; font-size: 10px; }
  .health { padding: 12px; gap: 8px; }
  .ring-wrap { width: 104px; height: 104px; }
  .ring-center strong { font-size: 28px; }
  .legend { gap: 3px; font-size: 12.5px; }
  .attention { display: flex; align-items: center; gap: 16px; overflow-x: auto; overflow-y: hidden; max-height: none; padding: 7px 12px; margin-bottom: 10px; }
  .attention h2 { white-space: nowrap; }
  .attention button { white-space: nowrap; }
  .toolbar { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.detail-item .v span[data-f='containers'] { white-space: pre-line; line-height: 1.7; }


/* ===== Pemantau kesehatan app Produksi ===== */
.t-health { display: flex; flex-direction: column; gap: 6px; }
.hchips { display: flex; flex-wrap: wrap; gap: 5px; }
.hchip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-dim);
  background: var(--raised); border: 1px solid var(--line-soft); white-space: nowrap;
}
.hchip b { font-weight: 600; color: var(--ink); }
.hchip i { width: 6px; height: 6px; border-radius: 50%; background: var(--idle); display: inline-block; }
.hchip.ok i { background: var(--ok); }
.hchip.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.hchip.warn i { background: var(--warn); }
.hchip.bad { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.hchip.bad i { background: var(--bad); }
.hchip.faint { color: var(--ink-faint); }
.spark.mini { height: 22px; }
.spark.mini path.line { stroke: var(--ink-faint); stroke-width: 1.3; }
.spark.mini.ms path.line { stroke: var(--ok); }
.apps.list .t-health { display: none; }
.mon-h { font-size: 13px; font-weight: 700; margin: 4px 0 8px; }
.mon-warn { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; margin: 0 0 12px; }
.mon-sparks { margin-bottom: 14px; }
.mon-events { margin-bottom: 16px; }
.detail-item .v.bad { color: var(--bad); }
.ev-cause { display: block; margin-top: 2px; font-family: var(--mono); font-size: 11px; color: var(--ink-faint); word-break: break-word; }

/* ===== Disk, suhu, top proses ===== */
.disks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.disk-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-dim); margin-bottom: 4px; }
.disk-head b { font-family: var(--mono); color: var(--ink); font-weight: 600; }
.disk small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-faint); }
.disk .bar-mini { display: block; height: 5px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.disk .bar-mini b { display: block; height: 100%; background: var(--ok); }
.disk.warn .bar-mini b, .disk.warn .disk-head b { background: var(--warn); }
.disk.warn .disk-head b { background: none; color: var(--warn); }
.disk.bad .bar-mini b { background: var(--bad); }
.disk.bad .disk-head b { background: none; color: var(--bad); }
.temp-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-dim); padding: 8px 0; border-top: 1px solid var(--line-soft); }
.temp-row b { font-family: var(--mono); color: var(--ink); }
.temp-row .muted { color: var(--ink-faint); }
.proc-list { list-style: none; margin: 0 0 10px; padding: 0; }
.proc-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 3px 0; color: var(--ink-dim); }
.proc-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proc-list li b { font-family: var(--mono); color: var(--ink); font-weight: 600; flex: none; }
.mon-warn .act { margin-left: 8px; vertical-align: middle; }

.attention .att-alert { margin: 0; font-size: 13px; color: var(--ink); }
.attention .att-alert small { color: var(--ink-faint); }
