* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #f2f4f7;
    color: #1f2937;
}

body.fondo-edificio {
    position: relative;
}

body.fondo-edificio::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url('../img/fondo-edificio.svg') center 30% / cover no-repeat;
    filter: blur(5.25px) saturate(0.9);
    transform: scale(0.81);
    opacity: 0.55;
    z-index: 0;
}

body.fondo-edificio::after {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(242,244,247,0.35) 0%, rgba(242,244,247,0.85) 45%, #f2f4f7 75%);
    z-index: 0;
}

body.fondo-edificio > header.app-header,
body.fondo-edificio > main {
    position: relative;
    z-index: 1;
}

header.app-header {
    background: #1f2937;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header.app-header a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}

header.app-header nav a {
    color: #d1d5db;
    font-weight: normal;
    font-size: 0.9rem;
    margin-left: 16px;
}

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

h1, h2, h3 { margin-top: 0; }

.planta-titulo {
    margin: 28px 0 12px;
    font-size: 1.1rem;
    color: #374151;
    border-bottom: 2px solid #d1d5db;
    padding-bottom: 4px;
}

.grid-habitaciones {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.tarjeta-habitacion {
    display: block;
    border-radius: 10px;
    padding: 12px;
    text-decoration: none;
    color: #fff;
    position: relative;
    min-height: 92px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.1s ease;
}

.tarjeta-habitacion:hover {
    transform: translateY(-2px);
}

.tarjeta-habitacion.libre {
    background: #2563eb;
}

.tarjeta-habitacion.ocupada {
    background: #dc2626;
}

.tarjeta-habitacion .numero {
    font-size: 1.3rem;
    font-weight: 700;
}

.tarjeta-habitacion .estado {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.9;
}

.tarjeta-habitacion .inquilino {
    font-size: 0.8rem;
    margin-top: 6px;
    line-height: 1.3;
}

.tarjeta-habitacion .accesible-icono {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.1rem;
}

.leyenda {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #374151;
}

.leyenda .muestra {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}

.leyenda .muestra.libre { background: #2563eb; }
.leyenda .muestra.ocupada { background: #dc2626; }

.panel {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.badge-accesible {
    display: inline-block;
    background: #0ea5e9;
    color: #fff;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.75rem;
    margin-left: 8px;
}

.datos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px 20px;
    margin: 12px 0;
}

.dato label {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
}

.dato span {
    font-size: 0.95rem;
}

.acciones {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.btn {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-primario { background: #2563eb; color: #fff; }
.btn-peligro { background: #dc2626; color: #fff; }
.btn-secundario { background: #e5e7eb; color: #1f2937; }
.btn-exito { background: #16a34a; color: #fff; }

table.historial {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

table.historial th, table.historial td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
}

table.historial th {
    background: #f9fafb;
    color: #374151;
}

table.historial .fila-acciones a {
    margin-right: 10px;
    font-size: 0.85rem;
}

form.formulario .campo {
    margin-bottom: 14px;
}

form.formulario label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

form.formulario input[type=text],
form.formulario input[type=date],
form.formulario input[type=tel],
form.formulario input[type=password],
form.formulario select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
}

form.formulario .fila-dos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

form.formulario fieldset {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 14px;
}

.login-box {
    max-width: 340px;
    margin: 80px auto;
    background: #fff;
    padding: 28px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.login-box h1 {
    font-size: 1.2rem;
    text-align: center;
}

.error-msg {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 0.9rem;
}

.no-imprimir {
    text-align: center;
    margin: 20px auto;
}

.hoja {
    width: 210mm;
    min-height: 297mm;
    margin: 20px auto 40px;
    background: #fff;
    box-shadow: 0 2px 16px rgba(0,0,0,0.18);
    padding: 20mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    font-family: Georgia, 'Times New Roman', serif;
    color: #1f2937;
}

.hoja-cabecera {
    text-align: center;
    border-bottom: 3px solid #1f2937;
    padding-bottom: 14px;
}

.hoja-marca {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.hoja-subtitulo {
    font-size: 1rem;
    color: #6b7280;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hoja-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #6b7280;
    margin: 14px 0 30px;
}

.hoja-seccion {
    margin-bottom: 30px;
}

.hoja-seccion h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #1f2937;
    border-left: 4px solid #2563eb;
    padding-left: 10px;
    margin-bottom: 16px;
}

.hoja .datos-grid {
    row-gap: 16px;
}

.hoja .dato label {
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.hoja-firma {
    margin-top: auto;
    padding-top: 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.firma-fecha {
    font-size: 0.95rem;
    color: #374151;
}

.firma-caja {
    width: 280px;
    text-align: center;
}

.firma-linea {
    border-bottom: 1px solid #1f2937;
    height: 60px;
}

.firma-etiqueta {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #374151;
}

@media print {
    .no-imprimir { display: none; }
    body { background: #fff; }
    .hoja {
        box-shadow: none;
        margin: 0;
        width: auto;
        min-height: auto;
        padding: 0;
    }
    @page {
        size: A4;
        margin: 18mm;
    }
}
