/* ─── Reset ─────────────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ─── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg:         #0c0c0b;
  --surface:    #141412;
  --border:     #242420;
  --border-mid: #333330;
  --text:       #f5f4f0;
  --muted:      #888880;
  --subtle:     #555550;
  --amber:      #f59e0b;
  --amber-dim:  rgba(245, 158, 11, 0.12);
  --amber-glow: rgba(245, 158, 11, 0.25);
  --price-green: hsl(142, 80%, 65%);
  --price-red:   hsl(0, 80%, 65%);
  --radius:     10px;
  --radius-sm:  6px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── Base ───────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body {
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
code {
  font-family: 'SF Mono', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 0.875em;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  color: var(--text);
}

/* ─── Header / Nav ───────────────────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(12, 12, 11, 0.85);
}
nav {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0.9rem 2rem;
  gap: 1.5rem;
  width: 100%;
}
.logo {
  font-size: 1.2rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.03em;
  line-height: 1;
}
.logo__el { color: var(--amber); }
.logo__cotizador { color: var(--text); }
.nav-links { margin-left: auto; }
.nav-links__admin {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}
.nav-links__admin:hover { color: var(--text); border-color: var(--border-mid); }

/* ─── Main ───────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

/* Wizard pages (anything with the step-bar at the top) get more
   horizontal real estate than the landing hero, since they're showing
   tabular data. The dashboard has its own wider override scoped via
   main:has(.dash) in the dashboard template. */
main:has(.stepper-bar) {
  max-width: 1280px;
  align-items: stretch;
  padding: 2rem 1.5rem 3rem;
  gap: 1.5rem;
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero { text-align: center; max-width: 640px; }
.hero__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid var(--amber-glow);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  margin-bottom: 1.25rem;
}
h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  background: linear-gradient(160deg, #ffffff 40%, #888880 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 540px;
  margin: 0 auto;
}

/* ─── Feature strip ──────────────────────────────────────────────────────── */
.features {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}
.feature {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.35rem 0.85rem;
}
.feature__icon { font-size: 0.9rem; }
.feature__sep { color: var(--subtle); font-size: 0.9rem; }

/* ─── Island wrapper ─────────────────────────────────────────────────────── */
#upload-island { width: 100%; }

/* ─── Upload ─────────────────────────────────────────────────────────────── */
.upload {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ─── Drop zone ──────────────────────────────────────────────────────────── */
.dropzone {
  position: relative;
  border: 2px dashed var(--border-mid);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  outline: none;
  text-align: center;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--border-mid);
  background: #171714;
  box-shadow: 0 0 0 1px var(--border);
}
.dropzone--active {
  border-color: var(--amber);
  background: var(--amber-dim);
  box-shadow: 0 0 0 1px var(--amber-glow), 0 0 32px var(--amber-glow);
}
.dropzone--disabled { opacity: 0.55; cursor: progress; }
.dropzone__icon { color: var(--subtle); transition: color 0.15s; }
.dropzone--active .dropzone__icon,
.dropzone:hover .dropzone__icon { color: var(--amber); }
.dropzone__title { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.dropzone__hint { font-size: 0.82rem; color: var(--muted); }
.dropzone__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.35rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: var(--amber);
  color: #1a1a18;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 18px -10px var(--amber-glow);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  pointer-events: none; /* label handles the tap */
}
.dropzone:hover .dropzone__cta,
.dropzone--active .dropzone__cta {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -10px var(--amber-glow);
}
/* iOS Safari opens the file picker reliably only when the tap lands on the
   <input type="file"> element itself. Label association (wrap or for=) is
   inconsistent. Stretch the input transparently over the whole label so any
   tap inside the dropzone is a physical tap on the input. Drag events still
   bubble to the label, so drag-and-drop handlers keep working. */
.dropzone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

/* ─── Upload status / error ──────────────────────────────────────────────── */
.upload__status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.upload__error {
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  text-align: left;
}

