:root {
    --bg: #07111f;
    --bg-elevated: #0d1b2f;
    --surface: rgba(10, 19, 33, 0.88);
    --surface-strong: #11233b;
    --surface-soft: #162a44;
    --border: rgba(153, 180, 214, 0.16);
    --border-strong: rgba(130, 180, 255, 0.3);
    --text: #edf4ff;
    --text-soft: #bdd0ea;
    --text-muted: #87a3c2;
    --title: #ffffff;
    --primary: #38bdf8;
    --primary-strong: #0284c7;
    --primary-soft: rgba(56, 189, 248, 0.14);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.16);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.16);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.16);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 12px;
    --font-sans: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 28%),
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.08), transparent 24%),
        linear-gradient(180deg, #06111d 0%, #071321 38%, #08111d 100%);
}

body.app-shell {
    overflow-x: hidden;
}

body[data-theme="light"] {
    --bg: #eef3f8;
    --bg-elevated: #ffffff;
    --surface: rgba(255, 255, 255, 0.96);
    --surface-strong: #ffffff;
    --surface-soft: #eef4fb;
    --border: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(2, 132, 199, 0.18);
    --text: #163047;
    --text-soft: #26445f;
    --text-muted: #5f7993;
    --title: #0f172a;
    --primary-soft: rgba(2, 132, 199, 0.1);
    --success-soft: rgba(34, 197, 94, 0.12);
    --warning-soft: rgba(245, 158, 11, 0.12);
    --danger-soft: rgba(239, 68, 68, 0.12);
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

a {
    color: inherit;
}

.sidebar {
    width: 270px;
    height: 100vh;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 28px 20px;
    background: linear-gradient(180deg, rgba(7, 18, 31, 0.98), rgba(11, 24, 41, 0.97));
    border-right: 1px solid var(--border);
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.24);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(125, 211, 252, 0.45) transparent;
}

.logo {
    margin: 0;
    color: var(--title);
    font-size: 1.75rem;
    letter-spacing: 0.04em;
}

.sidebar-subtitle {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.94rem;
}

.sidebar-section-label {
    padding: 10px 12px 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

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

.menu li {
    margin: 0;
}

.menu a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid transparent;
    text-decoration: none;
    color: var(--text-soft);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.menu a:hover,
.menu a.active {
    color: var(--title);
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.16), rgba(14, 165, 233, 0.10));
    border-color: rgba(56, 189, 248, 0.24);
    transform: translateX(3px);
}

.menu-link-with-badge {
    display: flex;
}

.menu-badge-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
}

.sidebar-footer-note {
    margin-top: auto;
    padding: 14px 15px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.88rem;
}

.main-container {
    margin-left: 270px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 26px 30px 18px;
    background: linear-gradient(180deg, rgba(7, 17, 31, 0.96), rgba(7, 17, 31, 0.78), transparent);
    backdrop-filter: blur(16px);
}

.header-left h1 {
    margin: 0;
    color: var(--title);
    font-size: 2rem;
}

.header-left p {
    margin: 8px 0 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 13px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    background: var(--primary-soft);
    border-color: var(--border-strong);
}

.theme-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.content {
    flex: 1;
    padding: 10px 30px 32px;
}

.footer {
    padding: 18px 30px 28px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.94rem;
}

.card,
.auth-card,
.error-card,
.global-handoff-alert,
.toast {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(17, 31, 51, 0.96), rgba(11, 22, 37, 0.96));
    box-shadow: var(--shadow);
}

body[data-theme="light"] .card,
body[data-theme="light"] .auth-card,
body[data-theme="light"] .error-card,
body[data-theme="light"] .global-handoff-alert,
body[data-theme="light"] .toast {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.98));
}

.card {
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
}

.page-header h2,
.stats-block-title,
.table-header h3,
.section-heading h3,
.info-panel h3,
.error-card h2 {
    margin: 0;
    color: var(--title);
}

.page-header h2 {
    font-size: 2rem;
}

.page-subtitle,
.section-heading p,
.table-header p,
.metric-card p,
.next-step-box p,
.info-panel p,
.auth-brand p,
.pagination-info,
.empty-state,
.empty-cell,
.text-muted {
    color: var(--text-muted);
}

.page-subtitle {
    margin: 10px 0 0;
    max-width: 900px;
    line-height: 1.7;
}

