/* Electrocom Prepaid. Self-contained: no external fonts/CDNs, so the portal
   loads inside the walled garden. */
:root {
  --ink: #14202b;
  --ink-2: #4a5966;
  --ink-3: #7a8894;
  --line: #e2e7ec;
  --bg: #f5f7f9;
  --card: #ffffff;
  --brand: #0b6e4f;
  --brand-ink: #ffffff;
  --brand-soft: #e3f3ec;
  --accent: #f2a541;
  --ok: #0b6e4f;
  --ok-soft: #e3f3ec;
  --warn: #9a5b00;
  --warn-soft: #fff3df;
  --bad: #b3261e;
  --bad-soft: #fdeceb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 32, 43, .06), 0 4px 16px rgba(20, 32, 43, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eef3; --ink-2: #b4c0ca; --ink-3: #8696a3; --line: #2a3742;
    --bg: #0f171e; --card: #16212a; --brand: #3fbf8f; --brand-ink: #06140e;
    --brand-soft: #143429; --ok: #3fbf8f; --ok-soft: #143429;
    --warn: #f2b45a; --warn-soft: #3a2a10; --bad: #ff8a80; --bad-soft: #3b1714;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
small, .muted { color: var(--ink-3); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

/* ---------- layout ---------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .wrap, .topbar .wrap-wide { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { white-space: nowrap; font-weight: 800; font-size: 1.1rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); margin-right: 8px; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.topbar .wrap nav { flex-wrap: nowrap; }
.topbar .wrap-wide { flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.topbar nav a, .linkbtn {
  color: var(--ink-2); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem;
  background: none; border: 0; cursor: pointer; font: inherit;
}
.topbar nav a:hover, .linkbtn:hover, .topbar nav a.on { background: var(--bg); color: var(--ink); }
main { padding: 24px 0 48px; }
footer { color: var(--ink-3); font-size: .9rem; padding: 24px 0 40px; text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.hero { padding: 28px 22px; background: var(--brand); color: var(--brand-ink); border: 0; }
.hero h1 { color: inherit; }
.hero p { opacity: .9; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .92rem; margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.help { font-size: .85rem; color: var(--ink-3); margin-top: 4px; }
input:not([type]), input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number],
input[type=search], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 90px; }
.inline-input { display: flex; gap: 8px; }
.inline-input input { flex: 1; min-width: 0; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: 18px; height: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font: inherit; font-weight: 650; text-decoration: none; white-space: nowrap;
  background: var(--brand); color: var(--brand-ink);
}
.btn:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-light { background: var(--card); color: var(--brand); }
.btn-sm { padding: 6px 10px; font-size: .88rem; border-radius: 8px; }
.btn-block { width: 100%; }
form.inline { display: inline; }

/* ---------- flashes / badges ---------- */
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: .95rem; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-muted { background: var(--bg); color: var(--ink-3); border: 1px solid var(--line); }

/* ---------- passes ---------- */
.passes { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pass { position: relative; display: block; cursor: pointer; }
.pass input { position: absolute; opacity: 0; pointer-events: none; }
.pass .box {
  border: 2px solid var(--line); border-radius: 12px; padding: 14px; background: var(--card);
  transition: border-color .12s, box-shadow .12s; height: 100%;
}
.pass .name { font-weight: 700; }
.pass .price { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin: 4px 0; }
.pass .desc { font-size: .88rem; color: var(--ink-3); }
.pass input:checked + .box { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pass input:focus-visible + .box { outline: 2px solid var(--brand); outline-offset: 2px; }
.pass-static .box { cursor: default; }

.status { display: flex; align-items: center; gap: 14px; }
.status .big { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.pulse { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.pulse.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.pulse.off { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: var(--bg); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: color-mix(in srgb, var(--bg) 60%, transparent); }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .label { font-size: .8rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.stat .value { white-space: nowrap; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat a { color: inherit; text-decoration: none; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .bar span { display: block; width: 100%; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar em { font-style: normal; font-size: .7rem; color: var(--ink-3); margin-top: 4px; white-space: nowrap; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .95rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
details summary { cursor: pointer; font-weight: 600; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.toolbar .field { margin: 0; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; }

@media (max-width: 560px) {
  h1 { font-size: 1.45rem; }
  .card { padding: 16px; }
  .hide-sm { display: none; }
  .topbar .wrap nav a, .topbar .wrap .linkbtn { padding: 6px 8px; font-size: .9rem; }
  .topbar .wrap-wide nav { margin-left: 0; justify-content: flex-start; }
  .toolbar input, .toolbar select { min-width: 0; width: 100%; }
  .toolbar .field { flex: 1 1 140px; }
}
