﻿:root {
    --bg: #f7f5fb;
    --surface: #ffffff;
    --panel: #ffffff;
    --text: #1f1f1f;
    --muted: #5a5a6a;
    --border: rgba(0, 0, 0, 0.08);
    --accent: #e72285;
    --accent-strong: #470c9d;
    --danger: #d9534f;
    --success: #2fbf71;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

/* Grid de una columna para ubicar grÃ¡ficos verticales en dashboards */
.info-grid-single {
    grid-template-columns: 1fr !important;
    gap: 18px;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(rgba(231, 34, 133, 0.08) 2px, transparent 2px),
        radial-gradient(rgba(71, 12, 157, 0.08) 2px, transparent 2px),
        var(--bg);
    background-size: 44px 44px, 44px 44px, auto;
    background-position: 0 0, 22px 22px, 0 0;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

button {
    font: inherit;
}

#scrollBtn {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border: none;
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 10;
}

#scrollBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px rgba(71, 12, 157, 0.25);
}

.view {
    display: none;
    min-height: 100vh;
}

.login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
}

.shell {
    width: min(1080px, 100%);
}

.brand-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 18px;
}

.login-card {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 36px;
    background: linear-gradient(135deg, rgba(231, 34, 133, 0.12), rgba(71, 12, 157, 0.1));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 34px;
    box-shadow: var(--shadow);
}

