/* ============================================================
   CRM Nubip — Theme Modern (Apple Health style)
   ============================================================
   Se carga DESPUÉS de style.css y elevenlabs-extra.css para
   sobrescribir lo necesario manteniendo el funcionamiento.
   ============================================================ */

:root {
    /* ─── Backgrounds ─── */
    --bg-app:           #F2F2F7;
    --bg-card:          #FFFFFF;
    --bg-elevated:      #FFFFFF;
    --bg-secondary:     #F9F9FB;
    --bg-hover:         #F2F2F7;

    /* ─── Texto ─── */
    --text-1:           #1C1C1E;
    --text-2:           #6E6E73;
    --text-3:           #AEAEB2;

    /* ─── Acento principal (verde sanitario Apple Health) ─── */
    --accent:           #30B07A;
    --accent-hover:     #248F60;
    --accent-light:     #E6F7EE;
    --accent-soft:      #F0FAF5;
    --accent-text:      #1A6E47;

    /* ─── Estados ─── */
    --success:          #30B07A;
    --success-bg:       #E6F7EE;
    --warning:          #FF9F0A;
    --warning-bg:       #FFF5E1;
    --danger:           #FF453A;
    --danger-bg:        #FFEDEB;
    --info:             #007AFF;
    --info-bg:          #E5F1FF;

    /* ─── Bordes ─── */
    --border-light:     #E5E5EA;
    --border-medium:    #D1D1D6;
    --border-strong:    #C7C7CC;

    /* ─── Sombras (ultra-sutiles) ─── */
    --shadow-xs:        0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:        0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md:        0 4px 12px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
    --shadow-lg:        0 12px 32px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);

    /* ─── Radius ─── */
    --r-sm:             8px;
    --r-md:             12px;
    --r-lg:             16px;
    --r-xl:             20px;
    --r-2xl:            24px;
    --r-full:           999px;

    /* ─── Easing ─── */
    --ease:             cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring:      cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══════════════════════════════════════════════════════════
   TIPOGRAFÍA Y BASE
   ═══════════════════════════════════════════════════════════ */

body {
    background: var(--bg-app);
    color: var(--text-1);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-1);
    letter-spacing: -0.02em;
    font-weight: 700;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent-light); color: var(--accent-text); }

/* ═══════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════ */

.shell, .layout {
    background: var(--bg-app);
}

.main, .content, .page {
    padding: 28px 32px;
    max-width: none;   /* anula el max-width: 1400px de style.css base para usar todo el ancho */
}

@media (max-width: 768px) {
    .main, .content, .page { padding: 18px 16px; }
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */

.sidebar, aside.sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border-light);
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

/* ─── Brand (logo cliente arriba) ─── */
.sb-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border-light);
}

.sb-logo-img {
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
    background: #000;
}

.sb-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    flex-shrink: 0;
}

.sb-brand-text {
    flex: 1;
    min-width: 0;
}

.sb-name {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    line-height: 1.2;
    margin-bottom: 2px;
}

.sb-client {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.25;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Navegación ─── */
.sb-section, .sidebar-section {
    color: var(--text-3);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 18px 20px 6px;
}

.sb-nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.sb-item, a.sb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 1px 10px;
    color: var(--text-2);
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s var(--ease);
}

.sb-item i { font-size: 19px; opacity: 0.9; }

.sb-item:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.sb-item.active {
    background: var(--accent-light);
    color: var(--accent-text);
    font-weight: 600;
}

.sb-item.active i { color: var(--accent); opacity: 1; }

/* ─── Footer (usuario logueado + Nubip) ─── */
.sb-foot {
    border-top: 1px solid var(--border-light);
    padding: 12px 10px;
    position: relative;
}

.sb-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background 0.15s var(--ease);
}

.sb-user-clickable:hover { background: var(--bg-hover); }

.sb-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--r-full);
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.sb-user-info {
    flex: 1;
    min-width: 0;
}

