/**
 * Quintana Dashboard — Brand Guidelines 2026
 * Colores: Paleta institucional + App (p.22–24)
 * Tipografía: Avenir (primaria), Helvetica Neue (secundaria)
 */

:root {
    /* Paleta institucional (Brand Guidelines p.22) */
    --brand-color-1: #242a63;
    --brand-color-2: #3f84d8;
    --brand-color-3: #8abaf8;
    --brand-neutral: #CECECE;
    --brand-dark: #181818;

    /* Paleta App (Brand Guidelines p.24) */
    --app-light-1: #f1f4fd;
    --app-light-2: #dfe9fb;
    --app-light-3: #c7d8f8;
    --app-blue-1: #517de8;
    --app-blue-2: #3a5fdb;
    --app-blue-3: #2a3ea3;
    --app-blue-4: #273881;

    /* Tokens derivados */
    --ink: var(--brand-dark);
    --ink-secondary: var(--brand-color-1);
    --ink-muted: var(--app-blue-3);
    --ink-tertiary: #64748b;
    --paper: #ffffff;
    --canvas: #eef2fc; /* Tono más presente que app-light-1, evita monotonía blanca */
    --surface-1: #ffffff;
    --surface-2: var(--app-light-2);
    --accent: var(--brand-color-2);
    --accent-hover: var(--app-blue-1);
    --accent-muted: var(--brand-color-3);
    --border-subtle: rgba(36, 42, 99, 0.06);
    --border-soft: rgba(36, 42, 99, 0.1);
    --border-default: rgba(36, 42, 99, 0.14);
    --success: #059669;
    --success-bg: #d1fae5;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --space: 8px;
    --shadow-subtle: 0 1px 2px rgba(36, 42, 99, 0.04);
    --shadow-sidebar: 4px 0 24px rgba(36, 42, 99, 0.08);
    --shadow-card: 0 2px 8px rgba(36, 42, 99, 0.06);
    --shadow-header: 0 1px 3px rgba(36, 42, 99, 0.05);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Legacy tokens para compatibilidad */
:root {
    --color-1-navy: var(--ink-secondary);
    --color-2-blue: var(--accent);
    --color-3-lightblue: var(--accent-muted);
    --color-neutral: var(--brand-neutral);
    --color-dark: var(--ink);
    --comp-light-1: var(--app-light-1);
    --comp-light-2: var(--app-light-2);
    --comp-light-3: var(--app-light-3);
    --comp-blue-1: var(--app-blue-1);
    --comp-blue-2: var(--app-blue-2);
    --comp-blue-3: var(--app-blue-3);
    --comp-blue-4: var(--app-blue-4);
    --primary: var(--accent);
    --primary-dark: var(--ink-secondary);
    --primary-light: var(--comp-light-1);
    --bg-main: var(--canvas);
    --surface: var(--paper);
    --text-main: var(--ink);
    --text-muted: var(--ink-muted);
    --border: var(--border-default);
    --gray-bg: var(--surface-2);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --shadow-sm: var(--shadow-subtle);
    --shadow-md: 0 4px 12px rgba(36, 42, 99, 0.06);
    --shadow-lg: 0 12px 32px rgba(36, 42, 99, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Avenir", "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
    background: var(--canvas);
    color: var(--ink);
    overflow-x: hidden;
}

/**
 * El `display: none` que el navegador le da a [hidden] lo pisa cualquier clase
 * que declare display — `.btn { display: inline-flex }` sin ir más lejos. Sin
 * esta regla, poner `el.hidden = true` desde JS no esconde nada y quedan botones
 * visibles que no deberían estar. Vale para todo el panel.
 */
[hidden] {
    display: none !important;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR — Navy institucional, sombra para profundidad ===== */
.sidebar {
    width: 240px;
    background: var(--brand-color-1);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--shadow-sidebar);
}

.sidebar-header {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 calc(var(--space) * 3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo-circle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    padding: 4px;
    box-sizing: border-box;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(63, 132, 216, 0.3);
}

.logo-circle img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transform: scale(1.16);
    transform-origin: center center;
}

.brand-name {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    color: white;
}

.brand-name span {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
}

.sidebar-nav {
    flex: 1;
    padding: calc(var(--space) * 3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.15rem;
    margin-right: 12px;
    opacity: 0.9;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-item:active {
    background: rgba(255, 255, 255, 0.12);
}

.nav-item:focus-visible {
    outline: 2px solid var(--brand-color-3);
    outline-offset: 2px;
}

.nav-item.active {
    background: var(--brand-color-2);
    color: white;
    box-shadow: 0 2px 8px rgba(63, 132, 216, 0.25);
}

.nav-item.active i {
    opacity: 1;
}

.sidebar-footer {
    padding: calc(var(--space) * 3);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-item.logout {
    color: rgba(255, 255, 255, 0.85);
}

.nav-item.logout:hover {
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
}

.nav-item.logout:focus-visible {
    outline: 2px solid #fca5a5;
    outline-offset: 2px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== HEADER — Contexto, búsqueda y usuario ===== */
.top-header {
    height: 72px;
    background: var(--paper);
    border-bottom: 1px solid rgba(36, 42, 99, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 calc(var(--space) * 5);
    position: sticky;
    top: 0;
    z-index: 90;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    width: 360px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: rgba(63, 132, 216, 0.4);
    background: var(--paper);
    box-shadow: 0 0 0 2px rgba(63, 132, 216, 0.1);
}

.search-bar i {
    color: var(--ink-tertiary);
    margin-right: 10px;
    font-size: 1.1rem;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--ink);
    font-size: 0.9rem;
}

.search-bar input::placeholder {
    color: var(--ink-tertiary);
}

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

.header-actions .btn-secondary {
    padding: 8px 16px;
    font-size: 0.875rem;
    border: 1px solid var(--border-default);
    background: var(--paper);
}

.header-actions .btn-secondary:hover {
    border-color: var(--accent);
    background: rgba(63, 132, 216, 0.06);
    color: var(--ink-secondary);
}

.icon-btn {
    background: none;
    border: none;
    position: relative;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--ink-muted);
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--accent);
    background: rgba(63, 132, 216, 0.08);
}

.icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Sin notificaciones: el contador no ocupa lugar ni muestra número */
.badge.badge--hidden,
.badge[hidden] {
    display: none !important;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px 8px 12px;
    margin-left: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--paper);
    transition: var(--transition);
}

.user-profile:hover {
    border-color: var(--border-soft);
    background: var(--surface-2);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(63, 132, 216, 0.2);
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ink);
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: var(--ink-muted);
    font-weight: 500;
}

/* ===== CONTENT ===== */
.content {
    padding: calc(var(--space) * 5);
    flex: 1;
}

.page-title {
    margin-bottom: calc(var(--space) * 4);
}

.page-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink-secondary);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.page-title p {
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.page-title-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* ===== STATS — estructura narrativa ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: calc(var(--space) * 3);
    margin-bottom: calc(var(--space) * 5);
}

.stat-card {
    background: var(--paper);
    border-radius: var(--radius-md);
    padding: calc(var(--space) * 3);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.stat-card:hover {
    border-color: rgba(63, 132, 216, 0.2);
    box-shadow: 0 4px 16px rgba(36, 42, 99, 0.08);
}

.stat-details {
    flex: 1;
}

.stat-details-full {
    width: 100%;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.stat-icon.primary { background: rgba(63, 132, 216, 0.1); color: var(--accent); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.gray { background: var(--surface-2); color: var(--ink-muted); }

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink-secondary);
    letter-spacing: -0.02em;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    margin-top: 12px;
    margin-bottom: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.6s ease-out;
}

.stat-subtext {
    font-size: 0.65rem;
    color: var(--ink-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== CHART SECTION ===== */
.chart-section {
    background: var(--paper);
    border-radius: var(--radius-md);
    padding: calc(var(--space) * 4);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    margin-bottom: calc(var(--space) * 5);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: calc(var(--space) * 4);
}

.chart-toolbar {
    display: flex;
    justify-content: flex-start;
    margin: 0 0 calc(var(--space) * 3);
}

.chart-range {
    display: inline-flex;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-2);
}

.chart-range-btn {
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 7px 12px;
    cursor: pointer;
    line-height: 1.2;
}

.chart-range-btn + .chart-range-btn {
    border-left: 1px solid var(--border-subtle);
}

.chart-range-btn:hover {
    color: var(--ink);
    background: var(--paper);
}

.chart-range-btn.is-active {
    background: var(--paper);
    color: var(--ink-secondary);
}

.chart-range-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 4px;
}

.chart-header p {
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.chart-legend {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.chart-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.primary { background: var(--accent); }
.legend-dot.secondary { background: var(--comp-light-3); }

.chart-canvas-wrap {
    height: 300px;
    width: 100%;
}

.chart-section[data-range="3"] .chart-canvas-wrap { height: 240px; }
.chart-section[data-range="6"] .chart-canvas-wrap { height: 300px; }
.chart-section[data-range="12"] .chart-canvas-wrap { height: 380px; }

.chart-summary {
    margin: calc(var(--space) * 3) 0 0;
    font-size: 0.85rem;
    color: var(--ink-muted);
    line-height: 1.45;
}

/* ===== TABLE ===== */
.table-section {
    background: var(--paper);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.table-header {
    padding: calc(var(--space) * 3);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header-flex {
    flex-wrap: wrap;
    gap: 16px;
}

.search-bar-in-table {
    max-width: 400px;
    flex: 1 1 300px;
    border: 1px solid var(--border-default);
}

.table-actions-wrap {
    flex-wrap: wrap;
}

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

.filter-select {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    outline: none;
    color: var(--ink);
    background: var(--paper);
    font-size: 0.9rem;
}

.filter-select:focus {
    border-color: var(--accent);
}

.filter-select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 0;
}

.btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    border: none;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--ink-secondary);
}

.btn-secondary:hover {
    background: var(--comp-light-2);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

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

.data-table th,
.data-table td {
    padding: 14px calc(var(--space) * 3);
    text-align: left;
}

.data-table th {
    background: var(--surface-2);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: var(--canvas);
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--ink-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-name-table {
    font-weight: 600;
    color: var(--ink);
    display: block;
}

.user-email-table {
    font-size: 0.85rem;
    color: var(--ink-secondary);
    overflow-wrap: anywhere;
}

.badge-status {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: var(--surface-2); color: var(--ink-muted); }
/* «Mail enviado»: el acceso salió y el cliente todavía no lo abrió. Informativo,
   no requiere acción — por eso azul y no el ámbar de «Registro incompleto». */
.badge-info { background: rgba(37, 99, 235, .12); color: #2563eb; }

.policy-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--ink);
}

.policy-count i { color: var(--accent); font-size: 1.1rem; }
.claim-count i { color: var(--danger); }

.action-btns {
    display: flex;
    gap: 6px;
}

.action-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default);
    background: transparent;
    cursor: pointer;
    color: var(--ink-muted);
    transition: var(--transition);
    font-size: 1rem;
}

.action-btn:hover {
    background: var(--surface-2);
    color: var(--accent);
    border-color: var(--border-soft);
}

.action-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.action-btn--danger:hover {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
    background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.modal-feedback {
    font-size: 0.88rem;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.modal-feedback--error {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
}

.modal-feedback--success {
    color: var(--success);
    background: color-mix(in srgb, var(--success) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
}

/* ===== PROFILE VIEW ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-muted);
    margin-bottom: calc(var(--space) * 3);
}

.breadcrumb-link {
    cursor: pointer;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: var(--accent);
}

.breadcrumb-sep {
    font-size: 0.8rem;
}

.breadcrumb-current {
    font-weight: 600;
    color: var(--ink-secondary);
}

.profile-grid {
    display: flex;
    gap: calc(var(--space) * 4);
    align-items: flex-start;
}

.profile-sidebar {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: calc(var(--space) * 3);
}

.profile-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: calc(var(--space) * 3);
}

.profile-card {
    background: var(--paper);
    border-radius: var(--radius-md);
    padding: calc(var(--space) * 4);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

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

.profile-avatar-lg {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--ink-secondary);
    font-size: 2.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto calc(var(--space) * 3) auto;
}

.profile-name-display {
    color: var(--ink-secondary);
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.profile-status-wrap {
    margin-bottom: 16px;
}

.profile-member-since {
    color: var(--ink-muted);
    font-size: 0.9rem;
}

.profile-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--space) * 3);
}

.card-title-lg {
    margin: 0;
    font-size: 1.1rem;
    color: var(--ink-secondary);
    text-transform: none;
}

.card-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ink-muted);
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.btn-action-dark {
    width: 100%;
    justify-content: center;
    background: var(--ink-secondary);
    color: white;
}

.btn-action-dark:hover { background: var(--comp-blue-4); }

.btn-action-blue {
    width: 100%;
    justify-content: center;
    background: var(--accent);
    color: white;
}

.btn-action-blue:hover { background: var(--accent-hover); }

.btn-action-outline {
    width: 100%;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--ink-secondary);
}

.btn-action-outline:hover {
    background: var(--surface-2);
    border-color: var(--border-soft);
}

.btn-text-only {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-text-only:hover { color: var(--accent-hover); }

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--space) * 3);
}

.info-item label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ink-muted);
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.info-item p {
    font-size: 0.9rem;
    color: var(--ink);
    font-weight: 500;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-subtle);
}

.timeline-item {
    display: flex;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.timeline-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ink-secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.timeline-icon.secondary {
    background: var(--surface-2);
    color: var(--ink-secondary);
}

.timeline-content h4 {
    font-size: 0.85rem;
    color: var(--ink);
    margin-bottom: 2px;
}

.timeline-content p {
    font-size: 0.75rem;
    color: var(--ink-muted);
}

.internal-note {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 12px;
    border-left: 3px solid var(--accent);
}

.internal-note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-secondary);
}

.internal-note p {
    font-size: 0.85rem;
    color: var(--ink);
    line-height: 1.5;
}

/* Placeholder “próximamente” (siniestros / notas en perfil) */
.profile-section-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 28px 20px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-subtle);
}

.profile-section-soon .ph {
    font-size: 2rem;
    color: var(--ink-muted);
    margin-bottom: 10px;
    opacity: 0.9;
}

.profile-section-soon p {
    font-size: 0.9rem;
    color: var(--ink-muted);
    line-height: 1.5;
    margin: 0;
    max-width: 360px;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(24, 24, 24, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--paper);
    width: 100%;
    max-width: 560px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-subtle);
    transform: translateY(12px);
    transition: var(--transition);
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: calc(var(--space) * 3);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ink-secondary);
}

.modal-header h2 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    padding: 4px;
}

