/* ============================================================
   Brozziano — hoja de estilos unificada
   Tokens de diseño + componentes. Una sola definición por
   componente (antes había duplicados en conflicto).
   ============================================================ */

:root {
    --bordo: #800000;
    --bordo-dark: #5e0000;
    --bordo-light: #a31515;
    --bordo-soft: #fdf1ef;
    --bordo-border: rgba(128, 0, 0, 0.16);

    --bg: #f6f4f2;
    --surface: #ffffff;
    --line: #e7e0dc;
    --text: #221c19;
    --text-muted: #70645e;

    --ok: #1a7f37;
    --ok-soft: #e6f4ea;
    --bad: #b00000;
    --bad-soft: #fdecea;
    --pending: #6b6560;
    --pending-soft: #ece8e5;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 3px rgba(34, 28, 25, 0.08);
    --shadow-md: 0 8px 24px rgba(34, 28, 25, 0.12);

    --footer-h: 76px;
}

* {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    /* evita scroll horizontal por elementos fuera de pantalla (sidebar, sombras) */
    overflow-x: hidden;
}

img {
    max-width: 100%;
}

/* iOS Safari: quita estilos nativos de inputs de texto (sombras internas),
   sin tocar checkbox/radio/time que usan el render nativo */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea {
    -webkit-appearance: none;
    appearance: none;
}

/* ---------- Header ---------- */

.container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5%;
    background: linear-gradient(120deg, var(--bordo-dark), var(--bordo));
    color: #ffffff;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.container img {
    height: 50px;
    width: auto;
    cursor: pointer;
}

.menu img {
    height: 34px;
}

/* ---------- Encabezado de página ---------- */

.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
    padding: 18px 20px 6px;
}

.page-header h1 {
    flex: 1;
    text-align: center;
    font-size: 1.45rem;
    color: var(--text);
    /* compensa el ancho del botón volver para centrar de verdad */
    margin-right: 40px;
}

.back-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    font-size: 20px;
    line-height: 1;
    color: var(--bordo);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.back-button:hover {
    background: var(--bordo-soft);
    transform: translateX(-1px);
}

/* ---------- Buscador ---------- */

.searchBar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 20px;
}

.searchBar input {
    width: 100%;
    max-width: 480px;
    padding: 12px 18px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    font-size: 16px;
    background: var(--surface);
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.searchBar input:focus {
    border-color: var(--bordo);
    box-shadow: 0 0 0 3px var(--bordo-border);
}

/* ---------- Contenedores de contenido ---------- */

.content {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

#localGroup,
#preguntaGroup {
    max-width: 900px;
    margin: 0 auto;
    padding: 4px 20px calc(var(--footer-h) + 30px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#localGroup {
    padding-top: 8px;
}

.detail-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 20px calc(var(--footer-h) + 30px + env(safe-area-inset-bottom, 0px));
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 10px;
}

/* ---------- Títulos de sección del checklist ---------- */

.seccion-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bordo);
    margin: 14px 4px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--bordo-border);
}

.seccion-title:first-of-type {
    margin-top: 4px;
}

/* ---------- Barra de progreso del checklist ---------- */

.progress-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.progress-info .progress-count {
    color: var(--bordo);
}

.progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--bg);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--bordo), var(--bordo-light));
    transition: width 0.35s ease;
}

/* ---------- Cards de locales (index) ---------- */

.card-local {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--bordo);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card-local:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card-local-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.card-local-info a {
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
}

.card-local-info a:hover {
    color: var(--bordo);
}

.card-local-dir {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---------- Cards de preguntas (checklist) ---------- */

.card-pregunta {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

.card-pregunta:hover {
    box-shadow: var(--shadow-md);
}

.card-pregunta span {
    flex: 1;
    font-size: 15px;
}

.card-pregunta.completada {
    background: var(--bordo-soft);
    border-color: var(--bordo-border);
}

.card-pregunta.completada span {
    color: var(--text-muted);
}

.card-pregunta input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--bordo);
    cursor: pointer;
    flex-shrink: 0;
}

