/* Base palette (overridden per theme by theme.js); derived tokens follow from it. */
:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #8b93a7;
  --accent: #4c8dff;
  --on-accent: #ffffff;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --info: #a371f7;

  --radius: 12px;
  --radius-sm: 8px;
  --accent-2: color-mix(in srgb, var(--accent) 82%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-ring: color-mix(in srgb, var(--accent) 30%, transparent);
  --line: color-mix(in srgb, var(--border) 70%, transparent);
  --hover: color-mix(in srgb, var(--text) 5%, transparent);
  --subtle: color-mix(in srgb, var(--muted) 70%, var(--bg));
  --scroll: color-mix(in srgb, var(--border) 85%, var(--text));
  --input: color-mix(in srgb, var(--bg) 60%, var(--panel));
  --danger-border: color-mix(in srgb, var(--bad) 40%, var(--panel));
  --danger-text: var(--bad);
  --danger-hover: color-mix(in srgb, var(--bad) 12%, var(--panel));
  --shadow-sm: 0 1px 2px color-mix(in srgb, #000 18%, transparent);
  --shadow: 0 10px 30px -8px color-mix(in srgb, #000 40%, transparent);
  --ease: cubic-bezier(.2, .7, .2, 1);

  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-size: 13.5px;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { display: flex; background: var(--bg); color: var(--text); overflow: hidden; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ========== Sidebar ========== */
.sidebar {
  width: 232px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 0 12px 12px;
}
.brand {
  display: flex; align-items: center; gap: 11px; height: 72px; padding: 14px 8px 0;
  -webkit-app-region: drag; user-select: none;
}
.license-screen {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px;
  background: var(--bg); -webkit-app-region: drag;
}
.license-card {
  width: 440px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; padding: 28px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  -webkit-app-region: no-drag;
}
.license-card h1 { margin: 6px 0 0; font-size: 22px; }
.license-card .lead { margin: 0; color: var(--muted); }
.license-card .err { color: var(--bad); font-size: 12.5px; }
.license-card .err:empty { display: none; }
.license-id { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--input); border: 1px solid var(--line); }
.license-id .mono { flex: 1; color: var(--text); font-size: 15px; letter-spacing: 1px; }
.logo {
  width: 34px; height: 34px; border-radius: 9px; display: block; object-fit: cover;
  box-shadow: 0 6px 16px -6px #3b82f6;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-ver { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--hover); color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: 0; vertical-align: 2px; }
.brand-ver:empty { display: none; }
.brand-sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; }

.nav-list { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; overflow: auto; }
.nav-group { color: var(--subtle); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.1px; padding: 16px 12px 6px; }
.nav {
  position: relative; display: flex; align-items: center; justify-content: flex-start; gap: 11px;
  background: none; border: 0; color: var(--muted); text-align: left; padding: 9px 12px;
  border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav svg { width: 17px; height: 17px; opacity: .85; }
.nav:hover { background: var(--hover); color: var(--text); }
.nav.active { background: var(--accent-soft); color: var(--accent); }
.nav.active svg { opacity: 1; }
.nav.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.theme-select { flex-direction: row !important; align-items: center; gap: 0 !important; position: relative; }
.theme-select svg { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.theme-select select { padding-left: 32px; height: 34px; }
.conn-status {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--input); color: var(--muted); font-size: 12px; overflow: hidden;
}
#connText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.conn-status.ok .dot { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2.4s infinite; }
.conn-status.bad .dot { background: var(--bad); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ========== Main ========== */
main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
/* Draggable strip under the native window controls (titleBarOverlay). */
.topbar {
  height: 40px; flex-shrink: 0; display: flex; align-items: center; padding: 0 160px 0 28px;
  -webkit-app-region: drag; user-select: none; color: var(--subtle); font-size: 12px;
}
.view {
  display: none; flex: 1; min-height: 0; flex-direction: column; gap: 16px;
  padding: 4px 28px 24px; overflow: auto;
}
.view.active { display: flex; animation: fade .22s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-head h1 { font-size: 24px; margin: 0; font-weight: 650; letter-spacing: -.3px; }
.view-head .lead { margin: 4px 0 0; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 8px; }

/* ========== Controls ========== */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .08s, box-shadow .15s;
}
button:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
button:disabled { opacity: .5; cursor: default; }
button.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  border-color: transparent; color: var(--on-accent);
  box-shadow: 0 4px 14px -6px var(--accent), inset 0 1px 0 color-mix(in srgb, #fff 20%, transparent);
}
button.primary:hover { filter: brightness(1.06); }
button.ghost { background: transparent; }
button.ghost:hover { background: var(--hover); }
button.danger { background: transparent; border-color: var(--danger-border); color: var(--danger-text); }
button.danger:hover { background: var(--danger-hover); border-color: var(--bad); }
button.sm { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 6px; }

input, select, textarea {
  width: 100%; background: var(--input); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0 11px; height: 36px; font: inherit; font-weight: 400;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
input:hover, select:hover, textarea:hover { border-color: var(--border); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
input::placeholder, textarea::placeholder { color: var(--subtle); }
select { cursor: pointer; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
label small { color: var(--subtle); font-weight: 400; }
label.check { flex-direction: row; align-items: center; gap: 9px; color: var(--text); font-size: 13px; cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* Toggle switch */
.switch { flex-direction: row; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 32px; height: 18px; border-radius: 999px; background: var(--border); position: relative; transition: background .2s var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }

/* ========== Tabs (segmented) ========== */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; align-self: flex-start; }
.tab {
  height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font-weight: 500; gap: 7px;
}
.tab:hover { color: var(--text); background: var(--hover); border: 0; }
.tab.active { background: var(--panel-2); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.tab .count[hidden] { display: none; }
.tab .count { min-width: 20px; height: 18px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 999px; background: var(--hover); font-size: 11px; font-weight: 600; color: var(--muted); }
.tab.active .count { background: var(--accent-soft); color: var(--accent); }

.finder { display: flex; gap: 6px; }
.finder select { width: 120px; }
.finder input { width: 220px; }

/* ========== Panes / cards ========== */
.split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(380px, 1fr); gap: 16px; flex: 1; min-height: 420px; }
.pane, .card, fieldset {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.pane { min-height: 0; overflow: auto; }
.card { padding: 14px 16px; }
.list-pane { display: flex; flex-direction: column; }
.search-wrap { position: relative; margin: 12px; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--subtle); }
.search-wrap input { padding-left: 34px; }
.detail-pane { padding: 18px 20px; }
.empty { color: var(--subtle); padding: 48px 20px; text-align: center; }

/* ========== Table ========== */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th {
  position: sticky; top: 0; z-index: 1; background: var(--panel);
  color: var(--subtle); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
}
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
td.mono, .mono { font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .2px;
  background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge.info { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.badge.purple { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); }

/* ========== Detail ========== */
.detail-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.detail-title h2 { margin: 0; font-size: 18px; font-weight: 650; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title .sub { color: var(--muted); font-size: 12px; margin-top: 5px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0 0 6px; }
.kv > div { background: var(--input); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 11px; min-width: 0; }
.kv dt { color: var(--subtle); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.kv dd { margin: 3px 0 0; word-break: break-word; font-weight: 500; }
.section-title {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin: 22px 0 8px; color: var(--subtle); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
}
.detail-pane .table-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.progress { height: 6px; background: var(--hover); border-radius: 999px; overflow: hidden; margin: 12px 0 0; }
.progress > div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 60%, var(--info)), var(--accent)); transition: width .4s var(--ease); }
details.raw summary { cursor: pointer; color: var(--muted); margin-top: 20px; font-size: 12px; user-select: none; }
details.raw summary:hover { color: var(--text); }
pre {
  background: var(--input); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; overflow: auto; font: 12px/1.55 "Cascadia Code", Consolas, monospace;
  max-height: 380px; margin: 8px 0 0; white-space: pre-wrap; word-break: break-word;
}

/* ========== Forms ========== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; align-items: start; }
fieldset { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 14px; margin: 0; min-width: 0; }
legend {
  float: left; width: 100%; padding: 0 0 12px; margin-bottom: 2px; border-bottom: 1px solid var(--line);
  color: var(--text); font-weight: 650; font-size: 14px;
}
legend + * { clear: both; }
legend.legend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
legend.legend-row .switch { font-size: 12.5px; font-weight: 500; }
.row2, .row3, .row5 { display: grid; gap: 12px; }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1fr 1fr 1fr; }
.row5 { grid-template-columns: repeat(5, 1fr); }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { width: 150px; }
.inline-form .or { color: var(--subtle); padding-bottom: 9px; font-size: 12px; }
.result:empty { display: none; }

/* ========== Pengaturan ========== */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
#connForm { display: flex; flex-direction: column; gap: 16px; }
.conn-result:empty { display: none; }
.nav-count { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--warn); color: #000; font-size: 11px; font-weight: 700; }
.tx-link { color: var(--accent); font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; cursor: pointer; }
.pay-section { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--accent); }
.gas-info { font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.gas-info:empty { display: none; }
.gas-info .mono { color: var(--text); }
.gas-info button { margin-left: 6px; }
.pay-checks { list-style: none; margin: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; border-radius: var(--radius-sm); background: var(--input); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.pay-checks:empty { display: none; }
.pay-checks li::before { content: "✕"; display: inline-block; width: 18px; color: var(--bad); font-weight: 700; }
.pay-checks li.ok::before { content: "✓"; color: var(--ok); }
.pay-checks li.ok { color: var(--subtle); }
.wd-list { display: flex; flex-direction: column; gap: 10px; }
.wd-list:empty::after { content: attr(data-empty); color: var(--subtle); font-size: 12.5px; }
.wd-item { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius-sm); background: var(--input); border: 1px solid var(--line); }
.wd-path { display: flex; gap: 6px; align-items: center; }
.wd-path input { flex: 1; min-width: 0; }
.wd-status { font-size: 12px; color: var(--muted); }
.wd-status.ok { color: var(--ok); }
.wd-status.bad { color: var(--bad); }
.mono-input { font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
.web-status { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.web-status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--subtle); }
.web-status .dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.web-status .err { color: var(--bad); }
.web-url { display: flex; align-items: center; gap: 8px; }
.web-url a { color: var(--accent); font-family: "Cascadia Code", Consolas, monospace; cursor: pointer; }
.conn-result { display: flex; flex-direction: column; gap: 6px; }
.conn-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.conn-result details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.conn-result pre { max-height: 220px; }


/* ========== Log ========== */
.log { display: flex; flex-direction: column; gap: 6px; }
.log-item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; transition: border-color .15s; }
.log-item:hover { border-color: var(--border); }
.log-item .line { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.log-item .time { color: var(--subtle); font-size: 12px; font-variant-numeric: tabular-nums; }
.log-item .url { font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-item pre { display: none; }
.log-item.open pre { display: block; }

/* ========== Toasts ========== */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 440px; padding: 11px 16px;
  background: color-mix(in srgb, var(--panel-2) 92%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  animation: toast-in .25s var(--ease);
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.toast.ok::before { background: var(--ok); }
.toast.bad::before { background: var(--bad); }
@keyframes toast-in { from { transform: translateY(10px) scale(.98); opacity: 0; } }

/* ========== Dialog ========== */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; min-width: 400px; box-shadow: var(--shadow);
}
dialog[open] { animation: toast-in .2s var(--ease); }
dialog::backdrop { background: color-mix(in srgb, #000 50%, transparent); backdrop-filter: blur(3px); }
dialog h3 { margin: 0 0 14px; font-size: 16px; font-weight: 650; }
dialog #promptBody { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; color: var(--muted); }

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--subtle); }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }

@media (max-width: 1150px) {
  .split { grid-template-columns: 1fr; }
}


/* ========== Redeem: sub views ========== */
.subview { display: none; flex-direction: column; gap: 16px; flex: 1; min-height: 0; }
.subview.active { display: flex; animation: fade .22s var(--ease); }

/* Wizard */
.wizard {
  width: 100%; max-width: 620px; margin: 0 auto; padding: 26px 28px 28px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm);
}
.stepper { list-style: none; display: flex; padding: 0; margin: 0 0 26px; counter-reset: s; }
.stepper li {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; position: relative;
  color: var(--subtle); font-size: 12px; font-weight: 600;
}
.stepper li:not(:first-child)::before {
  content: ""; position: absolute; top: 14px; right: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0;
}
.stepper li span {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; position: relative; z-index: 1;
  background: var(--panel-2); border: 2px solid var(--line); color: var(--muted); font-size: 13px;
  transition: all .25s var(--ease);
}
.stepper li.active, .stepper li.done { color: var(--text); }
.stepper li.active span { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.stepper li.done span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.stepper li.done + li::before, .stepper li.active:not(:first-child)::before { background: var(--accent); }

.wstep { display: none; flex-direction: column; gap: 16px; }
.wstep.active { display: flex; animation: fade .22s var(--ease); }
.req { color: var(--bad); }
.key-input { height: 46px; font: 600 17px "Cascadia Code", Consolas, monospace; letter-spacing: 2px; text-transform: uppercase; text-align: center; }
.key-info:empty { display: none; }
.key-info { margin-top: -6px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.res-chip { display: inline-flex; gap: 5px; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 12px; font-weight: 600; }
.res-chip i { font-style: normal; color: var(--muted); font-weight: 500; }

.loc-parts { display: grid; grid-template-columns: 1fr 2fr .8fr .8fr .8fr; gap: 8px; margin-top: -6px; }
.loc-parts > div { display: flex; flex-direction: column; gap: 4px; }
.loc-parts span { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--subtle); }
.loc-parts input { height: 32px; font-size: 12.5px; }
.loc-parts input.filled { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }

details.optional { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
details.optional summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 500; }
details.optional[open] summary { margin-bottom: 12px; }
.notice {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.5;
  background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  color: color-mix(in srgb, var(--warn) 55%, var(--text));
}

.summary { display: grid; grid-template-columns: 140px 1fr; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.summary dt, .summary dd { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.summary dt { color: var(--muted); background: var(--input); font-size: 12.5px; }
.summary dd { font-weight: 500; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.summary dt:nth-last-child(2), .summary dd:last-child { border-bottom: 0; }
.preview-box:empty { display: none; }
.preview-box { font-size: 12.5px; color: var(--muted); }

.done-panel { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0; }
.done-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); margin-bottom: 6px; animation: pop .4s var(--ease); }
.done-icon svg { width: 32px; height: 32px; stroke-width: 2.6; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.done-panel h2 { margin: 0; font-size: 22px; }
.order-label { color: var(--subtle); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; margin-top: 8px; }
.order-no { height: auto; padding: 10px 18px; font: 700 20px "Cascadia Code", Consolas, monospace; letter-spacing: 1px; background: var(--input); border: 1px dashed var(--accent); color: var(--accent); }
.done-panel p { color: var(--muted); max-width: 400px; margin: 6px 0 10px; }
.btn-row.center { justify-content: center; }

/* Manage keys */
.gen-card { display: flex; flex-direction: column; gap: 12px; }
.gen-head { display: flex; justify-content: space-between; align-items: center; }
.gen-grid { display: grid; grid-template-columns: 110px minmax(240px, 2fr) 90px 130px 1fr 1fr auto; gap: 10px; align-items: end; }
.uses { font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; color: var(--muted); margin-left: 6px; }
.key-cell { font-family: "Cascadia Code", Consolas, monospace; font-weight: 600; letter-spacing: .5px; }
.copy-list { width: 100%; min-height: 200px; }

@media (max-width: 1250px) {
  .gen-grid { grid-template-columns: 1fr 1fr; }
}

/* ========== Order baru ========== */
.order-form {
  width: 100%; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm);
}
.of-sec { display: flex; flex-direction: column; gap: 14px; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.of-sec h3, .of-adv summary { margin: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.order-form label small { font-size: 11.5px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.span2 { grid-column: span 2; }
.span4 { grid-column: 1 / -1; }
.accent-label { color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.select-row { display: flex; gap: 8px; }
.select-row select { flex: 1; }
.pkg-info:empty { display: none; }
.pkg-info { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-row.start { justify-content: flex-start; }
.of-adv { padding: 18px 26px; border-bottom: 1px solid var(--line); }
.of-adv summary { cursor: pointer; user-select: none; }
.of-adv summary small { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--subtle); margin-left: 6px; }
.of-adv[open] summary { margin-bottom: 16px; }
.of-adv .btn-row { margin-top: 12px; }
.of-foot { display: flex; align-items: center; gap: 8px; padding: 18px 26px; }
.of-foot .spacer { flex: 1; }
.of-foot .primary { height: 40px; padding: 0 22px; font-size: 14px; }
.order-form .result { padding: 0 26px 22px; }
.order-form .result .section-title { margin-top: 0; }

/* Manage dialog (customers / packages) */
.manage-dlg { width: 560px; max-width: calc(100vw - 40px); padding: 0; }
.md-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.md-head h3 { margin: 0; }
.md-list { max-height: 300px; overflow: auto; padding: 8px 12px; }
.md-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); }
.md-item:hover { background: var(--hover); }
.md-item .md-main { flex: 1; min-width: 0; }
.md-item .md-name { font-weight: 600; }
.md-item .md-sub { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 5px; }
.md-form { display: flex; flex-direction: column; gap: 10px; padding: 16px 22px 20px; border-top: 1px solid var(--line); background: var(--input); border-radius: 0 0 16px 16px; }
.md-form .md-form-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }

/* ========== Paket & Harga ========== */
.eyebrow { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--accent); }
.eyebrow.warn { color: var(--warn); }

.pkg-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pkg-pick { display: flex; flex-direction: column; gap: 8px; }
.pkg-pick .eyebrow { color: var(--muted); }
.pkg-pick-row { display: flex; gap: 8px; }
.pkg-pick-row select { width: 200px; font-weight: 600; }
.pkg-new { display: flex; gap: 8px; }
.pkg-new input { width: 180px; }

.range-board {
  flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr);
  overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.range-board > .empty { grid-column: 1 / -1; }
.rcol { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-width: 0; transition: background .15s var(--ease); }
.rcol:last-child { border-right: 0; }
.rcol.hit { background: var(--accent-soft); }
.rc-top { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.rc-foot { display: flex; flex-direction: column; gap: 8px; min-height: 96px; padding: 14px; border-top: 1px solid var(--line); }

.rc-head { display: flex; align-items: center; gap: 6px; }
.rc-label { font-weight: 700; }
.rc-x { flex: none; width: 30px; height: 30px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 18px; }
.rc-x:hover { background: var(--danger-hover); color: var(--danger-text); }
.rc-span { display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: 8px; }
.rc-span input { height: 32px; padding: 0 8px; min-width: 0; }

.rcol.base .rc-top { gap: 6px; }
.rc-title { font-weight: 700; font-size: 14px; }
.rc-sub { color: var(--subtle); font-size: 12px; }
.rc-res { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

.rc-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.rc-price.saved, .rc-span input.saved, .rc-label.saved { border-color: var(--ok); }
.rc-note { color: var(--muted); font-size: 11.5px; line-height: 1.45; }

.rcol.add .rc-top input { height: 34px; }
.rcol.add .rc-foot { border-top-color: transparent; }

.calc { flex-direction: row; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.calc input { width: 140px; }
.calc-out { color: var(--muted); font-size: 12.5px; }
.calc-out b { color: var(--text); }
.hint { margin: 0; color: var(--subtle); font-size: 12px; }

/* Price shown in the order form */
.price-tag { display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); font-weight: 700; font-size: 14px; }
.price-tag small { color: var(--muted); font-weight: 500; font-size: 11.5px; }

/* Supply progress */
.sp-progress { background: var(--hover); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin: 4px 0 14px; }
.sp-progress .progress { height: 10px; margin-top: 10px; }
.sp-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sp-pct { font-size: 28px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.sp-amount { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-extra { margin-top: 8px; font-size: 12px; color: var(--subtle); }
.mini-progress { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.mini-progress .progress { flex: 1; margin: 0; }
.mini-progress b { font-size: 12px; font-variant-numeric: tabular-nums; }

.gas-balance { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.gas-balance .err { color: var(--bad); }

.qr-box { width: 160px; margin-top: 10px; border-radius: 8px; overflow: hidden; line-height: 0; }
.qr-box svg { width: 100%; height: auto; display: block; }

/* ========== Dashboard ========== */
.dash-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1250px) { .dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.4px; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-value small { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-sub { font-size: 12px; color: var(--subtle); }
.stat.warn { box-shadow: inset 3px 0 0 var(--warn), var(--shadow-sm); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.dash-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dash-wide { grid-column: 1 / -1; }
.dash-title { font-weight: 650; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dash-title small { font-weight: 400; font-size: 12px; color: var(--subtle); }
.dash-today { margin-left: auto; font-variant-numeric: tabular-nums; }
.dash-today b { font-weight: 650; color: var(--text); }
.dash-sys .badge { gap: 5px; }
.dash-sys .badge::before { display: none; }
.dash-title a { color: var(--text); cursor: pointer; text-decoration: none; }
.dash-title a:hover { color: var(--accent); }
.dash-big { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-big small { font-size: 13px; font-weight: 500; color: var(--muted); }
.dash-chips { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.dash-chips span { display: inline-flex; align-items: center; gap: 6px; }
.dash-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.dash-row:last-child { border-bottom: 0; }
.dash-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-list td { padding: 8px 4px; white-space: normal; }
.dash-list tr { cursor: pointer; }
.dash-sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 20px; }
.dash-sys { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.dash-sys .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dash-table summary { font-size: 12px; }
/* Bar chart: thin bars, 4px rounded tops on a zero baseline, recessive axis. */
.bar-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.bar-axis { height: 140px; display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--subtle); text-align: right; font-variant-numeric: tabular-nums; }
.bar-plot { display: flex; align-items: stretch; gap: 2px; border-top: 1px dashed var(--line); }
.bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; cursor: default; }
.bar-area { height: 140px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid var(--line); position: relative; }
.bar { width: 62%; max-width: 22px; background: color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 4px 4px 0 0; transition: background .12s; }
.bar.today, .bar-col.hover .bar { background: var(--accent); }
.bar-value { font-size: 11px; color: var(--text); font-weight: 600; margin-bottom: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-x { height: 18px; font-size: 10px; color: var(--subtle); text-align: center; padding-top: 4px; white-space: nowrap; }
.chart-tip { position: fixed; z-index: 1000; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow-sm); color: var(--text); }
.chart-tip div { color: var(--muted); font-variant-numeric: tabular-nums; }