.dashboard-grid,
.dashboard-content-grid,
.settings-grid,
.form-grid,
.price-grid {
    display: grid;
    gap: 20px;
}

.dashboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 24px;
}

.dashboard-content-grid,
.settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 24px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.price-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.metric-card,
.dashboard-section,
.settings-section,
.form-card,
.table-card,
.stats-filter-card,
.conversation-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.metric-card {
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), rgba(34, 197, 94, 0.7));
}

.metric-label {
    display: inline-flex;
    width: fit-content;
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.metric-card h3,
.price-card strong {
    margin: 0;
    color: var(--title);
    font-size: 1.9rem;
}

.detail-list,
.checklist,
.batch-report,
.quick-replies-panel,
.conversation-thread,
.global-handoff-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.check-item,
.detail-item,
.info-panel,
.empty-state,
.import-error-item,
.global-handoff-item {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}

.detail-item,
.check-item,
.global-handoff-item,
.message-meta,
.global-handoff-alert-main,
.table-header,
.filters-actions,
.pagination,
.page-actions,
.table-actions,
.form-actions,
.user-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.detail-item-stack {
    align-items: flex-start;
}

.detail-item-stack strong {
    max-width: 320px;
    text-align: right;
    word-break: break-word;
}

.settings-form,
.auth-form,
.soat-inline-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.form-group label,
.checkbox-label,
.quick-replies-label {
    color: var(--text-soft);
    font-weight: 700;
    font-size: 0.94rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bulk-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin: 18px 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, rgba(56, 189, 248, 0.07), transparent 46%),
        rgba(255, 255, 255, 0.025);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.bulk-actions.has-selection {
    border-color: rgba(56, 189, 248, 0.28);
    background:
        linear-gradient(135deg, rgba(56, 189, 248, 0.12), transparent 52%),
        rgba(255, 255, 255, 0.035);
    box-shadow: 0 12px 28px rgba(2, 132, 199, 0.08);
}

.bulk-actions-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
}

.bulk-select-all {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
}

.bulk-select-all > input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.custom-checkbox,
.selection-column input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    min-height: 20px;
    border: 1px solid rgba(130, 180, 255, 0.38);
    border-radius: 6px;
    background: rgba(7, 17, 31, 0.68);
}