.close-modal:hover { color: white; }

.close-modal:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.modal-body {
    padding: calc(var(--space) * 4);
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: calc(var(--space) * 3) calc(var(--space) * 4);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--canvas);
}

.modal-content-narrow {
    max-width: 450px;
}

/* Las listas de la tanda de ABSA van en columnas y no entran comodas en 560px. */
.modal-content-wide {
    max-width: 680px;
}

.modal-body-center {
    text-align: center;
}

.modal-footer-center {
    justify-content: center;
    background: var(--paper);
    border-top: none;
    padding-bottom: calc(var(--space) * 4);
}

/*
 * Diálogo genérico de la app (showAppAlert/showAppConfirm/showAppPrompt):
 * tiene que quedar por encima de cualquier otro modal ya abierto, porque
 * puede pedirse mientras hay un #editPolicyModal o #createUserModal activo.
 */
.modal-overlay--dialog {
    z-index: 1100;
}

.app-dialog-layout {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.app-dialog-icon {
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 1.4rem;
}

.app-dialog-icon--info { color: var(--accent); }
.app-dialog-icon--success { color: var(--success); }
.app-dialog-icon--error { color: var(--danger); }
.app-dialog-icon--warning { color: var(--warning); }

.app-dialog-content {
    flex: 1;
    min-width: 0;
}

.app-dialog-message {
    margin: 0;
    line-height: 1.5;
    /* Algunos mensajes existentes traen \n para separar ideas; hay que
       conservar esos saltos de línea en vez de que el navegador los colapse. */
    white-space: pre-line;
}

.app-dialog-detail {
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: pre-line;
}

.app-dialog-input-group {
    margin-top: 12px;
}

.construction-illustration {
    max-width: 250px;
    margin: 0 auto calc(var(--space) * 3) auto;
    display: block;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.construction-title {
    color: var(--ink-secondary);
    margin-bottom: 12px;
    font-size: 1.5rem;
}

.construction-text {
    color: var(--ink-muted);
    font-size: 1.05rem;
}

.construction-section-name {
    color: var(--accent);
}

.btn-lg {
    padding: 12px 32px;
}

.detail-section {
    margin-bottom: calc(var(--space) * 4);
}

.detail-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--ink-muted);
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    font-weight: 600;
}

