/* ══ PANEL DIARIO ══ */

/* ── Contenedor principal ── */
.pd-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  background: var(--gray-l);
}

/* ── Toolbar sticky ── */
.pd-toolbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-d);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pd-toolbar-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.pd-toolbar-date {
  font-size: 12.5px;
  color: var(--ink-l);
  white-space: nowrap;
}
.pd-toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--gray-d);
  flex-shrink: 0;
}
.pd-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pd-counter {
  background: var(--blue-l);
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.pd-counter.all-done {
  background: #d4edda;
  color: #155724;
}
.pd-fisio-sel {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--gray-d);
  border-radius: 3px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  cursor: pointer;
}
.pd-fisio-sel:focus { border-color: var(--blue); }
.pd-refresh-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--gray-d);
  border-radius: 3px;
  background: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--ink-m);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pd-refresh-btn:hover { background: var(--blue-l); border-color: var(--blue); color: var(--blue); }

/* ── Lista de citas ── */
.pd-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* ── Fila de cita ── */
.pd-row {
  display: flex;
  align-items: flex-start;
  gap: 0;
  background: #fff;
  border: 1px solid var(--gray-d);
  border-left: 4px solid var(--blue);
  border-radius: 4px;
  margin-bottom: 8px;
  transition: box-shadow .12s, opacity .2s;
  position: relative;
}
.pd-row:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.pd-row--current {
  border-left-color: var(--orange);
  background: #fff8f2;
}
.pd-row--done {
  border-left-color: var(--green);
  opacity: .6;
}
.pd-row--done .pd-patient-name {
  text-decoration: line-through;
  color: var(--ink-l);
}