/* ─── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid var(--border-mid);
  border-top-color: var(--text);
  animation: spin 0.75s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
.btn--primary .spinner { border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { background: #1e1d1a; border-color: var(--border-mid); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover { background: var(--surface); }
.btn--primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #0c0c0b;
}
.btn--primary:hover {
  background: #e08e00;
  border-color: #e08e00;
  box-shadow: 0 0 16px var(--amber-glow);
}
.btn--lg {
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
}

/* ─── Results ────────────────────────────────────────────────────────────── */
.results {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.results__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.results__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
  word-break: break-all;
}
.results__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.results__meta strong { color: var(--text); font-weight: 600; }
.results__meta-warning { color: #fbbf24; }
.results__actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.results__search {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  min-width: 160px;
}
.results__search:focus { border-color: var(--amber); }

.results__hint {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: left;
  line-height: 1.6;
}
.results__hint strong { color: var(--text); font-weight: 600; }
.results__banner {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.results__banner--error { color: #f87171; background: rgba(248, 113, 113, 0.07); }
.results__errors {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  color: #fbbf24;
  font-size: 0.82rem;
}
.results__errors summary { cursor: pointer; user-select: none; }
.results__errors ul { margin-top: 0.4rem; padding-left: 1.2rem; color: var(--muted); }
.results__errors li { margin-bottom: 0.15rem; }

.results__table-wrap { overflow-x: auto; }
.results__table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.results__table thead th {
  text-align: left;
  padding: 0.65rem 1.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.results__table tbody td {
  padding: 0.65rem 1.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.results__table tbody tr:last-child td { border-bottom: none; }
.results__table tbody tr:hover { background: rgba(255,255,255,0.02); }
.results__cell-row { width: 3rem; color: var(--subtle); font-variant-numeric: tabular-nums; }
.results__cell-qty { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.results__empty { text-align: center; padding: 2rem; color: var(--subtle); }

.results__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}
.results__footer .btn--primary { flex: 1; justify-content: center; min-width: 200px; }

/* ─── Example link ───────────────────────────────────────────────────────── */
.example-link {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}
.example-link a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--border-mid);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.example-link a:hover { color: var(--text); text-decoration-color: var(--muted); }

/* ─── Intake (chat vs excel) ─────────────────────────────────────────────── */
.intake {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Tabs — the switcher bar */
.intake__tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.intake__tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 0.3rem);
  color: var(--muted);
  padding: 0.85rem 1rem;
  cursor: pointer;
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  row-gap: 0.15rem;
  align-items: center;
  font: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.intake__tab:hover { background: #171714; color: var(--text); }
.intake__tab:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.intake__tab-icon {
  grid-row: span 2;
  font-size: 1.5rem;
  line-height: 1;
  align-self: center;
}
.intake__tab-label { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.intake__tab-sub { font-size: 0.78rem; color: var(--muted); }
.intake__tab--active {
  background: var(--bg);
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber-glow);
}
.intake__tab--active .intake__tab-label { color: var(--amber); }

/* Panels — start stacked (no-JS fallback), then collapse to one when JS activates */
.intake__panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.intake--enhanced .intake__panel { display: none; }
.intake--enhanced .intake__panel--active { display: flex; }

.intake__form { display: flex; flex-direction: column; gap: 1rem; }
.intake__actions { display: flex; justify-content: center; }

/* Blank-list panel — friendly hero card before the user starts adding rows */
.intake__blank {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding: 2.25rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--border-mid);
  border-radius: var(--radius);
}
.intake__blank-icon {
  font-size: 2.4rem;
  line-height: 1;
}
.intake__blank-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}
.intake__blank-hint {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 36rem;
  margin: 0;
}
.intake__example-link {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin: 0;
}
.intake__example-link a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--border-mid);
  text-underline-offset: 3px;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.intake__example-link a:hover { color: var(--text); text-decoration-color: var(--muted); }

/* Chat bubble textarea — made to feel like a messaging app */
.intake__chat {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.intake__chat:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber-glow), 0 0 32px var(--amber-glow);
}
.intake__chat-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.intake__chat-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 1rem;
}
.intake__chat-name { color: var(--text); font-weight: 600; }
.intake__chat-status {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.intake__chat-status::before {
  content: '';
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}
.intake__chat-input {
  appearance: none;
  border: none;
  background: var(--surface);
  color: var(--text);
  padding: 1rem 1.1rem;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 9rem;
  outline: none;
  font-family: inherit;
}
.intake__chat-input::placeholder {
  color: var(--subtle);
  font-style: normal;
  white-space: pre-line;
}
.intake__chat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
}
.intake__chat-hint { flex: 1; }
.intake__chat-counter {
  font-variant-numeric: tabular-nums;
  color: var(--subtle);
}

/* Submit button with loading shimmer */
.intake__submit-arrow { display: inline-block; margin-left: 0.4rem; transition: transform 0.2s; }
.btn:hover .intake__submit-arrow { transform: translateX(3px); }
.btn--loading { position: relative; color: transparent !important; pointer-events: none; }
.btn--loading .intake__submit-label { color: var(--text); }
.btn--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: #000;
  animation: intake-spin 0.8s linear infinite;
}
@keyframes intake-spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .intake__tabs { grid-template-columns: 1fr; }
  .intake__chat-input { min-height: 11rem; }
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--subtle);
}

