:root {
    --brand-gradient: linear-gradient(90deg, #7357ff 0%, #58c3ff 100%);
    --primary: #6d3ef5;
    --primary-dark: #4b2bbe;
    --primary-light: #9a7cff;
    --secondary: #3ba3f7;
    --secondary-dark: #1f6fcc;
    --secondary-light: #7cc4ff;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 2px 10px rgba(17, 24, 39, 0.06);
    --shadow-md: 0 12px 30px rgba(17, 24, 39, 0.12);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text-primary);
    font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
}

body:not(.login-page) {
    display: flex;
    flex-direction: column;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--primary);
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(109, 62, 245, 0.16);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 0.68rem 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

button:active {
    transform: translateY(1px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

/*Estado activo de navegación*/
#mediadores.is-active,
#aseguradoras.is-active,
#listado.is-active,
#comunidades.is-active,
#inicio-dashboard.is-active,
#editor.is-active {
    background: #eef2ff;
    border-color: var(--primary-light);
    color: var(--primary-dark);
    box-shadow: inset 0 0 0 1px rgba(109, 62, 245, 0.18);
}

#nav-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(7px);
    background: rgba(248, 250, 252, 0.95);
    border-bottom: 1px solid var(--border);
}

#botones {
    width: 100%;
    margin: 0;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.2rem;
}

#botones-izquierda {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#botones-derecha {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.nav-logo {
    display: inline-flex;
    align-items: center;
    border-radius: 12px;
    padding: 0.3rem 0.4rem;
}

.nav-logo img {
    height: 38px;
    width: auto;
}

#mediadores,
#aseguradoras,
#listado,
#comunidades,
#inicio-dashboard,
#editor,
#volver,
#cerrar-sesion,
#btn-filtrar {
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

#mediadores:hover,
#aseguradoras:hover,
#listado:hover,
#comunidades:hover,
#inicio-dashboard:hover,
#editor:hover,
#volver:hover,
#btn-filtrar:hover {
    border-color: var(--secondary);
    color: var(--secondary-dark);
    background: #f8fbff;
}

#cerrar-sesion {
    background: #fff;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
#cerrar-sesion:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

#titulo-comunidades,
#titulo-aseguradoras,
#titulo-mediadores,
#titulo-listado {
    width: calc(100% - 2.4rem);
    margin: 1.6rem 1.2rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

#titulo-comunidades h1,
#titulo-aseguradoras h1,
#titulo-mediadores h1,
#titulo-listado h1 {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 2rem);
    line-height: 1.15;
}

.inicio-layout {
    width: calc(100% - 2.4rem);
    margin: 1.4rem 1.2rem 1.6rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.inicio-columna {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    min-height: 420px;
}

.inicio-bienvenida {
    width: calc(100% - 2.4rem);
    margin: 1.2rem 1.2rem 0.2rem;
}

.inicio-bienvenida h1 {
    margin: 0 0 0.2rem;
    font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.inicio-bienvenida p {
    margin: 0;
    color: var(--text-secondary);
}

.inicio-brand {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
}

.inicio-columna__header h2 {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
}

.inicio-filtros {
    display: grid;
    grid-template-columns: 1fr 180px auto;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.inicio-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    padding: 0.8rem;
    margin-bottom: 0.7rem;
}

.inicio-card h3 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
}

.inicio-card p {
    margin: 0.25rem 0;
}

.inicio-card__acciones {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.65rem;
    flex-wrap: wrap;
}

.inicio-paginacion {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.inicio-paginacion span {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.filtro-inline {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: min(480px, 100%);
}

.filtro-inline input {
    min-width: 220px;
}

#contenido-comunidades,
#informacion-general,
#contenido-listado,
#listado-aseguradoras,
#listado-mediadores {
    width: calc(100% - 2.4rem);
    margin: 0 1.2rem 2rem;
}

#contenido-comunidades,
#contenido-listado,
#listado-aseguradoras,
#listado-mediadores {
    display: grid;
    gap: 1rem;
}

#titulo-listado .filtro-inline {
    min-width: 0;
    margin-left: auto;
    justify-content: flex-end;
}

#tabla-listado-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: auto;
}

#tabla-listado {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
    font-size: 0.95rem;
}

#tabla-listado th,
#tabla-listado td {
    text-align: left;
    white-space: nowrap;
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--border);
}