.policy-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.policy-item {
    padding: 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--paper);
}

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

.policy-icon {
    width: 40px;
    height: 40px;
    /*
     * `flex-shrink: 0` no es cosmetico: sin el, el contenedor flex `.policy-info`
     * encoge esta caja cuando el texto de `.policy-meta` no entra (descripcion
     * larga, o la fila extra de "Compartida por"), y el icono queda mas chico
     * que en el resto de las tarjetas. El tamano tiene que ser el mismo en
     * todas las polizas, compartidas o propias.
     */
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: rgba(63, 132, 216, 0.08);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/*
 * `min-width: 0` anula el `min-width: auto` implicito de los items flex, que
 * impide encoger por debajo del contenido minimo y empuja la presion de
 * tamano hacia los iconos vecinos. Con esto el texto envuelve y los iconos
 * conservan su caja.
 */
.policy-meta { min-width: 0; }
.policy-meta h5 { font-size: 0.9rem; color: var(--ink-secondary); margin-bottom: 2px; }
.policy-meta p { font-size: 0.8rem; color: var(--ink-muted); }

/*
 * Ícono de póliza compartida: `ph-arrow-bend-up-right` espejado en el eje Y.
 * El espejo vertical invierte solo ese eje, conserva el sentido de lectura
 * izquierda→derecha y deja la punta apuntando abajo-a-la-derecha (diseño,
 * decisión 1). NO reemplazar por `ph-arrow-bend-right-down`: tiene el mismo
 * recorrido pero la punta mira hacia abajo, no hacia la derecha.
 * `display: inline-block` no es decorativo: `transform` no aplica sobre
 * elementos inline no reemplazados.
 */
.poliza-compartida-flecha {
    display: inline-block;
    transform: scaleY(-1);
}

.policy-shared-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Ancho fijo y sin encoger: la flecha ocupa lo mismo en toda tarjeta
     * compartida, asi los iconos de producto quedan alineados entre si. */
    width: 20px;
    flex-shrink: 0;
    color: var(--accent);
    font-size: 1.1rem;
}

