/* =====================================================================
   Status Page Publik — PT Tungkal Lintas Bersama
   Design token sesuai docs/UIUX_notes.md (light theme, IBM Plex Sans).
   Font di-fallback ke system stack bila IBM Plex Sans belum di-host lokal
   (CSP membatasi font-src ke 'self'; lihat web/README.md).
   ===================================================================== */

:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --grid: #e1e0d9;
  --accent: #005aa1;
  --accent-2: #00acd6;

  --down: #2a78d6;
  --up: #eb6834;

  --good: #0ca30c;
  --good-text: #006300;
  --warn: #fab219;
  --crit: #d03b3b;
  --nodata: #d6d5cd;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 11, 11, .05), 0 1px 8px rgba(11, 11, 11, .04);

  --font: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body { font-variant-numeric: tabular-nums; }

.wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

h2 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: -.01em; }

/* ------------------------------ Header ----------------------------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--grid);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}
.logo { height: 34px; width: auto; display: block; }
.header-meta { display: flex; flex-direction: column; line-height: 1.25; }
.header-title { font-weight: 600; font-size: 15px; }
.header-sub { color: var(--ink-3); font-size: 12.5px; }

/* ------------------------------ Banner ----------------------------- */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 22px 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--grid);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.banner-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  flex: none;
  background: var(--nodata);
}
.banner-text { display: flex; flex-direction: column; gap: 2px; }
.banner-text strong { font-size: 16px; font-weight: 600; }
.banner-text span { color: var(--ink-2); font-size: 13.5px; }

.banner[data-level="operational"] { border-left-color: var(--good); }
.banner[data-level="operational"] .banner-dot { background: var(--good); }
.banner[data-level="operational"] strong { color: var(--good-text); }

.banner[data-level="degraded"] { border-left-color: var(--warn); }
.banner[data-level="degraded"] .banner-dot { background: var(--warn); }

.banner[data-level="maintenance"] { border-left-color: var(--accent-2); }
.banner[data-level="maintenance"] .banner-dot { background: var(--accent-2); }

.banner[data-level="outage"] { border-left-color: var(--crit); }
.banner[data-level="outage"] .banner-dot { background: var(--crit); }
.banner[data-level="outage"] strong { color: var(--crit); }

.banner[data-level="error"] { border-left-color: var(--ink-3); }

.notice {
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  background: #fff9ec;
  color: var(--ink-2);
  font-size: 13.5px;
}

/* ------------------------------ Tiles ------------------------------ */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow);
}
.tile-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.tile-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.tile-note { font-size: 12px; color: var(--ink-3); }

/* ------------------------------ Cards ------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-sub { margin: 4px 0 0; color: var(--ink-3); font-size: 13px; max-width: 62ch; }

/* ------------------------------ Pills ------------------------------ */
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font: inherit;
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid var(--grid);
  background: transparent;
  border-radius: 999px;
  color: var(--ink-2);
  cursor: pointer;
}
.pill:hover { border-color: var(--accent-2); color: var(--accent); }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ------------------------------ Legend ----------------------------- */
.legend { display: flex; gap: 18px; margin-bottom: 6px; font-size: 12.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.swatch-down { background: var(--down); }
.swatch-up { background: var(--up); }
.swatch-cir {
  background: none;
  border-top: 2px dashed var(--crit);
  height: 0;
}

/* ------------------------------ Chart ------------------------------ */
.chart-host { width: 100%; position: relative; min-height: 240px; }
.chart-host svg { display: block; width: 100%; height: auto; }
.chart-host .axis-text { font-size: 11px; fill: var(--ink-3); }
.chart-host .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart-host .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-host .series-area { opacity: .08; }
.chart-host .crosshair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-host .threshold-line { stroke: var(--crit); stroke-width: 1.5; stroke-dasharray: 6 4; }
.chart-host .threshold-text { font-size: 11px; fill: var(--crit); font-weight: 600; }
.chart-host .marker { stroke: var(--surface); stroke-width: 2; }
.chart-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; color: var(--ink-3); font-size: 13.5px; text-align: center;
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 18px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--grid);
}
.chart-stats div { display: flex; flex-direction: column; }
.chart-stats dt { font-size: 12px; color: var(--ink-3); }
.chart-stats dd { margin: 0; font-size: 15px; font-weight: 600; }

