/* ── Variables ───────────────────────────────────────── */
:root {
  --c-primary:       #f14e1c;
  --c-primary-light: #fde8e0;
  --c-primary-dark:  #c43a10;
  --c-text:          #374151;
  --c-muted:         #6b7280;
  --c-border:        #d1d5db;
  --c-bg:            #ffffff;
  --c-bg-soft:       #f3f4f6;
  --c-wa:            #25d366;
  --radius:          10px;
  --nav-h:           56px;
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100dvh;
  padding-top: var(--nav-h);
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }

/* ── Nav ─────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--c-primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  z-index: 100;
}
.nav__logo  { width: 28px; height: 28px; border-radius: 50%; }
.nav__title { flex: 1; font-size: 15px; font-weight: 700; }
.nav__btn   { font-size: 22px; line-height: 1; padding: 4px; color: #fff; }

/* ── Screens ─────────────────────────────────────────── */
.screen  { padding: 16px; max-width: 480px; margin: 0 auto; }
.hidden  { display: none !important; }

/* ── Stepper ─────────────────────────────────────────── */
.stepper { display: flex; flex-direction: column; }

.step {
  padding: 14px 0;
  border-bottom: 1px solid var(--c-border);
  transition: opacity 0.2s;
}
.step--locked { opacity: 0.35; pointer-events: none; }

.step__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.step__num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--c-border);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step:not(.step--locked) .step__num { background: var(--c-primary); }
.step__title { font-size: 14px; font-weight: 600; }
.step__body  { padding-left: 36px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  transition: opacity 0.15s;
}
.btn--primary          { background: var(--c-primary); color: #fff; }
.btn--primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--outline          { border: 2px solid var(--c-primary); color: var(--c-primary); }
.btn--danger           { border: 2px solid #dc2626; color: #dc2626; }
.btn--full             { width: 100%; margin-top: 16px; }

/* ── Grid buttons (rangos / kg) ──────────────────────── */
.grid-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-btns .span-2 { grid-column: span 2; }

.grid-btn {
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  padding: 10px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
  background: var(--c-bg);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.grid-btn.selected {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
}

/* ── Input km (modo A y C, y +300 en modo B) ─────────── */
.km-input {
  width: 100%;
  border: 2px solid var(--c-primary);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--c-primary);
  background: var(--c-primary-light);
}
.km-input:focus { outline: none; border-color: var(--c-primary-dark); }

/* ── Toggle ──────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.toggle-label { font-size: 13px; }
.toggle {
  position: relative;
  width: 44px; height: 24px;
  background: var(--c-border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--c-primary); }
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(20px); }

/* ── Result card ─────────────────────────────────────── */
.result-card {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  text-align: center;
}
.result__precio  { font-size: 40px; font-weight: 800; color: var(--c-primary); line-height: 1.1; }
.result__resumen { font-size: 12px; color: var(--c-muted); margin-top: 4px; }

.result__breakdown {
  background: var(--c-bg);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
  text-align: left;
}
.result__breakdown summary {
  color: var(--c-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 6px;
  list-style: none;
}
.result__breakdown summary::-webkit-details-marker { display: none; }
.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--c-muted);
  padding: 4px 0;
  border-bottom: 1px solid var(--c-bg-soft);
}
.breakdown-row--total {
  font-weight: 700;
  color: var(--c-text);
  border-bottom: none;
  font-size: 13px;
  margin-top: 4px;
}

.result__share { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.share-btn { border-radius: 8px; padding: 10px; font-size: 13px; font-weight: 700; text-align: center; cursor: pointer; border: none; }
.share-btn--copy { background: #1d4ed8; color: #fff; }
.share-btn--wa   { background: var(--c-wa); color: #fff; }

/* ── Settings lock banner ────────────────────────────── */
.settings__lock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 12px 0 4px;
  font-size: 13px;
  color: #713f12;
  gap: 10px;
}
.settings__lock-banner--open {
  background: #f0fdf4;
  border-color: #86efac;
  color: #14532d;
}
.lock-btn {
  font-size: 12px;
  font-weight: 700;
  color: #713f12;
  text-decoration: underline;
  white-space: nowrap;
  cursor: pointer;
}

/* ── Settings ────────────────────────────────────────── */
.settings__section        { padding: 16px 0; border-bottom: 1px solid var(--c-border); }
.settings__section-title  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--c-muted); margin-bottom: 12px; }
.setting-row              { margin-bottom: 12px; }
.setting-label            { font-size: 12px; color: var(--c-muted); margin-bottom: 4px; display: block; }
.setting-input,
.setting-select {
  width: 100%;
  border: 1.5px solid var(--c-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
  background: var(--c-bg);
}
.setting-input:focus,
.setting-select:focus { outline: none; border-color: var(--c-primary); }
.setting-hint         { font-size: 11px; color: var(--c-muted); margin-top: 5px; line-height: 1.4; }
.setting-input:disabled { opacity: 0.45; cursor: not-allowed; background: var(--c-bg-soft); }
.setting-row--calc    { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px dashed var(--c-border); margin-top: 4px; }
.setting-calc         { font-size: 18px; font-weight: 800; color: var(--c-primary); }
.settings__footer { padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.version-text     { font-size: 11px; color: var(--c-border); text-align: center; margin-top: 4px; }

/* ── iOS hint ────────────────────────────────────────── */
.ios-hint {
  position: fixed;
  bottom: 16px; left: 16px; right: 16px;
  background: #1e293b;
  color: #fff;
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  z-index: 200;
}
.ios-hint__close { color: #fff; font-size: 16px; padding: 4px; flex-shrink: 0; }