/* ─── Stepper — numbered circles with connector lines ───────────────────── */
.stepper-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.stepper {
  display: flex;
  align-items: center;
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.stepper__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--subtle);
}
/* Connector line between this step and the next */
.stepper__item:not(:last-child)::after {
  content: "";
  flex: 1;
  height: 2px;
  margin: 0 0.6rem;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.2s ease;
}
.stepper__item--done:not(:last-child)::after {
  background: var(--amber);
}
.stepper__item--current:not(:last-child)::after {
  background: linear-gradient(90deg, var(--amber) 0%, var(--border) 80%);
}
.stepper__bullet {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border-mid);
  background: var(--surface);
  font-size: 0.78rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--muted);
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.stepper__item--done .stepper__bullet {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1a18;
}
.stepper__item--current .stepper__bullet {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--bg);
  box-shadow: 0 0 0 4px var(--amber-dim);
}
.stepper__label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.stepper__item--done .stepper__label { color: var(--muted); }
.stepper__item--current .stepper__label { color: var(--amber); }
/* Reset button — small pill with an icon-circle that echoes the step
   bullets, so it sits in the same visual family but reads as "exit". */
.stepper__reset {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem 0.3rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.stepper__reset:hover {
  color: var(--text);
  border-color: var(--border-mid);
  background: var(--bg);
}
.stepper__reset:focus-visible {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}
.stepper__reset-icon {
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
}
.stepper__reset:hover .stepper__reset-icon {
  color: var(--amber);
  border-color: var(--amber-glow);
}

/* Compact: only show the current step's label inline; circles + connectors
   keep showing progress so the user still sees where they are. The reset
   button collapses to its icon. */
@media (max-width: 720px) {
  .stepper-bar { padding: 0.75rem 1rem; gap: 0.6rem; }
  .stepper__item:not(.stepper__item--current) .stepper__label { display: none; }
  .stepper__item--current { flex: 2; }
  .stepper__bullet { width: 1.6rem; height: 1.6rem; font-size: 0.72rem; }
  .stepper__item:not(:last-child)::after { margin: 0 0.4rem; }
  .stepper__reset { padding: 0.25rem; border: 0; background: transparent; }
  .stepper__reset-label { display: none; }
}

/* ─── Stores selector ────────────────────────────────────────────────────── */
.stores {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.stores__group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.stores__list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
}
.stores__item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.6rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  transition: border-color 0.15s, background 0.15s;
}
.stores__item:hover { border-color: var(--border-mid); }
.stores__item--synced { border-color: rgba(34, 197, 94, 0.25); background: rgba(34, 197, 94, 0.04); }
.stores__item--synced:hover { border-color: rgba(34, 197, 94, 0.45); }
.stores__item input { accent-color: var(--amber); }
.stores__item-name { color: var(--text); font-weight: 500; }
.stores__item-loc { color: var(--subtle); font-size: 0.78rem; margin-left: auto; }
.stores__item-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  /* Push to a new row only when there isn't space inline. */
  margin-left: 0.25rem;
}
.stores__item-badge--synced {
  color: hsl(142, 70%, 70%);
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.32);
}
.stores__item-badge--manual {
  color: var(--muted);
  background: var(--surface);
  border-color: var(--border);
}
.stores__item-badge--unknown {
  color: var(--subtle);
  background: var(--surface);
  border-color: var(--border);
  font-weight: 500;
  font-style: italic;
}
.stores__item-badge-sub { font-weight: 500; opacity: 0.85; margin-left: 0.15rem; }
@media (max-width: 480px) {
  .stores__item-loc { margin-left: 0; font-size: 0.75rem; }
  .stores__item-badge { flex-basis: 100%; margin-left: 1.6rem; text-align: left; }
}