/* ------------------------------ Tooltip ---------------------------- */
.tooltip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  background: #ffffff;
  border: 1px solid var(--grid);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(11, 11, 11, .12);
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
}
.tooltip .tt-time { color: var(--ink-3); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; }

/* ------------------------------ Uptime ----------------------------- */
.uptime-list { display: flex; flex-direction: column; gap: 18px; }
.uptime-row { display: flex; flex-direction: column; gap: 6px; }
.uptime-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.uptime-name { font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.uptime-pct { font-size: 13px; color: var(--ink-2); }
.uptime-bars { display: flex; gap: 2px; width: 100%; }
.uptime-bars i {
  flex: 1 1 0;
  min-width: 2px;
  height: 30px;
  border-radius: 2px;
  background: var(--nodata);
  cursor: default;
}
.uptime-bars i.up { background: var(--good); }
.uptime-bars i.degraded { background: var(--warn); }
.uptime-bars i.down { background: var(--crit); }
.uptime-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); }

.uptime-legend { display: flex; gap: 12px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.uptime-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cell { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--nodata); }
.cell-up { background: var(--good); }
.cell-degraded { background: var(--warn); }
.cell-down { background: var(--crit); }
.cell-nodata { background: var(--nodata); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--nodata); display: inline-block; }
.status-dot.up { background: var(--good); }
.status-dot.down { background: var(--crit); }

