/* Entorno Serrano — cuaderno de campo: papel cálido, verde monte, ocre de piedra serrana. */
:root {
  --monte: #1f3d2b;
  --monte-2: #2d5640;
  --pasto: #5f8f3a;
  --pasto-claro: #e4eed6;
  --ocre: #c0832a;
  --ocre-claro: #f6e7cc;
  --papel: #f5f1e6;
  --papel-2: #fbf9f3;
  --tinta: #1c211d;
  --tinta-2: #4b5149;
  --piedra: #8a8577;
  --linea: #e2dac7;
  --rojo: #a23b2a;
  --rojo-claro: #f6dcd5;

  --fuente-titulo: 'Fraunces', Georgia, 'Times New Roman', serif;
  --fuente-texto: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --radio: 14px;
  --radio-chico: 8px;
  --sombra: 0 1px 0 rgba(31, 61, 43, .06), 0 6px 18px -10px rgba(31, 61, 43, .35);
  --rapido: 140ms;
  --suave: cubic-bezier(.2, .8, .2, 1);
  --alto-pestanas: 64px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papel);
  background-image: radial-gradient(rgba(31, 61, 43, .045) 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--tinta);
  font-family: var(--fuente-texto);
  font-size: 17px;
  line-height: 1.45;
  padding-bottom: calc(var(--alto-pestanas) + 24px + env(safe-area-inset-bottom));
}

a { color: var(--monte-2); }

h1, h2, h3 { font-family: var(--fuente-titulo); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 1.5rem + 2vw, 2.6rem); }
h2 { font-size: 1.25rem; }

/* ——— Barra superior ——— */
.barra {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--monte);
  color: var(--papel);
}
.marca { font-family: var(--fuente-titulo); font-size: 1.2rem; font-weight: 700; color: var(--papel); text-decoration: none; letter-spacing: .01em; }
.marca span { color: var(--ocre); font-style: italic; font-weight: 500; }
.barra-usuario { font-size: .85rem; opacity: .75; }

.contenido { max-width: 720px; margin: 0 auto; padding: 20px 16px; }

