/* Product styles use the shared C Électrique foundation; no remote font required. */
:root {
    --bg: var(--ce-bg); --surface: var(--ce-surface); --surface2: var(--ce-surface-subtle);
    --border: var(--ce-border); --accent: var(--ce-primary); --accent2: var(--ce-primary-strong);
    --text: var(--ce-text); --text-muted: var(--ce-muted); --success: var(--ce-success);
    --danger: var(--ce-danger); --warning: var(--ce-warning); --bg-input: var(--ce-input);
    --bg-card-alt: var(--ce-surface-subtle); --radius: var(--ce-radius); --transition: .15s ease;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 110px; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--ce-font); font-size: 16px; line-height: 1.5; }
body { min-width: 280px; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
button { touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
:where(button, a, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--ce-primary-soft); color: var(--text); }

.app-shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); min-height: 88px; padding: 10px max(24px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 100; }
.topbar-logo { flex-shrink: 0; min-width: 0; }
.celectrique-logo { display: block; width: 164px; height: 50px; object-fit: contain; background: white; padding: 4px 6px; border-radius: var(--radius); }
.celectrique-logo.cbox-logo { height: 60px; padding: 2px 6px; }
.topbar-logo span { color: var(--text-muted); font-size: .75rem; display: block; margin-top: 3px; font-weight: 600; }
.topbar-actions, .topbar > div:not(.topbar-logo) { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tier-badge { display: inline-flex; align-items: center; max-width: 100%; overflow-wrap: anywhere; background: var(--ce-primary-soft); color: var(--accent); font-size: .75rem; font-weight: 700; padding: 6px 10px; border-radius: var(--radius); }
.main-content { flex: 1; padding: 32px 24px 64px; max-width: 1120px; margin: 0 auto; width: 100%; min-width: 0; }

/* Workflow hierarchy: configuration identity remains visible between steps. */
.configurator-intro { margin-bottom: 24px; max-width: 760px; }
.configurator-kicker { display: block; color: var(--text-muted); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.configurator-intro h1 { font-size: clamp(1.6rem, 3vw, 2rem); letter-spacing: -.025em; line-height: 1.2; font-weight: 750; }
.configurator-description { color: var(--text-muted); margin-top: 8px; max-width: 64ch; font-size: .9375rem; }
.configuration-overview { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 20px; font-size: .875rem; }
.configuration-overview > span { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 5px; }
.configuration-overview .project-badge { margin-left: auto; color: var(--text-muted); }
.configuration-overview strong { font-weight: 700; }
.configuration-overview > div { display: flex; flex: 1; min-width: 160px; flex-direction: column; gap: 2px; }
.configuration-overview > div > span { font-size: .75rem; color: var(--text-muted); }
.configuration-step-heading { font-size: 1.25rem; font-weight: 700; margin: 0 0 16px; scroll-margin-top: 110px; }
.field-help { color: var(--text-muted); font-size: .8125rem; margin-top: 6px; }
.text-button { border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 4px; font: inherit; }
.alert-info { background: var(--ce-primary-soft); border: 1px solid var(--border); color: var(--text); margin-bottom: 16px; }
.table-scroll { overflow-x: auto; min-width: 0; }
.configuration-json { font-size: .75rem; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 350px; }
.review-confirmation { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0; }
.review-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.review-actions .btn { flex: 1 1 240px; }
.price-value small { font-size: .9375rem; color: var(--text-muted); }
.configurator-body, .configurator-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.workflow-note { color: var(--text-muted); font-size: .875rem; margin-top: 8px; }

.selection-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.selection-option { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-input); color: var(--text); padding: 16px; cursor: pointer; }
.selection-option span { font-size: .8125rem; color: var(--text-muted); font-weight: 400; }
.selection-option:hover, .selection-option.active { border-color: var(--accent); }
.selection-option.active { background: var(--ce-primary-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.selection-option:disabled { opacity: .6; }
.selection-brand-label { margin: 16px 0 8px; }
.comparison-result { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.comparison-result strong { font-size: 1.125rem; }
.comparison-result span { color: var(--text-muted); font-size: .8125rem; }
.comparison-savings { margin-top: 12px; padding: 12px 16px; border: 1px solid var(--ce-success-border); border-radius: var(--radius); background: var(--ce-success-soft); color: var(--success); display: flex; flex-direction: column; gap: 4px; }
.comparison-savings > span { font-size: .8125rem; }
.comparison-table { width: 100%; border-collapse: collapse; font-size: .8125rem; margin-top: 12px; }
.comparison-table caption { text-align: left; color: var(--text-muted); padding: 8px 0; font-size: .75rem; }
.comparison-table th, .comparison-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--ce-border-soft); }
.comparison-table th { background: var(--surface2); color: var(--text-muted); }
.comparison-table .selected { background: var(--ce-primary-soft); }
.comparison-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.comparison-badge, .comparison-reference { display: inline-block; margin-left: 8px; font-size: .6875rem; font-weight: 600; color: var(--accent); }
.comparison-reference { color: var(--text-muted); }
.specification-review > summary, .delivery-details > summary { font-weight: 650; cursor: pointer; color: var(--accent); }
.specification-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.specification-grid dt { color: var(--text-muted); font-size: .75rem; }
.specification-grid dd { margin: 4px 0 0; font-size: .875rem; overflow-wrap: anywhere; }
.delivery-details { margin: 20px 0 0; }
.delivery-details > .grid-2 { margin-top: 16px; }
.request-readiness { border-left: 3px solid var(--accent); }
.request-submit-note { font-size: .8125rem; color: var(--text-muted); text-align: center; margin-top: 8px; }
.project-savings { margin-top: 12px; color: var(--success); font-size: .875rem; }

.gate-wrap { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; text-align: center; }
.gate-title { font-family: var(--ce-font); font-size: 2rem; font-weight: 750; letter-spacing: -.025em; color: var(--text); line-height: 1.2; }
.gate-title span { color: var(--accent); }
.gate-sub { color: var(--text-muted); max-width: 400px; line-height: 1.6; }
.gate-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--ce-shadow); }
.section-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; min-width: 0; }
.section-card:has(> .project-table), .section-card:has(> .bom-table) { overflow-x: auto; }
.section-title { font-size: .875rem; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 12px; line-height: 1.4; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--ce-border-soft); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: .8125rem; color: var(--text-muted); font-weight: 600; }
.field + .field { margin-top: 16px; }
.grid-2 .field + .field, .motor-info-row .field + .field { margin-top: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]), select, textarea { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: var(--ce-font); font-size: 1rem; padding: 10px 12px; width: 100%; min-height: var(--ce-target); transition: border-color var(--transition); }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--text-muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface2); color: var(--text-muted); cursor: not-allowed; }
select { cursor: pointer; padding-right: 28px; }
textarea { resize: vertical; min-height: 100px; }
input[type=checkbox], input[type=radio] { accent-color: var(--ce-action-bg); width: 18px; height: 18px; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important; -webkit-text-fill-color: var(--text) !important; caret-color: var(--text); }
select option { background: var(--bg-input); }

