* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f3f6f8;
    color: #17202a;
    font-family: "Segoe UI", Arial, sans-serif;
}

.topbar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #d9e1e8;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    padding: 16px 22px;
    position: sticky;
    top: 0;
    z-index: 80;
}

.topbar-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.eyebrow {
    color: #577084;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 4px;
    text-transform: uppercase;
}

h1 {
    font-size: 22px;
    line-height: 1.2;
    margin: 0;
}

.filters {
    background: #ffffff;
    border-bottom: 1px solid #d9e1e8;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(8, minmax(130px, 1fr));
    padding: 14px 22px;
    position: sticky;
    top: 73px;
    z-index: 70;
}

.filters label {
    color: #52616f;
    display: grid;
    font-size: 12px;
    font-weight: 700;
    gap: 6px;
    text-transform: uppercase;
}

.input,
.select {
    background: #ffffff;
    border: 1px solid #c5d0da;
    border-radius: 6px;
    color: #1f2933;
    font-size: 14px;
    min-height: 38px;
    padding: 6px 9px;
    width: 100%;
}

.input:focus,
.select:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
    outline: none;
}

.actions {
    align-items: end;
    display: flex;
    gap: 8px;
}

.primary-button,
.secondary-button,
.export-button {
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    min-height: 40px;
    padding: 0 18px;
}

.nav-button {
    align-items: center;
    background: #eef8f6;
    border: 1px solid #9fd2ca;
    border-radius: 6px;
    color: #0f766e;
    display: inline-flex;
    font-size: 14px;
    font-weight: 900;
    min-height: 40px;
    padding: 0 14px;
    text-decoration: none;
}

.nav-button:hover {
    background: #dff3ef;
}

.primary-button {
    background: #0f766e;
    border: 1px solid #0f766e;
    color: #ffffff;
    width: 100%;
}

.secondary-button {
    background: #ffffff;
    border: 1px solid #9aa8b5;
    color: #263238;
}

.export-button {
    background: #17324d;
    border: 1px solid #17324d;
    color: #ffffff;
    white-space: nowrap;
}

.hidden-submit {
    display: none;
}

.message {
    background: #fff8df;
    border: 1px solid #e9cf79;
    border-radius: 6px;
    margin: 16px 22px 0;
    padding: 11px 13px;
}

.summary {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    margin: 16px 22px 10px;
}