.question-action {
    background: linear-gradient(135deg, var(--bordo), var(--bordo-light));
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(128, 0, 0, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.question-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(128, 0, 0, 0.2);
}

/* ---------- Cards de checklists (vista admin) ---------- */

.card-checklist {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

.card-checklist strong {
    color: var(--text);
}

.detail-btn {
    border: none;
    min-width: 120px;
    padding: 10px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--bordo), var(--bordo-light));
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.detail-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(128, 0, 0, 0.2);
}

/* ---------- Card genérica ---------- */

.card {
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px 24px;
    margin-bottom: 16px;
}

.card h2 {
    margin-bottom: 16px;
    color: var(--bordo);
    font-size: 1.2rem;
}

.card h3 {
    color: var(--text);
    font-size: 1.05rem;
}

.card p {
    margin: 6px 0;
    color: var(--text);
    font-size: 15px;
}

.card p strong {
    color: var(--text-muted);
    font-weight: 600;
}

/* Textos largos (observaciones, nombres, URLs) nunca desbordan la card */
.card,
.card-pregunta span,
.card-local-info,
.card-checklist > div,
.locale-row-details,
.usuario-card > div {
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.status-badge.ok {
    background: var(--ok-soft);
    color: var(--ok);
}

.status-badge.bad {
    background: var(--bad-soft);
    color: var(--bad);
}

.status-badge.pending {
    background: var(--pending-soft);
    color: var(--pending);
}

.card.card-pending {
    opacity: 0.85;
}

/* ---------- Botones ---------- */

.save-btn {
    background-color: var(--bordo);
    border: none;
    color: #ffffff;
    padding: 12px 22px;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.save-btn:hover {
    background-color: var(--bordo-light);
    transform: translateY(-1px);
}

.save-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

.save-btn.primary {
    width: 100%;
    max-width: 320px;
}

.save-btn.square {
    min-width: 140px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.secondary {
    min-width: 110px;
    padding: 10px 16px;
    border: 1.5px solid var(--bordo);
    background: var(--surface);
    color: var(--bordo);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary:hover {
    background: var(--bordo);
    color: #ffffff;
}

#uploadBtn {
    background-color: var(--bordo);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#uploadBtn:hover {
    background-color: var(--bordo-light);
}

#deleteBtn {
    background: var(--surface);
    border: 1.5px solid var(--bordo);
    color: var(--bordo);
    padding: 0 14px;
    height: 46px;
    border-radius: var(--radius-sm);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#deleteBtn:hover {
    background-color: var(--bordo);
    color: #ffffff;
}

/* ---------- Footer fijo de acciones ---------- */

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: var(--footer-h);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    border-top: 1px solid var(--line);
    /* safe-area: los iPhone con notch/barra de gestos no tapan los botones */
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    z-index: 20;
}

/* ---------- Formularios de auth ---------- */

.login-container, .signup-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 72vh;
    padding: 20px;
}

.login-container h2, .signup-container h2 {
    margin-bottom: 22px;
    color: var(--bordo);
    font-size: 1.6rem;
}

.login-container form, .signup-container form {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 360px;
    background-color: var(--surface);
    padding: 28px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
}

