/* NetKontrol — panel operator jaringan */
:root {
  --bg: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --ink: #16201c;
  --ink-2: #4b5852;
  --muted: #7d8a84;
  --line: #e2e5e0;
  --side: #0f1916;
  --side-ink: #b9c7c0;
  --side-active: #1c2b26;
  --accent: #0e9f6e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f5ee;
  --warn: #c27c0e;
  --warn-soft: #fdf3e1;
  --danger: #d03b3b;
  --danger-soft: #fce9e9;
  --info: #2f6fd6;
  --info-soft: #e7effc;
  --radius: 10px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .92em; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .85em; }
.muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.1rem .9rem;
  color: #fff; font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  display: grid; place-items: center;
}
.brand-mark svg { width: 18px; height: 18px; }
.router-switch { margin: 0 .8rem .8rem; }
.router-switch select {
  width: 100%; background: var(--side-active); color: #fff; border: 1px solid #2a3b35;
  border-radius: 8px; padding: .5rem .6rem; font: inherit; font-size: .9rem;
}
.nav { padding: .25rem .6rem 1rem; flex: 1; }
.nav-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6b7d75;
  padding: .9rem .6rem .35rem; font-weight: 700;
}
.nav a {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 7px;
  color: var(--side-ink); font-weight: 500; font-size: .92rem;
}
.nav a:hover { background: var(--side-active); color: #fff; text-decoration: none; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { width: 17px; height: 17px; opacity: .85; flex-shrink: 0; }
.side-foot { padding: .9rem 1.1rem; border-top: 1px solid #1f2e29; font-size: .85rem; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-foot button { background: none; border: 0; color: var(--side-ink); padding: 0; cursor: pointer; font: inherit; }
.side-foot button:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; align-items: center; gap: .75rem; padding: .7rem 1rem; background: var(--side); color: #fff;
  position: sticky; top: 0; z-index: 30;
}
.topbar button { background: none; border: 0; color: #fff; padding: .2rem; cursor: pointer; }
.content { padding: 1.5rem 1.75rem 3rem; max-width: 1280px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- cards & grid ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 1rem 1.2rem 0; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.stat .label { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.45rem; font-weight: 800; margin-top: .15rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .sub { font-size: .82rem; color: var(--muted); }

.router-card { display: block; color: inherit; transition: border-color .15s; }
.router-card:hover { border-color: var(--accent); text-decoration: none; }
.router-card .rc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; font-size: .88rem; margin-top: .75rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
tbody tr:hover { background: #fafbf9; }
tbody tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2.2rem 1rem; }

/* ---------- badges & status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem; border-radius: 999px;
  font-size: .76rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge.green { background: var(--accent-soft); color: #08744f; border-color: #bfe8d6; }
.badge.red { background: var(--danger-soft); color: #a52828; border-color: #f4c6c6; }
.badge.amber { background: var(--warn-soft); color: #8c5900; border-color: #f3dcae; }
.badge.blue { background: var(--info-soft); color: #234f9c; border-color: #c8d9f6; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex-shrink: 0; }
.dot.on { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot.wait { background: #c3cbc7; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .35; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .9rem;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.btn:hover { border-color: #c9cfca; text-decoration: none; background: var(--surface-2); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #0b8a5f; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: #f0bcbc; }
.btn.solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { padding: .28rem .55rem; font-size: .8rem; border-radius: 6px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }

/* ---------- forms ---------- */
.field { margin-bottom: .9rem; }
.field label, .label-txt { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .3rem; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid #d3d8d3; border-radius: 8px; background: #fff;
  font: inherit; color: var(--ink); font-size: .92rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-row { display: grid; gap: .9rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row.r3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row.r4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.err { color: var(--danger); font-size: .82rem; margin-top: .25rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters input, .filters select { width: auto; min-width: 150px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.segmented a { padding: .42rem .8rem; color: var(--ink-2); font-weight: 600; font-size: .85rem; border-right: 1px solid var(--line); }
.segmented a:last-child { border-right: 0; }
.segmented a.on { background: var(--ink); color: #fff; }
.segmented a:hover { text-decoration: none; }

/* ---------- alerts ---------- */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; font-size: .92rem; }
.alert.success { background: var(--accent-soft); border-color: #bfe8d6; color: #075c3f; }
.alert.error { background: var(--danger-soft); border-color: #f4c6c6; color: #8f2020; }
.alert.info { background: var(--info-soft); border-color: #c8d9f6; color: #1f437f; }
.alert.warn { background: var(--warn-soft); border-color: #f3dcae; color: #774b00; }
.alert ul { margin: .3rem 0 0 1.1rem; padding: 0; }

/* ---------- code blocks ---------- */
pre.code {
  background: #0f1916; color: #d7e4dd; padding: .9rem 1rem; border-radius: 8px; overflow-x: auto;
  font-family: var(--mono); font-size: .82rem; line-height: 1.55; margin: .5rem 0 0; position: relative; white-space: pre;
}
.copy-wrap { position: relative; }
.copy-btn { position: absolute; top: .5rem; right: .5rem; background: #24352f; color: #cfe0d8; border: 0; border-radius: 6px; padding: .25rem .55rem; font-size: .75rem; cursor: pointer; font-family: var(--sans); font-weight: 600; }
.copy-btn:hover { background: #2e4640; }
.step { display: grid; grid-template-columns: 30px 1fr; gap: .75rem; margin-bottom: 1.4rem; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem; }

/* ---------- traffic meter ---------- */
.traffic { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.traffic .v { font-family: var(--mono); font-size: 1.25rem; font-weight: 700; }
.spark { width: 100%; height: 90px; display: block; margin-top: .5rem; }

/* ---------- pagination ---------- */
.pager { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; padding: 1rem; }
.pager a, .pager span { padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; color: var(--ink-2); background: #fff; }
.pager .on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager .off { opacity: .45; }

/* ---------- modal (details) ---------- */
details.pop { position: relative; display: inline-block; }
details.pop > summary { list-style: none; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop[open] > .pop-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: .9rem; width: 280px; box-shadow: 0 12px 30px rgba(15, 25, 22, .12); white-space: normal; text-align: left;
}

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background:
  radial-gradient(circle at 20% 10%, #183a2f 0, transparent 45%), var(--side); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 1.75rem; }
.auth-card .brand { color: var(--ink); padding: 0 0 1.25rem; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
  .topbar { display: flex; }
  .content { padding: 1rem 1rem 3rem; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .form-row, .form-row.r3 { grid-template-columns: minmax(0, 1fr); }
  .form-row.r4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters input, .filters select { flex: 1; min-width: 0; }
  .filters input[type=search] { flex-basis: 100%; }
}
@media (max-width: 520px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat .value { font-size: 1.15rem; } }

[hidden] { display: none !important; }

/* ---- Trafik & kestabilan / kecepatan jaringan ---- */
.stat.lv-green { border-left: 4px solid var(--accent); }
.stat.lv-amber { border-left: 4px solid #e0a100; }
.stat.lv-red { border-left: 4px solid var(--danger); }
.acc-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.acc-head h2 { margin: 0; }
.reason { font-size: .78rem; color: var(--muted); margin-top: .2rem; max-width: 260px; white-space: normal; }
.hours { display: flex; gap: 2px; align-items: flex-end; height: 22px; }
.hours i { display: block; width: 6px; height: 100%; border-radius: 2px; background: #dfe4e1; }
.hours i.g { background: var(--accent); }
.hours i.a { background: #e0a100; }
.hours i.r { background: var(--danger); }
.speed-card .card-head { margin-bottom: .6rem; }

/* ---- Logo SARM IT ---- */
.brand-logo { width: 34px; height: 34px; object-fit: contain; flex: none; }
.auth-logo { text-align: center; margin: -.25rem 0 1rem; }
.auth-logo img { width: 190px; max-width: 70%; height: auto; }

/* ---- Cek server ---- */
.verdict { display: flex; gap: 1rem; align-items: center; padding: 1.1rem 1.3rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin-bottom: 1.25rem; }
.verdict .v-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; font-weight: 800; color: #fff; background: #c3cbc7; flex: none; }
.verdict .v-title { font-size: 1.25rem; font-weight: 800; }
.verdict .v-sub { color: var(--muted); font-size: .9rem; }
.verdict.ok { background: var(--accent-soft); border-color: #bfe8d6; } .verdict.ok .v-icon { background: var(--accent); }
.verdict.warn { background: var(--warn-soft); border-color: #f3dcae; } .verdict.warn .v-icon { background: #e0a100; }
.verdict.bad { background: var(--danger-soft); border-color: #f4c6c6; } .verdict.bad .v-icon { background: var(--danger); }

/* ---- Login 2 langkah ---- */
.otp-input { font-size: 1.35rem; letter-spacing: .3em; text-align: center; }
.otp-setup { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.otp-qr { width: 190px; height: 190px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.otp-qr svg { width: 100%; height: 100%; display: block; }
.otp-secret { font-size: 1rem; font-weight: 700; background: var(--bg, #f3f5f4); padding: .4rem .6rem; border-radius: 6px; display: inline-block; margin-top: .3rem; word-break: break-all; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; margin-top: .6rem; }
.recovery-codes code { font-size: .95rem; background: #fff; padding: .25rem .5rem; border-radius: 5px; text-align: center; }

/* Verifikasi 2 langkah: pilih metode */
.method-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.method-list form + form .method-item { border-top: 1px solid var(--line); }
.method-item { display: flex; align-items: center; gap: .8rem; width: 100%; padding: .95rem 1rem; background: var(--surface); border: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.method-item:hover, .method-item:focus-visible { background: var(--accent-soft); outline: none; }
.method-ico svg { width: 22px; height: 22px; display: block; color: var(--muted); }
.method-txt { flex: 1; overflow-wrap: anywhere; }
.method-arrow { font-size: 1.4rem; line-height: 1; color: var(--muted); }
.tf-box { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem; }