.monitor-summary {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.sismo-summary {
    grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.summary-red strong {
    color: #b42318;
}

.summary-yellow strong {
    color: #a05a00;
}

.summary-green strong {
    color: #137333;
}

.summary div {
    background: #ffffff;
    border: 1px solid #d9e1e8;
    border-radius: 6px;
    padding: 12px 14px;
}

.summary span {
    color: #66788a;
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

.summary strong {
    font-size: 16px;
}

.notes {
    color: #52616f;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-size: 13px;
    margin: 0 22px 12px;
}

.sismo-dashboard {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    margin: 0 22px 16px;
}

.chart-panel,
.table-panel {
    background: #ffffff;
    border: 1px solid #d9e1e8;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(24, 33, 43, 0.06);
    min-width: 0;
    overflow: hidden;
}

.panel-title {
    align-items: baseline;
    background: #f7fafc;
    border-bottom: 1px solid #d9e1e8;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px 14px;
}

.panel-title h2 {
    font-size: 16px;
    margin: 0;
}

.panel-title span {
    color: #66788a;
    font-size: 12px;
    font-weight: 700;
}

.chart-box {
    height: 360px;
    padding: 14px;
}

.compact-table-wrap {
    max-height: 360px;
    overflow: auto;
}

.compact-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    min-width: 920px;
    width: 100%;
}

.compact-table th,
.compact-table td {
    border-bottom: 1px solid #dde5ec;
    border-right: 1px solid #dde5ec;
    padding: 7px 8px;
    vertical-align: middle;
}

.compact-table th {
    background: #25313d;
    color: #ffffff;
    font-weight: 800;
    position: sticky;
    text-align: left;
    top: 0;
    z-index: 2;
}

.compact-table tbody tr:nth-child(even) {
    background: #f8fafb;
}

.status-danger-text {
    color: #b42318;
    font-weight: 900;
}

.sismo-table-wrap {
    max-height: calc(100vh - 520px);
}

.sismo-nominal-table {
    min-width: 1900px;
}

.sismo-filters {
    grid-template-columns: repeat(10, minmax(120px, 1fr));
}

.nominal-lock {
    align-items: end;
    background: #ffffff;
    border: 1px solid #d9e1e8;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(24, 33, 43, 0.06);
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto auto;
    margin: 0 22px 24px;
    padding: 14px;
}

.nominal-lock span {
    color: #66788a;
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.nominal-lock strong {
    color: #1f2933;
    display: block;
    font-size: 14px;
}

.nominal-lock label {
    color: #52616f;
    display: grid;
    font-size: 12px;
    font-weight: 700;
    gap: 6px;
    text-transform: uppercase;
}

.lock-error {
    align-self: center;
    color: #b42318;
    font-size: 13px;
    font-weight: 900;
}

.nominal-toolbar {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d9e1e8;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(24, 33, 43, 0.06);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin: 0 22px 12px;
    padding: 12px 14px;
}

.nominal-toolbar span {
    color: #66788a;
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.nominal-toolbar strong {
    color: #1f2933;
    display: block;
    font-size: 14px;
}


.table-wrap {
    background: #ffffff;
    border: 1px solid #cdd7e1;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(24, 33, 43, 0.06);
    margin: 0 22px 24px;
    max-height: calc(100vh - 312px);
    min-height: 280px;
    overflow: auto;
}

.pager {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    margin: -10px 22px 24px;
}

.pager-summary {
    color: #52616f;
    font-size: 13px;
    font-weight: 700;
}

.pager-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pager-button {
    background: #ffffff;
    border: 1px solid #b6c4d2;
    border-radius: 6px;
    color: #263238;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    min-height: 34px;
    min-width: 36px;
    padding: 0 10px;
}

.pager-button:hover:not(:disabled) {
    background: #eef8f6;
    border-color: #0f766e;
    color: #0f766e;
}

.pager-button.active {
    background: #0f766e;
    border-color: #0f766e;
    color: #ffffff;
}

.pager-button:disabled {
    cursor: default;
    opacity: 0.72;
}

.pager-ellipsis {
    align-items: center;
    color: #52616f;
    display: inline-flex;
    font-weight: 800;
    min-height: 34px;
    padding: 0 2px;
}

.empty-state {
    color: #52616f;
    font-size: 15px;
    padding: 34px;
    text-align: center;
}

.materno-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    min-width: 4200px;
    width: 100%;
}

.monitor-wrap {
    max-height: calc(100vh - 286px);
}

.monitor-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    min-width: 1500px;
    width: 100%;
}

.monitor-table th,
.monitor-table td {
    border-bottom: 1px solid #dde5ec;
    border-right: 1px solid #dde5ec;
    padding: 8px 9px;
    vertical-align: middle;
}

.monitor-table th {
    background: #25313d;
    color: #ffffff;
    font-weight: 800;
    position: sticky;
    text-align: left;
    top: 0;
    z-index: 30;
}

.monitor-table tbody tr:nth-child(even) {
    background: #f8fafb;
}

.monitor-table tbody tr:hover {
    background: #eef8f6;
}

.status-cell {
    text-align: center;
    white-space: nowrap;
}

.status-pill {
    border-radius: 999px;
    display: inline-block;
    font-size: 12px;
    font-weight: 900;
    min-width: 82px;
    padding: 4px 10px;
    text-align: center;
}

.status-rojo {
    background: #fee4e2;
    border: 1px solid #fda29b;
    color: #b42318;
}

.status-amarillo {
    background: #fff3cd;
    border: 1px solid #f3c461;
    color: #875200;
}

.status-verde {
    background: #dcfae6;
    border: 1px solid #86d39e;
    color: #137333;
}

.semaforo-cell {
    text-align: center;
}

.semaforo-dot {
    border-radius: 999px;
    box-shadow: 0 0 0 3px rgba(23, 32, 42, 0.06);
    display: inline-block;
    height: 18px;
    vertical-align: middle;
    width: 18px;
}

.semaforo-dot-verde {
    background: #16a34a;
    border: 2px solid #86efac;
}

.semaforo-dot-amarillo {
    background: #f59e0b;
    border: 2px solid #fde68a;
}

.semaforo-dot-rojo {
    background: #dc2626;
    border: 2px solid #fecaca;
}

.mini-ok {
    background: #f0fbf3;
    color: #137333;
    font-weight: 800;
}

.mini-yellow {
    background: #fff8e6;
    color: #875200;
    font-weight: 900;
}

.mini-red {
    background: #fff1f0;
    color: #b42318;
    font-weight: 900;
}

.muted-cell {
    background: #f6f8fa;
    color: #8a98a8;
    font-size: 11px;
}

.observation-cell {
    min-width: 260px;
}

.observation-action-cell {
    min-width: 96px;
    text-align: center;
    width: 96px;
}

.observation-cell div {
    line-height: 1.25;
    margin-bottom: 7px;
}

.norma-button {
    background: #eef8f6;
    border: 1px solid #9fd2ca;
    border-radius: 6px;
    color: #0f766e;
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
    min-height: 28px;
    padding: 0 10px;
}

.norma-button:hover {
    background: #dff3ef;
}

.normativa-dialog {
    max-width: 820px;
}

.normativa-body {
    display: grid;
    gap: 12px;
}

.norma-current,
.norma-section {
    background: #f7fafc;
    border: 1px solid #d8e1ea;
    border-radius: 8px;
    padding: 12px;
}

.norma-current span {
    color: #66788a;
    display: block;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.norma-current p,
.norma-section p {
    color: #263238;
    font-size: 14px;
    line-height: 1.45;
    margin: 8px 0 0;
}

.norma-section h3 {
    color: #17324d;
    font-size: 15px;
    margin: 0;
}

.materno-table th,
.materno-table td {
    border-bottom: 1px solid #dde5ec;
    border-right: 1px solid #dde5ec;
    padding: 7px 8px;
    vertical-align: middle;
}

.materno-table .group-start {
    border-left: 1px solid #8fb3c8;
}

.materno-table thead .group-start {
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.55);
}

.materno-table thead th {
    background: #25313d;
    color: #ffffff;
    font-weight: 800;
    line-height: 1.15;
    position: sticky;
    text-align: center;
    top: 0;
    z-index: 30;
}

.materno-table thead tr:first-child th {
    height: 58px;
}

.materno-table .group-help-cell {
    padding: 7px 10px;
    min-width: 180px;
}

.materno-table .group-title {
    display: block;
    font-size: 12px;
    font-weight: 900;
}

.materno-table .group-help {
    color: rgba(255, 255, 255, 0.82);
    display: block;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    margin-top: 3px;
    white-space: normal;
}

.materno-table thead tr:nth-child(2) th {
    background: #0f766e;
    top: 58px;
    z-index: 29;
}

.materno-table tbody tr:nth-child(even) {
    background: #f8fafb;
}

.materno-table tbody tr:hover {
    background: #eef8f6;
}

.num,
.date,
.check {
    text-align: center;
    white-space: nowrap;
}

.dni {
    color: #0f4c81;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.wide {
    min-width: 180px;
}

.morbidities {
    max-width: 320px;
    min-width: 320px;
    overflow-wrap: anywhere;
    white-space: normal;
    width: 320px;
}

.morbidity-list {
    display: grid;
    gap: 6px;
}

.morbidity-chip {
    align-items: center;
    background: #f8fbfc;
    border: 1px solid #cddbe5;
    border-radius: 6px;
    color: #263238;
    cursor: pointer;
    display: grid;
    gap: 4px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 34px;
    padding: 5px 7px;
    text-align: left;
    width: 100%;
}

.morbidity-chip:hover {
    background: #eef8f6;
    border-color: #0f766e;
}

.morbidity-alert-rojo {
    background: #fff1f0;
    border-color: #fda29b;
}

.morbidity-alert-amarillo {
    background: #fff8e6;
    border-color: #f3c461;
}

.morbidity-alert-verde {
    background: #f0fbf3;
    border-color: #86d39e;
}

.morbidity-chip span {
    background: #17324d;
    border-radius: 4px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    padding: 3px 5px;
    white-space: nowrap;
}

.morbidity-chip em {
    font-style: normal;
    font-weight: 700;
    line-height: 1.2;
    min-width: 0;
}

.morbidity-chip strong {
    color: #0f766e;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
}

.morbidity-list.compact {
    gap: 5px;
}

.morbidity-chip-read {
    border: 1px solid #cddbe5;
    border-radius: 6px;
    display: block;
    line-height: 1.25;
    padding: 5px 7px;
}

.morbidity-chip-read b {
    color: #17324d;
    font-weight: 900;
}

.html-cell {
    min-width: 340px;
}

.ok {
    background: #def7ec;
    border: 1px solid #8ed7b5;
    border-radius: 999px;
    color: #136a42;
    display: inline-block;
    font-weight: 800;
    min-width: 34px;
    padding: 2px 7px;
}

.loading-overlay {
    align-items: center;
    background: rgba(15, 23, 32, 0.48);
    display: none;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 5000;
}

.loading-box {
    background: #ffffff;
    border: 1px solid #c8d1dc;
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(15, 23, 32, 0.28);
    color: #263238;
    font-size: 16px;
    font-weight: 800;
    min-width: 220px;
    padding: 22px 28px;
    text-align: center;
}

.loading-box::before {
    animation: spin 0.8s linear infinite;
    border: 3px solid #dce3ec;
    border-radius: 999px;
    border-top-color: #0f766e;
    content: "";
    display: block;
    height: 28px;
    margin: 0 auto 12px;
    width: 28px;
}

.modal-open {
    overflow: hidden;
}

.modal-backdrop-custom {
    align-items: center;
    background: rgba(15, 23, 32, 0.62);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: fixed;
    z-index: 6000;
}

.modal-dialog-custom {
    background: #ffffff;
    border: 1px solid #c7d3df;
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(15, 23, 32, 0.32);
    display: flex;
    flex-direction: column;
    max-height: 92vh;
    max-width: 1180px;
    overflow: hidden;
    width: min(1180px, 100%);
}

.modal-header-custom {
    align-items: center;
    background: #17324d;
    color: #ffffff;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 14px 18px;
}

.modal-header-custom span {
    color: #b9d0e4;
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 3px;
    text-transform: uppercase;
}

.modal-header-custom h2 {
    font-size: 18px;
    line-height: 1.25;
    margin: 0;
}

.modal-close {
    background: #ffffff;
    border: 1px solid #ffffff;
    border-radius: 6px;
    color: #17324d;
    cursor: pointer;
    font-weight: 900;
    min-height: 36px;
    padding: 0 14px;
}

.modal-body-custom {
    overflow: auto;
    padding: 16px;
}

.follow-summary {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.follow-summary div {
    background: #f7fafc;
    border: 1px solid #d9e3ec;
    border-radius: 6px;
    min-width: 0;
    padding: 9px 10px;
}

.follow-summary span {
    color: #66788a;
    display: block;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.follow-summary strong {
    color: #1f2933;
    display: block;
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.follow-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.follow-panel {
    border: 1px solid #d8e1ea;
    border-radius: 8px;
    min-width: 0;
    overflow: hidden;
}

.follow-panel-title {
    align-items: baseline;
    background: #f3f7fa;
    border-bottom: 1px solid #d8e1ea;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 10px 12px;
}

.follow-panel-title h3 {
    font-size: 15px;
    margin: 0;
}

.follow-panel-title span {
    color: #66788a;
    font-size: 12px;
    font-weight: 700;
}

.follow-table-wrap {
    max-height: 420px;
    overflow: auto;
}

.follow-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    min-width: 760px;
    width: 100%;
}

.follow-table th,
.follow-table td {
    border-bottom: 1px solid #e1e8ef;
    border-right: 1px solid #e1e8ef;
    padding: 7px 8px;
    vertical-align: top;
}

.follow-table th {
    background: #25313d;
    color: #ffffff;
    font-weight: 800;
    position: sticky;
    text-align: left;
    top: 0;
    z-index: 2;
}

.follow-table tbody tr:nth-child(even) {
    background: #f8fafb;
}

.follow-empty {
    color: #52616f;
    font-size: 13px;
    font-weight: 700;
    padding: 18px;
    text-align: center;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 980px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        position: static;
    }

    .summary {
        grid-template-columns: 1fr;
    }

    .monitor-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sismo-summary,
    .sismo-dashboard {
        grid-template-columns: 1fr;
    }

    .sismo-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nominal-lock {
        grid-template-columns: 1fr;
    }

    .nominal-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .follow-summary,
    .follow-grid {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        max-height: none;
    }
}

@media (max-width: 560px) {
    .filters {
        grid-template-columns: 1fr;
    }

    .topbar,
    .filters,
    .summary,
    .notes,
    .table-wrap,
    .pager,
    .message {
        margin-left: 12px;
        margin-right: 12px;
    }

    .topbar,
    .filters {
        margin-left: 0;
        margin-right: 0;
    }

    .topbar-actions {
        width: 100%;
    }

    .topbar-actions .secondary-button,
    .topbar-actions .nav-button {
        justify-content: center;
        width: 100%;
    }

    .monitor-summary {
        grid-template-columns: 1fr;
    }

    .sismo-summary,
    .sismo-filters {
        grid-template-columns: 1fr;
    }

    .sismo-dashboard {
        margin-left: 12px;
        margin-right: 12px;
    }

    .nominal-lock {
        margin-left: 12px;
        margin-right: 12px;
    }

    .nominal-toolbar {
        margin-left: 12px;
        margin-right: 12px;
    }
}