#tabla-listado th {
    position: sticky;
    top: 0;
    background: #eef2ff;
    color: var(--primary-dark);
    font-weight: 700;
    z-index: 1;
}

#tabla-listado tbody tr:nth-child(even) {
    background: #fafbff;
}

#tabla-listado tbody tr:hover {
    background: #f2f6ff;
}

/* Editor - vista de edición masiva (compacta tipo Excel) */
#editor-barra {
    width: calc(100% - 2.4rem);
    margin: 0.65rem 1.2rem 0.45rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

#editor-barra .acciones-editor {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

#editor-barra .acciones-editor button {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    line-height: 1.2;
}

#editor-barra .acciones-editor button i {
    font-size: 0.85em;
}

#btn-guardar-editor {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
}

#btn-guardar-editor:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

#btn-guardar-editor:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

#btn-exportar-editor {
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

#btn-exportar-editor:hover {
    border-color: var(--secondary);
    color: var(--secondary-dark);
    background: #f8fbff;
}

#editor-toolbar.editor-barra-izquierda {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1;
    min-width: 0;
}

#editor-buscar {
    min-width: 200px;
    max-width: 320px;
    padding: 0.32rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.2;
}

.editor-btn-secundario {
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.32rem 0.55rem;
    font-size: 0.78rem;
    line-height: 1.2;
}

.editor-btn-secundario:hover {
    border-color: var(--secondary);
    color: var(--secondary-dark);
    background: #f8fbff;
}

.editor-resumen-busqueda {
    color: var(--text-secondary);
    font-size: 0.78rem;
    white-space: nowrap;
}

#contenido-editor {
    width: calc(100% - 2.4rem);
    margin: 0 1.2rem 1rem;
    display: grid;
    gap: 0;
}

#tabla-editor-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    overflow: auto;
    max-height: calc(100vh - 155px);
}

#tabla-editor {
    width: 100%;
    border-collapse: collapse;
    min-width: 1050px;
    font-size: 0.78rem;
    table-layout: fixed;
}

#tabla-editor th,
#tabla-editor td {
    text-align: left;
    vertical-align: middle;
    padding: 0.12rem 0.28rem;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    line-height: 1.15;
}

#tabla-editor th:nth-child(1),
#tabla-editor td:nth-child(1) {
    width: 10%;
    max-width: 9.5rem;
}

#tabla-editor th:nth-child(2),
#tabla-editor td:nth-child(2) {
    width: 6.75rem;
    min-width: 6.75rem;
    max-width: 6.75rem;
}

#tabla-editor th:nth-child(3),
#tabla-editor td:nth-child(3) {
    width: 2.85rem;
    min-width: 2.85rem;
    max-width: 2.85rem;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
    text-align: center;
}

#tabla-editor th:nth-child(4),
#tabla-editor td:nth-child(4) {
    width: 9%;
    min-width: 7.25rem;
    max-width: 9.5rem;
}

#tabla-editor th:nth-child(5),
#tabla-editor td:nth-child(5) {
    width: 5.75rem;
    min-width: 5.75rem;
    max-width: 5.75rem;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
}

#tabla-editor th:nth-child(6),
#tabla-editor td:nth-child(6),
#tabla-editor th:nth-child(7),
#tabla-editor td:nth-child(7) {
    width: 8.1rem;
    min-width: 8.1rem;
    max-width: 8.1rem;
}

#tabla-editor th:nth-child(8),
#tabla-editor td:nth-child(8),
#tabla-editor th:nth-child(9),
#tabla-editor td:nth-child(9) {
    width: 6.25rem;
    min-width: 6.25rem;
    max-width: 6.75rem;
}

#tabla-editor td.celda-editor--mediador {
    overflow: visible;
    position: relative;
}

#tabla-editor .editor-autocomplete {
    position: relative;
    width: 100%;
}

#tabla-editor .editor-autocomplete__lista {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    z-index: 30;
    margin: 0;
    padding: 0.15rem 0;
    list-style: none;
    max-height: 9rem;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

#tabla-editor .editor-autocomplete__item {
    padding: 0.22rem 0.4rem;
    font-size: 0.78rem;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tabla-editor .editor-autocomplete__item:hover,
#tabla-editor .editor-autocomplete__item--activo {
    background: #eef2ff;
    color: var(--primary-dark);
}