.custom-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.custom-checkbox svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: #fff;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transform: scale(0.65);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.bulk-select-all > input:checked + .custom-checkbox,
.bulk-select-all > input:indeterminate + .custom-checkbox {
    border-color: var(--primary);
    background: linear-gradient(135deg, #38bdf8, #0284c7);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.bulk-select-all > input:checked + .custom-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

.bulk-select-all > input:indeterminate + .custom-checkbox::after {
    width: 10px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
    content: "";
}

.bulk-select-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bulk-select-copy strong {
    color: var(--text);
    font-size: 0.92rem;
}

.bulk-select-copy small {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.selection-column input {
    width: 18px;
    height: 18px;
    min-height: 18px;
    accent-color: var(--primary-strong);
    cursor: pointer;
}

.selected-count {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.selected-count strong {
    color: var(--primary);
    font-size: 0.95rem;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 40px;
    border: 1px solid rgba(248, 113, 113, 0.42);
    border-radius: 13px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    padding: 11px 16px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(185, 28, 28, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn-danger svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(185, 28, 28, 0.3);
}

.btn-danger:disabled {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.045);
    color: var(--text-muted);
    box-shadow: none;
}

.selection-column {
    width: 42px;
    text-align: center;
}

.modern-table tbody tr {
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.modern-table tbody tr.is-selected {
    background: rgba(56, 189, 248, 0.075);
    box-shadow: inset 3px 0 0 var(--primary);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(130, 154, 185, 0.24);
    border-radius: 14px;
    background: rgba(7, 17, 31, 0.72);
    color: var(--text);
    padding: 13px 14px;
    font: inherit;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input,
select {
    min-height: 48px;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #6f8aab;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.14);
}

.btn-primary,
.btn-secondary,
.btn-whatsapp,
.btn-logout,
.global-handoff-link,
.toast-btn,
.stats-filter-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.btn-primary,
.toast-btn,
.stats-filter-link.active {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    box-shadow: 0 12px 30px rgba(2, 132, 199, 0.24);
}

.btn-secondary,
.btn-logout,
.stats-filter-link {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
    color: var(--text-soft);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #22c55e, #15803d);
    color: #fff;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-whatsapp:hover,
.btn-logout:hover,
.global-handoff-link:hover,
.toast-btn:hover,
.stats-filter-link:hover {
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

.btn-small {
    min-height: 38px;
    padding: 9px 12px;
    font-size: 0.86rem;
}

button {
    font: inherit;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

.alert,
.header-flash {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    line-height: 1.6;
}

.alert-success,
.flash-success,
.success-card,
.batch-ok {
    background: var(--success-soft);
    border-color: rgba(34, 197, 94, 0.3);
    color: #ccfbe0;
}

.alert-error,
.flash-error,
.error-card,
.batch-fail {
    background: var(--danger-soft);
    border-color: rgba(239, 68, 68, 0.28);
    color: #ffd8d8;
}

.attention-card {
    background: var(--warning-soft);
    border-color: rgba(245, 158, 11, 0.3);
}

.alert-warning {
    background: var(--warning-soft);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fde7b0;
}

.dashboard-alert,
.stats-filter-card,
.client-stats-grid,
.recordatorio-metrics,
.recordatorio-metrics-2,
.recordatorio-metrics-3,
.recordatorio-metrics-4,
.stats-block {
    margin-bottom: 24px;
}

.inline-link,
.pagination-link,
.action-link,
.global-handoff-item a {
    color: #7dd3fc;
    text-decoration: none;
    font-weight: 700;
}

.inline-link:hover,
.pagination-link:hover,
.action-link:hover,
.global-handoff-item a:hover {
    text-decoration: underline;
}

.table-card {
    overflow: hidden;
}

.filters-form {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.filters-grid {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 16px;
    align-items: end;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(4, 10, 19, 0.34);
}

.modern-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.modern-table th,
.modern-table td {
    padding: 16px;
    text-align: left;
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.modern-table thead th {
    background: #0e1e33;
    color: var(--text-soft);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border-bottom: 1px solid var(--border);
}

body[data-theme="light"] .modern-table thead th {
    background: #edf4fb;
}

.modern-table tbody td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    color: var(--text);
}

.modern-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.05);
}

.table-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
}

.badge-success {
    background: var(--success-soft);
    color: #b8f5d0;
}

.badge-warning {
    background: var(--warning-soft);
    color: #fde3a7;
}

.badge-danger {
    background: var(--danger-soft);
    color: #ffc0c0;
}

.badge-info {
    background: rgba(14, 165, 233, 0.16);
    color: #bae6fd;
}

.badge-primary {
    background: rgba(59, 130, 246, 0.18);
    color: #bfdbfe;
}

.status-ok {
    color: #bbf7d0;
}

.status-bad,
.text-error,
.error-column {
    color: #fca5a5;
}

.empty-cell {
    text-align: center;
    padding: 28px 16px !important;
}

.pagination {
    justify-content: flex-end;
    padding-top: 18px;
}

.conversation-thread {
    padding: 4px 0;
}

.message-row {
    display: flex;
    width: 100%;
}

.message-inbound {
    justify-content: flex-start;
}

.message-outbound {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 78%;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.message-inbound .message-bubble {
    background: rgba(255, 255, 255, 0.03);
}

.message-outbound .message-bubble {
    background: rgba(14, 165, 233, 0.10);
    border-color: rgba(56, 189, 248, 0.26);
}

.message-meta {
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.83rem;
}

.message-body {
    color: var(--text);
    line-height: 1.7;
}

.message-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.quick-replies-list,
.stats-filter-nav,
.page-actions,
.table-actions,
.filters-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quick-reply-chip {
    border: 1px solid rgba(56, 189, 248, 0.24);
    background: rgba(56, 189, 248, 0.10);
    color: #d8f3ff;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
}

.quick-reply-chip:hover {
    background: rgba(56, 189, 248, 0.18);
}

.csv-example {
    margin: 0;
    padding: 16px;
    overflow: auto;
    border-radius: 16px;
    background: #050c16;
    color: #d5e6ff;
    border: 1px solid var(--border);
    font-size: 0.84rem;
    line-height: 1.7;
}

.import-errors {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.import-error-item {
    font-size: 0.92rem;
    line-height: 1.6;
}

.configuration-guide {
    margin-bottom: 22px;
    border-color: rgba(14, 165, 233, 0.32);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.10), rgba(34, 197, 94, 0.05));
}

.configuration-guide-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 320px);
    align-items: center;
    gap: 24px;
}

.configuration-guide-summary h3,
.configuration-guide-summary p {
    margin: 0;
}

.configuration-guide-summary p {
    margin-top: 6px;
    color: var(--text-muted);
}

.configuration-guide-eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #7dd3fc;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.configuration-progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
}

.configuration-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0ea5e9, #22c55e);
}

.configuration-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.82rem;
}

.configuration-field-statuses {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin-top: 16px;
}

.configuration-field-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 11px;
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 0.76rem;
}

.configuration-field-status strong {
    white-space: nowrap;
    font-size: 0.68rem;
}

.configuration-field-status.is-configured strong {
    color: #86efac;
}

.configuration-field-status.is-missing {
    border-color: rgba(248, 113, 113, 0.28);
    background: rgba(239, 68, 68, 0.06);
}

.configuration-field-status.is-missing strong {
    color: #fca5a5;
}

.field-requirement,
.section-requirement {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
}

.requirement-required,
.section-requirement {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(248, 113, 113, 0.28);
}

.requirement-module {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.13);
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.requirement-optional {
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.22);
}