.login-copy h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.login-copy .lead {
    color: var(--muted);
    line-height: 1.5;
    max-width: 480px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 24px;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.login-form label {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.95rem;
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(90, 200, 250, 0.2);
}

.error-message {
    display: none;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(217, 83, 79, 0.12);
    border: 1px solid rgba(217, 83, 79, 0.35);
    color: #a94442;
    font-size: 0.95rem;
}

.primary-btn {
    margin-top: 6px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(71, 12, 157, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(71, 12, 157, 0.35);
}
.primary-btn.danger {
    background: linear-gradient(135deg, #ef5350, #c62828);
    box-shadow: 0 10px 25px rgba(198, 40, 40, 0.25);
}
.primary-btn.danger:hover {
    box-shadow: 0 16px 28px rgba(198, 40, 40, 0.35);
}

.dashboard-view {
    display: none;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    background: linear-gradient(90deg, rgba(231, 34, 133, 1) 0%, rgba(71, 12, 157, 1) 70%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    color: #fff;
}

.navbar h2,
.navbar .eyebrow {
    color: #fff;
}

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

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 0;
    flex: 1;
    min-height: 0;
}

.sidebar {
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    position: relative;
    top: 0;
    backdrop-filter: blur(6px);
    align-self: stretch;
}

.sidebar-section {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.sidebar-link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 6px;
    border: 1px solid transparent;
}

.sidebar-link:hover {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-link.active {
    border-color: var(--accent);
    background: rgba(90, 200, 250, 0.08);
}

.content {
    padding: 24px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.user-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
}

.user-names small {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
}

.user-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(47, 191, 113, 0.15);
}

.ghost-btn {
    background: none;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.ghost-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(90, 200, 250, 0.05);
}

.info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.pill {
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid var(--border);
}

.pill.success {
    color: var(--success);
    background: rgba(107, 224, 162, 0.08);
    border-color: rgba(107, 224, 162, 0.4);
}

.hint {
    color: var(--muted);
    font-size: 0.95rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 18px 12px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(4px);
    margin-bottom: 18px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.panel-header h3 {
    font-size: 1.2rem;
    white-space: normal;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 4px;
}

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

.mail-layout {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 14px;
}

.mail-list-wrap {
    border-right: 1px solid var(--border);
    padding-right: 8px;
    min-height: 420px;
}

.mail-list,
.contact-list {
    list-style: none;
}

.mail-list li {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.mail-list li:hover {
    background: rgba(255, 255, 255, 0.03);
}

.mail-list li:last-child {
    border-bottom: none;
}

.mail-subject {
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}

.mail-from {
    color: var(--muted);
    font-size: 0.95rem;
}

.mail-date {
    color: var(--muted);
    font-size: 0.9rem;
    text-align: right;
}

.mail-fragment {
    color: var(--muted);
    grid-column: 1 / -1;
    font-size: 0.95rem;
    margin-top: 4px;
}

.contact-list li {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
}

.contact-list li:last-child {
    border-bottom: none;
}

.contact-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(90, 200, 250, 0.1);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 800;
}

.contact-name {
    color: var(--text);
    font-weight: 700;
}

.contact-meta {
    color: var(--muted);
    font-size: 0.95rem;
}

.state {
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed var(--border);
    background: rgba(231, 34, 133, 0.04);
    color: var(--muted);
    margin: 6px 0 8px;
}

.state-error {
    color: var(--danger);
    border-color: rgba(217, 83, 79, 0.4);
    background: rgba(217, 83, 79, 0.08);
}

.state-muted {
    color: var(--muted);
}

.mail-detail-pane {
    min-height: 420px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.mail-detail-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.mail-detail-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.mail-detail-body {
    color: var(--text);
    line-height: 1.5;
}

.mail-iframe {
    width: 100%;
    height: 460px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.action-card {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--text);
    background: rgba(255, 255, 255, 0.02);
    text-decoration: none;
    cursor: pointer;
}

.action-card:hover {
    border-color: var(--accent);
}

/* Modal redacciÃ³n */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 16px;
}

.modal-card {
    width: min(720px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 18px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.modal-card.large {
    width: min(900px, 100%);
}

.news-images-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.news-images-preview img {
    width: 90px;
    height: 70px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid transparent;
}

.news-images-preview img.is-cover {
    border-color: #6f2cf3;
}

.news-image-thumb {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.news-image-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: #111827;
    color: #ffffff;
    font-size: 16px;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0,0,0,0.25);
}

.news-video-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.news-video-thumb {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.news-video-preview video {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    background: #111827;
    pointer-events: none;
}

.news-video-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: #111827;
    color: #ffffff;
    font-size: 16px;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0,0,0,0.25);
}

.news-video-info {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: -6px;
}

.modal-card.full {
    width: 96%;
    height: 92vh;
    max-width: 1600px;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    margin: 0;
}

.modal-body {
    overflow-y: auto;
    padding: 4px 0 10px;
    max-height: calc(92vh - 140px);
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
}
.excel-table th,
.excel-table td {
    border: 1px solid rgba(0,0,0,0.06);
    padding: 6px 4px;
    background: #fafbfd;
}
.excel-table thead th {
    position: sticky;
    top: 0;
    background: #eef0f6;
    z-index: 2;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.excel-table td input,
.excel-table td textarea {
    width: 100%;
    border: 1px solid rgba(0,0,0,0.08);
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.88rem;
    min-width: 120px;
    box-sizing: border-box;
    background: transparent;
}
.excel-table td input:focus,
.excel-table td textarea:focus {
    outline: none;
    border-color: rgba(71,12,157,0.4);
    box-shadow: 0 0 0 2px rgba(71,12,157,0.12);
}
.excel-table tbody tr:nth-child(even) td {
    background: #f5f7fb;
}
.excel-table .row-num {
    text-align: center;
    width: 56px;
    font-weight: 600;
    color: var(--muted);
}

.excel-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0 12px;
    flex-wrap: wrap;
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
}

.sticky-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(4px);
}
.excel-toolbar input[type="color"] {
    width: 44px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}
.color-palette {
    display: inline-flex;
    gap: 6px;
    margin: 0 10px;
    vertical-align: middle;
}
.color-swatch {
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.color-swatch:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.paint-grid {
    display: grid;
    grid-template-columns: repeat(9, 22px);
    gap: 6px;
    margin: 0 12px;
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-right: 1px solid var(--border);
}
.toolbar-group:last-child {
    border-right: none;
}
.group-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.toolbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.ghost-btn.btn-small#applyText,
.ghost-btn.btn-small#toggleBold {
    min-width: 110px;
    font-weight: 600;
}
.ghost-btn.btn-small#toggleBold.active {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 6px 14px rgba(71,12,157,0.18);
}

.close-btn {
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--text);
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    cursor: pointer;
    padding: 0;
    display: grid;
    place-items: center;
}
.close-btn img {
    width: 22px;
    height: 22px;
    max-width: 22px;
    max-height: 22px;
    object-fit: contain;
    display: block;
    transition: transform 0.18s ease, filter 0.18s ease;
}
.close-btn:hover img {
    transform: scale(1.06);
    filter: drop-shadow(0 1px 4px rgba(0,0,0,0.18));
}

.compose-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.compose-form .modal-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(71,12,157,0.03) 0%, rgba(231,34,133,0.03) 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.compose-form .modal-body > label,
.compose-form .modal-body > .radio-stack {
    width: 100%;
}
.compose-form .label-title,
.compose-form .radio-label-title {
    font-weight: 700;
    color: var(--text);
    display: block;
    margin-bottom: 4px;
}
.compose-form .required-star {
    color: var(--accent);
    margin-left: 4px;
}
.compose-form .radio-stack {
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    display: grid;
    gap: 6px;
}
.compose-form input:read-only,
.compose-form textarea:read-only {
    background: rgba(0,0,0,0.04);
}

.compose-form label {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.95rem;
}

.compose-form input,
.compose-form textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
    padding: 6px 4px;
}