.sb-uname {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sb-urole {
    font-size: 11.5px;
    color: var(--text-2);
    line-height: 1.2;
}

.sb-user-caret {
    color: var(--text-3);
    font-size: 18px;
}

/* Menú desplegable del usuario */
.sb-user-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    left: 10px;
    right: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 100;
}

.sb-user-menu.open { display: block; }

.sb-user-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    color: var(--text-1);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.12s var(--ease);
}

.sb-user-menu a:hover { background: var(--bg-hover); }

.sb-user-menu a i { font-size: 16px; color: var(--text-2); }

.sb-user-menu-danger { color: var(--danger) !important; }
.sb-user-menu-danger:hover { background: var(--danger-bg) !important; }
.sb-user-menu-danger i { color: var(--danger) !important; }

/* ─── Powered by Nubip ─── */
.sb-poweredby {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px 4px;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

.sb-poweredby-label {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    font-weight: 600;
}

.sb-poweredby-img {
    height: 18px;
    width: auto;
    opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════
   PAGE HEAD
   ═══════════════════════════════════════════════════════════ */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    padding-bottom: 0;
    border-bottom: none;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.025em;
    margin: 0 0 4px;
    line-height: 1.2;
}

.page-sub {
    font-size: 14px;
    color: var(--text-2);
    margin: 0;
    font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    box-shadow: none;
    overflow: hidden;
    margin-bottom: 18px;
    padding: 18px 22px;
    transition: box-shadow 0.2s var(--ease);
}

.card:hover { box-shadow: var(--shadow-sm); }

/* Componentes full-bleed dentro de .card: rompen el padding extendiéndose a los bordes */
.card > .toolbar:first-child {
    margin: -18px -22px 0;
}
.card > .tbl {
    margin-left: -22px;
    margin-right: -22px;
    width: calc(100% + 44px);
}
.card > .tbl:last-child {
    margin-bottom: -18px;
}
.card > .pager {
    margin: 18px -22px -18px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
}
.card > .empty {
    margin: 0 -22px;
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-1);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-bottom: 14px;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 4px;
}

.section-title i {
    color: var(--accent);
    font-size: 16px;
}

/* ═══════════════════════════════════════════════════════════
   KPI TILES (Estilo widgets Apple Health)
   ═══════════════════════════════════════════════════════════ */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    box-shadow: none;
    position: relative;
    overflow: hidden;
    transition: all 0.2s var(--ease);
}

.stat:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.stat-l {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.stat-l i {
    color: var(--accent);
    font-size: 14px;
    opacity: 0.95;
}

.stat-v {
    font-size: 34px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.stat-foot {
    font-size: 12.5px;
    color: var(--text-2);
    font-weight: 400;
    line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════
   BOTONES
   ═══════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: var(--r-md);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    text-decoration: none;
    letter-spacing: -0.005em;
}

.btn i { font-size: 15px; }

.btn-sm {
    padding: 7px 13px;
    font-size: 13px;
    border-radius: var(--r-sm);
}

.btn-sm i { font-size: 14px; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 2px rgba(48,176,122,0.25), 0 1px 3px rgba(48,176,122,0.1);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(48,176,122,0.25), 0 2px 4px rgba(48,176,122,0.15);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-1);
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #E03E33;
}

/* Botón icono */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--r-md);
    color: var(--text-2);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s var(--ease);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.btn-icon-danger { color: var(--text-3); }
.btn-icon-danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ═══════════════════════════════════════════════════════════
   TABLAS
   ═══════════════════════════════════════════════════════════ */

.tbl {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
}

.tbl thead th {
    background: transparent;
    color: var(--text-2);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 14px 18px 12px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}

.tbl tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-1);
    vertical-align: middle;
}

.tbl tbody tr {
    transition: background 0.12s var(--ease);
}

.tbl tbody tr:hover {
    background: var(--bg-secondary);
}

.tbl tbody tr:last-child td { border-bottom: none; }

.tbl-name {
    font-weight: 600;
    color: var(--text-1);
    font-size: 14px;
}

.tbl-sub {
    color: var(--text-2);
    font-size: 12.5px;
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   BADGES (pastel, estilo iOS)
   ═══════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: none;
    text-transform: capitalize;
}