#tabla-editor th:nth-child(10),
#tabla-editor td:nth-child(10),
#tabla-editor th:nth-child(11),
#tabla-editor td:nth-child(11) {
    width: 5.5rem;
    min-width: 5.5rem;
    max-width: 5.5rem;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
}

#tabla-editor td:nth-child(3) input {
    text-align: center;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
}

#tabla-editor td:nth-child(2) input {
    padding-left: 0.3rem;
    padding-right: 0.3rem;
    letter-spacing: 0.01em;
}

#tabla-editor td:nth-child(4) input {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

#tabla-editor td:nth-child(5) input {
    padding-left: 0.2rem;
    padding-right: 0.2rem;
}

#tabla-editor td:nth-child(10) input,
#tabla-editor td:nth-child(11) input {
    padding-left: 0.1rem;
    padding-right: 0.1rem;
    font-size: 0.76rem;
}

#tabla-editor th {
    position: sticky;
    top: 0;
    background: #eef2ff;
    color: var(--primary-dark);
    font-weight: 700;
    z-index: 2;
    white-space: nowrap;
    font-size: 0.76rem;
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}

#tabla-editor td.celda-editor--comunidad {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: 0;
    max-width: 9.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 1px 0 0 var(--border);
    font-size: 0.78rem;
}

#tabla-editor th:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    box-shadow: 1px 0 0 var(--border);
}

#tabla-editor tbody tr:nth-child(even) td:not(.celda-editor--comunidad) {
    background: #fafbff;
}

#tabla-editor tbody tr:hover td:not(.celda-editor--comunidad) {
    background: #f2f6ff;
}

#tabla-editor tbody tr.fila-editor--modificada td.celda-editor--comunidad {
    box-shadow: inset 4px 0 0 var(--secondary);
}

#tabla-editor tbody tr.fila-editor--pendiente:not(.fila-editor--modificada) td.celda-editor--comunidad {
    box-shadow: inset 4px 0 0 #f97316;
}

#tabla-editor tbody tr.fila-editor--modificada.fila-editor--pendiente td.celda-editor--comunidad {
    box-shadow: inset 4px 0 0 #f97316, inset 8px 0 0 var(--secondary);
}

#tabla-editor .celda-editor input,
#tabla-editor .celda-editor select {
    width: 100%;
    min-width: 0;
    border: 1px solid transparent;
    border-radius: 2px;
    padding: 0.14rem 0.22rem;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.78rem;
    line-height: 1.15;
    min-height: 1.35rem;
}

#tabla-editor .celda-editor input[type="date"] {
    padding: 0.1rem 0.15rem;
}

#tabla-editor .celda-editor select {
    padding-right: 1.1rem;
}

#tabla-editor .celda-editor input:hover,
#tabla-editor .celda-editor select:hover {
    border-color: #dbe3f3;
    background: #fff;
}

#tabla-editor .celda-editor input:focus,
#tabla-editor .celda-editor select:focus {
    border-color: var(--secondary);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.18);
}

#tabla-editor .celda-editor--modificada input,
#tabla-editor .celda-editor--modificada select {
    border-color: #fbbf24;
    background: #fffbeb;
}

#tabla-editor td.celda-editor--alerta {
    background: #fff1f0 !important;
}

#tabla-editor tbody tr:nth-child(even) td.celda-editor--alerta {
    background: #ffe8e6 !important;
}

#tabla-editor tbody tr:hover td.celda-editor--alerta {
    background: #ffddd9 !important;
}

#tabla-editor .celda-editor--alerta input,
#tabla-editor .celda-editor--alerta select {
    background: #fff7ed;
    border-color: #f97316;
    box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.45);
    color: #9a3412;
}

#tabla-editor .celda-editor--alerta input::placeholder,
#tabla-editor .celda-editor--alerta select option[value=""] {
    color: #c2410c;
}

#tabla-editor .celda-editor--alerta input:hover,
#tabla-editor .celda-editor--alerta select:hover {
    background: #ffedd5;
    border-color: #ea580c;
}

#tabla-editor .celda-editor--alerta input:focus,
#tabla-editor .celda-editor--alerta select:focus {
    background: #fff;
    border-color: #dc2626;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.35);
}

.comunidad,
.aseguradora,
.mediador,
.poliza-item,
.siniestro-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.comunidad:hover,
.aseguradora:hover,
.mediador:hover,
.poliza-item:hover,
.siniestro-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #dbe4ff;
}