.compose-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.compose-actions .ghost-btn,
.compose-actions .primary-btn {
    min-width: 120px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    vertical-align: middle;
    padding: 0 14px;
    line-height: 1;
}
.compose-actions .primary-btn {
    margin-top: 0;
}
.compose-actions .ghost-btn {
    box-shadow: 0 8px 18px rgba(0,0,0,0.08);
    color: var(--accent);
    border: 1px solid var(--accent);
    background: #fff;
    margin-top: 0;
}
.compose-actions .ghost-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(0,0,0,0.12);
    border-color: var(--accent-strong);
    color: var(--accent-strong);
}

.table-wrap {
    width: 100%;
    overflow: auto;
    margin-bottom: 12px;
}

.table-thumb {
    width: 96px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.table-thumb.video-thumb {
    background: #111827;
}

.table-thumb.table-thumb-empty {
    background: #e5e7eb;
    border-style: dashed;
}
.table-thumb:hover {
    transform: scale(1.04);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.table-thumb.banner-thumb {
    width: 280px;
    height: 120px;
    margin: 0 auto;
}

#infoTable .table-thumb {
    width: 120px;
    height: 80px;
}

.view-image {
    width: 100%;
    max-width: 720px;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    object-fit: contain;
}

.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: center;
}

.data-table td,
.data-table th {
    vertical-align: middle;
}

.data-table td {
    height: 105px;
    padding-top: 8px;
    padding-bottom: 8px;
    line-height: 1.3;
}

.data-table td.table-actions {
    width: 140px;
    min-width: 140px;
    text-align: center;
}

.data-table tbody tr {
    height: 105px;
}
.scroll-x {
    overflow: auto;
}

/* Ajustes visuales tabla estilo Excel */
.excel-table {
    min-width: 1400px;
}
.excel-table th,
.excel-table td {
    padding: 8px 10px;
    font-size: 0.92rem;
    white-space: normal;
}
.excel-table thead th {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: normal;
}
.excel-table td input,
.excel-table td textarea {
    padding: 6px 8px;
    min-width: 150px;
}

/* Modal Excel: altura cÃ³moda con scroll interno */
.modal-card.full .modal-body {
    max-height: 75vh;
    overflow: auto;
}

/* Overrides para tabla Excel: textos completos y scroll cÃ³modo */
.excel-table th,
.excel-table td {
    padding: 8px 10px;
    font-size: 0.95rem;
    white-space: normal;
    width: auto;
    min-width: 140px;
}
.excel-table thead th {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: normal;
}
.excel-table td input,
.excel-table td textarea {
    padding: 6px 8px;
    min-width: 140px;
    white-space: normal;
}

/* Anchos mayores solo para columnas de texto largo en la tabla Excel */
.excel-table th:nth-child(2),
.excel-table td:nth-child(2),   /* Nombre */
.excel-table th:nth-child(7),
.excel-table td:nth-child(7),   /* DirecciÃ³n */
.excel-table th:nth-child(8),
.excel-table td:nth-child(8),   /* TelÃ©fonos */
.excel-table th:nth-child(9),
.excel-table td:nth-child(9),   /* Correo */
.excel-table th:nth-child(10),
.excel-table td:nth-child(10),  /* Sit. lab / Nivel */
.excel-table th:nth-child(16),
.excel-table td:nth-child(16),  /* Ayudas tÃ©cnicas */
.excel-table th:nth-child(17),
.excel-table td:nth-child(17),  /* DiagnÃ³stico */
.excel-table th:nth-child(18),
.excel-table td:nth-child(18),  /* Beneficios */
.excel-table th:nth-child(20),
.excel-table td:nth-child(20),  /* Ayudas necesita */
.excel-table th:nth-child(21),
.excel-table td:nth-child(21),  /* Acciones por hacer */
.excel-table th:nth-child(22),
.excel-table td:nth-child(22)   /* Cuidador/Redes */
{
    min-width: 700px;
}

/* Anchos compactos para columnas numÃ©ricas/cortas */
.excel-table th:nth-child(1),
.excel-table td:nth-child(1) { min-width: 60px; }
.excel-table th:nth-child(3),
.excel-table td:nth-child(3) { min-width: 140px; } /* RUT */
.excel-table th:nth-child(5),
.excel-table td:nth-child(5) { min-width: 90px; }  /* Edad */
.excel-table th:nth-child(13),
.excel-table td:nth-child(13) { min-width: 90px; } /* Grado */
.excel-table th:nth-child(20),
.excel-table td:nth-child(20) { min-width: 100px; }/* RSH */