/* ── Columna hora ── */
.pd-time-col {
  width: 58px;
  padding: 12px 0 12px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.pd-time {
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  line-height: 1;
}
.pd-row--current .pd-time { color: var(--orange); }
.pd-row--done .pd-time { color: var(--ink-l); }
.pd-time-end {
  font-size: 10.5px;
  color: var(--ink-l);
}

/* ── Divisor vertical ── */
.pd-divider {
  width: 1px;
  background: var(--gray-d);
  margin: 10px 0;
  flex-shrink: 0;
}

/* ── Info principal ── */
.pd-info {
  flex: 1;
  padding: 11px 14px;
  min-width: 0;
}
.pd-line1 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}
.pd-patient-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  transition: color .1s;
}
.pd-patient-name:hover { color: var(--blue-h); text-decoration: underline; }
.pd-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.3;
  white-space: nowrap;
}
.pd-badge--new { background: #e3f0fb; color: var(--blue); }
.pd-badge--debt {
  background: var(--orange);
  color: #fff;
  cursor: help;
  font-weight: 700;
  margin-left: 8px;
}
.pd-badge--alert { background: #fff3cd; color: #856404; }
.pd-badge--insurance { background: #e8f5e9; color: #2e7d32; cursor: help; }
.pd-motivo {
  font-size: 12.5px;
  color: var(--ink-m);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-treatment-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}
.pd-treatment-name {
  font-size: 12px;
  color: var(--ink-m);
  background: var(--gray-l);
  padding: 2px 7px;
  border-radius: 3px;
}
.pd-sala-pill {
  font-size: 11.5px;
  color: var(--ink-l);
  background: #f0f4ff;
  border: 1px solid #d8e3f8;
  padding: 1px 7px;
  border-radius: 3px;
}
.pd-estado-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: .02em;
  white-space: nowrap;
}
.pd-price {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.pd-history {
  font-size: 11.5px;
  color: var(--ink-l);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-history--loading { color: var(--gray-m); }
.pd-notas {
  font-size: 11.5px;
  color: var(--ink-m);
  background: #fffbeb;
  border-left: 2px solid #f59e0b;
  padding: 2px 7px;
  border-radius: 0 3px 3px 0;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-observaciones {
  font-size: 11.5px;
  color: #5b4200;
  background: #fef9ec;
  border-left: 2px solid #d97706;
  padding: 2px 7px;
  border-radius: 0 3px 3px 0;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Acciones ── */
.pd-actions {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
  align-items: stretch;
  justify-content: center;
  min-width: 148px;
}
.pd-btn {
  height: 26px;
  padding: 0 9px;
  border-radius: 3px;
  border: 1px solid var(--gray-d);
  background: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-m);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all .1s;
}
.pd-btn:hover { background: var(--blue-l); border-color: var(--blue); color: var(--blue); }
.pd-btn--complete { border-color: #a3d9a5; color: var(--green); background: #f0fbf1; }
.pd-btn--complete:hover { background: var(--green); color: #fff; border-color: var(--green); }
.pd-btn--done { background: #d4edda; border-color: #a3d9a5; color: #155724; cursor: default; }
.pd-btn--done:hover { background: #d4edda; border-color: #a3d9a5; color: #155724; }
.pd-btn--charge { border-color: #b8d4f8; color: var(--blue); background: #eef4fe; }
.pd-btn--charge:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.pd-btn--paid { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; font-weight: 600; }
.pd-btn--paid:hover { background: #eff6ff; border-color: var(--blue); }

/* ── Banner próxima cita ── */
.pd-proxima-banner {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-m);
  background: #f0f7ff;
  border: 1px solid #c3dafe;
  border-radius: 20px;
  padding: 3px 12px;
  white-space: nowrap;
  transition: background .3s, border-color .3s;
}
.pd-proxima-banner--soon {
  background: #fff8f0;
  border-color: #fdd9b5;
  color: #92400e;
}
.pd-proxima-banner--now {
  background: #f0fdf4;
  border-color: #a7f3d0;
  color: #065f46;
}
.pd-proxima-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: pdPulse 1.8s ease-in-out infinite;
}
@keyframes pdPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

/* ── Huecos libres ── */
.pd-gap-row {
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-l);
  padding: 6px 0;
  border-top: 1px dashed var(--gray-d);
  border-bottom: 1px dashed var(--gray-d);
  margin: 2px 0 6px;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 6px,
    #f3f4f6 6px,
    #f3f4f6 7px
  );
  border-radius: 3px;
}

/* ── Resumen del día ── */
.pd-summary-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: #fff;
  border: 1px solid var(--gray-d);
  border-radius: 6px;
  margin-top: 12px;
  padding: 14px 24px;
}
.pd-summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 28px;
}
.pd-summary-sep {
  width: 1px;
  height: 32px;
  background: var(--gray-d);
  flex-shrink: 0;
}
.pd-summary-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.pd-summary-value--green { color: var(--green); }
.pd-summary-value--blue  { color: var(--blue); }
.pd-summary-value--ink   { color: var(--ink); }
.pd-summary-label {
  font-size: 11px;
  color: var(--ink-l);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 500;
}

/* ── Botón tareas del día ── */
.pd-todo-btn {
  height: 28px;
  padding: 0 12px;
  border-radius: 3px;
  border: 1px solid #c3dafe;
  background: #ebf4ff;
  color: var(--blue);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.pd-todo-btn:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.pd-todo-count {
  background: var(--orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Modal Todo ── */
.pd-todo-modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  margin: 40px auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 85vh;
}
.pd-todo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--gray-d);
  background: linear-gradient(135deg, #f0f7ff 0%, #fff 100%);
  flex-shrink: 0;
}
.pd-todo-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pd-todo-icon {
  font-size: 26px;
  line-height: 1;
}
.pd-todo-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.pd-todo-subtitle {
  font-size: 11.5px;
  color: var(--ink-l);
  margin-top: 1px;
}
.pd-todo-close {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--gray-l);
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-m);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s;
  flex-shrink: 0;
}
.pd-todo-close:hover { background: #fde8e8; color: var(--red); }
.pd-todo-input-wrap {
  display: flex;
  gap: 8px;
  padding: 16px 22px 12px;
  flex-shrink: 0;
}
.pd-todo-input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1.5px solid var(--gray-d);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color .12s;
}
.pd-todo-input:focus { border-color: var(--blue); }
.pd-todo-add-btn {
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s;
}
.pd-todo-add-btn:hover { background: var(--blue-h); }
.pd-todo-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 22px 8px;
}
.pd-todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  transition: opacity .15s;
}
.pd-todo-item:last-child { border-bottom: none; }
.pd-todo-item--done { opacity: .55; }
.pd-todo-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--gray-d);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  transition: all .15s;
}
.pd-todo-check:hover { border-color: var(--blue); }
.pd-todo-check--done { background: var(--green); border-color: var(--green); }
.pd-todo-text {
  flex: 1;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
  word-break: break-word;
}
.pd-todo-item--done .pd-todo-text {
  text-decoration: line-through;
  color: var(--ink-l);
}
.pd-todo-delete {
  width: 22px;
  height: 22px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--gray-m);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .12s, background .12s, color .12s;
  flex-shrink: 0;
}
.pd-todo-item:hover .pd-todo-delete { opacity: 1; }
.pd-todo-delete:hover { background: #fde8e8; color: var(--red); }
.pd-todo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 20px;
  color: var(--ink-l);
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}
.pd-todo-empty-icon { font-size: 32px; }
.pd-todo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px 16px;
  border-top: 1px solid var(--gray-d);
  flex-shrink: 0;
  min-height: 44px;
}
.pd-todo-stats {
  font-size: 11.5px;
  color: var(--ink-l);
}
.pd-todo-clear-btn {
  font-size: 11.5px;
  color: var(--ink-l);
  background: none;
  border: 1px solid var(--gray-d);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all .12s;
}
.pd-todo-clear-btn:hover { background: #fde8e8; border-color: #f5c6c2; color: var(--red); }

/* ── Estado vacío / loading ── */
.pd-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-l);
  font-size: 13px;
}
.pd-empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
  display: block;
}
.pd-loading {
  text-align: center;
  padding: 40px;
  color: var(--gray-m);
  font-size: 13px;
}