.b-success { background: var(--success-bg); color: #1A6E47; }
.b-danger  { background: var(--danger-bg);  color: #C7281F; }
.b-warning { background: var(--warning-bg); color: #B36800; }
.b-info    { background: var(--info-bg);    color: #0A5BC4; }
.b-soft, .b-gray   { background: #F0F0F3;   color: #6E6E73; }

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-1);
    font-family: inherit;
    transition: all 0.15s var(--ease);
    width: 100%;
    box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

label {
    color: var(--text-1);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
}

/* Toolbar de filtros */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

/* Override del width:100% global cuando estamos dentro de la toolbar:
   los filtros deben compartir una sola fila horizontal */
.toolbar input,
.toolbar select,
.toolbar .btn {
    width: auto;
}

.search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search input {
    width: 100%;     /* Sí ocupa el wrap entero, pero el .search es flex:1 */
}

.search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 16px;
}

.search input {
    padding-left: 36px;
}

.filter, select.filter, .toolbar select.filter {
    padding: 8px 32px 8px 12px;
    font-size: 13px;
    width: auto;
    min-width: 130px;
    max-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--r-md);
    color: var(--text-1);
    cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */

.empty {
    text-align: center;
    padding: 60px 30px;
}

.empty-icon {
    font-size: 48px;
    color: var(--text-3);
    margin-bottom: 16px;
    width: 80px;
    height: 80px;
    background: var(--bg-app);
    border-radius: var(--r-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.empty-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 6px;
}

.empty-text {
    font-size: 14px;
    color: var(--text-2);
    max-width: 400px;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */

.alert-error {
    background: var(--danger-bg);
    color: #C7281F;
    border: 1px solid #FFCFCB;
    border-radius: var(--r-lg);
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.5;
}

.alert-error i { font-size: 20px; flex-shrink: 0; margin-top: 1px; }

/* ═══════════════════════════════════════════════════════════
   PAGER
   ═══════════════════════════════════════════════════════════ */

.pager {
    padding: 14px 18px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pager-info {
    font-size: 12.5px;
    color: var(--text-2);
}

/* ═══════════════════════════════════════════════════════════
   AUTH (login)
   ═══════════════════════════════════════════════════════════ */

.auth-body {
    background: linear-gradient(135deg, #F2F2F7 0%, #E6F7EE 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--r-2xl);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 100%;
    border: 1px solid var(--border-light);
}

.auth-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-1);
    margin: 16px 0 4px;
    letter-spacing: -0.025em;
}

.auth-sub {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 28px;
}

.auth-form label {
    margin-top: 14px;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 17px;
}

.auth-input-wrap input {
    padding-left: 42px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.auth-submit {
    width: 100%;
    justify-content: center;
    margin-top: 22px;
    padding: 13px;
    font-size: 15px;
}

.auth-error {
    background: var(--danger-bg);
    color: #C7281F;
    border-radius: var(--r-md);
    padding: 11px 14px;
    margin-bottom: 14px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-foot {
    text-align: center;
    margin-top: 28px;
    font-size: 12px;
    color: var(--text-3);
}

/* ═══════════════════════════════════════════════════════════
   ELEVENLABS MODULE — Adaptación
   ═══════════════════════════════════════════════════════════ */

.tabs-page {
    border-bottom: 1px solid var(--border-light);
}

.tab-page {
    color: var(--text-2);
    padding: 12px 18px;
    border-bottom-width: 2.5px;
}

.tab-page:hover { color: var(--text-1); }

.tab-page.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Charts */
.chart-card {
    border-radius: var(--r-lg);
}

/* Hero consumo */
.hero-card {
    border-radius: var(--r-xl);
    padding: 24px 28px;
}

.hero-num {
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

/* Progress bar */
.progressbar {
    background: var(--bg-app);
    border-radius: var(--r-full);
}

.pb-ok     { background: linear-gradient(90deg, #34C759, #30B07A); }
.pb-warn   { background: linear-gradient(90deg, #FFD60A, #FF9F0A); }
.pb-danger { background: linear-gradient(90deg, #FF6961, #FF453A); }

/* Agente box */
.agente-box {
    background: var(--bg-card);
    border-radius: var(--r-lg);
}

.agente-ic {
    background: var(--accent-light);
    color: var(--accent);
}

.agente-pct { color: var(--accent); }

/* Chat bubbles */
.chat-msg-agent .chat-avatar {
    background: var(--accent-light);
    color: var(--accent);
}

.chat-msg-agent .chat-text {
    background: var(--accent-soft);
    border-color: var(--accent-light);
    border-radius: var(--r-lg);
}

.chat-msg-user .chat-text {
    border-radius: var(--r-lg);
}

/* Chips */
.chip {
    background: var(--accent-light);
    color: var(--accent-text);
    border-color: transparent;
    border-radius: var(--r-full);
}

.chip-count { background: var(--accent); }

/* Eval items */
.eval-item.eval-ok {
    background: var(--success-bg);
    border-color: transparent;
    border-radius: var(--r-md);
}
.eval-item.eval-fail {
    background: var(--danger-bg);
    border-color: transparent;
    border-radius: var(--r-md);
}
.eval-item.eval-unk {
    background: var(--bg-app);
    border-color: transparent;
    border-radius: var(--r-md);
}
.eval-ok .eval-icon   { background: var(--success); }
.eval-fail .eval-icon { background: var(--danger); }

/* ═══════════════════════════════════════════════════════════
   FICHA DE PACIENTE
   ═══════════════════════════════════════════════════════════ */

.ficha-back {
    background: transparent;
    border: none;
    color: var(--text-2);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--r-md);
    margin-bottom: 14px;
    transition: all 0.15s var(--ease);
}

.ficha-back:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

/* Paciente links */
.paciente-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.paciente-link:hover {
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════
   ANIMACIONES SUTILES
   ═══════════════════════════════════════════════════════════ */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card, .stat {
    animation: fadeInUp 0.3s var(--ease) backwards;
}

.stats .stat:nth-child(1) { animation-delay: 0.04s; }
.stats .stat:nth-child(2) { animation-delay: 0.08s; }
.stats .stat:nth-child(3) { animation-delay: 0.12s; }
.stats .stat:nth-child(4) { animation-delay: 0.16s; }

/* Smooth scroll para toda la app */
html { scroll-behavior: smooth; }

/* Scrollbar más fina y discreta */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--r-full);
    border: 2px solid var(--bg-app);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ═══════════════════════════════════════════════════════════
   CELDA DE NOTAS (botón clicable que abre el modal)
   ═══════════════════════════════════════════════════════════ */

.cell-notas-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    padding: 7px 11px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--text-1);
    cursor: pointer;
    width: 100%;
    max-width: 180px;
    text-align: left;
    transition: all 0.15s var(--ease);
    display: block;
}

.cell-notas-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

.cell-notas-btn:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.cell-notas-txt {
    display: flex;
    align-items: center;
    gap: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-notas-txt > i {
    color: var(--accent);
    font-size: 14px;
    flex-shrink: 0;
}

.cell-notas-empty {
    color: var(--text-3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
}

.cell-notas-empty i { font-size: 13px; }

/* ═══════════════════════════════════════════════════════════
   MODAL genérico (backdrop + dialog)
   ═══════════════════════════════════════════════════════════ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 28, 30, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.18s var(--ease);
}

.modal-backdrop[hidden] { display: none; }

body.modal-open { overflow: hidden; }

.modal-dialog {
    background: var(--bg-card);
    border-radius: var(--r-2xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 580px;
    max-height: 86vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.24s var(--ease-spring);
}

@keyframes modalSlideUp {
    from { transform: translateY(16px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0) scale(1);       opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 22px 24px 14px;
    gap: 12px;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.015em;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-title i {
    color: var(--accent);
    font-size: 19px;
}

.modal-sub {
    font-size: 13px;
    color: var(--text-2);
    font-weight: 500;
}

.modal-body {
    padding: 4px 24px 14px;
    flex: 1;
    overflow-y: auto;
}

.modal-body textarea {
    width: 100%;
    border: 1px solid var(--border-medium);
    border-radius: var(--r-md);
    padding: 13px 15px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-1);
    resize: vertical;
    min-height: 220px;
    line-height: 1.55;
    transition: all 0.15s var(--ease);
    background: var(--bg-card);
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.modal-help {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-3);
    flex-wrap: wrap;
    gap: 8px;
}

.modal-help kbd {
    background: var(--bg-app);
    border: 1px solid var(--border-light);
    padding: 1.5px 6px;
    border-radius: 5px;
    font-family: ui-monospace, monospace;
    font-size: 10.5px;
    margin: 0 1px;
    color: var(--text-2);
}

.modal-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.modal-foot .btn { padding: 9px 18px; }

.modal-status {
    flex: 1;
    font-size: 13px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-status.saving { color: var(--info); }
.modal-status.saving::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--info);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

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

@media (max-width: 600px) {
    .modal-backdrop { padding: 12px; }
    .modal-dialog {
        max-width: 100%;
        max-height: 95vh;
        border-radius: var(--r-lg);
    }
    .modal-head    { padding: 18px 20px 12px; }
    .modal-body    { padding: 4px 20px 12px; }
    .modal-foot    { padding: 12px 20px; flex-wrap: wrap; }
    .modal-body textarea { min-height: 180px; }
}

/* ═══════════════════════════════════════════════════════════
   TABLAS: scroll horizontal SOLO en pantallas estrechas
   ═══════════════════════════════════════════════════════════ */

/* ─── Reservas: tabla envuelta en [data-save-url] ─── */

/* Por defecto (pantallas amplias): tabla normal, sin scroll, ocupa todo el ancho */
.card > [data-save-url] {
    margin: 0 -22px -18px;
}

.card > [data-save-url] > .tbl {
    margin: 0;
    width: 100%;
}

/* Pantallas estrechas: activar scroll horizontal y forzar min-width */
@media (max-width: 1280px) {
    .card > [data-save-url] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .card > [data-save-url] > .tbl {
        min-width: 1000px;
    }
}

/* ─── Wrapper genérico .tbl-scroll: usable en cualquier tabla ─── */

/* Por defecto: bloque normal, sin scroll */
.tbl-scroll {
    width: 100%;
}

.tbl-scroll > .tbl {
    width: 100%;
}

/* Pantallas estrechas: activar scroll horizontal */
@media (max-width: 1280px) {
    .tbl-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -22px -18px;
    }
    .tbl-scroll > .tbl {
        min-width: 900px;
        margin: 0;
    }
}

/* Scrollbar más sutil para todos los wrappers de scroll */
.card > [data-save-url]::-webkit-scrollbar,
.tbl-scroll::-webkit-scrollbar {
    height: 8px;
}
.card > [data-save-url]::-webkit-scrollbar-track,
.tbl-scroll::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
.card > [data-save-url]::-webkit-scrollbar-thumb,
.tbl-scroll::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--r-full);
    border: 2px solid var(--bg-secondary);
}

/* ═══════════════════════════════════════════════════════════
   DATA-CARDS (rediseño visual de la pestaña Datos en ficha de paciente)
   ═══════════════════════════════════════════════════════════ */

.data-card {
    background: var(--bg-card);
    border-radius: var(--r-xl);
    border: 1px solid var(--border-light);
    margin-bottom: 18px;
    overflow: hidden;
    transition: box-shadow 0.2s var(--ease);
}

.data-card:hover {
    box-shadow: 0 2px 14px rgba(0,0,0,0.04);
}

.data-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.data-card-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(48,176,122,0.25);
}

.data-card-icon.dc-icon-clinical {
    background: #0A93C2;
    box-shadow: 0 2px 6px rgba(10,147,194,0.25);
}

.data-card-icon.dc-icon-tag {
    background: #8B5CF6;
    box-shadow: 0 2px 6px rgba(139,92,246,0.25);
}

.data-card-titles {
    flex: 1;
    min-width: 0;
}

.data-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.data-card-sub {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 1px;
}

.data-card-body {
    padding: 20px 22px;
}

/* En pantallas estrechas, reducir paddings */
@media (max-width: 768px) {
    .data-card-head { padding: 14px 16px; }
    .data-card-body { padding: 16px; }
}

/* ═══════════════════════════════════════════════════════════
   PESTAÑA BONOS
   ═══════════════════════════════════════════════════════════ */

.bonos-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.bonos-head-stats {
    display: flex;
    gap: 28px;
}

.bonos-head-stat {
    min-width: 110px;
}

.bhs-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-1);
    letter-spacing: -0.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.bhs-lbl {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    font-weight: 600;
    margin-top: 6px;
}

/* Sección título tipo "Bonos activos" */
.bonos-section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
    margin: 8px 0 14px;
}

.bonos-section-title i {
    font-size: 16px;
    color: var(--accent);
}

/* Empty state */
.bonos-empty {
    background: var(--bg-card);
    border: 1px dashed var(--border-medium);
    border-radius: var(--r-xl);
    padding: 48px 30px;
    text-align: center;
}

.bonos-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 14px;
}

.bonos-empty-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 6px;
}

.bonos-empty-text {
    font-size: 13.5px;
    color: var(--text-2);
    max-width: 440px;
    margin: 0 auto 18px;
    line-height: 1.55;
}

/* Grid de cards */
.bonos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Tarjeta de bono */
.bono-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--r-xl);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.bono-card:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.bono-activo {
    border-left: 3px solid var(--accent);
}

.bono-cerrado {
    opacity: 0.78;
}

.bono-cerrado:hover {
    opacity: 1;
}

/* Header de la card */
.bono-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.bono-head-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--accent-light, #E6F7EE);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
}

.bono-head-icon-muted {
    background: var(--bg-secondary);
    color: var(--text-3);
}

.bono-head-titles {
    flex: 1;
    min-width: 0;
}

.bono-terapia {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.25;
    letter-spacing: -0.005em;
}

.bono-nombre {
    font-size: 12.5px;
    color: var(--text-2);
    margin-top: 2px;
    font-style: italic;
}

/* Menú contextual */
.bono-head-actions {
    position: relative;
}

.bono-menu-btn {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-3);
    font-size: 16px;
    transition: all 0.15s var(--ease);
}

.bono-menu-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-1);
}

