/* Theme variables are overridden at runtime by js/theme.js from public/themes/<partner>.json */
:root {
  --brand-primary: #1f4e79;
  --brand-primary-contrast: #ffffff;
  --brand-accent: #2a9d8f;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #5c6670;
  --border: #d9dee3;
  --danger: #b3261e;
  --warn: #9a6700;
  --ok: #1a7f37;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--brand-primary);
  color: var(--brand-primary-contrast);
}
.brand-logo { height: 28px; }
.brand-name { font-weight: 600; letter-spacing: 0.2px; }
.spacer { flex: 1; }
.countdown { font-variant-numeric: tabular-nums; opacity: 0.9; font-size: 0.9rem; }
.countdown.warning { color: #ffd166; font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 24px auto;
  padding: 24px 28px;
  width: min(900px, calc(100% - 32px));
}
.card-narrow { width: min(460px, calc(100% - 32px)); }

h1 { font-size: 1.4rem; margin: 0 0 8px; }
.muted { color: var(--muted); }
.fineprint { color: var(--muted); font-size: 0.85rem; }

label { display: block; margin: 14px 0 4px; font-weight: 500; }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"],
input:not([type]), select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 1px;
}
fieldset { border: 1px solid var(--border); border-radius: 6px; margin: 16px 0; padding: 8px 14px 14px; }
legend { padding: 0 6px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 12px; }
.check input { width: auto; }

