:root {
    --vino: #8a162c;
    --vino-oscuro: #64101f;
    --vino-suave: #f8eef1;
    --oro: #b8956a;
    --crema: #f6f1f2;
    --papel: #ffffff;
    --tinta: #000;
    --linea: #eadfe2;
    --solo: #f8f3ea;
    --verde: #e5f6ea;
    --salir: #c4525c;
    --sombra: 0 10px 28px rgba(100, 16, 31, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--tinta);
    background: var(--crema);
}

body > * { position: relative; z-index: 1; }

body > .flores {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.flor {
    position: absolute;
    width: 210px;
    height: 210px;
    background: url("../img/flor.png") center / contain no-repeat;
    animation: girar-a-veces 18s ease-in-out infinite;
}

.flor.uno { top: -46px; left: -46px; }
.flor.dos { top: -46px; right: -46px; animation-duration: 23s; animation-delay: -7s; }
.flor.tres { bottom: -46px; left: -46px; animation-duration: 21s; animation-delay: -13s; }
.flor.cuatro { bottom: -46px; right: -46px; animation-duration: 16s; animation-delay: -4s; }

@keyframes girar-a-veces {
    0%, 68% { transform: rotate(0deg); }
    84% { transform: rotate(200deg); }
    96%, 100% { transform: rotate(360deg); }
}

body::after {
    content: "";
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    margin-top: auto;
    aspect-ratio: 8002 / 1256;
    max-height: 220px;
    flex-shrink: 0;
    background: #6d1933 url("../img/foter.png") center / cover no-repeat;
}

main { flex: 1 0 auto; }

a { color: #000; }

.menubar {
    display: flex;
    gap: 4px;
    margin: 16px 18px 0;
    padding: 6px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(138, 22, 44, .08);
    border-radius: 14px;
    box-shadow: var(--sombra);
    backdrop-filter: blur(10px);
    font-size: 14px;
}

.menu-item { position: relative; }

.menu-item > span,
.menu-item > a {
    display: block;
    padding: 8px 16px;
    color: var(--tinta);
    text-decoration: none;
    border-radius: 10px;
    cursor: pointer;
}

.menu-item:hover > span,
.menu-item:hover > a { background: var(--vino); color: #fff; }

.submenu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    min-width: 190px;
    background: #fff;
    border: 1px solid var(--linea);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(100, 16, 31, .14);
    padding: 6px;
}

.menu-item:hover .submenu { display: block; }

.submenu a,
.submenu .mudo {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: var(--tinta);
    border-radius: 8px;
}

.submenu a:hover { background: var(--vino); color: #fff; }
.submenu .mudo { color: #000; }

.fondo-marco,
.fondo-ventana,
.fondo-inca,
.fondo-reporte { background: var(--crema); }

.marco,
.ventana,
.reporte {
    margin: 16px 18px 28px;
    padding: 0;
}

.fondo-marco .marco {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    width: min(920px, calc(100% - 48px));
    margin-left: auto;
    margin-right: auto;
}

.fondo-marco .panel-titulo,
.fondo-marco .rejilla { width: 100%; }

.fondo-marco .rejilla { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.panel-titulo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--papel);
    border: 1px solid var(--linea);
    border-radius: 18px;
    box-shadow: var(--sombra);
    padding: 18px 22px;
    font-size: 20px;
    font-weight: 650;
    color: #000;
}

.rejilla {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 282px));
    gap: 14px;
    width: max-content;
    max-width: 100%;
    margin-top: 16px;
}

.rejilla a,
.rejilla .apagado {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 114px;
    background: linear-gradient(180deg, #9a2038 0%, var(--vino) 100%);
    color: #fff;
    text-decoration: none;
    border: 0;
    border-radius: 18px;
    box-shadow: 0 12px 24px rgba(138, 22, 44, .18);
    font-size: 22px;
    font-weight: 650;
    text-align: center;
    transition: transform .15s ease, box-shadow .15s ease;
}

.rejilla a:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(138, 22, 44, .24);
}

.rejilla .apagado {
    background: #efe6e8;
    color: #000;
    box-shadow: none;
}

.rejilla .salir-grande {
    background: linear-gradient(180deg, #d46a72, var(--salir));
}

.fila-botones,
.encabezado {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--papel);
    border: 1px solid var(--linea);
    border-radius: 18px;
    box-shadow: var(--sombra);
    padding: 14px 16px;
    margin-bottom: 12px;
}

h1 {
    margin: 0 12px 0 0;
    font-family: "Segoe UI", "Avenir Next", Arial, sans-serif;
    font-size: 24px;
    font-weight: 750;
    letter-spacing: .02em;
    color: #000;
}

button,
.boton {
    background: var(--vino);
    color: #fff;
    border: 0;
    border-radius: 12px;
    padding: 8px 14px;
    font: 650 14px/1.2 "Segoe UI", "Avenir Next", Arial, sans-serif;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(138, 22, 44, .16);
}

button:hover,
.boton:hover { background: var(--vino-oscuro); }

button.alto,
a.boton.alto { min-width: 116px; height: 52px; border-radius: 14px; }

button.mini { height: 32px; min-width: 72px; padding: 0 12px; box-shadow: none; }

button.salir,
a.boton.salir,
a.salir,
button.peligro { background: var(--salir); box-shadow: none; }

button.salir:hover,
a.boton.salir:hover,
a.salir:hover,
button.peligro:hover { background: #a83d47; }

button:disabled {
    background: #eadfe2;
    color: #000;
    box-shadow: none;
    cursor: default;
}

input, select, textarea {
    font: 14px/1.3 "Segoe UI", "Avenir Next", Arial, sans-serif;
    color: var(--tinta);
    background: #fff;
    border: 1px solid #ddcfd3;
    border-radius: 10px;
    padding: 6px 10px;
    width: auto;
    max-width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(138, 22, 44, .28);
    border-color: var(--vino);
}

input.solo, textarea.solo, input[readonly] { background: var(--solo); }
input.verde { background: var(--verde); text-align: center; font-weight: 650; }

.c55 { width: 55px; }
.c70 { width: 70px; }
.c72 { width: 72px; }
.c120 { width: 120px; }
.c85 { width: 85px; }
.c100 { width: 100px; }
.c130 { width: 130px; }
.c140 { width: 143px; }
.c160 { width: 160px; }
.c200 { width: 200px; }
.c220 { width: 220px; }
.c255 { width: 255px; }
.c280 { width: 280px; }
.c337 { width: 337px; }

.seccion { margin: 8px 0 2px; font-size: 18px; color: #000; }

.linea {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 6px 0;
}

.linea label { font-size: 14px; white-space: nowrap; color: #000; }
.linea.abajo { align-items: flex-start; }
label.motivo { margin-top: 6px; }
textarea#motivo { width: 374px; height: 120px; }

.pestanas > input { display: none; }

.lenguetas { display: flex; gap: 8px; margin: 12px 0 0; }

.lenguetas label {
    background: #fff;
    border: 1px solid var(--linea);
    border-radius: 12px 12px 0 0;
    padding: 8px 16px;
    cursor: pointer;
    color: #000;
}

.panel-datos {
    display: none;
    background: #fff;
    border: 1px solid var(--linea);
    border-radius: 0 16px 16px 16px;
    box-shadow: var(--sombra);
    padding: 14px 16px 16px;
}

#tab-datos:checked ~ #panel-datos,
#tab-domicilio:checked ~ #panel-domicilio,
#tab-otros:checked ~ #panel-otros,
#tab-emp1:checked ~ #panel-emp1 { display: block; }

#tab-datos:checked ~ .lenguetas label[for="tab-datos"],
#tab-domicilio:checked ~ .lenguetas label[for="tab-domicilio"],
#tab-otros:checked ~ .lenguetas label[for="tab-otros"],
#tab-emp1:checked ~ .lenguetas label[for="tab-emp1"] {
    background: var(--vino);
    color: #fff;
    border-color: var(--vino);
}

.partido {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
    gap: 16px;
    align-items: stretch;
}

.partido > .pestanas,
.partido > .cubrir {
    min-width: 0;
}

.partido > .cubrir {
    margin-top: 0;
    display: flex;
    flex-direction: column;
}

.partido > .cubrir > .pestanas {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.partido #tab-emp1:checked ~ #panel-emp1 { flex: 1; }

.cubrir { margin-top: 8px; }
.dos { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr); gap: 4px 28px; }

.fondo-inca .panel-datos { background: #fff; }

fieldset {
    border: 1px solid var(--linea);
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--sombra);
    margin: 0 0 12px;
    padding: 14px;
}

legend { padding: 0 6px; color: #000; font-weight: 650; }

.campos {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 8px 16px;
}

.campos label, label.ancho {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.campos input, .campos select, .campos textarea, label.ancho input, label.ancho textarea { width: 220px; }
.ancho { grid-column: 1 / -1; }

.tabla-wrap {
    overflow: auto;
    background: #fff;
    border: 1px solid var(--linea);
    border-radius: 16px;
    box-shadow: var(--sombra);
    margin-top: 14px;
    max-height: 420px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }

.tabla-wrap th,
.tabla-wrap td,
.tabla-rep th,
.tabla-rep td {
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid #f0e6e8;
    text-align: left;
    white-space: nowrap;
}

.tabla-wrap th,
.tabla-rep th {
    background: var(--vino-suave);
    color: #000;
    font-weight: 700;
    position: sticky;
    top: 0;
}

.tabla-wrap tr:hover td,
.tabla-rep tr:hover td { background: #fbf6f7; }

tr.fila-activa td { background: var(--vino); color: #fff; }
tr.fila-activa a { color: #fff; }

.aviso {
    padding: 10px 14px;
    border: 1px solid var(--linea);
    border-radius: 12px;
    background: #fff;
    margin: 8px 0;
}
.aviso.ok { background: var(--verde); border-color: #c9e8d1; }
.aviso.error { background: #fdecee; border-color: #f3c5cb; }
.nota {
    background: #fff8e8;
    border: 1px solid #f0e0b8;
    border-radius: 12px;
    padding: 10px 14px;
}

.busqueda, .panel form, .acciones { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.panel {
    background: #fff;
    border: 1px solid var(--linea);
    border-radius: 16px;
    box-shadow: var(--sombra);
    padding: 14px 16px;
    margin: 12px 0;
}

.panel h2 { margin: 0 0 8px; font-size: 16px; color: #000; }
.panel label { display: flex; flex-direction: row; align-items: center; gap: 8px; }

.paginador { display: flex; gap: 12px; align-items: center; margin: 8px 0; }

.login-body {
    min-height: 100vh;
    align-items: center;
    justify-content: flex-start;
    background:
        radial-gradient(circle at top, #fff 0%, rgba(255, 255, 255, 0) 42%),
        var(--crema);
}
.login-body::after { margin-top: 0; }
.login-body .flor { width: 150px; height: 150px; opacity: .45; }
.login-card {
    flex: 0 0 auto;
    align-self: center;
    width: min(420px, calc(100% - 32px));
    margin: auto;
    background: #fff;
    border: 1px solid #e4d6d9;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(44, 16, 24, .12);
    padding: 0;
    overflow: hidden;
    text-align: center;
}
.login-marca {
    padding: 28px 32px 20px;
    background: #fff;
    border-bottom: 3px solid var(--vino);
}
.login-logo {
    display: block;
    width: min(100%, 300px);
    height: auto;
    margin: 0 auto;
}
.login-cuerpo { padding: 22px 28px 20px; }
.login-card h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 18px;
    text-align: center;
}
.login-card form { display: grid; justify-items: stretch; gap: 14px; }
.login-card label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    color: #000;
}
.login-card input {
    width: 100%;
    height: 46px;
    background: #fafafa;
    border: 1px solid #d5c8cb;
    border-radius: 10px;
}
.login-card .botones { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.login-card .botones button,
.login-card .botones .boton { width: 100%; height: 46px; border-radius: 10px; }
.login-card a.boton.salir {
    background: #fff;
    color: #000;
    border: 1px solid #d5c8cb;
    box-shadow: none;
}
.login-card a.boton.salir:hover { background: #f6f1f2; color: #000; }
.pie {
    font-size: 12px;
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid #efe4e6;
    color: #000;
    text-align: center;
}

.reporte { color: var(--tinta); }
.barra-cerrar {
    display: flex;
    justify-content: flex-end;
    border: 0;
    background: transparent;
    padding: 0;
    margin-bottom: 8px;
}
.reporte .titulo-rep {
    margin: 16px 0 8px;
    font: 700 18px "Segoe UI", Arial, sans-serif;
    color: #000;
}
.linea-rep { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; flex-wrap: wrap; }
.linea-rep .titulo-rep { margin: 0; }
.reporte button,
.reporte .boton,
.reporte a.boton.alto.gris {
    min-width: 108px;
    height: 38px;
}
.reporte a.boton.alto.gris {
    width: 116px;
    height: 64px;
    min-width: 116px;
    background: var(--salir);
}
.reporte .c162 { width: 162px; }
.reporte .c73 { width: 73px; }
.reporte .c174 { width: 174px; height: 36px; }
.panel-grabado {
    border: 1px solid var(--linea);
    border-radius: 16px;
    padding: 12px;
    background: #fff;
    box-shadow: var(--sombra);
}
.tabla-rep {
    height: 240px;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--linea);
    border-radius: 12px;
}
.tabla-rep.empleados { height: 220px; }
.tabla-rep table { font-size: 12px; }

.documento {
    display: block;
    min-height: 0;
    background: #ece7e4;
}
.documento .flores,
.documento::after { display: none; }
.barra-print {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    background: transparent;
}
.hoja {
    width: 595px;
    min-height: 842px;
    margin: 8px auto;
    padding: 36px 20px 20px;
    background: #fff;
    color: #000;
    page-break-after: always;
}
.cabeza-contrato { display: grid; grid-template-columns: 98px 1fr; align-items: center; }
.cabeza-contrato img { width: 98px; height: 32px; object-fit: contain; }
.muni { margin: 0; text-align: center; font: bold 12px Arial, Helvetica, sans-serif; }
.tipo { margin: 0; text-align: center; font: italic bold 10px Arial, Helvetica, sans-serif; }
.linea-centro { margin: 0; text-align: center; font: 8px Arial, Helvetica, sans-serif; }
table.formato { width: 555px; border-collapse: collapse; table-layout: fixed; margin-top: 4px; background: #fff; }
table.formato td {
    border: 1px solid #000;
    text-align: center;
    vertical-align: middle;
    font: bold 8px Arial, Helvetica, sans-serif;
    padding: 1px 2px;
    white-space: normal;
    color: #000;
    background: #fff;
}
table.formato td.dato { font-weight: normal; font-size: 7px; height: 22px; }
table.formato td.alto { height: 48px; }
table.formato td.izq, table.formato td.dom { text-align: left; }
table.formato .cp { float: right; }
table.formato .origen { margin-top: 4px; }
table.formato tr.firmas-formato td { height: 78px; vertical-align: bottom; font-weight: normal; font-size: 7px; padding: 3px; }
table.formato .firma { margin: 0 0 2px; }

@media (max-width: 1100px) {
    .partido { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .rejilla, .fondo-marco .rejilla { grid-template-columns: 1fr; width: 100%; }
    .dos, .campos { grid-template-columns: 1fr; }
    .campos label, label.ancho { justify-content: flex-start; }
    .flor { width: 140px; height: 140px; }
}

@media print {
    .no-imprimir, .barra-print, .menubar { display: none !important; }
    .flores, body::after { display: none !important; }
    body::after { content: none !important; }
    body, body.documento { display: block; background: #fff; }
    .hoja { margin: 0; width: auto; min-height: 0; padding: 0; }
}