.bono-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--r-md);
    box-shadow: 0 8px 28px rgba(0,0,0,0.10);
    padding: 4px;
    min-width: 160px;
    display: none;
    z-index: 30;
}

.bono-menu.open {
    display: block;
}

.bono-menu button {
    width: 100%;
    background: transparent;
    border: none;
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.bono-menu button:hover {
    background: var(--bg-secondary);
}

.bono-menu button.danger {
    color: #FF453A;
}

.bono-menu button.danger:hover {
    background: #FFEDEB;
}

.bono-menu button i {
    font-size: 15px;
}

/* Barra de progreso */
.bono-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bono-progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 99px;
    overflow: hidden;
}

.bono-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, #4FCB94 100%);
    border-radius: 99px;
    transition: width 0.4s var(--ease);
}

.bono-cerrado .bono-progress-fill {
    background: linear-gradient(90deg, var(--text-3) 0%, #B8B8BD 100%);
}

.bono-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
}

.bono-progress-num {
    color: var(--text-2);
}

.bono-progress-num strong {
    color: var(--text-1);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.bono-progress-pct {
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* Meta (compra, caducidad, precio) */
.bono-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-2);
}

.bono-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bono-meta-item i {
    color: var(--text-3);
    font-size: 14px;
    flex-shrink: 0;
}