.form-help {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.global-handoff-alert {
    width: fit-content;
    max-width: calc(100% - 60px);
    margin: 0 30px 8px auto;
    padding: 8px 10px 8px 12px;
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.20), rgba(194, 65, 12, 0.10));
    border-color: rgba(251, 146, 60, 0.35);
    color: #ffe7cf;
}

.global-handoff-alert-main {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.84rem;
}

.global-handoff-status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #fb923c;
    box-shadow: 0 0 0 4px rgba(251, 146, 60, 0.14);
}

.global-handoff-link {
    background: linear-gradient(135deg, #f97316, #c2410c);
    color: #fff;
    padding: 7px 10px;
    font-size: 0.8rem;
}

.global-handoff-item {
    background: rgba(255, 255, 255, 0.05);
}

body[data-theme="light"] {
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.07), transparent 24%),
        linear-gradient(180deg, #f6f9fc 0%, #edf3f9 38%, #e8eef5 100%);
}

body[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, rgba(245, 249, 253, 0.98), rgba(236, 243, 250, 0.98));
}

body[data-theme="light"] .menu a {
    color: var(--text-soft);
}

body[data-theme="light"] .menu a:hover,
body[data-theme="light"] .menu a.active {
    color: var(--title);
    background: linear-gradient(180deg, rgba(2, 132, 199, 0.12), rgba(2, 132, 199, 0.06));
}

body[data-theme="light"] .header {
    background: linear-gradient(180deg, rgba(240, 245, 251, 0.96), rgba(240, 245, 251, 0.8), transparent);
}

body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea {
    background: #ffffff;
    color: var(--text);
}

body[data-theme="light"] .btn-secondary,
body[data-theme="light"] .btn-logout,
body[data-theme="light"] .stats-filter-link,
body[data-theme="light"] .theme-toggle {
    background: #f3f7fb;
}

body[data-theme="light"] .table-responsive {
    background: rgba(255, 255, 255, 0.68);
}

