/* RouterStore customer site — mobile-first, no external fonts or frameworks. */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #17202b;
  --muted: #5b6775;
  --border: #dde3ea;
  --primary: #0f5b9c;
  --primary-hover: #0c4a80;
  --primary-soft: #e7f0f9;
  --success: #1c7c4a;
  --success-soft: #e6f4ec;
  --warning: #9a5b00;
  --warning-soft: #fdf3e2;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --focus: #2f80ed;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a; --surface: #171e26; --surface-2: #1d2630; --text: #e7edf3; --muted: #9aa8b6;
    --border: #2b3642; --primary: #5aa7e8; --primary-hover: #7bb9ee; --primary-soft: #16314a;
    --success: #4cc488; --success-soft: #133325; --warning: #f0b35a; --warning-soft: #3a2a10;
    --danger: #ff7a6e; --danger-soft: #3d1714; --focus: #7bb9ee;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; padding-top: 16px; padding-bottom: 96px; }
img { max-width: 100%; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
h2 small, h3 small, .label small { font-weight: 400; color: var(--muted); font-size: .85em; }
h3.sub, h2.sub { font-size: 1.05rem; margin-top: 1.25rem; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); }

.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.wrap.narrow { max-width: 620px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.header-nav a { font-weight: 600; text-decoration: none; padding: 8px 4px; }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding: 16px 0 24px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: var(--shadow); padding: 20px 16px; margin-bottom: 16px; }
@media (min-width: 640px) { .card { padding: 24px; } }
.step-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
           background: var(--primary); color: #fff; font-size: .9rem; font-weight: 700; flex: none; }
.hint { color: var(--muted); font-size: .92rem; display: block; }
.center { text-align: center; }

.intro .terms { font-size: .98rem; }
.intro .recommendation { color: var(--muted); }
.facts { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.facts li { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
            padding: 8px 10px; font-size: .9rem; display: flex; flex-direction: column; }
@media (min-width: 640px) { .facts { grid-template-columns: repeat(4, 1fr); } }

.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary);
           border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Alerts */
.alert { border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 16px; border: 1px solid; }
.alert, .alert.error { background: var(--danger-soft); color: var(--danger); border-color: currentColor; }
.alert.info { background: var(--primary-soft); color: var(--primary); }
.alert.warn { background: var(--warning-soft); color: var(--warning); }
.alert.ok { background: var(--success-soft); color: var(--success); }

/* Product selection */
.router-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 12px 0; }
@media (min-width: 560px) { .router-grid { grid-template-columns: 1fr 1fr; } }
.model-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface-2);
              transition: border-color .15s, box-shadow .15s; }
.model-card.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--surface); }
.model-card h3 { font-size: 1.05rem; margin: 0 0 6px; display: flex; justify-content: space-between; align-items: center; }
.variant-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0;
               border-top: 1px dashed var(--border); }
.variant-row:first-of-type { border-top: 0; }
.variant-info { display: flex; flex-direction: column; min-width: 0; }
.variant-name { font-weight: 600; }
.variant-price { color: var(--muted); font-size: .92rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px;
         background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge.out { color: var(--danger); border-color: currentColor; background: var(--danger-soft); }
.badge.ok { color: var(--success); border-color: currentColor; background: var(--success-soft); }
.badge.warn { color: var(--warning); border-color: currentColor; background: var(--warning-soft); }
.badge.info { color: var(--primary); border-color: currentColor; background: var(--primary-soft); }
.accessory-list .variant-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
                               background: var(--surface-2); margin-bottom: 12px; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm);
           background: var(--surface); flex: none; }
.stepper button { width: 40px; height: 40px; border: 0; background: transparent; color: var(--primary);
                  font-size: 1.25rem; cursor: pointer; border-radius: var(--radius-sm); }
.stepper button:disabled { color: var(--border); cursor: not-allowed; }
.stepper input { width: 44px; height: 40px; border: 0; text-align: center; font: inherit; font-weight: 600;
                 background: transparent; color: var(--text); -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Form fields */
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; }
.label { font-weight: 600; font-size: .95rem; }
.req { color: var(--danger); font-style: normal; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
.invalid input, .invalid textarea, input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .88rem; min-height: 0; }
.field-error:empty { display: none; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }

.file-drop { display: flex; align-items: center; gap: 12px; border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
             padding: 12px; cursor: pointer; background: var(--surface-2); position: relative; }