.comunidad {
    padding: 1rem;
    display: grid;
    grid-template-columns: auto minmax(260px, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 0.85rem 1rem;
}

.comunidad > .estado {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.comunidad > .nombre {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.estado {
    display: none;
}

.estado.activo {
    background: var(--success);
}

.estado.inactivo {
    background: var(--danger);
}

.nombre,
.telefono,
.email,
.direccion {
    color: var(--text-primary);
}

.nombre {
    font-weight: 600;
}

.aviso-vencimiento {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    min-width: 190px;
    text-align: center;
    font-size: 0.86rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    padding: 0.23rem 0.55rem;
    border-radius: 999px;
}

.acciones {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

.btn-consultar-informacion,
.btn-consultar-siniestros,
.btn-abrir-siniestro,
.btn-abrir-agregar-informacion,
.btn-abrir-nueva-poliza,
.btn-ver-siniestro {
    background: #fff;
    border: 1px solid var(--primary-light);
    color: var(--primary-dark);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.btn-consultar-informacion:hover,
.btn-consultar-siniestros:hover,
.btn-abrir-siniestro:hover,
.btn-abrir-agregar-informacion:hover,
.btn-abrir-nueva-poliza:hover,
.btn-ver-siniestro:hover {
    background: #f5f3ff;
    border-color: var(--primary);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.18rem 0.62rem;
    font-size: 0.84rem;
    font-weight: 600;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: #f8fafc;
}

.status-pill--success {
    background: #ecfdf3;
    border-color: #bbf7d0;
    color: #166534;
}

.status-pill--warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.status-pill--danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.status-pill--neutral {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #475569;
}

.aseguradora,
.mediador {
    padding: 0.95rem 1rem;
    display: grid;
    gap: 0.35rem;
}

.acciones-listado {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
    margin-top: 0.4rem;
}

.btn-editar-item {
    background: #fff;
    border: 1px solid var(--primary-light);
    color: var(--primary-dark);
    padding: 0.45rem 0.72rem;
    font-size: 0.88rem;
}

.btn-editar-item:hover {
    background: #f5f3ff;
    border-color: var(--primary);
}

.btn-eliminar-item {
    background: #fff;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 0.45rem 0.72rem;
    font-size: 0.88rem;
}

.btn-eliminar-item:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.telefono,
.email,
.direccion {
    color: var(--text-secondary);
}

.poliza-item,
.siniestro-item {
    margin-bottom: 1rem;
    padding: 1rem;
}

.info-group p {
    margin: 0.3rem 0;
}

.info-group strong {
    color: var(--text-primary);
}

/* Estructura refinada solo para "Consultar Información" de comunidades */
#informacion-general .poliza-item {
    padding: 1.15rem 1.2rem;
}

.estado-poliza-item {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.7rem;
}

#informacion-general .info-group--poliza {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.5rem 1rem;
}

#informacion-general .dato-poliza {
    margin: 0;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    display: grid;
    gap: 0.2rem;
}

#informacion-general .dato-poliza__label {
    display: inline-block;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

#informacion-general .dato-poliza__value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.98rem;
    overflow-wrap: anywhere;
}

.pdf-group {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.85rem;
}

.pdf-group h3 {
    margin: 0 0 0.6rem;
}

iframe {
    width: 100%;
    min-height: 360px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f1f5f9;
}

.pdf-group a,
.pdf-link {
    display: inline-block;
    margin-top: 0.6rem;
    font-weight: 600;
    color: var(--secondary-dark);
}

.acciones-poliza {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.btn-eliminar-poliza {
    background: var(--danger);
}

.btn-eliminar-poliza:hover {
    background: #dc2626;
}

.comentarios-siniestro,
.nuevo-comentario-siniestro {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.comentarios-siniestro h3,
.nuevo-comentario-siniestro h3 {
    margin: 0 0 0.7rem;
}

.lista-comentarios {
    display: grid;
    gap: 0.75rem;
}

.comentario-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    padding: 0.75rem;
}

.comentario-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.comentario-texto {
    margin: 0.45rem 0 0;
}

.formulario-comentario {
    display: grid;
    gap: 0.75rem;
}

.comentario-form-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.comentario-ayuda,
.nombre-archivo-seleccionado {
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.acciones-comentario {
    display: flex;
    justify-content: flex-end;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-contenido {
    width: min(680px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    padding: 1rem 1.15rem 1.2rem;
}

.cerrar-modal {
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.7rem;
    line-height: 1;
    padding: 0.1rem 0.3rem;
    margin-left: auto;
    display: block;
}

.cerrar-modal:hover {
    background: transparent;
    color: var(--text-primary);
    box-shadow: none;
}

.titulo h2 {
    margin: 0.25rem 0 1rem;
}

.form-group {
    margin-bottom: 0.8rem;
}

.campo-obligatorio {
    color: #dc2626;
    font-weight: 700;
}

.texto-obligatorio {
    margin: 0 0 0.7rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.texto-obligatorio > span {
    color: #dc2626;
    font-weight: 700;
}

#formAgregarInformacion .form-group > label {
    display: block;
    margin: 0 0 0.32rem;
    color: #475569;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

#formNuevaPoliza .form-group > label {
    display: block;
    margin: 0 0 0.32rem;
    color: #475569;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.acciones-modal {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.55rem;
}

.btn-cancelar,
#btnCancelarModalSiniestro,
#btnCancelarModalAgregarInformacion {
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-cancelar:hover,
#btnCancelarModalSiniestro:hover,
#btnCancelarModalAgregarInformacion:hover {
    background: #f1f5f9;
}

.oculto {
    display: none !important;
}

.empty-state,
.feedback-message {
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-md);
    background: #f8fafc;
    color: var(--text-secondary);
    padding: 1rem;
}

.feedback-message--error {
    border-style: solid;
    border-color: #fecaca;
    color: #991b1b;
    background: #fef2f2;
}

.overlay-carga {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.4);
}

.overlay-carga.visible {
    display: flex;
}

.spinner-contenedor {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #fff;
    box-shadow: var(--shadow-md);
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #dbeafe;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

form[action="#"] {
    width: min(430px, calc(100% - 2rem));
    margin: 7vh auto 0;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.25rem;
}

.login-page {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: #ffffff;
    overflow: hidden;
}

.login-stars-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #ffffff;
    overflow: hidden;
    pointer-events: none;
}

.login-star-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    animation: loginStarDrift linear infinite;
}

.login-star-layer {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
    border-radius: 50%;
}

.login-star-layer--clone {
    top: 2000px;
}

@keyframes loginStarDrift {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-2000px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-star-track {
        animation: none;
    }
}

.login-page form[action="#"] {
    position: relative;
    z-index: 1;
    margin: 0;
}

.login-logo {
    margin: 0 auto 0.95rem;
    width: min(240px, 78%);
}

form[action="#"] .form-group {
    position: relative;
}

form[action="#"] .form-group i {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

form[action="#"] input {
    padding-left: 2.2rem;
}

#login {
    width: 100%;
    background: var(--brand-gradient);
}

#tabla-siniestros table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

#tabla-siniestros th,
#tabla-siniestros td {
    text-align: left;
    padding: 0.65rem;
    border-bottom: 1px solid var(--border);
}