.bono-meta-item strong {
    color: var(--text-1);
    font-weight: 600;
}

.bono-meta-item.bm-warn {
    color: #B36800;
}

.bono-meta-item.bm-warn i {
    color: #FF9F0A;
}

.bono-meta-item.bm-warn strong {
    color: #B36800;
}

/* Notas */
.bono-notas {
    font-size: 12.5px;
    color: var(--text-2);
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--r-md);
    line-height: 1.5;
    border-left: 2px solid var(--border-medium);
}

.bono-notas i {
    color: var(--text-3);
    font-size: 14px;
    margin-right: 4px;
}

/* Historial de consumos (desplegable) */
.bono-consumos {
    border-top: 1px solid var(--border-light);
    padding-top: 10px;
}

.bono-consumos summary {
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
    list-style: none;
    font-weight: 600;
}

.bono-consumos summary::-webkit-details-marker { display: none; }

.bono-consumos summary i {
    transition: transform 0.2s var(--ease);
    font-size: 16px;
}

.bono-consumos[open] summary i {
    transform: rotate(90deg);
}

.bono-consumos-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bono-consumos-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: var(--r-sm);
    font-size: 12.5px;
    color: var(--text-2);
    background: var(--bg-secondary);
    position: relative;
}

.bcl-main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bcl-main i {
    color: var(--accent);
    font-size: 14px;
}