/* ─── Match review ───────────────────────────────────────────────────────── */
.matches {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.match-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
}
.match-card--empty { border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.04); }
.match-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.match-card__title { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.match-card__meta { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.match-card__meta strong { color: var(--text); font-weight: 600; }
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.badge--warning { color: #fbbf24; background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.3); }
.match-card__stores {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem 0.75rem;
}
.match-card__store {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
}
.match-card__store-label { color: var(--muted); font-weight: 500; }
.match-card__none { color: var(--subtle); font-style: italic; padding: 0.45rem 0; }
.match-card__select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.match-card__select:focus { border-color: var(--amber); }

/* ─── Matches step: view toggle + per-store list ─────────────────────────── */
.matches__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.matches__view-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.2rem;
  gap: 0.15rem;
}
.matches__view-tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: calc(var(--radius) - 0.25rem);
  cursor: pointer;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.matches__view-tab:hover { color: var(--text); }
.matches__view-tab--active {
  color: var(--amber);
  background: var(--amber-dim);
  border-color: var(--amber-glow);
  font-weight: 600;
}

/* Per-store layout: list of items, each row aligns name+meta with the
   combobox. Mobile stacks them vertically. */
.match-card__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.match-card__item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr);
  gap: 0.6rem 1rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.match-card__item-row:last-child { border-bottom: none; }
.match-card__item-info { min-width: 0; }
.match-card__item-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-card__item-meta { color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }
.match-card__item-meta strong { color: var(--text); font-weight: 600; }
.match-card__item-control { min-width: 0; }
@media (max-width: 560px) {
  .match-card__item-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .match-card__item-name { white-space: normal; }
}

/* ─── Items editor (items step) ──────────────────────────────────────────── */
.items-editor {
  padding: 1rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.items-editor__summary {
  font-size: 0.88rem;
  color: var(--muted);
}
.items-editor__summary strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.items-editor__warning { color: #fbbf24; font-weight: 500; }

.items-editor__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.items-editor__row {
  display: grid;
  grid-template-columns: auto minmax(0, 2fr) minmax(0, 1fr) auto;
  gap: 0.5rem 0.75rem;
  align-items: end;
  padding: 0.55rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.items-editor__row--invalid { border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.04); }
.items-editor__index {
  align-self: center;
  width: 1.6rem;
  text-align: right;
  color: var(--subtle);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.items-editor__field { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.items-editor__label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.items-editor__input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  /* 16px to avoid iOS auto-zoom on focus. */
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.items-editor__input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}
.items-editor__input--qty { text-align: right; font-variant-numeric: tabular-nums; }
.items-editor__input--invalid { border-color: rgba(239, 68, 68, 0.5); }

.items-editor__remove {
  align-self: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.items-editor__remove:hover {
  color: hsl(0, 80%, 72%);
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.items-editor__add {
  align-self: flex-start;
  appearance: none;
  background: transparent;
  border: 1px dashed var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--muted);
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.items-editor__add:hover {
  color: var(--amber);
  background: var(--amber-dim);
  border-color: var(--amber-glow);
  border-style: solid;
}

@media (max-width: 560px) {
  .items-editor { padding: 0.85rem 1rem 1.1rem; }
  .items-editor__row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "index name remove"
      "index qty  remove";
  }
  .items-editor__index { grid-area: index; }
  .items-editor__field--name { grid-area: name; }
  .items-editor__field--qty { grid-area: qty; }
  .items-editor__remove { grid-area: remove; }
}

/* ─── Combobox (matches step) ────────────────────────────────────────────── */
.combobox { position: relative; }
.combobox__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.combobox__trigger:hover { border-color: var(--border-mid); }
.combobox__trigger:focus-visible,
.combobox--open .combobox__trigger {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}
.combobox__trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.combobox__trigger-text--empty { color: var(--subtle); font-style: italic; }
.combobox__trigger-caret { color: var(--muted); font-size: 0.7rem; flex-shrink: 0; }

.combobox__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(245, 158, 11, 0.06);
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow: hidden;
}
.combobox__search {
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  /* 16px to avoid the iOS auto-zoom on focus. */
  font-size: 16px;
  padding: 0.6rem 0.75rem;
  outline: none;
}
.combobox__search:focus { background: var(--surface); }
.combobox__list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  overflow-y: auto;
  max-height: 260px;
  -webkit-overflow-scrolling: touch;
}
.combobox__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  border-left: 2px solid transparent;
}
.combobox__option-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combobox__option-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.combobox__option-score {
  color: var(--amber);
  font-weight: 600;
}
.combobox__option--highlight {
  background: rgba(245, 158, 11, 0.08);
  border-left-color: var(--amber);
}
.combobox__option--selected { background: rgba(245, 158, 11, 0.04); }
.combobox__option--selected .combobox__option-name { font-weight: 600; }
.combobox__option--none {
  color: var(--subtle);
  font-style: italic;
  border-top: 1px dashed var(--border);
}
.combobox__empty {
  padding: 0.85rem 0.75rem;
  color: var(--subtle);
  font-size: 0.82rem;
  font-style: italic;
  text-align: center;
}

/* ─── Quote table ────────────────────────────────────────────────────────── */
.quote-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0.25rem 0; }
.quote-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  width: 100%;
  min-width: 600px;
}
.quote-table thead th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.quote-table thead th.quote-table__item {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--bg);
  border-right: 1px solid var(--border);
}
.quote-table tbody td.quote-table__item {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.quote-table tfoot td.quote-table__item {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg);
  border-right: 1px solid var(--border);
}
.quote-table__store {
  text-align: center !important;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-left: 1px solid var(--border);
}
.quote-table__sub {
  font-size: 0.68rem !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-left: 1px solid var(--border);
  text-align: right !important;
}
.quote-table tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.quote-table tbody tr:last-child td { border-bottom: none; }
.quote-table__item { color: var(--text); font-weight: 500; white-space: normal !important; min-width: 180px; }
.quote-table__unit { text-align: left; color: var(--muted); font-size: 0.85em; white-space: nowrap; }
.quote-table__qty { text-align: right; font-weight: 600; }
.quote-table__stock { text-align: right; color: var(--muted); border-left: 1px solid var(--border); }
.quote-table__stock--selected {
  background: var(--amber-dim);
  color: var(--amber);
  box-shadow: inset 2px 0 0 var(--amber);
}
.quote-table__stock--selected strong { color: var(--amber); font-weight: 700; }
.quote-table__stock-avail { color: var(--muted); font-weight: 400; font-size: 0.78em; }