.policy-shared-attribution {
    font-size: 0.78rem;
    color: var(--ink-muted);
    font-style: italic;
}

.hidden {
    display: none !important;
}

.policy-extra-fields {
    padding: calc(var(--space) * 2) calc(var(--space) * 2.5);
    border-radius: var(--radius-md);
    background: var(--app-light-1);
    border: 1px solid var(--border-soft);
}

.policy-extra-fields-title {
    margin: 0 0 calc(var(--space) * 2);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink-secondary);
    letter-spacing: 0.03em;
}

/* ===== FORM (modals) ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--space) * 3);
}

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

.info-item-full {
    grid-column: 1 / -1;
}

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

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-muted);
    letter-spacing: 0.04em;
}

.form-group input {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    background: var(--surface-2);
    color: var(--ink);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--paper);
}

.form-group input:focus-visible {
    box-shadow: 0 0 0 2px rgba(63, 132, 216, 0.2);
}

.form-group input::placeholder {
    color: var(--ink-tertiary);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .btn-primary:active {
        transform: none;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }

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

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

/* ===== TRAER CLIENTES DE ABSA (modal: un cliente / tanda desde archivo) ===== */

.pull-absa-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 20px;
    background: var(--canvas);
    border-radius: var(--radius-md);
}

.pull-absa-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-tertiary);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.pull-absa-tab:hover { color: var(--ink-secondary); }

