:root {
    --primary-color: #143d59;
    --secondary-color: #f4b41a;
    --background-color: #f5f7fa;
    --text-color: #1b1b1b;
    --muted-color: #6c7a89;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #c0392b;
    --info-color: #2980b9;
    --card-bg: #ffffff;
    --border-radius: 14px;
    --shadow: 0 20px 35px rgba(20, 61, 89, 0.08);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background: var(--background-color);
    color: var(--text-color);
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, rgba(20, 61, 89, 0.95), rgba(20, 61, 89, 0.6)), url('https://images.unsplash.com/photo-1520607162513-77705c0f0d4a?auto=format&fit=crop&w=1400&q=80');
    background-size: cover;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 36px;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-card h1 {
    margin-bottom: 12px;
    font-size: 1.7rem;
    color: var(--primary-color);
}

.subtitle {
    color: var(--muted-color);
    margin-bottom: 24px;
}

label {
    display: block;
    text-align: left;
    font-weight: 600;
    margin-bottom: 8px;
}

label .info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35em;
    height: 1.35em;
    margin-left: 0.4rem;
    border-radius: 50%;
    background: var(--info-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: help;
    position: relative;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

label .info-icon:focus-visible {
    outline: 2px solid rgba(41, 128, 185, 0.4);
    outline-offset: 2px;
}

label .info-icon:hover,
label .info-icon:focus,
label .info-icon:focus-visible {
    transform: scale(1.05);
}

label .info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(27, 27, 27, 0.92);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.35;
    white-space: pre-line;
    box-shadow: 0 10px 25px rgba(20, 61, 89, 0.2);
    min-width: 200px;
    max-width: 320px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 20;
}

label .info-icon::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translate(-50%, 2px);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(27, 27, 27, 0.92) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 19;
}

