:root {
  --bg: #FAFBFC;
  --surface: #FFFFFF;
  --line: #E2E8F0;
  --text: #0F172A;
  --muted: #64748B;
  --brand: #2563EB;
  --brand-strong: #1D4ED8;
  --good: #16A34A;
  --warn: #F59E0B;
  --bad: #DC2626;
  --ring: rgba(37, 99, 235, 0.18);
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font: inherit; }

.brand-bar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 5;
}
.brand-bar .brand { font-weight: 700; font-size: 18px; }
.brand-bar .brand .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-right: 8px; vertical-align: middle; }

.layout { max-width: 1180px; margin: 0 auto; padding: 32px 24px 64px; }
.hero { text-align: center; margin: 36px 0 24px; }
.hero h1 { font-size: 36px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
.hero p { color: var(--muted); font-size: 16px; max-width: 620px; margin: 0 auto; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.card h2 { font-size: 18px; margin: 0 0 4px; }
.card p.lead { color: var(--muted); margin: 0 0 16px; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1 1 260px; min-width: 240px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 920px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px;
  font: inherit; background: #fff; color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring);
}
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.error { color: var(--bad); font-size: 13px; margin-top: 6px; }
.success { color: var(--good); font-size: 13px; margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px;
  border-radius: var(--r-md); border: 1px solid var(--brand); background: var(--brand); color: #fff;
  font-weight: 600; font-size: 14px; transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--brand-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--line); }
.btn.secondary:hover { background: #F1F5F9; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.small { padding: 6px 10px; font-size: 13px; }

.plan-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1080px) { .plan-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .plan-grid { grid-template-columns: 1fr; } }

.plan-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; cursor: pointer; transition: all 0.15s; position: relative;
}
.plan-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.plan-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.plan-card .badge { position: absolute; top: 14px; right: 14px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.plan-card .name { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.plan-card .price { font-size: 28px; font-weight: 700; margin: 8px 0; }
.plan-card .price small { font-size: 13px; color: var(--muted); font-weight: 500; }
.plan-card .desc { color: var(--muted); font-size: 13px; min-height: 36px; margin-bottom: 10px; }
.plan-card ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--text); }
.plan-card ul li { margin-bottom: 4px; }
.plan-card .caps { font-size: 12px; color: var(--muted); margin-top: 10px; }
/* Detailed plan card — seats/branches/warehouses + per-plan module list */
.plan-card .plan-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0; padding: 10px 8px; background: var(--bg-2, #f1f5f9); border-radius: 10px; text-align: center; }
.plan-card .plan-stats .s-val { font-size: 16px; font-weight: 800; color: var(--text, #0f172a); line-height: 1.1; }
.plan-card .plan-stats .s-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
.plan-card .plan-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 6px; }
.plan-card .plan-mods, .plan-card .plan-hl { list-style: none; margin: 0; padding: 0; }
.plan-card .plan-mods li { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 3px 0; color: var(--text, #0f172a); margin-bottom: 0; }
.plan-card .plan-mods li.off { color: var(--muted); opacity: .5; }
.plan-card .plan-mods .mk { width: 14px; text-align: center; flex: 0 0 14px; color: var(--brand); font-weight: 800; }
.plan-card .plan-mods li.off .mk { color: var(--muted); font-weight: 600; }
.plan-card .plan-mods .me { flex: 0 0 auto; }
.plan-card .plan-hl li { font-size: 12.5px; padding: 3px 0 3px 20px; position: relative; color: var(--text, #0f172a); margin-bottom: 0; }
.plan-card .plan-hl li::before { content: "✦"; position: absolute; left: 0; color: var(--brand); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 800px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px;
}
.kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.kpi .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.tag { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tag.green { background: #DCFCE7; color: #166534; }
.tag.amber { background: #FEF3C7; color: #92400E; }
.tag.red { background: #FEE2E2; color: #991B1B; }
.tag.blue { background: #DBEAFE; color: #1E40AF; }
.tag.gray { background: #E2E8F0; color: #334155; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { font-weight: 700; color: var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; background: #F8FAFC; }
tbody tr:hover { background: #F8FAFC; }

.toggle-pill { display: inline-flex; background: #E2E8F0; border-radius: 999px; padding: 3px; font-size: 13px; }
.toggle-pill button { background: transparent; border: 0; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; }
.toggle-pill button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 12px 14px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 14px; }
.alert.info { background: #DBEAFE; color: #1E40AF; border-left: 3px solid #2563EB; }
.alert.warn { background: #FEF3C7; color: #92400E; border-left: 3px solid var(--warn); }
.alert.bad  { background: #FEE2E2; color: #991B1B; border-left: 3px solid var(--bad); }
.alert.good { background: #DCFCE7; color: #166534; border-left: 3px solid var(--good); }

.invoice-list { margin: 18px 0; }
.invoice-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.invoice-row .num { font-weight: 600; }
.invoice-row .actions { display: flex; gap: 8px; }

.signature-pad-wrap { border: 2px dashed var(--line); border-radius: var(--r-md); padding: 8px; background: #fff; }
.signature-pad { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }

.steps { display: flex; gap: 6px; margin-bottom: 24px; }
.step { flex: 1; height: 4px; background: var(--line); border-radius: 2px; }
.step.active { background: var(--brand); }

.empty {
  text-align: center; padding: 40px 24px; color: var(--muted);
}

footer.app-footer {
  margin-top: 60px; padding: 24px; text-align: center; color: var(--muted); font-size: 13px;
  border-top: 1px solid var(--line);
}

/* === Address autocomplete dropdown (Canada Post style) === */
.addr-suggest-wrap { position: relative; }
.addr-suggest {
  position: absolute; left: 0; right: 0; top: 100%;
  z-index: 50;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  max-height: 300px;
  overflow-y: auto;
}
.addr-suggest-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background 0.1s;
}
.addr-suggest-item:last-child { border-bottom: 0; }
.addr-suggest-item:hover, .addr-suggest-item.active { background: #EEF2FF; }
.addr-suggest-item .addr-line1 { font-size: 13px; font-weight: 600; color: var(--text); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.addr-suggest-item .addr-line2 { font-size: 11px; color: var(--muted); margin-top: 2px; }
.addr-suggest-item .addr-chevron { color: var(--muted); font-size: 16px; font-weight: 700; flex: 0 0 auto; }
.addr-suggest-item:hover .addr-chevron, .addr-suggest-item.active .addr-chevron { color: var(--primary, #4F46E5); }

/* === License / promo code input on signup === */
.license-block {
  border: 1px dashed var(--line); border-radius: var(--r-md); padding: 14px;
  margin-top: 16px; background: #FAFBFC;
  transition: border-color 0.15s, background 0.15s;
}
.license-block.applied {
  display: flex; align-items: center; gap: 14px;
  border-color: var(--good); background: #DCFCE7;
}
.license-block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 4px; }
.license-meta { font-size: 11px; color: var(--muted); }
.license-input-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.license-input {
  flex: 1; min-width: 200px;
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px;
  font: inherit; background: #fff; color: var(--text);
  font-family: ui-monospace, Menlo, monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.license-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.license-icon { font-size: 28px; flex-shrink: 0; }
.license-text { flex: 1; min-width: 0; }
.license-summary { font-size: 14px; font-weight: 700; color: #166534; }
.license-block.applied .license-meta { color: #166534; opacity: 0.85; }
.license-block.applied code { background: rgba(22,163,74,0.15); padding: 1px 6px; border-radius: 4px; font-family: ui-monospace, Menlo, monospace; }
.license-error { font-size: 13px; color: var(--bad); margin-top: 8px; }

/* === Onboarding step dots — already use .steps + .step above === */
.steps + .card { margin-top: 4px; }

/* Slightly larger card padding for wizard steps */
main.layout .card { padding: 26px; }
@media (max-width: 600px) {
  main.layout .card { padding: 18px; }
  .hero h1 { font-size: 26px; }
}

/* ─── Billing / payment step ─────────────────────────────────────── */
.bill-summary {
  border: 1px solid var(--line);
  border-radius: var(--r-md, 12px);
  padding: 14px 16px;
  margin: 14px 0 18px;
  background: linear-gradient(180deg, #FAFBFF 0%, #F4F6FF 100%);
}
.bill-summary-row { display: flex; justify-content: space-between; align-items: baseline; }
.bill-summary-plan { font-weight: 700; font-size: 15px; color: var(--text); }
.bill-summary-price { font-weight: 800; font-size: 20px; color: var(--text); }
.bill-summary-price small { font-size: 12px; font-weight: 600; color: var(--muted); }
.bill-summary-trial { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.bill-trial-badge {
  background: #DCFCE7; color: #166534; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; letter-spacing: 0.02em;
}

.bill-card-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-md, 12px);
  padding: 14px 16px;
  background: #fff;
}
.bill-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.bill-card-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--text); }
.bill-card-label .lock-ico { font-size: 13px; }

.card-brands { display: inline-flex; gap: 6px; }
.card-brand {
  font-size: 10px; font-weight: 800; letter-spacing: 0.03em;
  padding: 3px 7px; border-radius: 5px; color: #fff; line-height: 1;
  text-transform: uppercase; opacity: 0.92;
}
.brand-visa { background: #1A1F71; }
.brand-mastercard { background: #EB001B; }
.brand-amex { background: #2E77BC; }
.brand-discover { background: #E0772E; }

.stripe-mount {
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; transition: border-color 0.15s, box-shadow 0.15s;
}
.stripe-mount.StripeElement--focus,
.stripe-mount:focus-within { border-color: var(--primary, #4F46E5); box-shadow: 0 0 0 3px rgba(79,70,229,0.12); }
.stripe-mount.StripeElement--invalid { border-color: var(--bad, #DC2626); }

.bill-card-error { color: var(--bad, #DC2626); font-size: 12px; margin-top: 8px; font-weight: 600; }
.bill-secure { margin-top: 10px; font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.bill-secure-addr { color: var(--muted); }

.saved-card {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  background: #DCFCE7; border: 1px solid #86EFAC; border-radius: 10px; padding: 10px 13px;
}
.saved-card-chip {
  background: #166534; color: #fff; font-weight: 800; font-size: 10px;
  padding: 3px 8px; border-radius: 5px; letter-spacing: 0.04em;
}
.saved-card-num { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; color: #14532D; letter-spacing: 0.06em; }
.saved-card-check { margin-left: auto; color: #166534; font-weight: 700; font-size: 12px; }

.btn-pay { min-width: 200px; justify-content: center; }
.bill-fineprint { margin-top: 14px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