.pull-absa-tab.is-active {
    background: var(--paper);
    color: var(--ink-secondary);
    font-weight: 600;
    box-shadow: var(--shadow-subtle);
}

.pull-absa-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.pull-absa-hint {
    font-size: 0.88rem;
    color: var(--ink-tertiary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.pull-absa-archivo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-secondary);
    margin-bottom: 14px;
    word-break: break-all;
}

.pull-absa-resumen {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--ink-tertiary);
}

.pull-absa-resumen li {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.pull-absa-resumen span {
    min-width: 3ch;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ink-secondary);
}

.pull-absa-total {
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    color: var(--ink-secondary);
    font-size: 0.95rem;
}

.pull-absa-total strong {
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

.pull-absa-detalle {
    margin-bottom: 12px;
    font-size: 0.86rem;
}

.pull-absa-detalle summary {
    cursor: pointer;
    color: var(--accent);
    padding: 4px 0;
}

.pull-absa-detalle summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.pull-absa-muestra {
    margin: 8px 0 0;
    padding: 10px 12px;
    max-height: 160px;
    overflow-y: auto;
    border-radius: var(--radius-sm);
    background: var(--canvas);
    color: var(--ink-tertiary);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    word-break: break-word;
}

.pull-absa-aviso {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--warning-bg);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
    color: #7c4a06;
    font-size: 0.85rem;
    line-height: 1.5;
}