/* Inputs/textarea en columnas numÃ©ricas mÃ¡s pequeÃ±as */
.excel-table td:nth-child(1) input,
.excel-table td:nth-child(3) input,
.excel-table td:nth-child(5) input,
.excel-table td:nth-child(13) input,
.excel-table td:nth-child(20) input {
    min-width: 110px;
}
.modal-card.full .modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 75vh;
    overflow: hidden;
}
.modal-card.full .table-wrap.scroll-x {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* Dash Discapacidad: estadÃ­sticas */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    align-items: stretch;
    justify-items: center;
}
.stats-left .chart-grid {
    justify-items: start;
}
.chart-card .chart-grid {
    justify-items: start;
}

.chart-grid canvas {
    width: 100% !important;
    height: 250px !important;
    max-width: 520px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15,23,42,0.16);
    padding: 12px;
    box-sizing: border-box;
}

.chart-card .chart-grid canvas {
    margin: 0;
    display: block;
}

#discChartMetric {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(71,12,157,0.14);
    background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(240,240,255,0.92));
    font-size: 0.95rem;
    max-width: 320px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

.info-card .icon {
    background: rgba(231,34,133,0.12);
}

.info-card h3 {
    letter-spacing: 0.01em;
}

.info-card p {
    font-size: 1rem;
}

/* Stack charts vertical in discapacidad dashboard */
.chart-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.chart-stack .info-card {
    width: 100%;
}
.chart-stack .chart-grid {
    justify-items: start;
}
.chart-stack .chart-grid canvas {
    max-width: 100%;
}

/* Layout estadÃ­sticas */
.stats-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 22px;
    align-items: start;
    width: 100%;
}
.stats-layout.pro {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}
.stats-layout .info-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.stats-layout .info-card .icon {
    margin: 0;
    background: transparent;
    box-shadow: none;
    color: #470c9d;
}
.stats-left .info-card,
.stats-right .info-card {
    text-align: left;
}
.stats-left .info-card p {
    font-size: 1.05rem;
}
.chart-inline {
    justify-items: center;
}
.stats-right .info-card {
    height: 100%;
    align-self: stretch;
}
.stats-right .chart-grid canvas {
    height: 240px !important;
    max-width: 520px;
}
#discChartMain {
    max-width: 520px;
    width: 100% !important;
    height: 520px !important;
}
/* Panel de estadÃ­sticas */
.stats-panel .panel-body {
    padding: 22px 24px;
    border-radius: 18px;
}

/* Nueva disposiciÃ³n profesional */
.stats-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.metrics-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}
.metric-card {
    align-items: center;
    text-align: left;
}
.stats-layout.pro .info-card h3 {
    font-size: 0.95rem;
}
.metric-card .metric-copy h3 {
    margin: 2px 0 0 0;
    font-size: 1.1rem;
}
.metric-card .metric-copy .eyebrow {
    font-size: 0.9rem;
    color: #6b7280;
}
.stats-right .info-card h3 {
    font-size: 1.08rem;
}