/* ------------------------------ Latency ---------------------------- */
.latency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.lat-card {
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--page);
}
.lat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lat-name { font-weight: 600; font-size: 14px; }
.badge {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
}
.badge.good { background: #e9f7e9; color: var(--good-text); border-color: #c3e8c3; }
.badge.warn { background: #fff4dd; color: #8a5a00; border-color: #f2ddab; }
.badge.crit { background: #fdeaea; color: #9c1f1f; border-color: #f0c2c2; }
.badge.nodata { background: #f0efe9; color: var(--ink-3); border-color: var(--grid); }

.lat-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 6px 0 2px; }
.lat-meta { font-size: 12px; color: var(--ink-3); }
.lat-spark { margin-top: 8px; height: 52px; }
.lat-spark svg { display: block; width: 100%; height: 52px; }
.lat-spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; }

/* ------------------------------ Insiden ---------------------------- */
.incident-list { display: flex; flex-direction: column; gap: 12px; }
.incident {
  border-left: 3px solid var(--grid);
  padding: 4px 0 4px 14px;
}
.incident.critical, .incident.major { border-left-color: var(--crit); }
.incident.minor { border-left-color: var(--warn); }
.incident.maintenance { border-left-color: var(--accent-2); }
.incident-title { font-weight: 600; font-size: 14px; }
.incident-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.incident-body { font-size: 13.5px; color: var(--ink-2); margin-top: 5px; }
.empty { color: var(--ink-3); font-size: 13.5px; padding: 8px 0; }

/* --------------------------- Halaman share ------------------------- */
.share-notice p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
  max-width: 78ch;
}
.share-notice { background: var(--page); }

/* ------------------------------ Footer ----------------------------- */
.site-footer {
  border-top: 1px solid var(--grid);
  background: var(--surface);
  margin-top: 8px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ------------------------------ Mobile ----------------------------- */
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile-value { font-size: 21px; }
  .latency-grid { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .uptime-bars i { height: 24px; }
  .card-head { flex-direction: column; align-items: stretch; }
}

@media (max-width: 400px) {
  .tiles { grid-template-columns: 1fr; }
}

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

/* =====================================================================
   FASE 4 — Halaman login & Panel Admin/NOC
   Blok tambahan; token warna tetap memakai :root di atas.
   Kartu di sini sengaja tidak memakai border kiri tebal berwarna —
   penanda status memakai badge, bukan garis tepi.
   ===================================================================== */

/* Beberapa elemen di bawah punya display eksplisit (grid/flex) yang akan
   mengalahkan display:none bawaan atribut hidden. */
[hidden] { display: none !important; }

/* Satu .panel = satu menu sidebar. Hanya satu yang tampak; sisanya diberi
   atribut hidden oleh admin.js, bukan disembunyikan lewat kelas. */
.panel { display: block; }

/* --------------------------- Kontrol dasar --------------------------
   Nama .btn/.btn-primary/.btn-quiet/.field juga dipakai blok Portal Mitra
   di bawah dengan ukuran dan makna berbeda (di sana .btn-quiet adalah
   tombol teks tanpa bingkai). Aturan di sini karena itu dikunci ke dua
   halaman Fase 4 lewat .login-page/.admin-page, supaya urutan blok di
   berkas ini tidak menentukan tampilan halaman mana pun. */
.login-page .btn,
.admin-page .btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--grid);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.login-page .btn:hover,
.admin-page .btn:hover { border-color: var(--accent-2); color: var(--accent); }
.login-page .btn:focus-visible,
.admin-page .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.login-page .btn:disabled,
.admin-page .btn:disabled { opacity: .55; cursor: progress; }

.login-page .btn-primary,
.admin-page .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.login-page .btn-primary:hover,
.admin-page .btn-primary:hover { background: #004b87; border-color: #004b87; color: #fff; }

.admin-page .btn-quiet { background: transparent; color: var(--ink-2); border-color: var(--grid); }
.admin-page .btn-quiet:hover { color: var(--accent); border-color: var(--accent-2); }

.admin-page .btn-danger { background: transparent; border-color: #e6bcbc; color: #9c1f1f; }
.admin-page .btn-danger:hover { background: #fdeaea; border-color: var(--crit); color: #9c1f1f; }

.admin-page .btn-light { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .35); color: #fff; }
.admin-page .btn-light:hover { background: rgba(255, 255, 255, .2); border-color: #fff; color: #fff; }

.admin-page .btn-sm { font-size: 12.5px; padding: 5px 10px; }
.login-page .btn-block,
.admin-page .btn-block { display: block; width: 100%; padding: 11px 14px; font-size: 14.5px; }

/* ------------------------------ Formulir ---------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 16px;
  align-items: start;
}
.login-page .field,
.admin-page .field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="datetime-local"],
.field select,
.field textarea {
  font: inherit;
  font-size: 14px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.field textarea { resize: vertical; min-height: 62px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.field-hint { font-size: 12px; color: var(--ink-3); }
.field-hint code { font-size: 11.5px; background: var(--page); padding: 1px 4px; border-radius: 4px; }
.admin-page .field-checks { gap: 8px; justify-content: start; }

.form-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }

.cond-builder {
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  background: var(--page);
}
.cond-builder legend { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
.cond-preview {
  margin: 12px 0 0;
  padding: 9px 11px;
  border: 1px dashed var(--grid);
  border-radius: 8px;
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

/* ------------------------------ Halaman login ----------------------- */
.login-page { background: var(--page); }
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px 24px;
}
.login-logo { height: 38px; width: auto; display: block; margin-bottom: 20px; }
.login-title { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.login-sub { margin: 4px 0 20px; font-size: 13px; color: var(--ink-3); }
.login-card .field { margin-bottom: 14px; }
.login-card .btn-block { margin-top: 4px; }
.login-note {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--grid);
  font-size: 12px;
  color: var(--ink-3);
}
.login-foot { font-size: 12px; color: var(--ink-3); margin: 0; text-align: center; }
.login-foot a { color: var(--accent); }

/* ------------------------- Panel admin: top bar --------------------- */
.admin-page { background: var(--page); }
.admin-bar { background: #12203a; color: #fff; }
.admin-bar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  flex-wrap: wrap;
}
.logo-chip {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  padding: 5px 9px;
}
.logo-chip img { height: 26px; width: auto; display: block; }
.admin-tag {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .12em;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  color: #cfe0f2;
}
.admin-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-user { font-size: 13px; color: #cfe0f2; }

.boot-note { padding: 40px 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

/* -------------------------- Panel admin: layout --------------------- */
.admin-shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px;
}
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 20px;
}
.nav-item {
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.nav-item:hover { background: var(--surface); border-color: var(--grid); color: var(--accent); }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-item.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.admin-main { min-width: 0; }

/* ------------------------------ Umpan balik ------------------------- */
.flash {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13.5px;
  color: var(--ink-2);
}
.flash-msg { color: inherit; }
.flash-note { font-size: 12.5px; color: var(--ink-3); }
.flash-ok { background: #eef8ee; border-color: #c3e8c3; color: #1c5c1c; }
.flash-ok .flash-note { color: #2f6b2f; }
.flash-err { background: #fdeaea; border-color: #f0c2c2; color: #8d1f1f; }
.flash-err .flash-note { color: #a04141; }
.flash-info { background: #eef4fb; border-color: #c4d9ef; color: #17456f; }
.flash-info .flash-note { color: #3d6a94; }

/* -------------------------------- Tabel ----------------------------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  background: var(--surface);
}
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--grid);
  background: var(--page);
  white-space: nowrap;
}
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--grid);
  vertical-align: middle;
  color: var(--ink);
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: #f5f7fa; }
.table-empty { color: var(--ink-3); text-align: center; padding: 22px 12px; }

.cell-stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.scan-status { font-size: 12px; color: var(--ink-3); }
.cond-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
  display: inline-block;
  max-width: 42ch;
}
.inline-select {
  font: inherit;
  font-size: 12.5px;
  padding: 5px 8px;
  border: 1px solid var(--grid);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

/* ------------------------------ Share link -------------------------- */
.share-box { background: #eef4fb; border-color: #c4d9ef; }
.share-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.share-url {
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  flex: 1 1 320px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--accent-2);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.share-box .field-hint { margin: 10px 0 0; }

/* -------------------- Panel admin: layar sempit --------------------- */
@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 14px;
  }
  .admin-nav {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--page);
    border-bottom: 1px solid var(--grid);
  }
  .nav-item { flex: 0 0 auto; border-radius: 999px; }
  .admin-bar-inner { padding: 10px 14px; gap: 10px; }
  .admin-user { width: 100%; order: 3; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  table.data { font-size: 12.5px; }
}

/* =====================================================================
   Portal Mitra (Fase 3b)
   Kartu circuit sengaja tidak memakai border kiri tebal berwarna: status
   sudah dibawa badge + bar utilisasi, dan garis warna tebal membuat kartu
   terpilih sulit dibedakan dari kartu bermasalah.
   ===================================================================== */

/* ------------------------- Header portal & tombol ------------------------ */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}

.tenant-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e8f2fa;
  color: var(--accent);
  border: 1px solid #cbe1f2;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  padding: 3px 10px;
  border: 1px solid var(--grid);
  border-radius: 999px;
  background: var(--page);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--nodata); flex: none; }
.live-pill[data-mode="live"] .live-dot { background: var(--good); }
.live-pill[data-mode="poll"] .live-dot { background: var(--warn); }

.btn {
  font: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.btn:hover { border-color: var(--accent-2); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #004c88; border-color: #004c88; color: #fff; }
.btn-ghost { background: transparent; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-3); padding: 4px 8px; }
.btn-quiet:hover { color: var(--crit); border-color: var(--grid); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------------------------- Kartu circuit ----------------------------- */
.circuit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.circuit-card {
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  background: var(--page);
  color: var(--ink);
  cursor: pointer;
}
.circuit-card:hover { border-color: var(--accent-2); }
.circuit-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.circuit-card.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: var(--surface);
}
.circuit-card.is-unmapped { opacity: .82; }

.circuit-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.circuit-code { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.circuit-badge { flex: none; }
.circuit-meta { font-size: 12.5px; color: var(--ink-3); }

.util-bar {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--grid);
  overflow: hidden;
}
.util-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--down);
}
.util-fill[data-level="warn"] { background: var(--warn); }
.util-fill[data-level="crit"] { background: var(--crit); }

.circuit-rates {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-2);
}
.circuit-rate { font-weight: 600; }
.circuit-pct { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.circuit-note { font-size: 12px; color: var(--ink-3); }
.circuit-note:empty { display: none; }

/* --------------------------- Langganan alert ---------------------------- */
.alert-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.field-grow { flex: 1 1 220px; }
.field-label { font-size: 12px; color: var(--ink-3); }
.input {
  font: inherit;
  font-size: 13.5px;
  padding: 7px 10px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.form-msg { margin: 0 0 10px; font-size: 12.5px; color: var(--good-text); }
.form-msg.is-error { color: var(--crit); }

.alert-list { display: flex; flex-direction: column; }
.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--grid);
  font-size: 13.5px;
}
.alert-item:first-child { border-top: none; }
.alert-item-text { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; color: var(--ink-2); }
.alert-item-text strong { color: var(--ink); }
.alert-dest { word-break: break-all; }
.alert-scope-text { color: var(--ink-3); }

@media (max-width: 640px) {
  .circuit-grid { grid-template-columns: 1fr; }
  .header-actions { margin-left: 0; width: 100%; }
  .head-actions { flex-direction: column; align-items: stretch; }
  .alert-form { flex-direction: column; align-items: stretch; }
  .alert-form .btn { width: 100%; }
  .field { min-width: 0; }
}