.pull-absa-aviso i {
    flex: none;
    margin-top: 2px;
    color: var(--warning);
}

/* --- progreso --- */

.pull-absa-progreso-texto {
    font-size: 0.95rem;
    color: var(--ink-secondary);
    margin-bottom: 10px;
    font-variant-numeric: tabular-nums;
}

.pull-absa-barra {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
    margin-bottom: 12px;
}

.pull-absa-barra-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.25s linear;
}

.pull-absa-actual {
    font-size: 0.88rem;
    color: var(--ink-tertiary);
    margin-bottom: 16px;
    font-variant-numeric: tabular-nums;
}

.pull-absa-contadores {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pull-absa-contador {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
}

.pull-absa-contador b {
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
    .pull-absa-barra-fill { transition: none; }
}

/* --- lista de resultados, desplegable desde los contadores --- */

button.pull-absa-contador {
    border: none;
    font-family: inherit;
    cursor: pointer;
    opacity: 0.82;
    transition: var(--transition);
}

button.pull-absa-contador:hover { opacity: 1; }

button.pull-absa-contador[aria-expanded="true"] {
    opacity: 1;
    box-shadow: inset 0 0 0 1.5px currentColor;
}

button.pull-absa-contador:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.pull-absa-pista-lista {
    margin: 10px 0 0;
    font-size: 0.8rem;
}

/* Sin bordes ni separadores por fila: el fondo agrupa y el espacio ordena. */
.pull-absa-lista {
    margin-top: 12px;
    padding: 4px;
    border-radius: var(--radius-md);
    background: var(--canvas);
}

.pull-absa-lista-titulo {
    margin: 0;
    padding: 8px 12px 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.pull-absa-lista-items {
    list-style: none;
    margin: 0;
    padding: 0 4px 4px;
    max-height: 240px;
    overflow-y: auto;
}

.pull-absa-lista-items li {
    display: grid;
    align-items: baseline;
    gap: 2px 14px;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
}

/* El DNI ocupa un ancho fijo (6-10 digitos en monoespaciada), asi las columnas de
   la derecha arrancan siempre en la misma linea vertical. */
.pull-absa-lista-items[data-columnas="2"] li {
    grid-template-columns: 10ch minmax(0, 1fr);
}

.pull-absa-lista-items[data-columnas="3"] li {
    grid-template-columns: 10ch minmax(0, 1fr) minmax(0, 1.3fr);
}

.pull-absa-lista-items li:not(.pull-absa-lista-cab):hover {
    background: var(--paper);
}

.pull-absa-lista-cab {
    position: sticky;
    top: 0;
    z-index: 1;
    padding-bottom: 4px;
    background: var(--canvas);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-tertiary);
}

.pull-absa-lista-dni {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-weight: 600;
    color: var(--ink-secondary);
    font-variant-numeric: tabular-nums;
}

.pull-absa-lista-celda {
    color: var(--ink-tertiary);
    word-break: break-word;
}

.pull-absa-lista-items li > .pull-absa-lista-celda:first-of-type {
    color: var(--ink);
}

.pull-absa-lista-extra {
    grid-column: 1 / -1;
    color: var(--ink-tertiary);
    font-size: 0.8rem;
    word-break: break-word;
}