.hp-display { font-family: var(--ce-font); font-size: 3rem; font-weight: 750; color: var(--accent); line-height: 1.1; text-align: center; font-variant-numeric: tabular-nums; }
.hp-display span { font-size: 1rem; color: var(--text-muted); font-weight: 500; }
input[type=range] { appearance: none; width: 100%; height: 8px; background: var(--border); border-radius: 4px; padding: 0; border: none; margin: 14px 0; accent-color: var(--ce-action-bg); }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--ce-action-bg); cursor: pointer; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--ce-action-bg); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--ce-action-bg); cursor: pointer; border: 3px solid var(--surface); }
.hp-marks { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

.chip-group, .hp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .hp-chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--ce-target); background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; font-family: var(--ce-font); font-size: .875rem; font-weight: 600; line-height: 1.3; cursor: pointer; transition: background var(--transition), border-color var(--transition); color: var(--text); user-select: none; text-align: center; }
.hp-chip { min-width: 60px; }
.chip:hover, .hp-chip:hover { border-color: var(--accent); background: var(--surface2); }
.chip.active, .hp-chip.active { background: var(--ce-primary-soft); border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chip.disabled, .chip:disabled, .hp-chip:disabled { opacity: .5; cursor: not-allowed; }
.operator-symbol { display: inline-block; width: 12px; height: 12px; flex: 0 0 12px; border-radius: 50%; border: 1px solid rgb(0 0 0 / 30%); box-shadow: inset 0 1px 2px rgb(255 255 255 / 45%); }
.indicator-green { background: #35c77a; }.indicator-red { background: #e33f5f; }.indicator-amber { background: #f2b94b; }
.emergency-stop { background: #d9293f; border: 2px solid #f6d45c; box-shadow: 0 0 0 1px #871827; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.motor-info-row { display: flex; gap: 16px; flex-wrap: wrap; }
.motor-info-row .field { flex: 1; min-width: 140px; }
.fla-auto { font-size: .75rem; color: var(--text-muted); margin-top: 3px; }

.btn { border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; font-family: var(--ce-font); font-size: .9375rem; font-weight: 650; min-height: var(--ce-target); padding: 10px 18px; transition: background var(--transition), border-color var(--transition); width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; text-align: center; line-height: 1.4; }
.btn-primary { background: var(--ce-action-bg); color: white; }
.btn-primary:hover { background: var(--ce-action-hover); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--accent); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface2); border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.lang-toggle { display: inline-flex; align-items: center; justify-content: center; min-height: var(--ce-target); min-width: var(--ce-target); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: var(--ce-font); font-size: .8125rem; font-weight: 600; padding: 8px 12px; cursor: pointer; transition: background var(--transition), border-color var(--transition); text-decoration: none; }
.lang-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--surface2); text-decoration: none; }
.lang-toggle:disabled { opacity: .55; }

