/* Shared styles for the customer portal, the admin dashboard and receipts. */
:root {
  --paper: #f3f6f4;
  --surface: #ffffff;
  --ink: #15201b;
  --muted: #5b6a62;
  --rule: #d9e1dc;
  --soft: #e9efeb;
  --signal: #0e7a55;
  --signal-ink: #ffffff;
  --signal-soft: #dff1e8;
  --amber: #a8690f;
  --amber-soft: #fbefd9;
  --red: #b4372b;
  --red-soft: #f8e1de;
  --focus: #2f6fed;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1512; --surface: #171f1b; --ink: #e6eee9; --muted: #9fb0a7; --rule: #2c3a33; --soft: #1f2a24;
    --signal: #2fb57f; --signal-ink: #06130d; --signal-soft: #143326; --amber: #e2a447; --amber-soft: #33270f;
    --red: #ef7b6e; --red-soft: #3a1c18; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--signal); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 19px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 56px; background: var(--surface); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--signal); display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; fill: var(--signal-ink); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.nav { padding: 20px 12px; border-right: 1px solid var(--rule); background: var(--surface); }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 14px; }
.nav a:hover { background: var(--soft); }
.nav a[aria-current="page"] { background: var(--signal-soft); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--signal); }
.nav .count { font-size: 12px; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: var(--red); color: #fff; text-align: center; }
.main { padding: 28px 32px 60px; max-width: 1080px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--rule); position: sticky; top: 56px; z-index: 4; }
  .nav a { white-space: nowrap; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--signal); }
  .main { padding: 20px 16px 48px; }
  .grid2 { grid-template-columns: 1fr; }
  .topbar .who { display: none; }
}

/* ---------- sections ---------- */
.section { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; }
.section > header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section > header p { color: var(--muted); font-size: 14px; }
.section.flush { padding: 0; }
.section.flush > header { padding: 20px 20px 0; }

/* ---------- the line status band (the one bold element) ---------- */
.status-band { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 22px 24px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); position: relative; overflow: hidden; }
.status-band::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--muted); }
.status-band .lamp { width: 18px; height: 18px; border-radius: 50%; background: var(--muted); margin-left: 6px; }
.status-band .state { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.status-band .why { color: var(--muted); margin-top: 2px; max-width: 62ch; }
.status-band[data-tone="ok"] { background: var(--signal-soft); border-color: transparent; }
.status-band[data-tone="ok"]::before, .status-band[data-tone="ok"] .lamp { background: var(--signal); }
.status-band[data-tone="ok"] .lamp { box-shadow: 0 0 0 6px color-mix(in srgb, var(--signal) 22%, transparent); }
.status-band[data-tone="wait"] { background: var(--amber-soft); border-color: transparent; }
.status-band[data-tone="wait"]::before, .status-band[data-tone="wait"] .lamp { background: var(--amber); }
.status-band[data-tone="off"] { background: var(--red-soft); border-color: transparent; }
.status-band[data-tone="off"]::before, .status-band[data-tone="off"] .lamp { background: var(--red); }
@media (max-width: 640px) { .status-band { grid-template-columns: auto 1fr; } .status-band > .act { grid-column: 1 / -1; } }

/* ---------- setup steps (a real sequence) ---------- */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: start; padding: 14px 0; border-top: 1px solid var(--rule); }
.steps li:first-child { border-top: 0; padding-top: 0; }
.steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 2px solid var(--rule); color: var(--muted); }
.steps li[data-done="true"]::before { content: "\2713"; background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.steps li[data-current="true"]::before { border-color: var(--ink); color: var(--ink); }
.steps .t { font-weight: 600; }
.steps .d { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field .help { font-size: 13px; color: var(--muted); margin-top: 4px; }
.field .err { font-size: 13px; color: var(--red); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit;
}
textarea { min-height: 84px; resize: vertical; }
input[type=color] { width: 56px; height: 42px; padding: 3px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--red); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 3px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1 1 160px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--rule)); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--signal); font-weight: 600; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--soft); }
table.data td.r, table.data th.r { text-align: right; }
.empty { padding: 28px 20px; text-align: center; color: var(--muted); }