/* ——— Pestañas inferiores ——— */
.pestanas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--alto-pestanas) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--papel-2);
  border-top: 1px solid var(--linea);
  box-shadow: 0 -8px 24px -18px rgba(31, 61, 43, .5);
}
.pestanas a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--piedra); font-size: .75rem; font-weight: 600; text-decoration: none;
  transition: color var(--rapido) var(--suave);
}
.pestanas svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pestanas a[aria-current="page"] { color: var(--monte); }
.pestanas a[aria-current="page"] svg { stroke-width: 2.3; }
.pestanas .pestana-cargar { color: var(--papel); }
.pestanas .pestana-cargar svg {
  width: 44px; height: 44px; padding: 10px; margin-top: -22px;
  background: var(--ocre); border-radius: 50%; stroke-width: 2.6;
  box-shadow: 0 6px 14px -4px rgba(192, 131, 42, .7), 0 0 0 4px var(--papel-2);
  transition: transform var(--rapido) var(--suave);
}
.pestanas .pestana-cargar { color: var(--ocre); }
.pestanas .pestana-cargar svg { color: #fff; }
.pestanas .pestana-cargar:active svg { transform: scale(.92); }

@media (min-width: 900px) {
  .pestanas { left: 50%; right: auto; transform: translateX(-50%); width: 520px; bottom: 16px; border: 1px solid var(--linea); border-radius: 20px; height: var(--alto-pestanas); padding-bottom: 0; }
}

/* ——— Encabezados de sección ——— */
.cabecera { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 4px 0 18px; }
.miga { margin: 0 0 6px; font-size: .9rem; }
.miga a { color: var(--piedra); text-decoration: none; }
.miga a:hover { color: var(--monte); }

/* ——— Botones ——— */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  background: var(--monte); color: var(--papel);
  border: 0; border-radius: 999px;
  font: 600 1rem var(--fuente-texto); text-decoration: none; cursor: pointer;
  transition: transform var(--rapido) var(--suave), background var(--rapido) var(--suave), box-shadow var(--rapido);
}
.boton:hover { background: var(--monte-2); }
.boton:active { transform: translateY(1px) scale(.98); }
.boton:focus-visible, .boton-texto:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .pestanas a:focus-visible {
  outline: 3px solid var(--ocre); outline-offset: 2px;
}
.boton-grande { min-height: 54px; font-size: 1.1rem; padding: 0 28px; }
.boton-suave { background: transparent; color: var(--monte); box-shadow: inset 0 0 0 1.5px var(--monte); }
.boton-suave:hover { background: var(--pasto-claro); }
.boton-hecho { background: var(--pasto); min-height: 46px; padding: 0 22px; font-size: 1.05rem; }
.boton-hecho:hover { background: #4f7c2e; }
.boton.enviando { opacity: .6; cursor: progress; }
.boton-texto {
  background: none; border: 0; padding: 10px 4px; cursor: pointer;
  color: var(--monte-2); font: 600 .95rem var(--fuente-texto); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.boton-texto:hover { color: var(--monte); text-decoration-thickness: 2px; }
.boton-peligro { color: var(--rojo); }
.boton-icono {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--papel-2); border: 1px solid var(--linea); color: var(--monte);
  font-size: 1.6rem; line-height: 1; text-decoration: none;
}
.boton-icono:hover { border-color: var(--monte); }

/* ——— Avisos ——— */
.aviso { padding: 12px 14px; border-radius: var(--radio-chico); margin-bottom: 14px; font-weight: 500; border-left: 4px solid; }
.aviso-ok { background: var(--pasto-claro); border-color: var(--pasto); }
.aviso-error { background: var(--rojo-claro); border-color: var(--rojo); }

/* ——— Tarjetas y formularios ——— */
.tarjeta { background: var(--papel-2); border: 1px solid var(--linea); border-radius: var(--radio); padding: 18px; box-shadow: var(--sombra); margin-bottom: 18px; }
.formulario { display: grid; gap: 16px; }
.formulario label, .formulario legend { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; color: var(--tinta-2); }
.opcional { font-weight: 400; color: var(--piedra); }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  background: #fff; color: var(--tinta);
  border: 1.5px solid var(--linea); border-radius: var(--radio-chico);
  font: 400 1.05rem var(--fuente-texto);
  transition: border-color var(--rapido);
}
input:hover, select:hover, textarea:hover { border-color: var(--piedra); }
input:focus, select:focus, textarea:focus { border-color: var(--monte); outline: none; }
textarea { resize: vertical; }
.campo-error { margin: 0; color: var(--rojo); font-weight: 600; font-size: .9rem; }
.ayuda { margin: 0; color: var(--tinta-2); font-weight: 400; font-size: .92rem; }
.fila { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo-con-boton { display: flex; gap: 8px; }
.campo-con-boton .boton { flex-shrink: 0; }
.formulario-acciones { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.casilla { display: flex !important; align-items: center; gap: 10px; font-weight: 500 !important; }
.casilla input { width: 22px; min-height: 22px; accent-color: var(--monte); }
.filtro { min-height: 40px; font-size: .95rem; background: var(--papel); }

/* Opciones como botones (servicio, trabajadores) */
.opciones-botones { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.opciones-botones legend { margin-bottom: 8px; padding: 0; }
.opciones-botones label { display: block; }
.opciones-botones input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opciones-botones span {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px;
  border-radius: 999px; border: 1.5px solid var(--linea); background: #fff;
  color: var(--tinta); font-weight: 600; cursor: pointer;
  transition: background var(--rapido), border-color var(--rapido), color var(--rapido);
}
.opciones-botones input:checked + span { background: var(--monte); border-color: var(--monte); color: var(--papel); }
.opciones-botones input:focus-visible + span { outline: 3px solid var(--ocre); outline-offset: 2px; }

/* ——— Buscador y listas ——— */
.buscador { display: flex; gap: 8px; margin-bottom: 16px; }
.lista { list-style: none; margin: 0 0 18px; padding: 0; border-radius: var(--radio); overflow: hidden; border: 1px solid var(--linea); background: var(--papel-2); box-shadow: var(--sombra); }
.lista li + li { border-top: 1px solid var(--linea); }
.lista-item { display: grid; gap: 2px; padding: 14px 16px; color: var(--tinta); text-decoration: none; position: relative; transition: background var(--rapido); }
.lista-item::after { content: '›'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--piedra); font-size: 1.4rem; }
.lista-item:hover { background: var(--pasto-claro); }
.lista-item strong { font-size: 1.05rem; padding-right: 24px; }
.lista-detalle { color: var(--tinta-2); font-size: .92rem; padding-right: 24px; }
.inactivo { opacity: .55; }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--monte); color: var(--papel); font: 600 .78rem var(--fuente-texto); letter-spacing: .02em; vertical-align: middle; }
.chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.chip-suave { background: var(--papel); color: var(--tinta-2); border: 1px solid var(--linea); }