.bcl-fecha {
    color: var(--text-1);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.bcl-user {
    color: var(--text-3);
}

.bcl-terapia {
    color: var(--text-2);
}

.bcl-terapeuta {
    color: var(--text-3);
    margin-left: 2px;
}

.bcl-terapeuta strong {
    color: var(--text-1);
    font-weight: 600;
}

.bcl-notas {
    width: 100%;
    margin-top: 4px;
    margin-left: 22px;
    font-size: 11.5px;
    color: var(--text-3);
    font-style: italic;
    order: 3;
}

.bcl-undo {
    background: transparent;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    padding: 4px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s var(--ease);
}

.bcl-undo:hover {
    background: white;
    color: #FF9F0A;
}

/* Acciones de la card */
.bono-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}

.bono-btn-consumir {
    flex: 1;
    justify-content: center;
}

.bono-restantes-lbl {
    font-size: 12px;
    color: var(--text-3);
    white-space: nowrap;
}

.bono-restantes-lbl strong {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

/* Bonos cerrados (sección colapsable) */
.bonos-cerrados-wrap {
    margin-top: 8px;
}

.bonos-cerrados-wrap summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.bonos-cerrados-wrap summary::-webkit-details-marker { display: none; }

.bcw-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    border-radius: 99px;
    background: var(--bg-secondary);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════
   MODALES DE BONOS (crear/editar y consumir sesión)
   ═══════════════════════════════════════════════════════════ */

.bono-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.bono-modal[hidden] {
    display: none;
}

.bono-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,0.45);
    backdrop-filter: blur(6px);
    animation: bono-fade-in 0.2s var(--ease);
}

