/* ---------- token warna: terang (bawaan) dan gelap ---------- */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f7f8fa; --surface-3: #eef0f4;
  --ink: #131722; --ink-2: #414a5a; --muted: #6b7484; --line: #e4e7ec; --line-2: #d3d8e0;
  --primary: #2f5bea; --primary-2: #2449c4; --primary-soft: #e9eefe; --on-primary: #ffffff;
  --accent: #f6821f;
  --ok: #157a3c; --ok-bg: #e3f5ea; --warn: #8a5a00; --warn-bg: #fff1cc; --err: #b4231a; --err-bg: #fde7e5;
  --info: #1d4f91; --info-bg: #e6effc; --violet: #5b3fb3; --violet-bg: #eeeafc; --soft: #7a5b12; --soft-bg: #fbf3dc;
  --dead: #ffffff; --dead-bg: #b4231a; --brand: #8a4208; --brand-bg: #fdebdc;
  --bar-live: #22a05a; --bar-redirect: #3b78e7; --bar-parkir: #b6bcc8; --bar-lain: #8b6fe0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --radius: 12px; --radius-sm: 8px;
  --mono: ui-monospace, "Cascadia Code", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  /* nama lama yang masih dipakai beberapa template */
  --panel: var(--surface); --navy: var(--ink); --navy2: var(--primary);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0e14; --surface: #131822; --surface-2: #181e2a; --surface-3: #202838;
  --ink: #e8ebf2; --ink-2: #bcc3d0; --muted: #8b94a5; --line: #242c3b; --line-2: #313b4e;
  --primary: #6b8eff; --primary-2: #86a2ff; --primary-soft: #1b2644; --on-primary: #0b0e14;
  --ok: #5fd18b; --ok-bg: #12301f; --warn: #f2c14e; --warn-bg: #3a2c0b; --err: #ff8a80; --err-bg: #3d1614;
  --info: #8ab4ff; --info-bg: #15264a; --violet: #b9a5ff; --violet-bg: #251d47; --soft: #dcc27a; --soft-bg: #2c2610;
  --dead: #ffffff; --dead-bg: #c0392b; --brand: #ffb37a; --brand-bg: #3a2210;
  --bar-live: #3fbf75; --bar-redirect: #5d92f5; --bar-parkir: #4a5466; --bar-lain: #9d84ee;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.5 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.ic { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mono, td.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap, td.nowrap { white-space: nowrap; }
.wrap { word-break: break-all; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- kerangka: menu samping + isi ---------- */
.layout { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px;
  background: var(--surface); border-right: 1px solid var(--line); z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); padding: 6px 10px 18px; }
.brand .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 550; }
.nav a:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a.cta { margin: 6px 0; background: var(--primary); color: var(--on-primary); justify-content: center; }
.nav a.cta:hover { background: var(--primary-2); color: var(--on-primary); }
.nav .count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn);
  font-size: 11.5px; font-weight: 700; text-align: center; line-height: 20px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 10px; }
.brand:hover { text-decoration: none; }
.side-foot button { display: flex; align-items: center; justify-content: flex-start; gap: 11px; width: 100%; padding: 9px 11px; border: 0; background: none;
  border-radius: var(--radius-sm); color: var(--ink-2); font: inherit; font-weight: 550; cursor: pointer; text-align: left; }
.side-foot button:hover { background: var(--surface-3); color: var(--ink); }
:root[data-theme="dark"] .only-light, :root:not([data-theme="dark"]) .only-dark { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .search { position: relative; flex: 1; max-width: 460px; }
.topbar .search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar .search input { padding-left: 36px; background: var(--surface); }
.topbar .spacer { flex: 1; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm); }
.menu-btn { display: none; }
.jobs-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; background: var(--info-bg);
  color: var(--info); font-weight: 600; font-size: 12.5px; }
.jobs-pill:hover { text-decoration: none; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.content { width: 100%; max-width: 1380px; margin: 0 auto; padding: 22px 28px 72px; }
.scrim { display: none; }

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; width: 264px; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 35; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 14px; }
  .content { padding: 16px 14px 64px; }
}

/* ---------- kepala halaman, tab ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 760px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.subnav { display: flex; gap: 4px; margin: -4px 0 18px; box-shadow: inset 0 -1px 0 var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.subnav a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; color: var(--muted); font-weight: 600; white-space: nowrap;
  border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.active { color: var(--primary); border-bottom-color: var(--primary); }
.subnav .count { padding: 0 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 11.5px; line-height: 18px; }

/* ---------- kartu, grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
  box-shadow: var(--shadow); overflow-x: auto; }
.card.flush { padding: 0; }
.card h2 { font-size: 15px; font-weight: 650; margin: 0 0 12px; }
.card h2 small { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 12.5px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid > .card { margin-bottom: 0; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 16px; }
@media (max-width: 1080px) { .grid.cols-2, .grid.cols-3, .grid.split { grid-template-columns: minmax(0, 1fr); } }

/* angka ringkas */
.tiles, .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile, .kpi { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); color: inherit; }
a.tile:hover, a.kpi:hover { border-color: var(--primary); text-decoration: none; }
.tile .label, .kpi .label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tile .value, .kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .value small, .kpi .value small { font-size: 14px; font-weight: 500; color: var(--muted); }
.tile .sub, .kpi .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.tile.ok .value, .kpi.ok .value { color: var(--ok); }
.tile.warn .value, .kpi.warn .value { color: var(--warn); }
.tile.err .value, .kpi.err .value { color: var(--err); }

/* batang proporsi (live / redirect / parkir) */
.stack { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-3); margin-top: 10px; }
.stack i { display: block; height: 100%; }
.stack .live { background: var(--bar-live); } .stack .redirect { background: var(--bar-redirect); }
.stack .parkir { background: var(--bar-parkir); } .stack .lain { background: var(--bar-lain); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c); }