.sidebar::-webkit-scrollbar {
    width: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(125, 211, 252, 0.32);
    border-radius: 999px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.vencidos-top-row {
    align-items: start;
}

.vencidos-batch-card,
.vencidos-list-card {
    min-height: 100%;
}

.toast-container {
    position: fixed;
    top: auto;
    bottom: 18px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    width: min(310px, calc(100vw - 32px));
    padding: 13px 14px;
    background: linear-gradient(180deg, rgba(35, 10, 10, 0.96), rgba(23, 8, 8, 0.96));
    border-color: rgba(239, 68, 68, 0.3);
    animation: toastIn 0.25s ease;
}

.toast-title {
    font-weight: 800;
    color: #ffd0d0;
    margin-bottom: 8px;
}

.toast-phone {
    font-size: 0.96rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #fff;
}

.toast-actions {
    display: flex;
    gap: 10px;
}

.toast-close {
    cursor: pointer;
    color: var(--text-muted);
    margin-left: auto;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 1.2rem;
    line-height: 1;
}

.auth-page,
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background:
        radial-gradient(circle at top, rgba(56, 189, 248, 0.16), transparent 30%),
        linear-gradient(180deg, #07111f 0%, #0a1728 100%);
}

.auth-card {
    width: 100%;
    max-width: 470px;
    padding: 38px;
}

.auth-brand {
    margin-bottom: 24px;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-help-row {
    margin-top: -6px;
    text-align: right;
}

.auth-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.auth-brand h1,
.error-card h1 {
    margin: 0 0 10px;
    color: var(--title);
}

.auth-brand h1 {
    font-size: 2.2rem;
}

.error-card {
    width: 100%;
    max-width: 560px;
    padding: 40px 34px;
    text-align: center;
}

.error-card h1 {
    font-size: 4rem;
}

.error-card p {
    color: var(--text-muted);
    line-height: 1.7;
}

.form-error {
    color: #fda4af;
    font-size: 0.84rem;
}

.recordatorio-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.recordatorio-metrics-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.recordatorio-metrics-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stage-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.price-card {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(56, 189, 248, 0.18);
    background: linear-gradient(180deg, rgba(56, 189, 248, 0.12), rgba(14, 165, 233, 0.06));
}

.price-card span {
    color: #d3ecff;
    font-weight: 700;
}

.soat-inline-textarea {
    min-height: 88px;
}

.soat-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.soat-save-btn,
.soat-contact-btn {
    width: 100%;
}

.soat-observacion-cell {
    max-width: 200px;
    color: var(--text-muted);
    line-height: 1.5;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(18px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .recordatorio-metrics-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .modern-table {
        min-width: 1180px;
    }
}

@media (max-width: 1100px) {
    .configuration-field-statuses {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-grid,
    .dashboard-content-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
        box-shadow: none;
    }

    .main-container {
        margin-left: 0;
    }

    .header {
        position: static;
        padding-top: 20px;
    }

    .vencidos-top-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .configuration-guide-summary {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .configuration-field-statuses {
        grid-template-columns: 1fr;
    }

    .bulk-actions,
    .bulk-actions-main {
        align-items: stretch;
        flex-direction: column;
    }

    .bulk-actions {
        padding: 14px;
    }

    .bulk-actions-main {
        gap: 12px;
    }

    .bulk-select-all {
        width: 100%;
    }

    .selected-count {
        align-self: flex-start;
    }

    .bulk-actions .btn-danger {
        width: 100%;
    }

    .content,
    .header,
    .footer,
    .global-handoff-alert {
        padding-left: 18px;
        padding-right: 18px;
    }

    .header,
    .page-header,
    .header-right,
    .global-handoff-alert-main,
    .detail-item,
    .table-header,
    .filters-actions,
    .pagination,
    .page-actions,
    .table-actions,
    .form-actions,
    .user-box {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-grid,
    .dashboard-content-grid,
    .recordatorio-metrics,
    .recordatorio-metrics-2,
    .recordatorio-metrics-3,
    .recordatorio-metrics-4,
    .price-grid,
    .filters-grid {
        grid-template-columns: 1fr;
    }

    .message-bubble {
        max-width: 100%;
    }

    .auth-card,
    .error-card,
    .card {
        padding: 20px;
    }

    .page-header h2 {
        font-size: 1.55rem;
    }
}

/* Envidiagnostico: compact administrative layout, 2026-10-01. */
body.app-shell { font-size: 14px; background: var(--bg); }
body.app-shell[data-theme="light"] { background: var(--bg); }
.app-shell .sidebar { width: 226px; padding: 20px 16px; gap: 12px; box-shadow: none; }
.app-shell .main-container { margin-left: 226px; }
.app-shell .logo { font-size: 1.35rem; letter-spacing: -.02em; }
.app-shell .sidebar-subtitle { font-size: .78rem; line-height: 1.5; }
.app-shell .sidebar-section-label { padding-top: 2px; font-size: .65rem; }
.app-shell .menu { gap: 2px; }
.app-shell .menu a { padding: 9px 11px; border-radius: 8px; font-size: .82rem; }
.app-shell .sidebar-footer-note { padding: 10px; font-size: .73rem; line-height: 1.45; border-radius: 9px; }
.app-shell .header { padding: 16px 24px; gap: 12px; }
.app-shell .header-left h1 { font-size: 1.25rem; }
.app-shell .header-left p { margin-top: 4px; font-size: .78rem; }
.app-shell .content { padding: 18px 24px; }
.app-shell .card { padding: 16px; border-radius: 12px; box-shadow: none; background: var(--surface); }
.app-shell .page-header { margin-bottom: 16px; gap: 12px; }
.app-shell .page-header h2 { font-size: 1.45rem; letter-spacing: -.025em; }
.app-shell .page-subtitle { font-size: .82rem; margin-top: 5px; line-height: 1.5; }
.app-shell .dashboard-grid, .app-shell .dashboard-content-grid, .app-shell .settings-grid { gap: 12px; margin-bottom: 16px; }
.app-shell .metric-card, .app-shell .dashboard-section, .app-shell .settings-section, .app-shell .form-card, .app-shell .table-card { gap: 12px; }
.app-shell .metric-card { min-height: 0; padding: 14px 16px; }
.app-shell .metric-card::before { height: 2px; opacity: .4; }
.app-shell .metric-card h3 { font-size: 1.45rem; }
.app-shell .metric-label { font-size: .65rem; letter-spacing: .06em; font-weight: 600; }
.app-shell .metric-card p { margin: 0; font-size: .77rem; line-height: 1.45; }
.app-shell .section-heading h3, .app-shell .table-header h3 { font-size: .95rem; }
.app-shell .section-heading p, .app-shell .table-header p { margin: 4px 0 0; font-size: .8rem; line-height: 1.5; }
.app-shell .form-grid { gap: 12px; }
.app-shell .settings-form { gap: 14px; }
.app-shell .form-group { gap: 5px; }
.app-shell .form-group label { font-size: .78rem; font-weight: 600; }
.app-shell input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), .app-shell select { min-height: 36px; padding: 8px 10px; border-radius: 8px; font-size: .82rem; }
.app-shell textarea { padding: 10px; border-radius: 8px; font-size: .82rem; }
.app-shell input[type="checkbox"], .app-shell input[type="radio"] { width: 16px; height: 16px; min-height: 16px; margin: 0; flex: 0 0 16px; accent-color: var(--primary-strong); }
.app-shell .checkbox-label, .app-shell .checkbox-card { display: flex; align-items: center; gap: 8px; font-size: .82rem; padding: 8px 10px; }
.app-shell .custom-checkbox { width: 17px; height: 17px; min-height: 17px; border-radius: 4px; }
.app-shell .custom-checkbox svg { width: 12px; height: 12px; }
.app-shell .bulk-select-all > input { position: absolute; width: 1px; height: 1px; min-height: 1px; }
.app-shell .checklist, .app-shell .detail-list { gap: 6px; }
.app-shell .check-item, .app-shell .detail-item { padding: 8px 10px; border-radius: 8px; font-size: .8rem; }
.app-shell .btn-primary, .app-shell .btn-secondary, .app-shell .btn-danger, .app-shell .theme-toggle { min-height: 34px; padding: 8px 12px; border-radius: 8px; font-size: .8rem; box-shadow: none; }
.app-shell .btn-small { min-height: 29px; padding: 6px 9px; font-size: .74rem; }
.app-shell .global-handoff-alert { margin-bottom: 16px; padding: 8px 12px; border-radius: 10px; box-shadow: none; }
.app-shell .table-wrapper th { font-size: .67rem; letter-spacing: .04em; padding: 10px; }
.app-shell .table-wrapper td { padding: 10px; font-size: .79rem; }
.app-shell .modern-table th, .app-shell .modern-table td { padding: 10px; font-size: .79rem; }
.app-shell .modern-table th { font-size: .67rem; letter-spacing: .04em; }
.app-shell .btn-logout { min-height: 34px; padding: 8px 12px; font-size: .8rem; border-radius: 8px; }
.app-shell .table-badge { padding: 4px 7px; font-size: .68rem; }
.app-shell .footer { padding: 12px 24px; font-size: .72rem; }
.reminders-heading { align-items: center; }
.reminder-ready { font-size: .75rem; padding: 6px 9px; border: 1px solid var(--border); border-radius: 20px; white-space: nowrap; color: var(--text-muted); }
.reminder-ready.ready { color: var(--success); }
.reminder-ready.not-ready { color: var(--warning); }
.reminder-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.reminder-stages, .reminder-periods { display: flex; flex-wrap: wrap; gap: 4px; }
.reminder-stages { border: 1px solid var(--border); padding: 3px; border-radius: 9px; background: var(--surface); }
.reminder-stages a, .reminder-periods a { padding: 7px 10px; font-size: .78rem; border-radius: 6px; text-decoration: none; color: var(--text-muted); }
.reminder-stages a.is-active, .reminder-periods a.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.reminder-periods a:hover, .reminder-stages a:hover { background: var(--surface-soft); color: var(--text); }
.reminder-period-caption { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--text-muted); font-size: .76rem; margin-bottom: 14px; }
.reminder-period-caption strong { color: var(--text-soft); font-weight: 600; }
.reminder-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.app-shell .reminder-stat { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px 16px; }
.reminder-stat span { color: var(--text-muted); font-size: .76rem; }
.reminder-stat strong { font-size: 1.35rem; color: var(--title); font-weight: 650; }
.reminder-batch { margin-bottom: 14px; }
.reminder-batch-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.reminder-batch h3 { margin: 0; font-size: .95rem; }
.reminder-batch p { margin: 5px 0 12px; font-size: .78rem; color: var(--text-muted); line-height: 1.45; }
.reminder-batch-count { color: var(--text-muted); font-size: .73rem; white-space: nowrap; }
.reminder-batch-form { display: grid; grid-template-columns: 140px minmax(180px, 280px) auto; gap: 12px; align-items: end; justify-content: start; }
.reminder-filters { display: grid; grid-template-columns: minmax(180px, 1.5fr) minmax(150px, 1fr) minmax(130px, 1fr) auto; gap: 12px; align-items: end; }
.reminder-filters .filters-actions { justify-content: start; gap: 6px; }
.reminder-table .table-header { padding-top: 3px; }
.reminder-table .table-wrapper { overflow-x: auto; }
.reminder-table table { width: 100%; border-collapse: collapse; text-align: left; }
.reminder-table .modern-table { min-width: 820px; }
.app-shell[data-theme="light"] .badge-warning { color: #854d0e; background: #fef3c7; }
.app-shell[data-theme="light"] .badge-success { color: #166534; background: #dcfce7; }
.app-shell[data-theme="light"] .badge-danger { color: #991b1b; background: #fee2e2; }
.reminder-table tbody tr + tr { border-top: 1px solid var(--border); }
.app-shell .reminder-table th { font-weight: 600; }
.reminder-client-id { display: block; font-size: .68rem; color: var(--text-muted); margin-top: 3px; }
.reminder-row-error { display: block; color: var(--danger); max-width: 210px; font-size: .68rem; margin-top: 5px; overflow-wrap: anywhere; }
.reminder-report { font-size: .78rem; margin-top: 8px; }
.reminder-report summary { cursor: pointer; color: var(--text-soft); }
.app-shell .pagination { gap: 12px; flex-wrap: wrap; }
@media (max-width: 1100px) { .reminder-filters { grid-template-columns: 1fr 1fr; } .reminder-batch-heading { align-items: start; flex-direction: column; gap: 0; } .reminder-batch-count { margin-bottom: 10px; } }
@media (max-width: 900px) { .app-shell .sidebar { position: static; width: 100%; height: auto; min-height: 0; padding: 14px 16px; } .app-shell .main-container { margin-left: 0; } .app-shell .sidebar .menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); } .app-shell .sidebar-subtitle, .app-shell .sidebar-footer-note, .app-shell .sidebar-section-label { display: none; } .app-shell .header { position: static; padding: 14px 16px; } .app-shell .content { padding: 14px 16px; } }
@media (max-width: 600px) { .reminder-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } .reminder-batch-form, .reminder-filters { grid-template-columns: 1fr; } .reminders-heading { flex-direction: column; align-items: start; } .app-shell .header-left p { display: none; } .app-shell .header { align-items: start; flex-wrap: wrap; } .app-shell .sidebar .menu { grid-template-columns: repeat(2, minmax(0, 1fr)); } .reminder-periods { gap: 2px; } .reminder-periods a { padding: 7px 8px; } }