#tabla-siniestros th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 700;
}

@media (max-width: 950px) {
    .inicio-layout {
        grid-template-columns: 1fr;
    }

    .inicio-bienvenida {
        width: calc(100% - 1.5rem);
        margin: 1rem 0.75rem 0.1rem;
    }

    .inicio-filtros {
        grid-template-columns: 1fr;
    }

    .comunidad {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto auto;
    }

    .comunidad > .estado {
        grid-row: 1 / span 3;
    }

    .comunidad > .nombre {
        grid-column: 2;
        grid-row: 1;
    }

    .comunidad > .aviso-vencimiento {
        grid-column: 2;
        grid-row: 2;
        justify-self: start;
        min-width: 0;
    }

    .acciones {
        grid-column: 2;
        grid-row: 3;
        justify-self: start;
    }
}

@media (max-width: 760px) {
    #botones {
        width: 100%;
        min-height: 62px;
        padding: 0 0.75rem;
    }

    #botones-izquierda {
        gap: 0.4rem;
        flex-wrap: wrap;
    }

    #titulo-comunidades,
    #titulo-aseguradoras,
    #titulo-mediadores,
    #titulo-listado {
        width: calc(100% - 1.5rem);
        margin: 1.2rem 0.75rem 0.9rem;
        flex-direction: column;
        align-items: flex-start;
    }

    #contenido-comunidades,
    #informacion-general,
    #contenido-listado,
    #contenido-editor,
    #listado-aseguradoras,
    #listado-mediadores,
    .inicio-layout {
        width: calc(100% - 1.5rem);
        margin: 0 0.75rem 1.35rem;
    }

    .filtro-inline {
        width: 100%;
        min-width: 0;
    }

    .filtro-inline input {
        min-width: 0;
    }

    #titulo-listado .filtro-inline {
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
    }

    #editor-barra {
        width: calc(100% - 1.5rem);
        margin: 0.55rem 0.75rem 0.4rem;
        flex-direction: column;
        align-items: stretch;
    }

    #editor-barra .acciones-editor {
        width: 100%;
        justify-content: flex-end;
    }

    #editor-toolbar.editor-barra-izquierda {
        flex-direction: column;
        align-items: stretch;
    }

    #editor-buscar {
        width: 100%;
        max-width: none;
    }

    #tabla-editor-wrapper {
        max-height: none;
    }

    .comunidad {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .comunidad > .estado,
    .comunidad > .nombre,
    .comunidad > .aviso-vencimiento,
    .comunidad > .acciones {
        grid-column: 1;
        grid-row: auto;
    }

    .comunidad > .estado {
        display: none;
    }

    .comunidad > .aviso-vencimiento {
        justify-self: start;
    }

    .acciones {
        justify-content: flex-start;
    }
}