/* daftar tugas di Beranda */
.tasks { display: flex; flex-direction: column; }
.task { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--line); color: inherit; }
.task:first-child { border-top: 0; }
.task:hover { background: var(--surface-2); text-decoration: none; }
.task .mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; flex: none; }
.task.err .mark { background: var(--err-bg); color: var(--err); } .task.warn .mark { background: var(--warn-bg); color: var(--warn); }
.task.soft .mark { background: var(--surface-3); color: var(--ink-2); }
.task .n { font-weight: 700; font-variant-numeric: tabular-nums; }
.task .go { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 600; white-space: nowrap; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 18px; color: var(--muted); text-align: center; }
.empty .mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--ok-bg); color: var(--ok); }

/* grafik batang expired per bulan */
.months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 150px; }
.months .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.months .bar { width: 100%; max-width: 34px; min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--primary); opacity: .85; }
.months .col.now .bar { background: var(--accent); }
.months .num { font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.months .lbl { font-size: 11.5px; color: var(--muted); }

/* ---------- tabel ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child > td { border-bottom: 0; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sortable[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; }
th.sortable[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }
tbody tr:hover td, tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.dname { font-weight: 600; color: var(--ink); }
a.dname:hover { color: var(--primary); }
.meter { display: inline-block; width: 38px; height: 5px; border-radius: 999px; background: var(--surface-3); vertical-align: middle; margin-left: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--bar-live); border-radius: 999px; }
.path { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; color: var(--muted); }
.path .hop { font-family: var(--mono); font-size: 12px; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
.path .hop.final { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.path .hop.bad { background: var(--err-bg); color: var(--err); font-weight: 600; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
@media (max-width: 760px) { .hide-sm { display: none !important; } th, td { padding: 9px 10px; } }
@media (max-width: 1180px) { .hide-md { display: none !important; } }

/* ---------- lencana ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted, .badge.plain { background: var(--surface-3); color: var(--muted); } .badge.brand { background: var(--brand-bg); color: var(--brand); }
.badge.violet { background: var(--violet-bg); color: var(--violet); } .badge.soft { background: var(--soft-bg); color: var(--soft); }
.badge.dead { background: var(--dead-bg); color: var(--dead); }
.ns { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 2px 8px; border-radius: 6px; }

/* ---------- tombol ---------- */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
button:hover, .btn:hover { background: var(--surface-3); text-decoration: none; }
button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary, button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover, button.primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn.accent, button.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger, button.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
.btn.ghost, button.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.ghost:hover, button.ghost:hover { background: var(--surface-3); }
.btn.sm, button.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
form.inline { display: inline; }
details > summary { cursor: pointer; }
details > summary.btn { list-style: none; }
details > summary.btn::-webkit-details-marker { display: none; }

/* ---------- formulir ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 12px 0 5px; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); font: inherit; background: var(--surface); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { min-height: 130px; font-family: var(--mono); font-size: 13px; resize: vertical; }
.help { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 500; }
.check input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 760px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { margin: 0 0 3px; }
.filters .f { min-width: 150px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.toolbar select { width: auto; min-width: 130px; }
.toolbar .grow { flex: 1; min-width: 180px; position: relative; }
.toolbar .grow .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .grow input { padding-left: 34px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); gap: 2px; }
.seg a { padding: 5px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.seg a:hover { color: var(--ink); text-decoration: none; }
.seg a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; background: var(--surface); }
.chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.table-foot { padding: 10px 14px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }

/* langkah bernomor di formulir tambah domain */
.steps-form { counter-reset: step; }
.step { position: relative; padding: 0 0 18px 44px; }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; display: grid; place-items: center; }
.step::after { content: ""; position: absolute; left: 13.5px; top: 32px; bottom: 4px; width: 1px; background: var(--line-2); }
.step:last-child::after { display: none; }
.step h3 { font-size: 14.5px; font-weight: 650; padding-top: 4px; }
.step h3 + .help { margin-bottom: 8px; }
.step label:first-of-type { margin-top: 8px; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-top: 8px; }
.option { position: relative; display: block; margin: 0; cursor: pointer; }
.option input { position: absolute; opacity: 0; }
.option span { display: block; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); font-weight: 600; color: var(--ink); height: 100%; }
.option small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; font-size: 12px; }
.option input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.option input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- pesan, log, lain-lain ---------- */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); } .flash.err { background: var(--err-bg); color: var(--err); }
.flash.info { background: var(--info-bg); color: var(--info); }
.flash a { color: inherit; text-decoration: underline; }
.log { font-family: var(--mono); font-size: 12.5px; background: #0d1320; color: #d8e1ee; border-radius: 10px; padding: 14px 16px; max-height: 560px; overflow: auto; }
.log .line { display: grid; grid-template-columns: 62px 86px 1fr; gap: 10px; padding: 2px 0; }
.log .ts { color: #7e8fa8; } .log .lvl { font-weight: 700; }
.log .info .lvl { color: #8fb4ff; } .log .ok .lvl { color: #58d68d; } .log .changed .lvl { color: #f6c343; }
.log .warn .lvl { color: #ffb86b; } .log .error .lvl { color: #ff7b72; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; overflow: auto; margin: 0 0 8px;
  white-space: pre-wrap; word-break: break-word; font-family: var(--mono); }
.copy { cursor: pointer; }
.copy.done { color: var(--ok); border-color: var(--ok); }

/* ---------- halaman masuk ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 28px 30px; box-shadow: var(--shadow-lg); }
.login-card .brand { padding: 0 0 14px; font-size: 18px; }