/* Cell status — mutually exclusive */
.quote-table__stock--confirmed { color: hsl(142, 80%, 72%); }
.quote-table__stock--pending   { color: #fbbf24; }
.quote-table__stock--unavailable { color: hsl(0, 60%, 62%); opacity: 0.65; }

/* When a pending / confirmed cell is also part of the allocation,
   the amber "selected" background still wins, but the left border
   reflects the status. */
.quote-table__stock--selected {
  background: var(--amber-dim);
  box-shadow: inset 2px 0 0 var(--amber);
}
.quote-table__stock--confirmed.quote-table__stock--selected {
  background: rgba(34, 197, 94, 0.12);
  box-shadow: inset 2px 0 0 hsl(142, 80%, 60%);
}
.quote-table__stock--confirmed.quote-table__stock--selected strong { color: hsl(142, 80%, 72%); }
.quote-table__stock--pending.quote-table__stock--selected {
  box-shadow: inset 2px 0 0 #fbbf24;
}
.quote-table__stock--pending.quote-table__stock--selected strong { color: #fbbf24; }

.quote-table__icon { margin-right: 0.2em; font-size: 0.9em; }
.results__meta-accent { color: hsl(142, 80%, 72%); font-weight: 600; }

.breakdown__row--pending { background: rgba(245, 158, 11, 0.06); }
.breakdown__row--pending td:first-child { color: #fbbf24; }
.breakdown__row--confirmed { background: rgba(34, 197, 94, 0.05); }
.breakdown__row--confirmed td:first-child { color: hsl(142, 80%, 72%); }
.quote-table__price { text-align: right; font-weight: 600; }
.quote-table tfoot td {
  padding: 0.65rem 0.75rem;
  border-top: 2px solid var(--border-mid);
  font-weight: 600;
  background: var(--bg);
}
.quote-table__total { text-align: right; color: var(--text); border-left: 1px solid var(--border); }
.quote-table__total--min { color: var(--price-green); }

/* ─── Per-store breakdown ────────────────────────────────────────────────── */
.breakdowns {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.breakdowns__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.breakdowns__heading h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.breakdowns__grand {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.breakdowns__grand strong { color: var(--amber); font-size: 1.05rem; font-weight: 700; }
.breakdowns__empty { color: var(--muted); font-size: 0.85rem; padding: 1rem 0; }
.breakdowns__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.75rem;
}
.breakdown {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.breakdown__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.breakdown__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.breakdown__total {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--price-green);
  font-variant-numeric: tabular-nums;
}
.breakdown__table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.breakdown__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
  min-width: 440px;
}
.breakdown__table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
.breakdown__table td {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.breakdown__table tr:last-child td { border-bottom: none; }
.breakdown__num { text-align: right !important; }
.breakdown__unit { color: var(--muted); font-size: 0.85em; white-space: nowrap; }

/* First column sticky-left so the material name stays visible while the
   numeric columns scroll horizontally on mobile. Sticky cells need a solid
   background to cover content scrolling behind them. */
.breakdown__table th:first-child,
.breakdown__table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 160px;
  max-width: 220px;
  white-space: normal;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.breakdown__table th:first-child { z-index: 3; }
.breakdown__row--pending td:first-child { background: #1a150b; }
.breakdown__row--confirmed td:first-child { background: #0d150f; }

.unfulfilled__table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
.unfulfilled__table th:first-child,
.unfulfilled__table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 160px;
  max-width: 220px;
  white-space: normal;
  border-right: 1px solid rgba(251, 191, 36, 0.18);
  /* Solid color that matches the amber-tinted card background so the
     sticky cell doesn't show as a dark patch when the row scrolls. */
  background: #1c1a13;
}
.unfulfilled__table th:first-child {
  z-index: 3;
  background: #1c1a13;
}

/* ─── Estado stack — the top-level container of all estado islands ───────── */
.estado-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 1.5rem 1.75rem;
  background: var(--bg);
}

/* Unified section card around each island */
.estado-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.estado-section--summary {
  background: transparent;
  border: none;
  padding: 0;
  overflow: visible;
}
.estado-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.estado-section__heading {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.estado-section__eyebrow {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--amber);
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--amber-glow);
  background: var(--amber-dim);
  border-radius: 999px;
  width: fit-content;
}
.estado-section__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.estado-section__hint {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
.estado-section__body {
  padding: 1.2rem 1.3rem;
}

/* ─── Summary strip (estado_summary island) ──────────────────────────────── */
.estado-summary {
  padding: 0.1rem 0.15rem;
}
.estado-summary__bar {
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-areas:
    "confirmed pending progress"
    "hint hint hint";
  align-items: center;
  gap: 0.7rem 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
@media (max-width: 640px) {
  .estado-summary__bar {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "confirmed pending"
      "progress  progress"
      "hint      hint";
  }
  .estado-summary__chip { justify-content: center; }
}
.estado-summary__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.estado-summary__chip strong { font-weight: 700; font-size: 0.95rem; }
.estado-summary__chip--confirmed { border-color: rgba(74, 222, 128, 0.35); }
.estado-summary__chip--confirmed strong { color: hsl(142, 70%, 65%); }
.estado-summary__chip--pending { border-color: rgba(245, 158, 11, 0.35); }
.estado-summary__chip--pending strong { color: var(--amber); }
.estado-summary__chip--confirmed { grid-area: confirmed; }
.estado-summary__chip--pending { grid-area: pending; }
.estado-summary__progress {
  grid-area: progress;
  height: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  min-width: 100px;
}
.estado-summary__progress-bar {
  height: 100%;
  background: linear-gradient(90deg, hsl(142, 70%, 55%), hsl(142, 70%, 70%));
  border-radius: 999px;
  transition: width 300ms ease;
}
.estado-summary__hint {
  grid-area: hint;
  font-size: 0.78rem;
  color: var(--muted);
}
.estado-summary__error { color: #fbbf24; }

/* ─── Empty state (no responses yet) ─────────────────────────────────────── */
.estado-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
}
.estado-empty__icon { font-size: 2.2rem; line-height: 1; }
.estado-empty__title { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.estado-empty__body { font-size: 0.82rem; line-height: 1.55; max-width: 34ch; }

/* ─── Purchase plan ──────────────────────────────────────────────────────── */
.plan {
  padding: 0;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Hero card — the first thing the user sees */
.plan-hero {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.02) 100%);
  border: 1px solid var(--amber-glow);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  grid-template-areas:
    "main stats"
    "compare compare";
  gap: 1rem 1.5rem;
  align-items: center;
}
.plan-hero__main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.plan-hero__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.plan-hero__total {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.plan-hero__meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.2rem;
}
.plan-hero__stats {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 0.5rem;
}
.plan-hero__stat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 120ms ease;
  min-width: 0;
}
.plan-hero__stat--confirmed { border-color: rgba(74, 222, 128, 0.3); }
.plan-hero__stat--pending   { border-color: rgba(245, 158, 11, 0.3); }
.plan-hero__stat--missing   { border-color: rgba(248, 113, 113, 0.3); }
.plan-hero__stat-icon {
  font-size: 1.25rem;
  line-height: 1;
  grid-row: span 2;
  align-self: center;
}
.plan-hero__stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
}
.plan-hero__stat-label {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin-top: 0.15rem;
}
.plan-hero__stat--confirmed .plan-hero__stat-value { color: hsl(142, 70%, 65%); }
.plan-hero__stat--missing .plan-hero__stat-value { color: #f87171; }
.plan-hero__compare {
  grid-area: compare;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text);
}
.plan-hero__compare em { color: var(--text); font-style: normal; font-weight: 600; }
.plan-hero__compare strong { color: var(--amber); font-variant-numeric: tabular-nums; }
.plan-hero__compare-icon { font-size: 1.05rem; flex-shrink: 0; }
.plan-hero__compare--save {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.05);
}
.plan-hero__compare--save strong { color: hsl(142, 70%, 65%); }
.plan-hero__compare--costly {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.05);
}
.plan-hero__compare--costly strong { color: #f87171; }
.plan-hero__compare--note {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Toggles — each pill shows contribution to help the user reason about removals */
.plan__toggles {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.plan__toggles-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.plan__toggles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.plan__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: all 120ms ease;
  min-width: 0;
}
.plan__toggle:hover { border-color: var(--border-mid); }
.plan__toggle input {
  accent-color: var(--amber);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  cursor: pointer;
}
.plan__toggle--active {
  border-color: var(--amber-glow);
  background: var(--amber-dim);
}
.plan__toggle--disabled {
  opacity: 0.55;
  background: transparent;
}
.plan__toggle--disabled .plan__toggle-name { text-decoration: line-through; color: var(--subtle); }
.plan__toggle-body {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  line-height: 1.25;
  min-width: 0;
}
.plan__toggle-name {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22ch;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.plan__toggle-badge {
  flex-shrink: 0;
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.25;
}
.plan__toggle-badge--confirmed {
  color: hsl(142, 80%, 72%);
  background: rgba(34, 197, 94, 0.12);
  border-color: hsla(142, 80%, 60%, 0.4);
}
.plan__toggle-badge--pending {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
}
.plan__toggle--confirmed {
  border-color: hsla(142, 80%, 60%, 0.35);
}
.plan__toggle--confirmed:hover { border-color: hsla(142, 80%, 60%, 0.55); }
.plan__toggle--disabled.plan__toggle--confirmed { border-color: var(--border); }
.plan__toggle-stats {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.plan__toggle-stats strong { color: var(--amber); font-weight: 700; }
.plan__toggle--active .plan__toggle-stats strong { color: var(--amber); }
.plan__toggle-stats--idle { font-style: italic; color: var(--subtle); }
.plan__toggle-stats--off { font-style: italic; color: var(--subtle); }

/* Breakdowns — enrich the cards with a rank badge and share-of-total */
.breakdown__titlewrap {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.breakdown__badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid var(--amber-glow);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  white-space: nowrap;
}
.breakdown__totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  line-height: 1.1;
}
.breakdown__share {
  font-size: 0.68rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Responsive: collapse hero to a single column on narrow viewports */
@media (max-width: 720px) {
  .plan-hero {
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "stats"
      "compare";
    gap: 0.85rem;
  }
  .plan-hero__stats { grid-template-columns: repeat(3, 1fr); }
  .plan__toggle-name { max-width: 100%; }
}

/* ─── Unfulfilled ────────────────────────────────────────────────────────── */
/* Modeled after `.breakdown` card: zero outer padding, children own
   their internal padding so the table sits flush against the card
   border. Amber tint signals the warning state. */
.unfulfilled {
  padding: 0;
  margin-top: 0.5rem;
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(251, 191, 36, 0.04);
  overflow: hidden;
}
.unfulfilled__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid rgba(251, 191, 36, 0.2);
  background: rgba(251, 191, 36, 0.06);
}
.unfulfilled__heading h3 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fbbf24;
}
.unfulfilled__count { font-size: 0.78rem; color: var(--muted); }
.unfulfilled__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
  min-width: 380px;
}
.unfulfilled__table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid rgba(251, 191, 36, 0.2);
}
.unfulfilled__table td {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid rgba(251, 191, 36, 0.15);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.unfulfilled__table tr:last-child td { border-bottom: none; }

/* ─── Received cards (estado_received island) ────────────────────────────── */
.received-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.received-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.received-card[open] {
  border-color: rgba(74, 222, 128, 0.35);
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.12);
}
.received-card__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 120ms ease;
}
.received-card__summary::-webkit-details-marker { display: none; }
.received-card__summary::marker { content: ''; }
.received-card__summary:hover { background: rgba(74, 222, 128, 0.04); }
.received-card__heading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}
.received-card__heading-text { min-width: 0; }
.received-card__icon { font-size: 1.3rem; flex-shrink: 0; line-height: 1; }
.received-card__store {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}
.received-card__meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.received-card__summary-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
}
.received-card__total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}
.received-card__total-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: hsl(142, 70%, 65%);
  font-variant-numeric: tabular-nums;
}
.received-card__total-label {
  font-size: 0.66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.1rem;
}
.received-card__cta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--amber);
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--amber-glow);
  background: var(--amber-dim);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.received-card[open] .received-card__cta {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.received-card[open] .received-card__cta::before { content: '▾ '; }
.received-card:not([open]) .received-card__cta::after { content: ' →'; }
.received-card__body {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.received-card__empty {
  padding: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
}
.received-card__totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.received-card__totals-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.received-card__totals-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.received-card__totals-item strong {
  font-size: 1.1rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.received-card__table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.received-card__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  min-width: 640px;
}
.received-card__table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
.received-card__table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  white-space: nowrap;
}
.received-card__table tr:last-child td { border-bottom: none; }
.received-card__num { text-align: right !important; }
.received-card__matched {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: italic;
}
.received-card__unit {
  color: var(--muted);
  font-size: 0.85em;
  white-space: nowrap;
}

/* First column = Material solicitado. Sticky left so it stays visible
   when the table scrolls horizontally. */
.received-card__table th:first-child,
.received-card__table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 180px;
  max-width: 260px;
  white-space: normal;
  border-right: 1px solid var(--border);
}
.received-card__table th:first-child { z-index: 3; }
.received-card__table tbody tr:not(:last-child) td:first-child {
  box-shadow: inset 0 -1px 0 var(--border);
}