/* ---------- plan comparison ---------- */
table.plans { width: 100%; border-collapse: separate; border-spacing: 0; }
table.plans th, table.plans td { padding: 12px 14px; border-bottom: 1px solid var(--rule); text-align: center; }
table.plans th:first-child, table.plans td:first-child { text-align: left; color: var(--muted); font-weight: 400; }
table.plans thead th { vertical-align: bottom; }
table.plans .pname { font-size: 17px; font-weight: 700; color: var(--ink); }
table.plans .price { font-size: 22px; font-weight: 700; color: var(--ink); }
table.plans .per { font-size: 13px; color: var(--muted); }
table.plans .current { background: var(--signal-soft); }
table.plans tfoot td { border-bottom: 0; }

/* ---------- small pieces ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--signal-soft); color: var(--signal); }
.pill.wait { background: var(--amber-soft); color: var(--amber); }
.pill.off { background: var(--red-soft); color: var(--red); }
.kv { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.code-box { display: flex; gap: 8px; align-items: stretch; }
.code-box pre { flex: 1; margin: 0; padding: 12px; background: var(--soft); border-radius: 6px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.list li:last-child { border-bottom: 0; }
details.howto { border-top: 1px solid var(--rule); padding: 10px 0; }
details.howto summary { cursor: pointer; font-weight: 600; }
details.howto p, details.howto ol { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.notice { padding: 12px 14px; border-radius: 6px; background: var(--amber-soft); color: var(--ink); font-size: 14px; }
.notice.ok { background: var(--signal-soft); }
.notice.off { background: var(--red-soft); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stats .section { padding: 16px; }
.preview-bubble { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border-radius: 24px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.preview-bubble svg { width: 18px; height: 18px; fill: currentColor; }
.test-frame { width: 100%; max-width: 380px; height: 600px; border: 1px solid var(--rule); border-radius: 12px; background: transparent; }

/* ---------- sign-in screens ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); }
.auth-side { padding: 48px; background: var(--ink); color: var(--paper); display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { font-size: 34px; max-width: 17ch; color: var(--paper); }
.auth-side p { color: color-mix(in srgb, var(--paper) 75%, transparent); max-width: 44ch; margin-top: 14px; }
.auth-side .brand { color: var(--paper); }
.auth-main { padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; background: var(--surface); }
.auth-main h2 { font-size: 22px; margin-bottom: 6px; }
.auth-main form { margin-top: 20px; }
.auth-main .alt { margin-top: 18px; font-size: 14px; color: var(--muted); }
.signal-lines { display: flex; gap: 6px; align-items: flex-end; height: 40px; }
.signal-lines i { width: 8px; border-radius: 2px; background: var(--signal); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { padding: 28px 20px; } .auth-side h1 { font-size: 26px; } .auth-main { padding: 28px 20px; } }

/* ---------- dialogs and toasts ---------- */
dialog { border: 1px solid var(--rule); border-radius: 10px; padding: 22px; max-width: 460px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(10, 20, 15, .45); }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 10px 18px; border-radius: 8px; background: var(--ink); color: var(--paper); font-size: 14px; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.bad { background: var(--red); color: #fff; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- receipt ---------- */
.receipt-page { background: var(--paper); }
.receipt { max-width: 640px; margin: 40px auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 36px; }
.receipt header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 18px; margin-bottom: 18px; }
.receipt h1 { font-size: 28px; }
.receipt table { width: 100%; border-collapse: collapse; font-size: 14px; }
.receipt th { text-align: left; color: var(--muted); font-weight: 400; padding: 8px 0; width: 42%; vertical-align: top; }
.receipt td { padding: 8px 0; font-weight: 600; }
.receipt-total { margin: 18px 0; border-top: 1px solid var(--rule); padding-top: 12px; }
.receipt-total div { display: flex; justify-content: space-between; padding: 4px 0; }
.receipt-total .grand { font-size: 20px; font-weight: 700; }
.receipt .no-print { margin-top: 20px; }
@media print {
  .no-print { display: none; }
  .receipt { border: 0; margin: 0; padding: 0; }
  body { background: #fff; color: #000; }
}

/* Registration and profile */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }
fieldset.choice { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset.choice legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
fieldset.choice .option { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); cursor: pointer; font-weight: 400; }
fieldset.choice .option:has(input:checked) { border-color: var(--signal); background: var(--signal-soft); }
fieldset.choice .option input { margin-top: 4px; }
fieldset.choice .option strong { display: block; }
fieldset.choice .option .help { display: block; font-size: 13px; color: var(--muted); }
@media (max-width: 560px) { fieldset.choice { grid-template-columns: 1fr; } }
.verify-box .row { margin: 10px 0; }
.map { width: 100%; height: 320px; border: 1px solid var(--rule); border-radius: var(--radius); }
.verified { color: var(--signal); font-weight: 700; }