/*Campos informativos con iconos*/
.campo-info {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.campo-info::before {
    font-size: 0.95rem;
    opacity: 0.9;
    display: inline-block;
}

.campo-info--telefono::before { content: "☎"; }
.campo-info--email::before { content: "✉"; }
.campo-info--direccion::before {
    content: "";
    width: 0.95rem;
    height: 0.95rem;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l9 8h-2v9a1 1 0 0 1-1 1h-5v-6H11v6H6a1 1 0 0 1-1-1v-9H3l9-8z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l9 8h-2v9a1 1 0 0 1-1 1h-5v-6H11v6H6a1 1 0 0 1-1-1v-9H3l9-8z'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}


/* Footer corporativo (aislado para no afectar otros estilos) */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: #eef2f7;
    color: var(--text-secondary);
}

.site-footer__inner {
    width: 100%;
    margin: 0;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: nowrap;
}

.site-footer__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.site-footer__logo {
    height: 34px;
    width: auto;
}

.site-footer__tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.site-footer__legal {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    text-align: right;
    margin-left: auto;
}

.site-footer__dev {
    color: var(--secondary-dark);
    font-weight: 600;
    font-size: 0.88rem;
}

.site-footer__copy {
    font-size: 0.8rem;
    color: #94a3b8;
}

.th-ordenable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.th-ordenable:hover {
    background: #e0e7ff;
}

.th-ordenable--activo {
    background: #dbeafe !important;
    color: var(--primary-dark) !important;
}

@media (max-width: 760px) {
    .site-footer__inner {
        width: calc(100% - 1.5rem);
        padding: 0.9rem 0;
    }

    .site-footer__brand,
    .site-footer__legal {
        width: 100%;
        align-items: flex-start;
        text-align: left;
    }
}

.toast-container {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    min-width: 240px;
    max-width: min(420px, calc(100vw - 2rem));
    background: #eef2ff;
    color: var(--primary-dark);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    box-shadow: var(--shadow-md);
    border: 1px solid #c7d2fe;
    border-left: 4px solid var(--primary);
    transform: translateY(8px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast--visible {
    transform: translateY(0);
    opacity: 1;
}

.toast--success {
    border-left-color: var(--success);
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

.toast--warning {
    border-left-color: var(--warning);
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

.toast--error {
    border-left-color: var(--danger);
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.modal-contenido--vencimientos {
    width: min(760px, 100%);
}

.lista-vencimientos-modal {
    max-height: 52vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    padding: 0.5rem;
    margin-bottom: 0.9rem;
}

.item-vencimiento-modal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.6rem;
    border-radius: var(--radius-sm);
}

.item-vencimiento-modal:nth-child(odd) {
    background: #eef2ff;
}

.item-vencimiento-modal__nombre {
    font-weight: 600;
    color: var(--text-primary);
}

.item-vencimiento-modal__fecha {
    color: var(--primary-dark);
    font-size: 0.92rem;
    white-space: nowrap;
}
