/* =====================================================
   DASHBOARD CLÍNICO PREMIUM
   ===================================================== */
.db-vista { padding: 8px 4px 40px; }

/* ---------- Encabezado ---------- */
.db-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.db-saludo { font-size: 28px; font-weight: 900; color: var(--morado-oscuro); letter-spacing: -.5px; line-height: 1.1; }
.db-fecha { font-size: 14px; font-weight: 700; color: #7b8794; margin-top: 4px; }
.db-acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.db-refrescar { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--fz-gris-200); background: #fff; color: var(--fz-gris-600); cursor: pointer; font-size: 15px; transition: .2s; }
.db-refrescar:hover { color: var(--turquesa); border-color: var(--turquesa); transform: rotate(60deg); }

/* ---------- Indicadores ---------- */
.db-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.db-kpi { background: #fff; border: 1px solid #eef0f3; border-radius: 18px; padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; position: relative; overflow: hidden; transition: .2s; }
.db-kpi::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--c); opacity: .85; }
.db-kpi[onclick] { cursor: pointer; }
.db-kpi[onclick]:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(16, 24, 40, .08); }
.db-kpi-icono { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 19px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); flex-shrink: 0; }
.db-kpi-texto { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.db-kpi-titulo { font-size: 11.5px; font-weight: 900; letter-spacing: .5px; text-transform: uppercase; color: #7b8794; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-kpi-valor { font-size: 30px; font-weight: 900; color: #1e293b; letter-spacing: -1px; line-height: 1.15; margin-top: 2px; white-space: nowrap; }
.db-kpi-sub { font-size: 12px; font-weight: 700; color: #94a3b8; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-progreso { height: 6px; background: #eef2f6; border-radius: 99px; margin-top: 8px; overflow: hidden; }
.db-progreso > div { height: 100%; width: 0; background: var(--c); border-radius: 99px; transition: width .5s; }

/* ---------- Cuerpo ---------- */
.db-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.db-lateral { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.db-tarjeta { background: #fff; border: 1px solid #eef0f3; border-radius: 18px; padding: 18px 20px; box-shadow: 0 1px 2px rgba(16, 24, 40, .03); }
.db-tarjeta-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.db-tarjeta-cab h3 { font-size: 15px; font-weight: 900; color: #1e293b; display: flex; align-items: center; gap: 9px; }
.db-tarjeta-cab h3 i { color: var(--turquesa); font-size: 14px; }
.db-tarjeta-cab h3 span { font-weight: 700; color: #94a3b8; text-transform: capitalize; }
.db-enlace { background: none; border: 0; color: var(--morado); font-weight: 800; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.db-enlace:hover { text-decoration: underline; }
.db-leyenda { display: flex; gap: 12px; font-size: 11px; font-weight: 800; flex-wrap: wrap; }
.db-leyenda i { font-size: 8px; margin-right: 3px; }
.db-vacio { text-align: center; color: #94a3b8; font-weight: 700; font-size: 13.5px; padding: 18px 8px; }
.db-vacio i { display: block; font-size: 26px; margin-bottom: 8px; opacity: .8; }

/* ---------- Agenda del día (restyling de las filas existentes) ---------- */
.db-agenda-lista { max-height: 640px; overflow-y: auto; padding-right: 4px; margin-right: -4px; }
.db-agenda-lista .slot-uni { border: 1px solid #edf0f4; border-radius: 14px; margin-bottom: 10px; background: #fff; box-shadow: none; transition: .18s; }
.db-agenda-lista .slot-uni:hover { transform: none; box-shadow: 0 6px 18px rgba(16, 24, 40, .07); }
.db-agenda-lista .slot-uni-hora { width: 74px; font-size: 15px; font-weight: 900; background: #f8fafc; color: #64748b; border-right: 1px solid #edf0f4; }
.db-agenda-lista .slot-ocupado { border-left-width: 5px !important; }
.db-agenda-lista .slot-ocupado .slot-uni-hora { background: transparent; }
.db-agenda-lista .slot-ocupado-contenido { padding: 12px 16px; }
.db-agenda-lista .slot-ocupado-contenido > div:first-child > div:first-child { font-size: 14px !important; letter-spacing: .1px; }
.db-agenda-lista .slot-libre { border: 1.5px dashed #d5dde6; background: transparent; padding: 0; min-height: 44px; align-items: center; }
.db-agenda-lista .slot-libre:hover { border-color: #34d399; background: #f0fdf9; }
.db-agenda-lista .slot-libre .slot-uni-hora { background: transparent; font-size: 14px; color: #94a3b8; width: 74px; }
.db-agenda-lista .slot-libre span { font-size: 12px !important; font-weight: 800 !important; color: #34a883 !important; letter-spacing: .3px !important; }
.db-agenda-lista .slot-libre button { background: transparent !important; color: #0e9f97 !important; border: 1px solid #b6e5e1 !important; padding: 5px 12px !important; font-size: 12px; border-radius: 99px !important; }
.db-agenda-lista .slot-libre:hover button { background: #0e9f97 !important; color: #fff !important; }
.db-agenda-lista select { border-radius: 9px !important; border: 1px solid #e2e8f0 !important; background: #fff; color: #475569; }
.db-agenda-lista .btn-tag { border-radius: 9px; width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Calendario ---------- */
.db-calendario-tarjeta { padding: 16px 18px 14px; }
.db-cal-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.db-cal-cab span { font-size: 15px; font-weight: 900; color: var(--morado-oscuro); text-transform: capitalize; }
.db-cal-cab button { width: 30px; height: 30px; border: 0; border-radius: 9px; background: #f5f7fa; color: #64748b; cursor: pointer; }
.db-cal-cab button:hover { background: var(--turquesa); color: #fff; }
.db-cal-semana { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; font-weight: 900; color: #a0aec0; margin-bottom: 4px; }
.db-calendario-tarjeta .cal-grilla { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.db-calendario-tarjeta .cal-dia { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 13px; font-weight: 800; color: #475569; cursor: pointer; transition: .15s; border: 1.5px solid transparent; }
.db-calendario-tarjeta .cal-dia:hover { background: #f0fdfa; }
.db-calendario-tarjeta .cal-dia.empty { cursor: default; }
.db-calendario-tarjeta .cal-dia.empty:hover { background: transparent; }
.db-calendario-tarjeta .cal-dia.hoy { border-color: var(--morado); color: var(--morado); }
.db-calendario-tarjeta .cal-dia.active { background: var(--turquesa); color: #fff; box-shadow: 0 4px 10px rgba(0, 168, 157, .35); }

/* ---------- Siguiente paciente ---------- */
.db-sig { display: flex; gap: 14px; align-items: center; }
.db-sig-hora { text-align: center; background: color-mix(in srgb, var(--c) 10%, white); border: 1px solid color-mix(in srgb, var(--c) 30%, white); border-radius: 14px; padding: 10px 12px; min-width: 86px; }
.db-sig-hora b { display: block; font-size: 17px; font-weight: 900; color: var(--c); white-space: nowrap; }
.db-sig-hora span { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .5px; color: var(--c); opacity: .85; }
.db-sig-datos { min-width: 0; }
.db-sig-nombre { font-size: 15.5px; font-weight: 900; color: #1e293b; line-height: 1.25; }
.db-sig-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.db-chip { display: inline-flex; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 900; color: var(--c); background: color-mix(in srgb, var(--c) 11%, white); border: 1px solid color-mix(in srgb, var(--c) 28%, white); }
.db-sig-botones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Requiere atención ---------- */
.db-alerta { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f4f7; }
.db-alerta:last-child { border-bottom: 0; padding-bottom: 0; }
.db-alerta:first-child { padding-top: 0; }
.db-alerta-icono { width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--c) 12%, white); color: var(--c); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.db-alerta-texto { flex: 1; font-size: 13px; font-weight: 600; color: #475569; line-height: 1.35; min-width: 0; }
.db-alerta-texto b { color: #1e293b; font-weight: 800; }
.db-alerta-btn { background: #f1f5f9; border: 0; color: #334155; font-weight: 800; font-size: 12px; padding: 7px 12px; border-radius: 99px; cursor: pointer; font-family: inherit; white-space: nowrap; transition: .15s; }
.db-alerta-btn:hover { background: var(--turquesa); color: #fff; }

/* ---------- Por cobrar ---------- */
.db-cobrar-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.db-cobrar-total b { font-size: 22px; font-weight: 900; color: #c2410c; letter-spacing: -.5px; }
.db-cobrar-total span { font-size: 12px; font-weight: 800; color: #9a6b4b; }
.db-deudor { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f4f7; }
.db-deudor:last-child { border-bottom: 0; padding-bottom: 0; }
.db-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--morado); color: #fff; font-weight: 900; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.db-deudor-nombre { flex: 1; min-width: 0; line-height: 1.25; }
.db-deudor-nombre b { display: block; font-size: 13px; color: #1e293b; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-deudor-nombre small { font-size: 11.5px; color: #94a3b8; font-weight: 700; }
.db-deudor-monto { font-weight: 900; font-size: 13.5px; color: #b91c1c; white-space: nowrap; }

/* ---------- Estado de los pacientes ---------- */
#resumen-estados-pacientes-container > div:first-child { gap: 12px !important; }
#resumen-estados-pacientes-container .tarjeta-estado-clickeable { border-radius: 14px !important; padding: 14px 16px !important; text-align: left !important; border: 1px solid rgba(0, 0, 0, .04); }
#resumen-estados-pacientes-container .tarjeta-estado-clickeable > div:first-child { font-size: 26px !important; letter-spacing: -1px; line-height: 1.1; }
#resumen-estados-pacientes-container .tarjeta-estado-clickeable > div:last-child { font-size: 11px !important; letter-spacing: .5px; margin-top: 2px; }
.db-detalles { margin-top: 14px; border: 1px solid #eef0f3; border-radius: 14px; padding: 0 16px; background: #fcfdfe; }
.db-detalles > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 0; font-weight: 800; font-size: 13.5px; color: #475569; }
.db-detalles > summary::-webkit-details-marker { display: none; }
.db-detalles > summary i:last-child { transition: transform .2s; color: #94a3b8; }
.db-detalles[open] > summary i:last-child { transform: rotate(180deg); }
.db-detalles[open] { padding-bottom: 16px; }

/* ---------- Adaptación ---------- */
@media (max-width: 1280px) { .db-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .db-cuerpo { grid-template-columns: 1fr; } .db-lateral { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
    .db-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .db-kpi { padding: 13px; gap: 10px; flex-direction: column; }
    .db-kpi-valor { font-size: 24px; }
    .db-lateral { grid-template-columns: 1fr; }
    .db-saludo { font-size: 23px; }
    .db-acciones .fz-btn { padding: 10px 12px; font-size: 13px; }
}

/* La agenda ocupa el mismo alto que la columna derecha y desplaza por dentro */
.db-cuerpo { align-items: stretch; }
.db-agenda-tarjeta { display: flex; flex-direction: column; }
.db-agenda-lista { flex: 1 1 0; height: 0; min-height: 520px; max-height: none; }