/* Row-level status — use solid colors so they survive through sticky cells */
.received-card__row--missing td { color: var(--subtle); }
.received-card__row--missing td:first-child { color: var(--subtle); }
.received-card__row--partial td { background: #201d13; }

/* ─── Comparison collapsible (plan-details inside estado-section) ────────── */
.plan-details { /* section card provides border + radius; details is transparent */ }
.plan-details__summary {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.1rem 1.3rem;
  cursor: pointer;
  color: var(--text);
  list-style: none;
  user-select: none;
  transition: background 120ms ease;
}
.plan-details__summary::-webkit-details-marker { display: none; }
.plan-details__summary::marker { content: ''; }
.plan-details__summary:hover { background: var(--surface); }
.plan-details__summary::after {
  content: '▸';
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: auto;
  transition: transform 150ms ease;
  padding-top: 0.45rem;
}
.plan-details[open] > .plan-details__summary::after { transform: rotate(90deg); }
.plan-details__label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.plan-details__hint {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
.plan-details__body {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  nav { padding: 0.8rem 1rem; }

  /* Edge-to-edge on mobile: let card shells run from screen edge to screen
     edge and add inner padding where it matters. Saves ~60px of horizontal
     real estate compared to nesting main/card/section padding. */
  main { padding: 2rem 0 1.5rem; gap: 1.25rem; }
  main:has(.stepper-bar) { padding: 1rem 0 2rem; gap: 1rem; }
  footer { padding: 1.25rem 1rem; }

  /* Landing-page blocks aren't inside a card shell, so they need their own
     horizontal padding now that main no longer provides any. */
  .hero,
  .features,
  .intake { padding-left: 1rem; padding-right: 1rem; }

  /* Card shells drop side borders + radius so they look flush to the edge. */
  .results,
  .estado-section { border-left: 0; border-right: 0; border-radius: 0; }
  .estado-section--summary { padding-left: 1rem; padding-right: 1rem; }

  /* Inner padding inside cards — trim from ~1.5rem to ~1rem horizontally. */
  .results__header { padding: 1rem; flex-direction: column; }
  .results__actions { width: 100%; }
  .results__search { flex: 1; min-width: 0; }
  .results__hint,
  .results__banner,
  .results__errors { padding-left: 1rem; padding-right: 1rem; }
  .results__footer { padding: 0.85rem 1rem; }
  .results__table thead th,
  .results__table tbody td { padding: 0.6rem 1rem; }

  .estado-section__header { padding: 0.9rem 1rem; }
  .estado-section__body { padding: 0.95rem 1rem; }

  .plan-details__summary { padding: 0.9rem 1rem; }
  .plan-hero { padding: 1rem; }

  .breakdowns { padding: 0.95rem 1rem; }
  .received-card__summary { padding: 0.9rem 1rem; }
  .received-card__empty { padding: 1rem; }
  .unfulfilled__heading { padding: 0.55rem 0.7rem; }
  .unfulfilled__table th,
  .unfulfilled__table td { padding: 0.45rem 0.7rem; }

  /* Wizard step containers (items / stores / matches / quote) */
  .stepper-bar { padding: 0.6rem 1rem; }
  .stores,
  .matches { padding: 0.9rem 1rem 1.1rem; }

  /* Typography / misc */
  h1 { font-size: 2.1rem; }
  .dropzone { padding: 2rem 1rem; }
  .features { gap: 0.5rem; }
  .feature__sep { display: none; }
}