.bono-modal-dialog {
    position: relative;
    background: var(--bg-card);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.20), 0 4px 12px rgba(0,0,0,0.08);
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: bono-pop-in 0.25s cubic-bezier(.34, 1.56, .64, 1);
}

.bono-modal-dialog-sm {
    max-width: 460px;
}

@keyframes bono-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bono-pop-in {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bono-modal-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--border-light);
}

.bono-modal-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent-light, #E6F7EE);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.bono-modal-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-1);
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.bono-modal-sub {
    font-size: 13px;
    color: var(--text-2);
    margin-top: 2px;
}

.bono-modal-close {
    margin-left: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-3);
    font-size: 22px;
    padding: 6px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s var(--ease);
}

.bono-modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-1);
}

.bono-modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bm-field label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-2);
}

.bm-field .muted {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--text-3);
    font-size: 11.5px;
}

.bm-field input[type="text"],
.bm-field input[type="number"],
.bm-field input[type="date"],
.bm-field select,
.bm-field textarea {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--r-md);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-1);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.bm-field input:focus,
.bm-field select:focus,
.bm-field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(48,176,122,0.12);
}

.bm-field input[hidden],
.bm-field select[hidden] {
    display: none;
}

.bm-hint {
    font-size: 11.5px;
    color: var(--text-3);
    line-height: 1.45;
}

.bm-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .bm-row-2 { grid-template-columns: 1fr; }
}

