/* SafetyBook - estilos */
:root {
    --azul: #0f4c81;
    --azul-oscuro: #0a3a63;
    --azul-claro: #e8f1f9;
    --verde: #1f9d55;
    --verde-claro: #e6f6ec;
    --rojo: #c53030;
    --rojo-claro: #fdecec;
    --ambar: #b7791f;
    --ambar-claro: #fdf6e3;
    --gris-900: #1a202c;
    --gris-600: #4a5568;
    --gris-400: #a0aec0;
    --gris-200: #e2e8f0;
    --gris-100: #f7fafc;
    --radio: 10px;
    --sombra: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--gris-100);
    color: var(--gris-900);
    font-size: 15px;
    line-height: 1.5;
}

h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .6rem; }
a { color: var(--azul); }

/* ---------- Barra superior ---------- */
.topbar { background: var(--azul); color: #fff; box-shadow: var(--sombra); }
.topbar-inner {
    max-width: 1080px; margin: 0 auto; padding: .55rem 1rem;
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.marca { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.marca-icono { margin-right: .15rem; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a {
    color: #dbe9f7; text-decoration: none; padding: .35rem .65rem;
    border-radius: 6px; font-size: .92rem;
}
.nav a:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.sesion { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.sesion-nombre { font-size: .85rem; opacity: .9; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.5); }

/* ---------- Contenedor ---------- */
.contenedor { max-width: 1080px; margin: 1.2rem auto 3rem; padding: 0 1rem; }
.pie { text-align: center; color: var(--gris-400); font-size: .8rem; padding: 1rem 0 4.5rem; }

/* ---------- Tarjetas ---------- */
.tarjeta {
    background: #fff; border: 1px solid var(--gris-200); border-radius: var(--radio);
    padding: 1.2rem 1.4rem; box-shadow: var(--sombra); margin-bottom: 1rem;
}
.centro-texto { text-align: center; }

.grid-zonas { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.zona-card {
    background: #fff; border: 1px solid var(--gris-200); border-radius: var(--radio);
    padding: 1.1rem 1.2rem; box-shadow: var(--sombra);
    display: flex; flex-direction: column; gap: .4rem;
}
.zona-card h2 { margin: 0; font-size: 1.05rem; }
.zona-desc { color: var(--gris-600); font-size: .88rem; flex: 1; }
.zona-meta { font-size: .85rem; color: var(--gris-600); }
.zona-precio { font-weight: 700; color: var(--verde); }

/* ---------- Botones ---------- */
.btn {
    display: inline-block; border: 0; border-radius: 7px; cursor: pointer;
    padding: .5rem .95rem; font-size: .92rem; text-decoration: none; text-align: center;
    font-family: inherit; line-height: 1.3;
}
.btn-primario { background: var(--azul); color: #fff; }
.btn-primario:hover { background: var(--azul-oscuro); }
.btn-verde { background: var(--verde); color: #fff; }
.btn-peligro { background: var(--rojo); color: #fff; }
.btn-borde { background: transparent; border: 1px solid rgba(255,255,255,.6); color: #fff; }
.btn-borde-oscuro { background: #fff; border: 1px solid var(--gris-200); color: var(--gris-900); }
.btn-chico { padding: .28rem .6rem; font-size: .8rem; }
.btn-bloque { display: block; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Formularios ---------- */
.formulario label { display: block; margin-bottom: .8rem; font-size: .88rem; font-weight: 600; color: var(--gris-600); }
.formulario input[type=text], .formulario input[type=password], .formulario input[type=email],
.formulario input[type=number], .formulario input[type=date], .formulario input[type=time],
.formulario input[type=tel], .formulario input[type=file], .formulario select, .formulario textarea {
    display: block; width: 100%; margin-top: .25rem; padding: .5rem .65rem;
    border: 1px solid var(--gris-200); border-radius: 7px; font-size: .95rem;
    font-family: inherit; background: #fff; color: var(--gris-900);
}
.formulario input:focus, .formulario select:focus, .formulario textarea:focus {
    outline: 2px solid var(--azul); outline-offset: 0; border-color: var(--azul);
}
.formulario .fila { display: flex; gap: .8rem; flex-wrap: wrap; }
.formulario .fila > label { flex: 1; min-width: 140px; }
.check { display: flex !important; align-items: center; gap: .45rem; font-weight: 600; }
.check input { width: auto !important; margin: 0 !important; }
.ayuda { font-size: .78rem; color: var(--gris-400); font-weight: 400; margin-top: .15rem; }

/* ---------- Avisos ---------- */
.aviso { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .92rem; }
.aviso-ok { background: var(--verde-claro); color: #17603a; border: 1px solid #b7e4c7; }
.aviso-error { background: var(--rojo-claro); color: #822727; border: 1px solid #f5b5b5; }

/* ---------- Tablas ---------- */
.tabla-scroll { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.tabla th { background: var(--azul-claro); color: var(--azul-oscuro); text-align: left; padding: .55rem .7rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.tabla td { padding: .55rem .7rem; border-top: 1px solid var(--gris-200); font-size: .9rem; vertical-align: middle; }
.tabla tr:hover td { background: var(--gris-100); }
.acciones-celda { display: flex; gap: .35rem; flex-wrap: wrap; }
.acciones-celda form { margin: 0; }

/* ---------- Insignias de estado ---------- */
.insignia { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.insignia-confirmada { background: var(--verde-claro); color: #17603a; }
.insignia-pendiente_pago { background: var(--ambar-claro); color: var(--ambar); }
.insignia-cancelada { background: var(--gris-200); color: var(--gris-600); }
.insignia-vencida { background: var(--rojo-claro); color: var(--rojo); }
.insignia-si { background: var(--verde-claro); color: #17603a; }
.insignia-no { background: var(--rojo-claro); color: var(--rojo); }

/* ---------- Slots ---------- */
.selector-fecha { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.grid-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.slot {
    border: 1px solid var(--gris-200); border-radius: 8px; background: #fff;
    padding: .6rem .7rem; font-size: .85rem; text-align: center;
}
.slot-hora { font-weight: 700; font-size: .95rem; }
.slot-cupo { color: var(--gris-600); font-size: .78rem; margin: .2rem 0 .45rem; }
.slot-lleno { opacity: .45; background: var(--gris-100); }
.slot form { margin: 0; }

/* ---------- Login ---------- */
.login-fondo {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(150deg, var(--azul-oscuro) 0%, var(--azul) 55%, #2a6ea8 100%);
    padding: 1rem;
}
.login-caja { background: #fff; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.25); padding: 2rem; width: 100%; max-width: 380px; }
.login-marca { text-align: center; margin-bottom: 1.2rem; }
.login-logo { font-size: 2.6rem; }
.login-marca h1 { margin: .2rem 0 .1rem; color: var(--azul); }
.login-marca p { margin: 0; color: var(--gris-600); font-size: .88rem; }
.login-pie { text-align: center; color: var(--gris-400); font-size: .78rem; margin: 1.2rem 0 0; }

/* ---------- Botones flotantes de WhatsApp ---------- */
.wa-flotantes { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 50; }
.wa-btn {
    background: #25d366; color: #fff; text-decoration: none; font-weight: 700;
    padding: .55rem .9rem; border-radius: 999px; font-size: .85rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
.wa-btn:hover { filter: brightness(1.06); }
.wa-allsafe { background: var(--azul); }

/* ---------- Bot / QR ---------- */
.qr-marco { text-align: center; padding: 1rem; }
.qr-marco img { width: 260px; height: 260px; image-rendering: pixelated; border: 8px solid #fff; box-shadow: var(--sombra); }
.punto { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .35rem; }
.punto-verde { background: var(--verde); }
.punto-rojo { background: var(--rojo); }
.punto-ambar { background: var(--ambar); }

/* ---------- Utilidades ---------- */
.encabezado-seccion { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.encabezado-seccion h1 { margin: 0; }
.texto-suave { color: var(--gris-600); font-size: .88rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
.filtros { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.filtros label { font-size: .8rem; font-weight: 600; color: var(--gris-600); }
.filtros select, .filtros input { display: block; margin-top: .2rem; padding: .4rem .55rem; border: 1px solid var(--gris-200); border-radius: 7px; font-family: inherit; font-size: .88rem; }
.foto-perfil { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--gris-200); }

@media (max-width: 640px) {
    .topbar-inner { gap: .5rem; }
    .sesion-nombre { display: none; }
    .contenedor { margin-top: .8rem; }
    .tarjeta { padding: 1rem; }
}
