/* pet-track. Diseno: el mapa es el protagonista; el estado del collar se lee en chips; todo lo demas es tranquilo.
   Tokens de color con tema claro y oscuro; tipografia del sistema con escala fija; navegacion inferior en movil. */
:root {
  color-scheme: light;
  --fondo: #f3f5f1;
  --superficie: #ffffff;
  --superficie-2: #e9eee8;
  --texto: #1c2622;
  --texto-suave: #5b6963;
  --borde: #d6ddd5;
  --acento: #2b6f55;
  --acento-fuerte: #1f5742;
  --acento-tinta: #ffffff;
  --acento-suave: #dcebe3;
  --bueno: #2b6f55;
  --aviso: #a86b0a;
  --aviso-suave: #fbefd6;
  --critico: #b23a2c;
  --critico-suave: #f8e2de;
  --mov: #1f5fa8;
  --mov-suave: #dde9f7;
  --sombra: 0 1px 2px rgba(20, 30, 25, 0.08), 0 8px 24px rgba(20, 30, 25, 0.06);
  --radio: 10px;
  --radio-chip: 999px;
  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --ancho-max: 1180px;
  --alto-cabecera: 57px;
  --alto-mapa: 420px;
  --alto-nav: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fondo: #141a17;
    --superficie: #1d2521;
    --superficie-2: #27312c;
    --texto: #e8ede9;
    --texto-suave: #a3b0a9;
    --borde: #34403a;
    --acento: #6fc39f;
    --acento-fuerte: #8ad3b3;
    --acento-tinta: #10201a;
    --acento-suave: #223b31;
    --bueno: #6fc39f;
    --aviso: #e2a93b;
    --aviso-suave: #3b2f17;
    --critico: #ef7f70;
    --critico-suave: #45231f;
    --mov: #7fb1ee;
    --mov-suave: #1f3047;
    --sombra: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --fondo: #141a17;
  --superficie: #1d2521;
  --superficie-2: #27312c;
  --texto: #e8ede9;
  --texto-suave: #a3b0a9;
  --borde: #34403a;
  --acento: #6fc39f;
  --acento-fuerte: #8ad3b3;
  --acento-tinta: #10201a;
  --acento-suave: #223b31;
  --bueno: #6fc39f;
  --aviso: #e2a93b;
  --aviso-suave: #3b2f17;
  --critico: #ef7f70;
  --critico-suave: #45231f;
  --mov: #7fb1ee;
  --mov-suave: #1f3047;
  --sombra: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  font-family: var(--fuente);
  font-size: 16px;
  line-height: 1.5;
  background: var(--fondo);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--acento);
}

:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

/* Cabecera y navegacion */
.cabecera {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--superficie);
  border-bottom: 1px solid var(--borde);
}

.marca {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--texto);
  text-decoration: none;
}

.marca-icono {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--acento);
  color: var(--acento-tinta);
  display: inline-grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
}

.cabecera nav {
  display: flex;
  gap: 4px;
}

.cabecera nav a {
  padding: 6px 12px;
  border-radius: var(--radio-chip);
  color: var(--texto-suave);
  text-decoration: none;
  font-weight: 500;
}

.cabecera nav a:hover {
  background: var(--superficie-2);
  color: var(--texto);
}

.cabecera nav a.activo {
  background: var(--acento-suave);
  color: var(--acento-fuerte);
}

/* Contenido */
.contenedor {
  max-width: var(--ancho-max);
  margin: 0 auto;
  padding-block: 20px 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 16px;
  align-content: start;
}

.contenedor > * {
  min-width: 0;
}

.estrecho {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
}

h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

p {
  margin: 0;
}

.contenedor > p,
.panel > p,
.bloque > p {
  color: var(--texto-suave);
}

small {
  color: var(--texto-suave);
  font-size: 0.85rem;
}

.etiqueta {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--texto-suave);
  font-weight: 600;
}

/* Formularios */
form {
  display: grid;
  gap: 14px;
  max-width: 480px;
}

form.ancho {
  max-width: none;
}

form.fila {
  grid-template-columns: 1fr auto auto;
  align-items: end;
  max-width: none;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
}

label.casilla {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

input,
select,
textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--superficie);
  color: var(--texto);
  max-width: 100%;
  min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--acento);
  outline: none;
  box-shadow: 0 0 0 3px var(--acento-suave);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--acento);
}

input[type="range"] {
  padding: 0;
  border: 0;
  width: 100%;
  accent-color: var(--acento);
}

button {
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radio);
  background: var(--acento);
  color: var(--acento-tinta);
  cursor: pointer;
  min-height: 42px;
}

button:hover {
  background: var(--acento-fuerte);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

button.secundario {
  background: var(--superficie);
  color: var(--texto);
  border-color: var(--borde);
}

button.secundario:hover {
  background: var(--superficie-2);
}

button.peligro {
  background: var(--critico);
  color: #fff;
}

button.pequeno {
  padding: 6px 12px;
  min-height: 34px;
  font-size: 0.9rem;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Los botones no se estiran al ancho de la tarjeta: ocupan lo que necesitan (en movil, todo el ancho) */
form > button,
.bloque > button,
.panel > button {
  justify-self: start;
}

@media (max-width: 719px) {
  form > button,
  .bloque > button,
  .panel > button {
    justify-self: stretch;
  }
}