.stats-panel .panel-body {
    padding: 20px;
}
.stats-shell {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 18px 40px rgba(15,23,42,0.08);
    min-height: 420px;
    display: grid;
    gap: 20px;
    width: 100%;
    overflow: hidden;
}
.stats-panel .info-card {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 8px 18px rgba(15,23,42,0.06);
    position: relative;
}
.stats-panel .info-card .icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(71,12,157,0.08);
    color: #3a0f7a;
    display: grid;
    place-items: center;
}
.stats-panel h3,
.stats-panel .chart-title {
    font-size: 0.98rem;
    letter-spacing: 0.01em;
}
.stats-panel .metric-card {
    gap: 10px;
    align-items: center;
    border-left: 4px solid rgba(71,12,157,0.5);
    padding-left: 14px;
    min-height: 86px;
}
.stats-panel .metric-card .metric-copy h3 {
    font-size: 1.05rem;
    font-weight: 700;
}
.stats-panel .metric-card .metric-copy .eyebrow {
    font-weight: 600;
    color: #4a4a4a;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.75rem;
}
.stats-right .interactive-card {
    padding: 18px;
    background: #f9f9fe;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.stats-right .chart-grid {
    justify-items: center;
}
.stats-right .chart-grid canvas,
#discChartMain {
    max-width: 100% !important;
}
.stats-panel select {
    background: #ffffff;
    border-color: rgba(71,12,157,0.2);
    font-weight: 600;
    color: #2d2d2d;
}
.interactive-card .chart-head {
    align-items: flex-start;
}
.interactive-card .chart-head .eyebrow {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #7a7a7a;
}
.interactive-card .controls-card {
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 14px;
    padding: 10px;
    gap: 10px;
    width: 100%;
}
.interactive-card .controls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.interactive-card .controls-inline {
    gap: 12px;
}
.interactive-card .field {
    background: transparent;
    border: none;
    padding: 0;
}
.interactive-card .label-title {
    font-size: 0.88rem;
}
.interactive-card select {
    width: 100%;
}
.interactive-card .control-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f7f7fb;
    border: 1px solid rgba(0,0,0,0.06);
}
.interactive-card .chart-grid canvas {
    height: 320px !important;
    max-width: 100% !important;
}
.interactive-card .chart-grid {
    width: 100%;
    margin-top: 4px;
}
.interactive-card .export-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
    margin-left: auto;
    width: 100%;
}
.env-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}
.env-card .table-wrap {
    max-height: 520px;
    overflow: auto;
}
.modal-body .modal-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.modal-body .modal-row:last-child {
    border-bottom: none;
}
.modal-label {
    font-weight: 600;
    color: #4a4a4a;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.modal-value {
    color: #1f1f1f;
}
.env-modal .modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.08);
    padding-bottom: 12px;
    gap: 12px;
}
.env-modal .modal-body {
    padding-top: 12px;
}
.env-modal {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 20px 48px rgba(15,23,42,0.12);
}
.env-modal .modal-header h3 {
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}
.denuncia-modal-grid {
    background: #fafbff;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid rgba(0,0,0,0.05);
}
.denuncia-details {
    background: #ffffff;
    border-radius: 14px;
    padding: 14px;
    border: 1px solid rgba(0,0,0,0.06);
}
.denuncia-evidence {
    background: #ffffff;
    border-radius: 14px;
    padding: 14px;
    border: 1px solid rgba(0,0,0,0.06);
}
.denuncia-modal-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
}
.denuncia-evidence h4 {
    margin: 0 0 10px;
    font-size: 1rem;
    letter-spacing: 0.01em;
}
.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.evidence-card {
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 10px 22px rgba(15,23,42,0.10);
}
.evidence-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease, filter 0.2s ease;
}
.evidence-card:hover img {
    transform: scale(1.06);
    filter: brightness(1.08) saturate(1.1);
}
.evidence-card::after {
    content: 'Ver';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: linear-gradient(180deg, rgba(0,0,0,0.0), rgba(0,0,0,0.45));
    pointer-events: none;
}
.evidence-card:hover::after {
    opacity: 1;
}
.evidence-card {
    position: relative;
}
.evidence-link,
.evidence-empty {
    display: block;
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed rgba(0,0,0,0.12);
    background: #fafafb;
    text-align: center;
    color: #4a4a4a;
    text-decoration: none;
}
@media (max-width: 900px) {
    .denuncia-modal-grid {
        grid-template-columns: 1fr;
    }
}
.lightbox .lightbox-card {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: transparent;
    padding: 0;
    border-radius: 16px;
    display: grid;
    place-items: center;
    gap: 12px;
}
.lightbox #lightboxImage {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
}
.lightbox #viewImage {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
}
.lightbox .lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #ffffff;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
}
.lightbox .lightbox-card.zoomed .lightbox-nav {
    opacity: 0;
    pointer-events: none;
}
.lightbox .lightbox-nav i {
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}
.lightbox .lightbox-nav {
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}
.lightbox .lightbox-nav.prev { left: -52px; }
.lightbox .lightbox-nav.next { right: -52px; }
.lightbox .close-btn {
    position: absolute;
    top: -32px;
    right: -32px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    display: grid;
    place-items: center;
}
.lightbox .close-btn img {
    filter: invert(1);
}
.lightbox-counter {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,0.45);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
}
.lightbox #lightboxImage.is-zoomed {
    transform: scale(1.4);
    cursor: zoom-out;
}
.lightbox #lightboxImage {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}
@media (max-width: 900px) {
    .env-grid {
        grid-template-columns: 1fr;
    }
    .modal-body .modal-row {
        grid-template-columns: 1fr;
    }
}
.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(31,122,57,0.6);
    background: #ffffff;
    color: #4a4a4a;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15,23,42,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.export-btn i {
    color: #1f7a39;
}
.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15,23,42,0.12);
}
.chart-card,
.sectors-card,
.interactive-card {
    padding: 18px;
    border-radius: 16px;
}
.chart-card,
.sectors-card,
.interactive-card {
    min-height: 320px;
}
.chart-card .chart-grid canvas,
.sectors-card .chart-grid canvas,
.interactive-card .chart-grid canvas {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 14px 28px rgba(15,23,42,0.08);
    max-width: 100%;
}
.interactive-card .controls-grid .field {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 10px;
}
.interactive-card .controls-grid {
    gap: 10px;
}
.chart-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.chart-title {
    margin: 0;
    font-size: 0.98rem;
}
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.controls-grid .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.controls-grid select {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(71,12,157,0.14);
    background: #fff;
    box-shadow: 0 8px 22px rgba(0,0,0,0.06);
    font-size: 0.95rem;
}
.controls-grid label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #3a3a3a;
    letter-spacing: 0.01em;
    display: block;
}
.sectors-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sectors-card .sector-head {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sectors-card .sector-head .icon {
    margin: 0;
}
.sectors-list {
    padding-left: 20px !important;
    margin: 0 !important;
}
.sectors-card .chart-grid {
    justify-items: start;
}
.sector-head .icon {
    margin: 0;
    background: transparent;
    box-shadow: none;
    color: #470c9d;
}

@media (max-width: 768px) {
    .chart-grid canvas {
        height: 240px !important;
    }
    .stats-layout {
        grid-template-columns: 1fr;
    }
    .stats-layout.pro {
        grid-template-columns: 1fr;
    }
}

.sector-chart {
    height: 280px !important;
}

/* RUT en una sola lÃ­nea en dashboard principal */
.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    white-space: nowrap;
}
.scroll-x {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 10px;
    text-align: left;
}