.file-drop:hover { border-color: var(--primary); }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.file-cta { background: var(--primary); color: #fff; font-weight: 600; padding: 8px 12px; border-radius: var(--radius-sm); flex: none; }
.file-name { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-preview { max-height: 200px; width: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-top: 8px; align-self: flex-start; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600;
       border-radius: var(--radius-sm); padding: 10px 18px; min-height: 44px; cursor: pointer; text-decoration: none;
       border: 1px solid transparent; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: var(--primary-soft); }
.btn-small { min-height: 32px; padding: 4px 10px; font-size: .88rem; background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-block { width: 100%; margin-top: 16px; font-size: 1.05rem; min-height: 52px; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

/* Shipping */
.shipping-status { margin-top: 12px; }
.shipping-status:empty { display: none; }
.shipping-options { border: 0; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.ship-opt { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border);
            border-radius: var(--radius-sm); cursor: pointer; background: var(--surface-2); }
.ship-opt:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--surface); }
.ship-opt input { width: 20px; height: 20px; flex: none; }
.ship-opt .ship-name { font-weight: 600; }
.ship-opt .ship-meta { color: var(--muted); font-size: .88rem; }
.ship-opt .ship-price { margin-left: auto; font-weight: 700; white-space: nowrap; }

/* Summary */
.summary { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin: 8px 0 16px; }
.summary:empty { display: none; }
.summary .row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--border); }
.summary .row:first-child { border-top: 0; }
.summary .row span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.summary .row.muted { color: var(--muted); font-size: .92rem; }
.summary .row.total { font-weight: 700; font-size: 1.1rem; background: var(--surface-2); }
.summary .row.empty { color: var(--muted); justify-content: center; }

.pay-box { display: grid; gap: 16px; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
           background: var(--surface-2); margin-bottom: 8px; }
@media (min-width: 560px) { .pay-box { grid-template-columns: 1fr 1fr; } }
.pay-amount strong { display: block; font-size: 1.6rem; color: var(--primary); font-variant-numeric: tabular-nums; }
.upi-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.upi-row code { background: var(--surface); border: 1px solid var(--border); padding: 6px 10px; border-radius: var(--radius-sm);
                font-size: 1rem; word-break: break-all; }
.upi-qr { display: block; margin-top: 10px; width: 200px; height: 200px; object-fit: contain; background: #fff;
          border-radius: var(--radius-sm); border: 1px solid var(--border); padding: 6px; }
#payment-instructions { grid-column: 1 / -1; white-space: pre-line; }

/* Sticky mini total (mobile) */
.mini-total { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border);
              display: flex; justify-content: space-between; align-items: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
              box-shadow: 0 -2px 8px rgba(0,0,0,.08); z-index: 5; font-size: 1.05rem; }
@media (min-width: 900px) { .mini-total { display: none !important; } }

/* Confirmation */
.confirm { text-align: center; }
.confirm-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--success-soft); color: var(--success);
                display: grid; place-items: center; font-size: 1.8rem; margin: 0 auto 12px; font-weight: 700; }
.order-ref { display: inline-flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--border);
             padding: 10px 14px; border-radius: var(--radius-sm); margin: 8px 0 16px; }
.order-ref code { font-size: 1.35rem; font-weight: 700; letter-spacing: .04em; }
.confirm .summary, .confirm .next-steps, .confirm h2 { text-align: left; }
.next-steps { padding-left: 1.25rem; margin: 0; }
.next-steps li { margin-bottom: 6px; }
.confirm .actions { justify-content: center; }

/* Status */
.lookup { display: grid; gap: 12px; }
@media (min-width: 560px) { .lookup { grid-template-columns: 1fr auto; align-items: end; } .lookup .btn { margin-bottom: 0; } }
.lookup .field { margin: 0; }
.status-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.status-head code { font-size: 1.2rem; font-weight: 700; display: block; }
.timeline { list-style: none; padding: 0; margin: 8px 0 16px; display: grid; gap: 0; }
.timeline li { position: relative; padding: 6px 0 6px 28px; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 12px; width: 12px; height: 12px; border-radius: 50%;
                       border: 2px solid var(--border); background: var(--surface); }
.timeline li::after { content: ""; position: absolute; left: 11px; top: 26px; bottom: -6px; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.done { color: var(--text); }
.timeline li.done::before { background: var(--success); border-color: var(--success); }
.timeline li.current { color: var(--text); font-weight: 700; }
.timeline li.current::before { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
