: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;
    }
}