.ficha p { margin: 0 0 10px; }
.etiqueta { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--piedra); font-weight: 700; }
.nota-acceso { background: var(--ocre-claro); padding: 10px 12px; border-radius: var(--radio-chico); }

/* ——— Agenda ——— */
.selector { display: inline-flex; background: var(--papel-2); border: 1px solid var(--linea); border-radius: 999px; padding: 3px; }
.selector a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--tinta-2); font-weight: 600; font-size: .9rem; }
.selector a[aria-current="true"] { background: var(--monte); color: var(--papel); }

.navegador-fechas { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.navegador-centro { flex: 1; display: grid; justify-items: center; gap: 4px; }
.navegador-centro strong { font-family: var(--fuente-titulo); font-size: 1.15rem; }
.navegador-centro input { max-width: 190px; min-height: 38px; padding: 4px 10px; font-size: .95rem; text-align: center; background: transparent; }
.centrado { text-align: center; margin: 0 0 8px; }

.bloque { margin: 26px 0; }
.bloque > h2 { margin-bottom: 10px; }
.bloque-alerta { background: var(--ocre-claro); border-radius: var(--radio); padding: 16px; margin-top: 16px; }
.bloque-alerta .ayuda { margin-bottom: 12px; }
.contador { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: var(--ocre); color: #fff; font: 700 .85rem var(--fuente-texto); vertical-align: middle; }

.dia { margin: 22px 0; }
.dia-cabeza { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 2px solid var(--monte); padding-bottom: 4px; margin-bottom: 10px; }
.dia-cabeza h2 { text-transform: capitalize; }
.dia-cabeza em { font-style: italic; font-weight: 500; color: var(--ocre); font-size: .95rem; text-transform: none; }
.dia-hoy .dia-cabeza { border-bottom-color: var(--ocre); }
.dia-vacio { color: var(--piedra); font-style: italic; margin: 6px 0 0; }

.trabajo {
  position: relative;
  background: var(--papel-2); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 14px 16px 10px 20px; margin-bottom: 12px; box-shadow: var(--sombra);
  overflow: hidden;
}
.trabajo::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--ocre); }
.estado-hecho::before { background: var(--pasto); }
.estado-cancelado::before { background: var(--piedra); }
.estado-cancelado .trabajo-titulo { text-decoration: line-through; color: var(--piedra); }
.estado-hecho { background: #f3f6ec; }
.trabajo-cabeza { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.trabajo-cuando { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--tinta-2); }
.trabajo-titulo { font-size: 1.2rem; margin: 0 0 4px; }
.trabajo-titulo a { color: var(--tinta); text-decoration: none; }
.trabajo-titulo span { font-family: var(--fuente-texto); font-weight: 500; font-size: 1rem; color: var(--tinta-2); }
.trabajo-dato { margin: 0; color: var(--tinta-2); font-size: .95rem; }
.trabajo-notas { margin: 6px 0 0; padding: 8px 10px; background: var(--papel); border-radius: var(--radio-chico); font-size: .92rem; }
.trabajo-acciones { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.trabajo-acciones form { margin: 0; }
.trabajo-estado { font-weight: 700; color: var(--pasto); }
.estado-cancelado .trabajo-estado { color: var(--piedra); }

/* ——— Vacíos y varios ——— */
.vacio { text-align: center; padding: 32px 16px; }
.vacio h2 { margin-bottom: 8px; }
.vacio p { color: var(--tinta-2); margin: 0 0 16px; }
.zona-peligro { text-align: center; margin: 8px 0 24px; }
.aviso-tarjeta { border-color: var(--ocre); background: var(--ocre-claro); display: grid; gap: 10px; }
.pie { text-align: center; color: var(--piedra); font-size: .85rem; }

/* ——— Pantalla de ingreso ——— */
.pagina-entrada { padding-bottom: 0; min-height: 100vh; background-color: var(--monte); background-image: radial-gradient(rgba(245, 241, 230, .06) 1px, transparent 1px); }
.entrada { max-width: 420px; margin: 0 auto; padding: 12vh 16px 40px; }
.entrada-marca { font-family: var(--fuente-titulo); font-size: 2.4rem; font-weight: 700; color: var(--papel); margin: 0 0 24px; text-align: center; }
.entrada-marca span { color: var(--ocre); font-style: italic; font-weight: 500; }
.entrada .tarjeta { box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6); }

@media (max-width: 380px) {
  .fila { grid-template-columns: 1fr; }
  .campo-con-boton { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