.data-table th:first-child,
.data-table td:first-child {
    width: 320px;
}

.data-table th:last-child,
.data-table td:last-child {
    width: 160px;
    text-align: center;
}


.data-table th {
    background: rgba(0, 0, 0, 0.03);
    font-weight: 700;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
}

#bannerTable th:nth-child(2),
#bannerTable td:nth-child(2),
#infoTable th:nth-child(2),
#infoTable td:nth-child(2),
#newsTable th:nth-child(3),
#newsTable td:nth-child(3) {
    white-space: normal;
    word-break: break-word;
}

#bannerTable td:nth-child(2),
#infoTable td:nth-child(2),
#newsTable td:nth-child(3),
#modalTable td:nth-child(2) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tabla Juventud: evitar sobreposiciones */
#juventudTable {
    table-layout: fixed;
}

#juventudTable th:nth-child(1),
#juventudTable td:nth-child(1) { width: 22ch; }
#juventudTable th:nth-child(2),
#juventudTable td:nth-child(2) { width: 6ch; }
#juventudTable th:nth-child(3),
#juventudTable td:nth-child(3) { width: 22ch; }
#juventudTable th:nth-child(4),
#juventudTable td:nth-child(4) { width: 14ch; }
#juventudTable th:nth-child(5),
#juventudTable td:nth-child(5) { width: 28ch; }
#juventudTable th:nth-child(6),
#juventudTable td:nth-child(6) { width: 12ch; }
#juventudTable th:nth-child(7),
#juventudTable td:nth-child(7) { width: 14ch; }

#juventudTable td:nth-child(1),
#juventudTable td:nth-child(3),
#juventudTable td:nth-child(5) {
    white-space: normal;
    word-break: break-word;
}

#juventudTable td:nth-child(6) .badge {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
}

/* Tabla Modal inicio */
#modalTable {
    table-layout: fixed;
}

#modalTable th:nth-child(1),
#modalTable td:nth-child(1) { width: 140px; }
#modalTable th:nth-child(2),
#modalTable td:nth-child(2) { width: auto; }
#modalTable th:nth-child(3),
#modalTable td:nth-child(3) { width: 120px; text-align: center; }
#modalTable th:nth-child(4),
#modalTable td:nth-child(4) { width: 160px; text-align: center; }

#modalTable td:nth-child(2) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#modalTable .table-thumb {
    width: 110px;
    height: 80px;
    border-radius: 12px;
}

#modalTable .switch {
    margin: 0 auto;
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(71, 12, 157, 0.1);
    color: var(--accent-strong);
    font-size: 0.85rem;
    border: 1px solid var(--border);
}

/* Switch simple */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.15);
    transition: 0.2s ease;
    border-radius: 999px;
}
.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    transition: 0.2s ease;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-slider {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}
.switch input:checked + .switch-slider:before {
    transform: translateX(20px);
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.9rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    color: inherit;
}

.icon-btn img {
    width: 16px;
    height: 16px;
}