label .info-icon:hover::after,
label .info-icon:hover::before,
label .info-icon:focus::after,
label .info-icon:focus::before,
label .info-icon:focus-visible::after,
label .info-icon:focus-visible::before {
    opacity: 1;
    visibility: visible;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select, textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #dfe6ed;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

select[multiple] {
    min-height: 160px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

.input-readonly {
    background: #f1f4f8;
    border-color: #d1d9e6;
    color: var(--muted-color);
    cursor: not-allowed;
}

.primary-button {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.primary-button:hover {
    background: #0f2d42;
}

.error {
    color: var(--danger-color);
    margin-top: 12px;
    min-height: 20px;
}

.captcha-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.captcha-text {
    background: #eef2f7;
    padding: 10px 16px;
    border-radius: 10px;
    letter-spacing: 6px;
    font-weight: bold;
}

.link-button {
    background: none;
    border: none;
    color: var(--info-color);
    cursor: pointer;
    font-weight: 600;
}

.main-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--primary-color);
    color: white;
    padding: 40px 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar h2 {
    margin: 0;
    font-size: 1.4rem;
    letter-spacing: 1px;
}

.sidebar nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    display: block;
    padding: 12px 0;
    font-weight: 500;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    color: white;
}

.sidebar-section {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 12px;
}

.sidebar-section-title {
    margin: 0 0 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-section a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    display: inline-block;
    padding: 4px 0;
    font-weight: 500;
}

.sidebar-section a:hover {
    color: white;
}

.content {
    padding: 36px 48px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card h3 {
    margin-top: 0;
    color: var(--muted-color);
    font-size: 0.95rem;
    letter-spacing: 1px;
}

.card .value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 10px;
}

.card-subtext {
    margin-top: 8px;
    color: var(--muted-color);
    font-size: 0.85rem;
}

.dashboard-overview {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.overview-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.overview-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.metric-card {
    border: none;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font: inherit;
    color: inherit;
}

.metric-card:hover,
.metric-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(20, 61, 89, 0.12);
}

.metric-card:focus-visible {
    outline: 3px solid rgba(244, 180, 26, 0.45);
    outline-offset: 3px;
}

.metric-card.metric-card--info {
    cursor: default;
}

.metric-card--wide {
    grid-column: span 2;
}

.metric-card--wide .metric-value {
    font-size: 2.6rem;
}

.metric-card--wide .metric-subtext {
    font-size: 0.9rem;
}

.metric-card--wide .metric-label {
    font-size: 0.95rem;
}

.metric-card--wide.metric-card--info {
    align-items: flex-start;
}

.metric-card.metric-card--info:hover,
.metric-card.metric-card--info:focus-visible {
    transform: none;
    box-shadow: var(--shadow);
    outline: none;
}

.metric-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.metric-subtext {
    display: block;
    font-size: 0.85rem;
    color: var(--muted-color);
}

@media (max-width: 900px) {
    .metric-card--wide {
        grid-column: span 1;
    }
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.chart-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-card canvas {
    width: 100%;
    min-height: 280px;
    height: clamp(260px, 35vh, 420px) !important;
    max-height: 420px;
}

.chart-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.chart-subtitle {
    margin: 0;
    color: var(--muted-color);
    font-size: 0.9rem;
}

.section-heading { 
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.section-heading h2 {
    margin: 0;
}

.section-heading .section-actions {
    margin-top: 8px;
}

.section-subtitle {
    margin: 0;
    color: var(--muted-color);
}

.modal-xxl {
    max-width: 960px;
    width: 95%;
}

.table-responsive {
    overflow-x: auto;
}

.section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 32px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
}

.section h2 {
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 1px solid #eef2f7;
    padding-bottom: 12px;
    margin-bottom: 24px;
}

.two-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px 24px;
}

textarea {
    min-height: 120px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    border-bottom: 1px solid #eef2f7;
    padding: 14px 18px;
    text-align: left;
}

.table-primary {
    font-weight: 600;
    color: var(--text-color);
}

.table-secondary {
    font-size: 0.8rem;
    color: var(--muted-color);
    margin-top: 4px;
}

.table tr.adenda-row td {
    background: #f9fbff;
    border-bottom-color: #e0e7f1;
}

.table tr.adenda-row td:first-child {
    padding-left: 42px;
}

.table tr.adenda-row .table-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.table tr.adenda-row .table-secondary {
    margin-left: 24px;
}

.table tr.adenda-row.adenda-row-depth-2 .table-secondary {
    margin-left: 48px;
}

.adenda-indent {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.contrato-codigo {
    display: inline-flex;
    align-items: center;
}

.table th {
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--muted-color);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.badge.verde { background: #1abc9c; }
.badge.amarillo { background: #f1c40f; color: #1b1b1b; }
.badge.naranja { background: #e67e22; }
.badge.rojo { background: #e74c3c; }
.badge.gris { background: #95a5a6; }
.badge.negro { background: #1b1b1b; color: #ffffff; }

.badge-inverse {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid currentColor;
    background: #ffffff;
    color: currentColor;
    white-space: nowrap;
}

.badge-inverse.verde { color: #1abc9c; }
.badge-inverse.naranja { color: #e67e22; }
.badge-inverse.rojo { color: #e74c3c; }
.badge-inverse.negro { color: #1b1b1b; }
.badge-inverse.gris { color: #7f8c8d; }

.dashboard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.dashboard-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filters-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-item {
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-item.autocomplete-item {
    position: relative;
}

.autocomplete-field {
    position: relative;
}

.autocomplete-field input {
    width: 100%;
}

.autocomplete-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #dfe6ed;
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 220px;
    overflow-y: auto;
    z-index: 20;
}

.autocomplete-results.visible {
    display: block;
}

.actions-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.hidden {
    display: none !important;
}

.secondary-button {
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
}

.danger-button {
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid var(--danger-color);
    background: var(--danger-color);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.danger-button:hover {
    background: #922b21;
    color: #ffffff;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.active {
    display: flex;
}

.table-wrapper {
    margin-top: 12px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.table.compact-table th,
.table.compact-table td {
    padding: 8px 10px;
}

.table.compact-table input,
.table.compact-table select,
.table.compact-table textarea {
    margin-bottom: 0;
    padding: 8px 10px;
    font-size: 0.9rem;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chip {
    background: rgba(20, 61, 89, 0.12);
    color: var(--primary-color);
    border-radius: 16px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.chip button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

#cliente-resultados,
#matriz-resultados,
#subcontratista-resultados,
#homologacion-cliente-resultados,
#homologacion-contratos-resultados {
    background: #ffffff;
    border: 1px solid #dfe6ed;
    border-radius: 10px;
    margin-top: 6px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: var(--shadow);
    z-index: 10;
}

.search-item {
    padding: 10px 14px;
    border-bottom: 1px solid #eef2f6;
    cursor: pointer;
    transition: background 0.15s ease;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: rgba(20, 61, 89, 0.08);
}

.search-item.disabled {
    color: var(--muted-color);
    cursor: default;
    background: #f8f9fb;
}

.icon-button {
    border: none;
    background: transparent;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
}

.resultados-lista {
    background: #ffffff;
    border: 1px solid #dfe6ed;
    border-radius: 10px;
    margin-top: 4px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: var(--shadow);
    z-index: 10;
    position: relative;
}

.resultados-lista button {
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 14px;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
}

.resultados-lista button:hover {
    background: rgba(20, 61, 89, 0.08);
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 32px;
    max-width: 960px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    position: relative;
}

#contrato-modal .modal-content {
    max-width: 1280px;
}

#contrato-modal .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
}

#contrato-modal .form-grid > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#contrato-modal .form-grid input,
#contrato-modal .form-grid select,
#contrato-modal .form-grid textarea {
    margin-bottom: 0;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--text-color);
    cursor: pointer;
    padding: 4px;
}

.modal-content.modal-wide {
    max-width: 1100px;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    gap: 16px;
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--muted-color);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 12px;
}

.help-text {
    font-size: 0.85rem;
    color: var(--muted-color);
    margin: 4px 0 0;
}

.import-preview {
    margin-top: 16px;
    max-height: 240px;
    overflow: auto;
    border: 1px solid #dfe6ed;
    border-radius: 12px;
    padding: 12px;
    background: #fbfdff;
}

.mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.mapping-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mapping-item select {
    margin-bottom: 0;
}

.fixed-input {
    padding: 10px 12px;
    border: 1px solid #dfe6ed;
    border-radius: 10px;
}

.import-result {
    margin-top: 12px;
}

.success-text {
    color: var(--success-color);
    font-weight: 600;
}

.error-text {
    color: var(--danger-color);
    font-weight: 600;
}

.error-list {
    margin-top: 8px;
    padding-left: 20px;
    color: var(--danger-color);
}

.preview-table th,
.preview-table td {
    white-space: nowrap;
    font-size: 0.85rem;
}

.table .empty {
    text-align: center;
    color: var(--muted-color);
}

.faq-guide {
    display: block;
}

.faq-header {
    margin-bottom: 24px;
}

.faq-header h1 {
    margin: 0;
    color: var(--primary-color);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.faq-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.faq-card h2 {
    margin-top: 0;
    color: var(--primary-color);
}

.faq-card ul {
    margin: 0;
    padding-left: 20px;
}

.faq-table-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}

.faq-table-card h2 {
    margin-top: 0;
    color: var(--primary-color);
}

.faq-table {
    width: 100%;
    border-collapse: collapse;
}

.faq-table th,
.faq-table td {
    padding: 12px 16px;
    border: 1px solid #e1e8f0;
    text-align: left;
    vertical-align: top;
}

.faq-table thead th {
    background: #eef3fb;
    color: var(--primary-color);
    font-weight: 700;
}

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

.faq-glossary dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px 24px;
    margin: 0;
}

.faq-glossary dt {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.faq-glossary dd {
    margin: 0;
    color: var(--muted-color);
    line-height: 1.5;
}

.modal-close:hover,
.modal-close:focus {
    color: var(--primary-color);
}

.attachments-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.attachments-list li {
    background: #f7fafc;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
}

.attachments-list li a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.attachments-list li a:hover,
.attachments-list li a:focus {
    text-decoration: underline;
}

.attachments-list .attachment-meta {
    font-size: 0.75rem;
    color: var(--muted-color);
    margin-top: 4px;
}

.attachments-list .attachment-category {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.attachments-list .attachment-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 4px;
}

.attachments-list .attachment-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.attachments-list .attachment-actions .danger-button {
    align-self: flex-start;
}

.attachments-list .empty {
    background: transparent;
    padding: 8px 0;
    color: var(--muted-color);
}

.associated-contracts-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.associated-contracts-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border: 1px solid #dfe6ed;
    border-radius: 12px;
    background: #f9fbff;
}

.associated-contracts-list .associated-info {
    flex: 1 1 240px;
}

.associated-contracts-list .associated-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.associated-contracts-list .associated-meta {
    color: var(--muted-color);
    font-size: 0.9rem;
}

.associated-contracts-list .associated-actions {
    display: flex;
    gap: 8px;
}

.associated-contracts-list .empty {
    background: transparent;
    border: none;
    padding: 12px 0;
    width: 100%;
    text-align: center;
    color: var(--muted-color);
}

.form-grid {
    display: grid;
    gap: 18px 24px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.modal-actions {
    display: flex;
    justify-content: stretch;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.modal-actions .primary-button,
.modal-actions .danger-button {
    flex: 1 1 50%;
    min-width: 180px;
    padding-inline: 24px;
}

.map-container {
    width: 100%;
    height: 320px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #dfe6ed;
    margin-bottom: 20px;
}

.table-actions {
    display: flex;
    gap: 12px;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(20, 61, 89, 0.35);
    backdrop-filter: blur(2px);
    z-index: 2000;
}

.loading-overlay[hidden] {
    display: none !important;
}

.loading-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 28px 36px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 4px solid rgba(20, 61, 89, 0.15);
    border-top-color: var(--primary-color);
    margin: 0 auto 8px;
    animation: dashboard-loading-spin 0.85s linear infinite;
}

.loading-title {
    margin: 0;
    font-weight: 600;
    color: var(--primary-color);
}

.loading-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: var(--muted-color);
}

.loading-detail {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted-color);
    word-break: break-word;
    display: none;
}

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

@media (max-width: 960px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .sidebar nav {
        display: flex;
        gap: 18px;
    }
}

/* Adenda UI styles */
.checkbox-item {
    min-width: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
}

.checkbox-item .checkbox-inline {
    margin-bottom: 0;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.checkbox-group {
    display: flex;
    gap: 16px;
    align-items: center;
}

.checkbox-inline input[type='checkbox'] {
    margin: 0;
    width: auto;
    height: auto;
}

.info-banner {
    border: 1px solid #dfe6ed;
    border-radius: 12px;
    background: #f1f6ff;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.info-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.section-heading.with-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.section-heading.with-actions h2 {
    margin-bottom: 0;
}

.section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.convertir-adenda {
    border: 1px solid #dfe6ed;
    border-radius: 12px;
    background: #f9fbff;
    padding: 16px;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.selector-input-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.selector-input-row input[type="text"] {
    flex: 1;
}

.selector-input-row button {
    white-space: nowrap;
}

.search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #dfe6ed;
    border-radius: 10px;
    max-height: 220px;
    overflow-y: auto;
    background: #ffffff;
}

.search-result-item {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    border-bottom: 1px solid #eef2f7;
    transition: background 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item:focus {
    background: #eef4ff;
}

.search-result-item.selected {
    background: #e3ecff;
    border-left: 4px solid var(--primary-color);
    padding-left: 12px;
}

.actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.result-title {
    font-weight: 600;
    color: var(--primary-color);
}

.result-meta {
    color: var(--muted-color);
    font-size: 0.85rem;
}

.selected-contract {
    border: 1px solid #dfe6ed;
    border-radius: 10px;
    padding: 12px 16px;
    background: #f9fbff;
    margin-top: 12px;
}

.selected-contract h4 {
    margin: 0 0 4px;
    font-size: 1rem;
    color: var(--primary-color);
}

.selected-contract p {
    margin: 0;
    color: var(--muted-color);
    font-size: 0.9rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    background: #e9eff6;
    color: var(--primary-color);
    margin-left: 8px;
}

.tag-adenda {
    background: rgba(244, 180, 26, 0.2);
    color: #8a5a00;
}

.tag-linea-negocio {
    background: rgba(76, 175, 80, 0.2);
    color: #1b5e20;
}