.btn {
  font: inherit;
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
}
.btn-primary { background: var(--brand-primary); color: var(--brand-primary-contrast); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-ghost { border-color: var(--border); color: var(--text); background: #fff; }
.topbar .btn-ghost { background: transparent; color: var(--brand-primary-contrast); border-color: rgba(255,255,255,0.5); }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
form .btn-primary { margin-top: 8px; }
.page-signin form .btn-primary { width: 100%; margin-top: 20px; }

.notice { padding: 12px 14px; border-radius: 6px; margin: 12px 0; border: 1px solid; }
.notice.error { color: var(--danger); border-color: var(--danger); background: #fdf2f1; }
.notice.warn { color: var(--warn); border-color: var(--warn); background: #fff8e6; }
.notice.ok { color: var(--ok); border-color: var(--ok); background: #eefaf1; }

.steps ol { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; flex-wrap: wrap; }
.steps li { padding: 6px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 0.85rem; }
.steps li.current { background: var(--brand-primary); color: var(--brand-primary-contrast); }
.steps li.done { background: var(--brand-accent); color: #fff; }

.radio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.radio-card {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin: 0; cursor: pointer;
  font-weight: 400;
}
.radio-card:has(input:checked) { border-color: var(--brand-primary); box-shadow: inset 0 0 0 1px var(--brand-primary); }
.radio-card input { width: auto; margin: 0 0 4px; }
.radio-card span { font-weight: 600; }
.radio-card small { color: var(--muted); }

.review { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; margin: 0; }
.review dt { color: var(--muted); }
.review dd { margin: 0; }

.progress { list-style: none; padding: 0; margin: 0; }
.progress li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.progress .state { width: 84px; flex: none; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.4px; }
.progress .pending .state { color: var(--muted); }
.progress .running .state { color: var(--brand-primary); }
.progress .done .state { color: var(--ok); }
.progress .error .state { color: var(--danger); }
.progress .human .state { color: var(--warn); }
.progress .detail { color: var(--muted); font-size: 0.9rem; }

.human-step {
  border: 1px solid var(--warn); background: #fff8e6; border-radius: 6px; padding: 14px; margin-top: 14px;
}
.human-step h3 { margin: 0 0 6px; font-size: 1rem; }
.human-step .actions { justify-content: flex-start; margin-top: 10px; }
.human-step.done { opacity: 0.6; }

.agent-widget { position: fixed; right: 16px; bottom: 16px; }

.footer { margin-top: auto; padding: 16px 20px; color: var(--muted); font-size: 0.8rem; text-align: center; }

@media (max-width: 600px) {
  .card { padding: 18px; }
  .review { grid-template-columns: 1fr; }
}

/* ---- Revision 3: customer self-registration ---- */
.page-start form .btn-primary { width: 100%; margin-top: 20px; }
.page-start .fineprint { margin: 4px 0 0; }
select:disabled { background: var(--bg); color: var(--muted); }
input[readonly] { background: var(--bg); color: var(--muted); cursor: default; }
input::placeholder { color: #9aa3ab; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

.device-chip {
  font-size: 0.85rem; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.16); color: var(--brand-primary-contrast);
  border: 1px solid rgba(255,255,255,0.35); white-space: nowrap;
}

.check.consent { align-items: flex-start; margin-top: 20px; padding: 12px; border: 1px solid var(--border); border-radius: 6px; }
.check.consent input { margin-top: 3px; }

.progress .human .state { color: var(--warn); }

.next-steps { margin-top: 20px; padding: 16px 18px; border: 1px solid var(--brand-accent); border-radius: var(--radius); background: #f3fbf9; }
.next-steps h2 { font-size: 1.1rem; margin: 0 0 8px; }
.next-steps ol { margin: 0; padding-left: 20px; }
.next-steps li { margin: 6px 0; }

/* Two-phase flow: create account (index), confirmation (registered), Firebox registration (activate) */
.card-form { width: min(640px, calc(100% - 32px)); }
.page-start form .btn-primary { width: 100%; margin-top: 20px; }
fieldset.plan { margin-top: 18px; }
fieldset.plan .radio-grid { margin-top: 6px; }
.reference-label { margin: 18px 0 4px; color: var(--muted); font-size: 0.9rem; }
.reference {
  font-size: 1.8rem; font-weight: 700; letter-spacing: 0.08em; font-variant-numeric: tabular-nums;
  margin: 0 0 4px; padding: 12px 16px; border: 1px dashed var(--brand-primary); border-radius: var(--radius);
  background: var(--bg); color: var(--brand-primary); text-align: center; word-break: break-all;
}
.page-registered h2 { font-size: 1.1rem; margin: 22px 0 8px; }
.plain-steps { margin: 0; padding-left: 20px; }
.plain-steps li { margin: 8px 0; }
.page-registered .actions { justify-content: flex-start; }
a.btn { display: inline-block; text-decoration: none; }

/* ---- One continuous run: choose your Firebox (screen 2) and live checklist (screen 3) ---- */
.section-title { font-size: 1.05rem; margin: 22px 0 6px; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 8px; }
.model-card {
  display: flex; flex-direction: column; gap: 2px; position: relative;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 14px 12px; margin: 0;
  cursor: pointer; font-weight: 400; background: #fff;
}
.model-card:has(input:checked) { border-color: var(--brand-primary); box-shadow: inset 0 0 0 1px var(--brand-primary); }
.model-card.disabled { opacity: 0.55; cursor: not-allowed; background: var(--bg); }
.model-card input { position: absolute; top: 12px; right: 12px; width: auto; margin: 0; }
.model-card .model-name { font-weight: 600; padding-right: 28px; }
.model-card .model-code { color: var(--muted); font-size: 0.85rem; }
.model-card small { color: var(--muted); }
.model-card .model-price { margin-top: 6px; font-weight: 600; color: var(--brand-primary); }
.model-card .model-stock { margin-top: 4px; font-size: 0.8rem; }
.model-card .model-stock.in { color: var(--ok); }
.model-card .model-stock.out { color: var(--warn); }

.checklist { list-style: none; padding: 0; margin: 12px 0 0; }
.checklist .row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.checklist .body { flex: 1; }
.checklist .label { font-weight: 500; }
.checklist .detail { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.checklist .badge { flex: none; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.4px; padding: 3px 8px; border-radius: 999px; align-self: center; }
.checklist .row.done .badge { background: #eefaf1; color: var(--ok); }
.checklist .row.team .badge { background: #fff8e6; color: var(--warn); }
.checklist .row.error .badge { background: #fdf2f1; color: var(--danger); }
.checklist .row.pending .badge, .checklist .row.running .badge { display: none; }
.checklist .mark {
  flex: none; width: 24px; height: 24px; border-radius: 50%; margin-top: 1px;
  border: 2px solid var(--border); position: relative; background: #fff;
}
.checklist .row.pending .label { color: var(--muted); }
.checklist .row.running .mark {
  border-color: var(--brand-primary); border-top-color: transparent;
  animation: fwaas-spin 0.8s linear infinite;
}
.checklist .row.done .mark { border-color: var(--ok); background: var(--ok); }
.checklist .row.done .mark::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.checklist .row.team .mark { border-color: var(--warn); background: var(--warn); }
.checklist .row.team .mark::after {
  content: ""; position: absolute; left: 9px; top: 5px; width: 2px; height: 10px; background: #fff; border-radius: 1px;
}
.checklist .row.error .mark { border-color: var(--danger); background: var(--danger); }
.checklist .row.error .mark::before, .checklist .row.error .mark::after {
  content: ""; position: absolute; left: 9px; top: 4px; width: 2px; height: 12px; background: #fff; border-radius: 1px;
}
.checklist .row.error .mark::before { transform: rotate(45deg); }
.checklist .row.error .mark::after { transform: rotate(-45deg); }
@keyframes fwaas-spin { to { transform: rotate(360deg); } }

.steps li.done::before { content: "\2713\00a0"; }
.page-wizard .actions { margin-top: 24px; }
@media (max-width: 600px) { .model-grid { grid-template-columns: 1fr 1fr; } }

/* Screen 2 waits for the stock check so models and plan appear together */
.loading-panel { display: flex; align-items: center; gap: 12px; padding: 28px 0; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--brand-primary); animation: fwaas-spin 0.8s linear infinite; flex: none; }
@keyframes fwaas-spin { to { transform: rotate(360deg); } }