.login-container input, .signup-container input {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-container input:focus, .signup-container input:focus {
    border-color: var(--bordo);
    box-shadow: 0 0 0 3px var(--bordo-border);
}

.login-container button, .signup-container button {
    padding: 12px;
    background-color: var(--bordo);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.login-container button:hover, .signup-container button:hover {
    background-color: var(--bordo-light);
}

.login-container p, .signup-container p {
    margin-top: 15px;
    font-size: 14px;
    color: var(--text-muted);
}

.login-container a, .signup-container a {
    color: var(--bordo);
    font-weight: 600;
    text-decoration: none;
}

.login-container a:hover, .signup-container a:hover {
    text-decoration: underline;
}

/* ---------- Recuperar contraseña ---------- */

.forgot-password-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 34px 24px;
}

.forgot-password-page h1 {
    margin-bottom: 28px;
    color: var(--bordo);
    font-size: 2rem;
    text-align: center;
}

.forgot-password-page .auth-form {
    width: 100%;
    max-width: 440px;
    background-color: var(--surface);
    padding: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.forgot-password-page .auth-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 17px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.forgot-password-page .auth-form input:focus {
    border-color: var(--bordo);
    box-shadow: 0 0 0 3px var(--bordo-border);
}

.forgot-password-page .auth-form button {
    width: 100%;
    padding: 14px 18px;
    background-color: var(--bordo);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.forgot-password-page .auth-form button:hover {
    background-color: var(--bordo-light);
}

.forgot-password-page p {
    margin-top: 18px;
    color: var(--text-muted);
    font-size: 14px;
}

.forgot-password-page a {
    color: var(--bordo);
    text-decoration: none;
    font-weight: 600;
}

.forgot-password-page a:hover {
    text-decoration: underline;
}

/* ---------- Menú lateral admin ---------- */

.admin-menu {
    position: fixed;
    top: 0;
    right: -260px;
    width: 260px;
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.18);
    padding: 20px;
    transition: right 0.3s ease;
    z-index: 30;
    display: flex;
    flex-direction: column;
}

.admin-menu.open {
    right: 0;
}

.admin-menu .close-btn {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 26px;
    color: var(--bordo);
    cursor: pointer;
    margin-bottom: 12px;
}

.admin-menu ul {
    list-style: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-menu li a {
    display: block;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--bordo);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s ease;
}

.admin-menu li a:hover {
    background: var(--bordo-soft);
}

.admin-menu li.logout-item {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

/* ---------- Formularios genéricos ---------- */

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form input,
.auth-form select,
.auth-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.auth-form select {
    background: var(--surface);
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
    border-color: var(--bordo);
    box-shadow: 0 0 0 3px var(--bordo-border);
}

.auth-form label {
    font-size: 14px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form .check-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.auth-form button {
    width: fit-content;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.info-message {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 15px;
}

.error {
    color: var(--bad);
    background: var(--bad-soft);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}

/* ---------- Listas de gestión (usuarios / locales) ---------- */

.list {
    display: grid;
    gap: 12px;
}

.locale-row,
.usuario-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.locale-row-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.locale-name,
.usuario-card strong {
    font-size: 16px;
    color: var(--text);
}

.locale-address,
.usuario-card span {
    font-size: 14px;
    color: var(--text-muted);
}

.locale-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.usuario-card .save-btn {
    font-size: 14px;
    padding: 9px 14px;
    min-width: 140px;
}

/* ---------- Modales ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 10, 8, 0.5);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 100;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 26px;
    width: min(520px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--line);
    overflow: hidden;
}

.modal-card.wide {
    width: min(680px, 100%);
}

.modal-card h2 {
    margin-bottom: 18px;
    color: var(--bordo);
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    overflow-y: auto;
    min-height: 0;
    flex: 1 1 auto;
}

.modal-field label {
    font-size: 14px;
    color: var(--text-muted);
}

.modal-field input,
.modal-field select,
.modal-field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 16px;
    outline: none;
    font-family: inherit;
    background: var(--surface);
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
    border-color: var(--bordo);
}

.modal-field hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 18px 0;
}

.admin-subrow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bordo-soft);
    border: 1px solid var(--bordo-border);
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.admin-subrow-info {
    flex: 1 1 200px;
    min-width: 0;
    overflow-wrap: break-word;
}

.admin-subrow-info .admin-subrow-meta {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
}

.admin-subrow-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-subrow-actions button {
    padding: 6px 12px;
    font-size: 13px;
    min-width: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

#permissionsList {
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
}

#permissionsList label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bordo-soft);
    border: 1px solid var(--bordo-border);
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
}

#permissionsList label:hover {
    background: #f8e3e0;
}

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

.modal-close {
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* ---------- Visor de imágenes ---------- */

.image-viewer-content {
    width: min(90vw, 900px);
    max-height: 90vh;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    overflow: hidden;
}

.image-viewer-content img {
    max-width: 100%;
    max-height: 78vh;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

/* ---------- Detalle de pregunta (InfoCat) ---------- */

.info-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 20px calc(var(--footer-h) + 30px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.textarea-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.textarea-row label,
.photo-row > label {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.textarea-row textarea {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 16px;
    color: var(--text);
    min-height: 140px;
    resize: vertical;
    outline: none;
    background: var(--surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.textarea-row textarea:focus {
    border-color: var(--bordo);
    box-shadow: 0 0 0 3px var(--bordo-border);
}

/* ---------- Campos dinámicos ---------- */

#camposContainer {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.campo-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    background-color: var(--surface);
    box-shadow: var(--shadow-sm);
}

.campo-row[hidden] {
    display: none;
}

.campo-row.campo-row-invalido {
    border-color: var(--bad);
    box-shadow: 0 0 0 1px var(--bad);
}

.campo-row > label {
    font-weight: 700;
    color: var(--text);
    font-size: 15px;
}

.campo-row select,
.campo-row input[type="number"],
.campo-row input[type="text"],
.campo-row input[type="time"] {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    font-size: 16px;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.campo-row select:focus,
.campo-row input:focus {
    border-color: var(--bordo);
    box-shadow: 0 0 0 3px var(--bordo-border);
}

.campo-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.campo-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: normal;
    color: var(--text);
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.campo-options label:hover {
    background: var(--bordo-soft);
    border-color: var(--bordo-border);
}

.campo-options input[type="radio"],
.campo-options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--bordo);
    flex-shrink: 0;
}

.campo-error {
    color: var(--bad);
    font-size: 13px;
    margin: 0;
}

.campo-hijos {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-left: 18px;
    padding-left: 14px;
    border-left: 3px solid var(--bordo-border);
}

.form-error {
    color: var(--bad);
    background: var(--bad-soft);
    border: 1px solid #f5c2c0;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
}

.form-error[hidden] {
    display: none;
}

/* ---------- Fotos ---------- */

.photo-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#photoModalOpenButton {
    border: 1.5px dashed var(--bordo);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--bordo);
    padding: 11px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#photoModalOpenButton:hover {
    background-color: var(--bordo);
    color: #ffffff;
}

.photo-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    align-items: start;
}

.photo-preview p {
    color: var(--text-muted);
    font-size: 14px;
}

.photo-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: var(--bg);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.photo-thumb button {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

/* ---------- Sidebar: el contenido queda centrado en el espacio restante ---------- */

.searchBar,
#localGroup {
    transition: transform 0.3s ease;
}

body.sidebar-open .searchBar,
body.sidebar-open #localGroup {
    /* la mitad del ancho de la sidebar (260px) para re-centrar */
    transform: translateX(-130px);
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    /* en mobile la sidebar se superpone, el contenido no se mueve */
    body.sidebar-open .searchBar,
    body.sidebar-open #localGroup {
        transform: none;
    }

    .admin-menu {
        width: min(320px, 85vw);
        right: -100%;
    }

    .admin-menu.open {
        right: 0;
    }

    .container {
        padding: 10px 14px;
    }

    .page-header h1 {
        font-size: 1.2rem;
    }

    .info-row {
        flex-direction: column;
    }

    .card {
        padding: 18px;
    }

    .locale-row,
    .usuario-card {
        flex-direction: column;
        align-items: stretch;
    }

    .locale-actions,
    .usuario-card > div:last-child {
        justify-content: stretch;
    }
}

@media (max-width: 480px) {
    /* menos padding lateral: más ancho útil en pantallas chicas */
    #localGroup,
    #preguntaGroup,
    .detail-content,
    .info-content,
    .content {
        padding-left: 12px;
        padding-right: 12px;
    }

    .page-header {
        padding: 14px 12px 4px;
    }

    .page-header h1 {
        font-size: 1.1rem;
        margin-right: 34px;
    }

    .back-button {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .searchBar {
        padding: 12px;
    }

    .card {
        padding: 16px 14px;
    }

    .card-pregunta {
        padding: 12px;
        gap: 10px;
    }

    .card-local {
        padding: 14px;
    }

    .question-action {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 16px;
    }

    .save-btn.primary {
        max-width: none;
        flex: 1;
    }

    #uploadBtn {
        flex: 1;
        padding: 12px 10px;
    }

    .card-checklist {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .detail-btn {
        width: 100%;
    }

    .card-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .campo-hijos {
        margin-left: 8px;
        padding-left: 10px;
    }

    .modal-overlay {
        padding: 12px;
    }

    .modal-card {
        padding: 20px 16px;
    }

    .photo-preview {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    }
}