.icon-btn.edit {
    border-color: rgba(244, 197, 66, 0.5);
    color: #f4c542;
}

.icon-btn.edit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(244, 197, 66, 0.28);
    background: rgba(244, 197, 66, 0.08);
}

.icon-btn.delete {
    border-color: rgba(217, 83, 79, 0.4);
    color: #d9534f;
}

.icon-btn.delete:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(217, 83, 79, 0.18);
    background: rgba(217, 83, 79, 0.08);
}
.icon-btn[title] {
    position: relative;
}
.icon-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2d2f3a, #1f222c);
    color: #f5f7fb;
    padding: 8px 12px;
    border-radius: 10px;
    white-space: nowrap;
    font-size: 0.82rem;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 12px 28px rgba(0,0,0,0.32);
    z-index: 5;
    pointer-events: none;
}
/* small arrow */
.icon-btn[title]:hover::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #2d2f3a;
    margin-bottom: 4px;
    z-index: 4;
}

.icon-btn.add {
    border-color: rgba(47, 191, 113, 0.5);
    color: #2fbf71;
}

.icon-btn.add:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(47, 191, 113, 0.28);
    background: rgba(47, 191, 113, 0.08);
}

.icon-btn.table-btn {
    border-color: rgba(71, 12, 157, 0.5);
    color: #470c9d;
    background: #fff;
}
.icon-btn.table-btn img {
    width: 16px;
    height: 16px;
    filter: invert(21%) sepia(71%) saturate(3164%) hue-rotate(259deg) brightness(92%) contrast(101%);
}
.icon-btn.table-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(71, 12, 157, 0.22);
    background: rgba(71, 12, 157, 0.06);
}

/* Fuerza color de los SVG (cargados como <img>) */
.icon-btn.edit img {
    /* amarillo mÃ¡s oscuro */
    filter: invert(68%) sepia(85%) saturate(451%) hue-rotate(3deg) brightness(95%) contrast(94%);
}
.icon-btn.delete img {
    /* rojo similar a pdf-icon */
    filter: invert(24%) sepia(95%) saturate(3038%) hue-rotate(349deg) brightness(100%) contrast(105%);
}
.icon-btn.add img {
    /* verde */
    filter: invert(58%) sepia(76%) saturate(410%) hue-rotate(84deg) brightness(95%) contrast(94%);
}
.icon-btn.view {
    border-color: rgba(52, 152, 219, 0.5);
    color: #3498db;
    width: 34px;
    height: 34px;
    padding: 0;
    min-width: 34px;
    min-height: 34px;
}
.icon-btn.view img {
    width: 16px;
    height: 16px;
    max-width: 16px;
    max-height: 16px;
    object-fit: contain;
    display: block;
    margin: auto;
    filter: invert(58%) sepia(66%) saturate(404%) hue-rotate(170deg) brightness(96%) contrast(95%);
}
.icon-btn.view:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(52,152,219,0.25);
    background: rgba(52,152,219,0.08);
}
.icon-btn.refresh {
    width: auto;
    min-width: 46px;
    height: 40px;
    padding: 0 12px;
    gap: 8px;
    border-radius: 12px;
    border-color: rgba(0,0,0,0.12);
    background: #fff;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}
.icon-btn.refresh img {
    width: 18px;
    height: 18px;
}
.icon-btn.refresh:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.96);
}
.icon-btn.reply {
    width: auto;
    min-width: 46px;
    height: 40px;
    padding: 0 12px;
    gap: 8px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.12);
    background: #fff;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}
.icon-btn.reply img {
    width: 18px;
    height: 18px;
}
.icon-btn.reply:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.96);
}
#composeBtn.icon-btn {
    width: auto;
    min-width: 46px;
    height: 40px;
    padding: 0 14px;
    gap: 8px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    box-shadow: 0 10px 25px rgba(71, 12, 157, 0.25);
}
#composeBtn.icon-btn img {
    width: 18px;
    height: 18px;
    filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(105%) contrast(105%);
}
#composeBtn.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(71, 12, 157, 0.32);
}

.filters-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.search-box {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    min-width: 260px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.footer {
    border-top: 1px solid var(--border);
    padding: 18px;
    background: linear-gradient(90deg, rgba(231, 34, 133, 1) 0%, rgba(71, 12, 157, 1) 70%);
    text-align: center;
    color: #fff;
    margin-top: auto;
}

.footer-content {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.footer-logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
}

@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: relative;
        top: 0;
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    .login-card {
        grid-template-columns: 1fr;
    }
    .mail-layout {
        grid-template-columns: 1fr;
    }
    .content {
        padding: 18px;
    }
}

