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

:root {
  --bg:     #f4f2ee;
  --dark:   #17150f;
  --gold:   #c8a84a;
  --muted:  #8a8070;
  --border: #e2ddd4;
  --white:  #ffffff;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #e8e4dc;
  min-height: 100vh;
}

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 60px rgba(0,0,0,.12);
}

/* ── Header ── */
header {
  background: var(--dark);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.logo {
  font-size: 15px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.1em;
}

.header-modo {
  font-size: 11px;
  color: rgba(244,242,238,.35);
  letter-spacing: 0.03em;
}

/* ── Screens ── */
.pantalla { display: none; }
.pantalla.activa { display: block; }

/* ── Login ── */
.login-wrap {
  padding: 48px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-wrap h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--dark);
}

.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: -10px;
}

/* ── Hero ── */
.hero {
  background: var(--dark);
  padding: 28px 20px 24px;
}

.hero h1 {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.hero-sub {
  font-size: 13px;
  color: rgba(244,242,238,.45);
  margin-bottom: 22px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-card {
  background: rgba(255,255,255,.07);
  border-radius: 10px;
  padding: 14px 6px;
  text-align: center;
}

.stat-num {
  font-size: 30px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.stat-label {
  font-size: 9px;
  color: rgba(244,242,238,.38);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-top: 7px;
  line-height: 1.5;
}

/* ── Content ── */
.content {
  padding: 20px 16px;
}

/* ── Buttons ── */
.btn-nueva {
  width: 100%;
  background: var(--gold);
  color: var(--dark);
  border: none;
  border-radius: 10px;
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background .15s;
  letter-spacing: 0.01em;
}

.btn-nueva:hover { background: #b89838; }

.btn-primary {
  width: 100%;
  background: var(--dark);
  color: var(--gold);
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}

.btn-primary:hover { background: #2a2820; }

.btn-logout {
  width: 100%;
  background: transparent;
  color: #c0392b;
  border: 1px solid #e8d0ce;
  border-radius: 8px;
  padding: 13px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  margin-top: 14px;
  transition: background .15s;
}

.btn-logout:hover { background: #fdf0ef; }

/* ── Ajustes link ── */
.ajustes-link {
  text-align: right;
  margin-bottom: 22px;
}

.ajustes-link a {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

.ajustes-link a:hover { color: var(--dark); }

/* ── Section header ── */
.seccion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.seccion-titulo {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--muted);
  text-transform: uppercase;
}

.ver-todas {
  font-size: 12px;
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}

/* ── Offer rows ── */
.oferta-row {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #ede9e1;
  gap: 10px;
  cursor: default;
}

.oferta-row:last-child { border-bottom: none; }

.oferta-info {
  flex: 1;
  min-width: 0;
}

.oferta-cliente {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oferta-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.oferta-kwp {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Badges ── */
.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-ganada    { background: #edf7ed; color: #2e7d32; border: 0.5px solid #a5d6a7; }
.badge-esperando { background: #fff8e1; color: #a08840; border: 0.5px solid #ead898; }
.badge-revision  { background: #eef2ff; color: #3949ab; border: 0.5px solid #b3bef8; }
.badge-cancelada { background: #f5f5f5; color: #757575; border: 0.5px solid #e0e0e0; }

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Profile rows ── */
.perfil-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #f0ece4;
}

.perfil-row:last-child { border-bottom: none; }

.perfil-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.perfil-valor {
  font-size: 13px;
  color: var(--dark);
  text-align: right;
  font-weight: 500;
}

/* ── Forms ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--dark);
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
}

input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,168,74,.1); }

/* ── Screen nav ── */
.screen-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 47px;
  z-index: 10;
}

.btn-back {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.screen-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark);
}

/* ── Steps bar ── */
.steps-bar {
  display: flex;
  gap: 6px;
  padding: 14px 16px;
  background: var(--bg);
}

.step {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
}

.step.active {
  background: var(--gold);
}

/* ── Form section label ── */
.form-seccion {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ── Select ── */
select {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--dark);
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8070' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,168,74,.1); }

/* ── Ajustes ── */
.ajustes-titulo {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
}

.ajustes-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.slider-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--dark);
}

.slider-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
}

.slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.slider-input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: none;
}

.slider-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.btn-cancelar-ajustes {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  padding: 8px;
}

/* ── Mapa superficie ── */
.mapa-search {
  width: 100%;
  margin-bottom: 8px;
}

.mapa-wrapper {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

#mapa-superficie {
  width: 100%;
  height: calc(100svh - 250px);
  min-height: 340px;
  max-height: 500px;
}

/* Controles overlay izquierda */
.mapa-ctrl {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mapa-ctrl-btn {
  height: 40px;
  background: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 11px;
  white-space: nowrap;
  transition: background .12s;
}

.mapa-ctrl-btn:active { background: #f0ece4; }
.mapa-ctrl-btn.activo { background: var(--gold); color: var(--dark); }

.mapa-ctrl-ok  { background: var(--gold); color: var(--dark); font-weight: 700; }
.mapa-ctrl-del { color: #c0392b; }

/* Hint overlay en el mapa */
.mapa-hint-overlay {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(23,21,15,.72);
  color: #fff;
  font-size: 11px;
  font-family: inherit;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  margin: 0;
}


.superficie-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dark);
}

.superficie-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dark);
  cursor: pointer;
  margin-top: 4px;
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Resultados ── */
.resultado-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.resultado-row.sin-borde { border-bottom: none; }

.resultado-label {
  font-size: 13px;
  color: var(--muted);
}

.resultado-valor {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}

/* ── Overlay calculando ── */
#overlay-calculando {
  position: fixed;
  inset: 0;
  background: rgba(23,21,15,.88);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.calc-spinner {
  width: 52px;
  height: 52px;
  border: 3px solid rgba(200,168,74,.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.calc-texto {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.calc-sub {
  font-size: 13px;
  color: rgba(244,242,238,.45);
  margin: 0;
}

/* ── Misc ── */
.muted {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 28px 0;
}
