/* Estilo nativo tipo iOS (claro/oscuro según el teléfono). Común al formulario y al CRM. */
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --card-press: #e5e5ea;
  --sep: rgba(60, 60, 67, .18);
  --label: #000000;
  --label-2: rgba(60, 60, 67, .6);
  --label-3: rgba(60, 60, 67, .3);
  --fill: rgba(118, 118, 128, .12);
  --tint: #d70015;            /* rojo de Iker; en oscuro se aclara */
  --green: #34c759;
  --orange: #ff9500;
  --bar: rgba(249, 249, 249, .86);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --card-press: #2c2c2e;
    --sep: rgba(84, 84, 88, .6);
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, .6);
    --label-3: rgba(235, 235, 245, .3);
    --fill: rgba(118, 118, 128, .24);
    --tint: #ff453a;
    --green: #30d158;
    --orange: #ff9f0a;
    --bar: rgba(29, 29, 31, .86);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--label); font-family: var(--font); font-size: 17px; line-height: 1.29;
  letter-spacing: -.41px; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--tint); }
.hidden { display: none !important; }

/* Botones */
.btn {
  appearance: none; border: 0; border-radius: 12px; background: var(--tint); color: #fff; font-weight: 600;
  padding: 15px 20px; cursor: pointer; width: 100%; font-size: 17px;
}
.btn:active { opacity: .7; }
.btn:disabled { opacity: .4; }
.btn.gris { background: var(--fill); color: var(--tint); }
.btn.chico { width: auto; padding: 8px 14px; font-size: 15px; border-radius: 10px; }
.link { background: none; border: 0; padding: 0; color: var(--tint); cursor: pointer; font-size: 17px; }
.link:disabled { color: var(--label-3); }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; }

/* Control segmentado */
.seg { display: inline-flex; background: var(--fill); border-radius: 9px; padding: 2px; }
.seg button {
  border: 0; background: transparent; padding: 5px 14px; border-radius: 7px; font-size: 13px; font-weight: 500;
  cursor: pointer; min-width: 44px;
}
.seg button.on { background: var(--card); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); font-weight: 600; }
@media (prefers-color-scheme: dark) { .seg button.on { background: #636366; } }

/* Listas agrupadas (como Ajustes) */
.seccion { margin: 0 0 22px; }
.cab { font-size: 13px; color: var(--label-2); text-transform: uppercase; letter-spacing: -.08px; padding: 0 16px 7px; }
.cab.normal { text-transform: none; font-size: 15px; color: var(--label); font-weight: 600; letter-spacing: -.24px; }
.pie { font-size: 13px; color: var(--label-2); padding: 7px 16px 0; letter-spacing: -.08px; }
.pie.error { color: var(--tint); }
.card { background: var(--card); border-radius: 10px; overflow: hidden; }
.fila {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 11px 16px; position: relative;
  width: 100%; background: none; border: 0; text-align: left; cursor: default;
}
.fila + .fila::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
button.fila { cursor: pointer; }
button.fila:active { background: var(--card-press); }
.fila .txt { flex: 1; min-width: 0; }
.fila .sec { color: var(--label-2); }
.fila .chev { color: var(--label-3); font-size: 20px; line-height: 1; }
.fila .ok { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--tint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.fila[aria-checked=true] .ok { visibility: visible; }
.fila input:not([type=checkbox]), .fila textarea {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 0; font-size: 17px;
}
.fila input[type=number], .fila .der { text-align: right; }
.fila textarea { min-height: 88px; resize: vertical; line-height: 1.35; }
.fila input::placeholder, .fila textarea::placeholder { color: var(--label-3); }
.fila .unidad { color: var(--label-2); min-width: 22px; }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* Interruptor */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--fill); border-radius: 99px; transition: background .2s; }
.switch span::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06); transition: transform .2s;
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }

.credito { text-align: center; font-size: 13px; color: var(--label-2); padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); }
.credito a { color: var(--label-2); }