@media (max-width: 520px) {
    .mail-list li {
        grid-template-columns: 1fr;
    }
    .mail-date {
        text-align: left;
    }
    #scrollBtn {
        right: 12px;
        bottom: 12px;
    }
}

/* === ValidaciÃ³n visual para modales (tomado del formulario pÃºblico) === */
.is-invalid {
    border-color: #d93025 !important;
    box-shadow: 0 0 0 3px rgba(217,48,37,0.16) !important;
}
.field-error {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #d93025;
    opacity: 0;
    transform: translateY(-4px);
    animation: fadeDown 0.18s ease forwards;
}
.radio-stack.is-invalid {
    border-color: #d93025 !important;
    box-shadow: 0 0 0 3px rgba(217,48,37,0.12) !important;
}
@keyframes fadeDown {
    to { opacity: 1; transform: translateY(0); }
}
.shake {
    animation: shake 0.22s ease;
}
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

/* Toast mensajes */
.toast-msg {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -10px);
    min-width: 280px;
    text-align: center;
    padding: 14px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    box-shadow: 0 16px 32px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1400;
}
.toast-msg.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Ajustes especificos para Discapacidad (no afectar otras tablas) */
#discTable {
    table-layout: auto;
}

#discTable th,
#discTable td {
    padding: 10px 12px;
    white-space: normal;
}

#discTable th:nth-child(2),
#discTable td:nth-child(2) {
    white-space: nowrap;
}

#discTable td,
#discTable tbody tr {
    height: var(--disc-row-h);
}

#discTableWrap {
    --disc-row-h: 88px;
    min-height: calc(var(--disc-row-h) * 15 + 56px);
}

#discTable th:first-child,
#discTable td:first-child,
#discTable th:last-child,
#discTable td:last-child {
    width: auto;
}

#discTable td.table-actions {
    width: auto;
    min-width: 0;
}

/* Modal Excel de Discapacidad: columnas segun label */
#discFullTable {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

#discFullTable th,
#discFullTable td {
    padding: 2px 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.05;
}

#discFullTable td input,
#discFullTable td textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 2px 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 24px;
}

#discFullTable th:nth-child(1),
#discFullTable td:nth-child(1) { width: 5ch; }
#discFullTable th:nth-child(2),
#discFullTable td:nth-child(2) { width: 18ch; }
#discFullTable th:nth-child(3),
#discFullTable td:nth-child(3) { width: 12ch; }
#discFullTable th:nth-child(4),
#discFullTable td:nth-child(4) { width: 11ch; }
#discFullTable th:nth-child(5),
#discFullTable td:nth-child(5) { width: 6ch; }
#discFullTable th:nth-child(6),
#discFullTable td:nth-child(6) { width: 9ch; }
#discFullTable th:nth-child(7),
#discFullTable td:nth-child(7) { width: 18ch; }
#discFullTable th:nth-child(8),
#discFullTable td:nth-child(8) { width: 12ch; }
#discFullTable th:nth-child(9),
#discFullTable td:nth-child(9) { width: 22ch; }
#discFullTable th:nth-child(10),
#discFullTable td:nth-child(10) { width: 34ch; }
#discFullTable th:nth-child(11),
#discFullTable td:nth-child(11) { width: 28ch; }
#discFullTable th:nth-child(12),
#discFullTable td:nth-child(12) { width: 18ch; }
#discFullTable th:nth-child(13),
#discFullTable td:nth-child(13) { width: 14ch; }
#discFullTable th:nth-child(14),
#discFullTable td:nth-child(14) { width: 18ch; }
#discFullTable th:nth-child(15),
#discFullTable td:nth-child(15) { width: 24ch; }
#discFullTable th:nth-child(16),
#discFullTable td:nth-child(16) { width: 26ch; }
#discFullTable th:nth-child(17),
#discFullTable td:nth-child(17) { width: 16ch; }
#discFullTable th:nth-child(18),
#discFullTable td:nth-child(18) { width: 20ch; }
#discFullTable th:nth-child(19),
#discFullTable td:nth-child(19) { width: 8ch; }
#discFullTable th:nth-child(20),
#discFullTable td:nth-child(20) { width: 26ch; }
#discFullTable th:nth-child(21),
#discFullTable td:nth-child(21) { width: 20ch; }
#discFullTable th:nth-child(22),
#discFullTable td:nth-child(22) { width: 26ch; }

#discFullScroll {
    height: 14px;
    margin: 6px 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.03);
    overflow-x: auto;
    overflow-y: hidden;
}

#discFullScroll .scrollbar-spacer {
    height: 1px;
    width: 0;
}


