/* Portal del cliente: borrador de la PAC. Mismos verdes que AGRO. Sin librerias externas. */
:root {
    color-scheme: light;
    --verde-900: #123c2b;
    --verde-700: #196242;
    --verde-500: #2f8a61;
    --verde-100: #eaf5ee;
    --tinta: #23312b;
    --suave: #5d6b64;
    --linea: #dce7e0;
    --fondo: #f5f8f6;
    --blanco: #fff;
    --cambio: #8a5a00;
    --cambio-fondo: #fff6dd;
    --baja: #a12d2d;
    --baja-fondo: #fdeceb;
    --radio: 10px;
    --columnas: 2.4rem 12.5rem minmax(6rem, 1fr) 4.4rem minmax(9rem, 1.5fr) minmax(9rem, 1.5fr) minmax(8rem, 1.1fr) 6.5rem 5.4rem 5.2rem;
    --ancho: 1680px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--fondo);
    color: var(--tinta);
    font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 .5rem; color: var(--verde-900); }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; color: var(--verde-900); }
main { max-width: var(--ancho); margin: 0 auto; padding: 1rem 1rem 6.5rem; }
.suave { color: var(--suave); }
.pequeno { font-size: .875rem; }
.centro { text-align: center; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Cabecera */
.cabecera { background: var(--verde-700); color: var(--blanco); }
.cabecera-dentro { max-width: var(--ancho); margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.marca { display: flex; flex-direction: column; line-height: 1.2; }
.marca-caja { font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; opacity: .85; }
.marca-titulo { font-size: 1.15rem; font-weight: 650; }
.cabecera-derecha { display: flex; align-items: center; gap: .75rem; }
.cliente { font-size: .875rem; opacity: .9; white-space: nowrap; }

/* Botones y campos */
.boton {
    font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid transparent;
    padding: .55rem 1rem; min-height: 2.75rem; cursor: pointer;
}
.boton:disabled { opacity: .6; cursor: default; }
.boton-principal { background: var(--verde-700); color: var(--blanco); }
.boton-principal:hover:not(:disabled) { background: var(--verde-900); }
.boton-claro { background: var(--blanco); color: var(--verde-900); border-color: var(--linea); }
.boton-claro:hover:not(:disabled) { background: var(--verde-100); }
.boton-ancho { width: 100%; }
.boton-pequeno { min-height: 2.25rem; padding: .3rem .75rem; font-size: .9rem; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }

input, select {
    font: inherit; color: inherit; background: var(--blanco);
    border: 1px solid #b9c9c0; border-radius: 8px; padding: .55rem .7rem; min-height: 2.75rem; width: 100%;
}
.campo { margin: 1rem 0; }
.campo label { display: block; font-weight: 600; margin-bottom: .3rem; }
.ayuda { display: block; font-size: .85rem; color: var(--suave); margin-top: .3rem; }
.error { color: var(--baja); background: var(--baja-fondo); border-radius: 8px; padding: .6rem .8rem; margin: 1rem 0; }

.tarjeta { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio); }

/* Entrar */
.entrar { display: flex; justify-content: center; padding-top: 4vh; }
.entrar-tarjeta { width: 100%; max-width: 27rem; padding: 1.5rem; box-shadow: 0 6px 24px rgba(18, 60, 43, .08); }
#entradaClave { letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }

/* Inicio */
.inicio { max-width: 60rem; margin: 0 auto; }
.servicio { padding: 1.1rem 1.2rem; margin: 1rem 0; box-shadow: 0 4px 18px rgba(18, 60, 43, .06); }
.servicio-cabecera { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .8rem; }
.servicio-cabecera h2 { margin: 0; font-size: 1.3rem; }
.chip-situacion { background: var(--verde-100); color: var(--verde-900); }
.pendiente { background: var(--cambio-fondo); border: 1px solid #e3c56a; border-radius: var(--radio); padding: .9rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pendiente.al-dia { background: var(--verde-100); border-color: #bfdccb; }
.pendiente-titulo { display: block; font-weight: 700; font-size: 1.1rem; color: var(--verde-900); }
.pendiente-texto { color: var(--suave); font-size: .92rem; }
.historial-titulo { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); margin: 1.2rem 0 .5rem; }
.historial { list-style: none; margin: 0; padding: 0 0 0 .4rem; }
.paso { position: relative; padding: 0 0 1rem 1.6rem; border-left: 2px solid var(--linea); display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.paso:last-child { border-left-color: transparent; padding-bottom: 0; }
.paso::before { content: ""; position: absolute; left: -8px; top: .2rem; width: 14px; height: 14px; border-radius: 50%; background: var(--blanco); border: 3px solid var(--verde-500); }
.paso.abierto::before { border-color: #d19a00; background: #f2b705; }
.paso-titulo { display: block; font-weight: 650; }
.paso-detalle { display: block; color: var(--suave); font-size: .9rem; }

/* Borrador */
.migas { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-bottom: .9rem; }
.migas h1 { margin: 0; font-size: 1.25rem; }

/* Avisos y pasos */
.aviso { border-radius: var(--radio); padding: .9rem 1rem; margin-bottom: 1rem; }
.aviso-hecho { background: var(--verde-100); border: 1px solid #bfdccb; color: var(--verde-900); }
.pasos { padding: .8rem 1rem; margin-bottom: 1rem; }
.pasos summary { font-weight: 650; color: var(--verde-900); cursor: pointer; }
.pasos ol { margin: .7rem 0 .2rem; padding-left: 1.3rem; }
.pasos li { margin-bottom: .35rem; }

/* Resumen */
.resumen { display: flex; gap: .6rem; margin-bottom: 1rem; }
.dato { flex: 1; background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio); padding: .55rem .8rem; display: flex; align-items: baseline; gap: .4rem; }
.dato-numero { font-size: 1.45rem; font-weight: 700; color: var(--verde-900); font-variant-numeric: tabular-nums; }
.dato-texto { color: var(--suave); font-size: .9rem; }
.dato-cambio .dato-numero { color: var(--cambio); }
.dato-baja .dato-numero { color: var(--baja); }

/* Filtros */
.filtros { display: flex; gap: .6rem; margin-bottom: .8rem; }
.filtros select { width: auto; flex: 0 0 auto; }

/* Recintos: en el movil, una tarjeta por recinto */
.fila.fila-cabecera { display: none; }
.fila {
    background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio);
    padding: .8rem .9rem; margin-bottom: .7rem;
    display: grid; grid-template-columns: 1fr auto; gap: .35rem .75rem; align-items: start;
}
.fila.cambiada { border-color: #e3c56a; }
.fila.baja { border-color: #e2b1ae; background: #fffafa; }
.c-num { display: none; }
.c-recinto { grid-column: 1; }
.c-estado { grid-column: 2; grid-row: 1; text-align: right; }
.c-paraje, .c-sup { grid-column: 1 / -1; color: var(--suave); font-size: .9rem; }
.c-valor, .c-acciones { grid-column: 1 / -1; }
.recinto-nombre { font-weight: 650; white-space: nowrap; }
.recinto-codigo { display: block; font-size: .8rem; color: var(--suave); }
.etiqueta { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); margin-top: .35rem; }
.en-linea .etiqueta { display: inline; margin-right: .3rem; }

.valor {
    font: inherit; color: inherit; text-align: left; width: 100%; min-height: 2.75rem;
    background: var(--fondo); border: 1px solid var(--linea); border-radius: 8px; padding: .45rem .65rem;
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
button.valor { cursor: pointer; }
button.valor:hover { border-color: var(--verde-500); background: var(--verde-100); }
button.valor::after { content: "▾"; color: var(--suave); }
.valor-texto { min-width: 0; }
.valor-codigo { color: var(--suave); font-size: .85em; }
.antes { display: block; font-size: .8rem; color: var(--suave); text-decoration: line-through; }
.fila.cambiada .valor.distinto { background: var(--cambio-fondo); border-color: #e3c56a; }
.fila.baja .valor-texto, .fila.baja .recinto-nombre { text-decoration: line-through; color: var(--suave); }

.chip { display: inline-block; font-size: .78rem; font-weight: 650; border-radius: 999px; padding: .12rem .6rem; white-space: nowrap; }
.chip-cambio { background: var(--cambio-fondo); color: var(--cambio); }
.chip-baja { background: var(--baja-fondo); color: var(--baja); }

.c-acciones { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .45rem; }
.accion {
    font: inherit; font-size: .9rem; font-weight: 600; color: var(--verde-900); text-decoration: none;
    background: var(--blanco); border: 1px solid var(--linea); border-radius: 8px;
    min-height: 2.5rem; padding: .35rem .7rem; display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
}
.accion:hover { background: var(--verde-100); }
.accion-baja { color: var(--baja); }
.accion svg { width: 1.05rem; height: 1.05rem; flex: none; }

/* Lista del campo con busqueda */
.lista {
    position: fixed; z-index: 50; max-height: 16rem; overflow-y: auto; margin: 0; padding: .25rem;
    background: var(--blanco); border: 1px solid #b9c9c0; border-radius: 8px; box-shadow: 0 8px 28px rgba(18, 60, 43, .18);
}
.opcion { padding: .55rem .7rem; border-radius: 6px; cursor: pointer; }
.opcion.activa { background: var(--verde-700); color: var(--blanco); }
.opcion.activa .valor-codigo { color: inherit; opacity: .8; }
.opcion.nada { color: var(--suave); cursor: default; }

/* Pie fijo */
.pie { position: fixed; left: 0; right: 0; bottom: 0; background: var(--blanco); border-top: 1px solid var(--linea); box-shadow: 0 -4px 18px rgba(18, 60, 43, .07); }
.pie-dentro { max-width: var(--ancho); margin: 0 auto; padding: .65rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.guardado { color: var(--suave); font-size: .9rem; }
.guardado.bien { color: var(--verde-700); }

/* Dialogo y mensajes */
.dialogo { border: 0; border-radius: 12px; padding: 1.3rem; max-width: 26rem; width: calc(100% - 2rem); box-shadow: 0 16px 48px rgba(0, 0, 0, .25); color: var(--tinta); }
.dialogo::backdrop { background: rgba(18, 60, 43, .45); }
.dialogo-botones { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.1rem; }
.mensaje { position: fixed; left: 50%; bottom: 5rem; transform: translateX(-50%); z-index: 60; background: var(--baja); color: var(--blanco); border-radius: 8px; padding: .65rem 1rem; max-width: calc(100% - 2rem); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }

/* En el ordenador, una tabla con edicion en la propia fila */
@media (min-width: 960px) {
    /* Letra algo mas pequena: caben mas recintos y mas columnas */
    .tabla { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; font-size: .875rem; }
    .fila, .fila.fila-cabecera {
        display: grid; grid-template-columns: var(--columnas); gap: 0 .6rem; align-items: center;
        border: 0; border-bottom: 1px solid var(--linea); border-radius: 0; margin: 0; padding: .12rem .75rem;
    }
    .fila.fila-cabecera { background: var(--verde-100); color: var(--verde-900); font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; padding: .55rem .75rem; position: sticky; top: 0; z-index: 5; }
    .fila > div { grid-column: auto; grid-row: auto; min-width: 0; }
    .fila:last-child { border-bottom: 0; }
    .fila.cambiada, .fila.baja { border-color: var(--linea); }
    .fila.baja { background: #fffafa; }
    .c-num { display: block; color: var(--suave); font-variant-numeric: tabular-nums; }
    .c-paraje, .c-sup { color: inherit; font-size: inherit; overflow: hidden; text-overflow: ellipsis; }
    .c-sup { text-align: right; font-variant-numeric: tabular-nums; }
    .c-estado { text-align: left; }
    .etiqueta { display: none !important; }
    .valor { min-height: 2rem; background: transparent; border-color: transparent; padding: .15rem .45rem; }
    button.valor::after { opacity: 0; }
    button.valor:hover::after, button.valor:focus-visible::after { opacity: 1; }
    .c-acciones { margin: 0; flex-wrap: nowrap; justify-content: flex-end; gap: .25rem; }
    .accion { min-height: 1.9rem; padding: .2rem .4rem; border-color: transparent; background: transparent; }
    .accion-texto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .c-valor input { min-height: 2rem; padding: .15rem .45rem; font-size: inherit; }
}