.bm-error {
    background: #FFEDEB;
    color: #C7281F;
    padding: 10px 12px;
    border-radius: var(--r-md);
    font-size: 13px;
    border-left: 3px solid #FF453A;
}

.bono-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    margin-top: 6px;
    padding-top: 16px;
}

/* ═══════════════════════════════════════════════════════════
   PÁGINA: CATÁLOGO DE BONOS (plantillas)
   ═══════════════════════════════════════════════════════════ */

.bp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.bp-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--r-xl);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
    border-left: 3px solid var(--accent);
}

.bp-card:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.bp-card-inactiva {
    border-left-color: var(--border-medium);
    opacity: 0.78;
}

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

.bp-head-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent-light, #E6F7EE);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.bp-card-inactiva .bp-head-icon {
    background: var(--bg-secondary);
    color: var(--text-3);
}

.bp-head-titles { flex: 1; min-width: 0; }

.bp-nombre {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.25;
    letter-spacing: -0.005em;
}

.bp-terapia {
    font-size: 12.5px;
    color: var(--text-2);
    margin-top: 2px;
}

.bp-stats {
    display: flex;
    gap: 22px;
    padding: 12px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.bp-stat {
    text-align: left;
}

.bp-stat-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.bp-stat-lbl {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-3);
    margin-top: 4px;
    font-weight: 600;
}

.bp-descripcion {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.55;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--r-md);
    border-left: 2px solid var(--border-medium);
}

.bp-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bp-usos {
    font-size: 12.5px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.bp-usos i {
    color: var(--text-3);
    font-size: 14px;
}

.bp-usos strong {
    color: var(--text-1);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.bp-actions {
    display: flex;
    gap: 4px;
}

/* ═══════════════════════════════════════════════════════════
   COMPONENTES DEL MODAL DE BONO (selector de plantilla)
   ═══════════════════════════════════════════════════════════ */

/* Mensaje cuando no hay plantillas */
.bp-empty-inline {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: #FFF5E1;
    border-radius: var(--r-lg);
    border-left: 3px solid #FF9F0A;
}

.bp-empty-inline i {
    font-size: 28px;
    color: #B36800;
    flex-shrink: 0;
}

.bp-empty-inline strong {
    display: block;
    color: #8A4F00;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.bp-empty-inline p {
    font-size: 12.5px;
    color: #8A4F00;
    margin: 0 0 10px;
    line-height: 1.5;
}

.btn-sm {
    padding: 6px 12px !important;
    font-size: 12.5px !important;
}

/* Resumen del bono elegido (tras seleccionar plantilla) */
.bono-elegido {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--accent-light, #E6F7EE);
    border-radius: var(--r-lg);
    border-left: 3px solid var(--accent);
    animation: bono-pop-in 0.2s cubic-bezier(.34, 1.56, .64, 1);
}

.bono-elegido-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.bono-elegido-info { flex: 1; min-width: 0; }

.bono-elegido-nombre {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.2;
}

.bono-elegido-meta {
    font-size: 12.5px;
    color: var(--text-2);
    margin-top: 2px;
}

.bono-elegido-meta strong {
    color: var(--text-1);
    font-weight: 600;
}

.bono-elegido-cambiar {
    background: white;
    border: 1px solid var(--border-medium);
    color: var(--text-2);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: all 0.15s var(--ease);
}

.bono-elegido-cambiar:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Bloque "personalizar" (campos finales tras elegir plantilla) */
.bono-personalizar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: bono-fade-in 0.25s var(--ease);
}

/* Bloque "libre" (edición de bonos existentes) */
.bono-libre {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: bono-fade-in 0.25s var(--ease);
}

/* hidden debe ganar a los display:flex de arriba */
.bono-elegido[hidden],
.bono-personalizar[hidden],
.bono-libre[hidden] {
    display: none;
}

/* Checkbox en modales */
.bm-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 500 !important;
    color: var(--text-1) !important;
    font-size: 13.5px !important;
}

.bm-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.bm-checkbox small {
    color: var(--text-3);
    font-weight: 400;
    margin-left: 4px;
}