.bom-table, .project-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.bom-table th, .project-table th { color: var(--text-muted); font-weight: 650; text-align: left; padding: 12px; border-bottom: 1px solid var(--border); font-size: .75rem; background: var(--surface2); }
.bom-table td, .project-table td { padding: 12px; border-bottom: 1px solid var(--ce-border-soft); vertical-align: top; }
.bom-table tr:last-child td, .project-table tr:last-child td { border-bottom: none; }
.bom-table .num, .project-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.project-table { min-width: 640px; }
.bom-total-row td { font-weight: 700; color: var(--text); font-size: 1rem; border-top: 2px solid var(--border); }
.project-grand-total { font-weight: 700; font-size: 1.125rem; color: var(--accent); }
.price-hero { text-align: center; padding: 24px 0; }
.price-label { font-size: .8125rem; font-weight: 600; color: var(--text-muted); }
.price-value { font-family: var(--ce-font); font-size: 2.75rem; font-weight: 750; color: var(--text); letter-spacing: -.03em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.price-tier { font-size: .8125rem; color: var(--text-muted); margin-top: 6px; }
.project-total-card { background: var(--ce-primary-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; text-align: center; }

.alert { border-radius: var(--radius); padding: 12px 16px; font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.alert-error { background: var(--ce-danger-soft); border: 1px solid var(--ce-danger-border); color: var(--danger); }
.alert-success { background: var(--ce-success-soft); border: 1px solid var(--ce-success-border); color: var(--success); }
.alert-warning { background: var(--ce-warning-soft); border: 1px solid var(--ce-warning-border); color: var(--warning); }
.spinner { width: 20px; height: 20px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { display: flex; gap: 4px; margin-bottom: 24px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.step { flex: 1; min-width: 0; min-height: var(--ce-target); text-align: center; font-family: var(--ce-font); font-size: .8125rem; font-weight: 600; color: var(--text-muted); background: transparent; border: 0; border-radius: 4px; position: relative; padding: 10px 6px; line-height: 1.3; }
button.step { cursor: pointer; }
button.step:hover { background: var(--surface2); color: var(--text); }
.step.active { color: var(--accent); background: var(--ce-primary-soft); font-weight: 750; }
.step.done { color: var(--success); }

/* Older account templates carry presentation inline. Align their supporting copy
   and headings until those templates migrate to semantic layout classes. */
.app-shell [style*="Bebas Neue"] { font-family: var(--ce-font) !important; font-weight: 700; letter-spacing: -.015em !important; line-height: 1.25; }
.app-shell [style*="font-size:0.6"], .app-shell [style*="font-size:0.7rem"], .app-shell [style*="font-size:0.70"], .app-shell [style*="font-size:0.71"], .app-shell [style*="font-size:0.72"], .app-shell [style*="font-size:0.73"], .app-shell [style*="font-size:0.74"] { font-size: .75rem !important; }
.topbar a[style*="font-size:0.8rem"] { min-height: var(--ce-target); display: inline-flex; align-items: center; }
.main-content[style*="min-height:80vh"] { min-height: calc(100dvh - 88px) !important; }
.app-loading { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--bg); text-align: center; }
.app-loading img { display: block; width: 220px; height: auto; background: white; padding: 8px 12px; border-radius: var(--radius); margin: 0 auto 16px; }
.app-loading-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.app-loading-status { color: var(--text-muted); font-size: .875rem; margin-top: 8px; }
.app-loading .spinner { color: var(--accent); margin-top: 16px; }

@media (max-width: 720px) {
    .topbar { position: relative; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
    .topbar-actions { justify-content: flex-start; }
    .configurator-topbar .topbar-actions { width: 100%; justify-content: flex-start; }
    .topbar > div:not(.topbar-logo) { justify-content: flex-start; }
    .celectrique-logo { width: 148px; height: 45px; }
    .main-content { padding: 24px 16px 48px; }
    .section-card { padding: 18px 16px; margin-bottom: 16px; }
    .gate-card { padding: 24px 20px; }
    .configuration-overview { padding: 12px; gap: 8px 12px; }
    .configuration-overview > div { min-width: 0; flex: 1 1 calc(50% - 6px); overflow-wrap: anywhere; }
    .configuration-overview .project-badge { width: 100%; margin-left: 0; }
    .steps { flex-wrap: wrap; gap: 4px; }
    .step { flex: 1 1 calc(33.333% - 8px); }
    .main-content[style*="min-height:80vh"] { min-height: auto !important; padding-top: 32px; }
    .app-shell [style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 480px) {
    .selection-options, .specification-grid { grid-template-columns: minmax(0, 1fr); }
    .comparison-table th, .comparison-table td { padding: 8px 6px; }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .btn { padding-inline: 12px; }
    .chip, .hp-chip { flex-grow: 1; }
    .bom-table th, .bom-table td { padding: 8px 6px; }
    .price-value { font-size: 2.25rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
    .spinner { animation-duration: 1.5s; }
}
@media print {
    html, body { background: white; color: black; }
    .topbar, .steps { position: static; }
    .main-content { max-width: none; padding: 0; }
    .section-card { break-inside: avoid; }
}
