/* ================================================
   MedConsulta — Estilos principales
   ================================================ */

:root {
  --teal:        #1D9E75;
  --teal-dark:   #0F6E56;
  --teal-light:  #E1F5EE;
  --teal-text:   #085041;
  --purple:      #534AB7;
  --purple-light:#EEEDFE;
  --amber:       #BA7517;
  --amber-light: #FAEEDA;
  --red:         #A32D2D;
  --red-light:   #FCEBEB;
  --green:       #3B6D11;
  --green-light: #EAF3DE;
  --blue:        #185FA5;
  --blue-light:  #E6F1FB;
  --gray:        #5F5E5A;
  --gray-light:  #F1EFE8;

  --bg:          #f5f5f3;
  --bg-card:     #ffffff;
  --border:      rgba(0,0,0,0.09);
  --border-md:   rgba(0,0,0,0.15);
  --text:        #1a1a18;
  --text-muted:  #6b6b67;
  --text-hint:   #9b9b97;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;

  --sidebar-w:   220px;
  --topbar-h:    56px;
  --shadow:      0 1px 3px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---- SCREENS ---- */
.screen { display: none; }
.screen.active { display: block; }

/* ---- LOGIN ---- */
.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-logo { width: 64px; height: 64px; margin-bottom: 16px; }
.login-logo svg { width: 100%; height: 100%; }
.login-title { font-size: 24px; font-weight: 600; color: var(--text); }
.login-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }
.login-form { width: 100%; max-width: 380px; }
.login-divider { width: 100%; max-width: 380px; border: none; border-top: 1px solid var(--border); margin: 20px 0 16px; }
.login-register-text { font-size: 13px; color: var(--text-muted); }

/* ---- TOPBAR ---- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.app-title { font-size: 16px; font-weight: 600; color: var(--teal); }
.menu-toggle { background: none; border: none; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); color: var(--text-muted); }
.menu-toggle svg { width: 20px; height: 20px; display: block; }
.topbar-btn { background: none; border: none; cursor: pointer; padding: 8px; border-radius: var(--radius-sm); color: var(--text-muted); position: relative; }
.topbar-btn svg { width: 20px; height: 20px; display: block; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--red); color: white;
  font-size: 10px; min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.topbar-name { font-size: 13px; color: var(--text-muted); display: none; }
@media(min-width:768px){ .topbar-name { display: block; } }
.user-pill { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-md); }
.user-pill:hover { background: var(--bg); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--purple-light); color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.user-menu {
  position: absolute; top: calc(var(--topbar-h) + 4px); right: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  overflow: hidden; z-index: 200; min-width: 140px;
}
.user-menu button {
  display: block; width: 100%; padding: 10px 16px;
  text-align: left; background: none; border: none;
  font-size: 14px; cursor: pointer; color: var(--text);
}
.user-menu button:hover { background: var(--bg); }

/* ---- LAYOUT ---- */
#screen-app.active { height: 100vh; display: flex; flex-direction: column; }
.app-body {
  display: flex;
  margin-top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 12px 0;
  transition: transform 0.25s ease;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.35); z-index: 90;
}

@media(max-width:767px) {
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
    z-index: 95; transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
}

.nav-section { padding: 0 10px; margin-bottom: 4px; }
.nav-label {
  font-size: 10px; font-weight: 600; color: var(--text-hint);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 10px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-md);
  cursor: pointer; font-size: 13px; color: var(--text-muted);
  transition: all 0.12s; position: relative; margin-bottom: 1px;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--teal-light); color: var(--teal-text); font-weight: 500; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }
.nav-badge {
  background: var(--red); color: white; font-size: 10px;
  border-radius: 8px; padding: 1px 5px; margin-left: auto; font-weight: 600;
}

/* ---- MAIN CONTENT ---- */
.main-content { flex: 1; overflow-y: auto; padding: 20px; }

/* ---- CARDS ---- */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 11px; font-weight: 600; color: var(--text-hint);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px;
}
.section-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 12px; }

/* ---- GRIDS ---- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media(max-width:900px){ .grid4 { grid-template-columns: 1fr 1fr; } }
@media(max-width:700px){ .grid2,.grid3,.grid4 { grid-template-columns: 1fr; } }

/* ---- STAT CARDS ---- */
.stat-num { font-size: 28px; font-weight: 600; line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---- FORMS ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input, select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-md); border-radius: var(--radius-md);
  font-size: 14px; color: var(--text); background: var(--bg-card);
  transition: border-color 0.12s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(29,158,117,0.12);
}
textarea { resize: vertical; min-height: 80px; }
.error-msg { color: var(--red); font-size: 13px; margin-bottom: 10px; padding: 8px 12px; background: var(--red-light); border-radius: var(--radius-sm); }

/* ---- BOTONES ---- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--teal); color: white; border: none;
  padding: 9px 18px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.12s;
}
.btn-primary:hover { background: var(--teal-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary.full { width: 100%; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border-md);
  padding: 8px 16px; border-radius: var(--radius-md);
  font-size: 14px; cursor: pointer; transition: all 0.12s;
}
.btn-secondary:hover { background: var(--bg); }
.btn-danger {
  background: var(--red-light); color: var(--red); border: 1px solid var(--red-light);
  padding: 8px 14px; border-radius: var(--radius-md);
  font-size: 13px; cursor: pointer;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon {
  width: 32px; height: 32px; border-radius: var(--radius-md);
  border: 1px solid var(--border-md); background: var(--bg-card);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all 0.12s;
}
.btn-icon:hover { background: var(--bg); }
.btn-icon.accept:hover { background: var(--teal-light); border-color: var(--teal); color: var(--teal-text); }
.btn-icon.reject:hover { background: var(--red-light); border-color: var(--red); color: var(--red); }

/* ---- TAGS / BADGES ---- */
.tag {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 20px;
}
.tag-green  { background: var(--green-light);  color: var(--green); }
.tag-teal   { background: var(--teal-light);   color: var(--teal-text); }
.tag-amber  { background: var(--amber-light);  color: var(--amber); }
.tag-red    { background: var(--red-light);    color: var(--red); }
.tag-purple { background: var(--purple-light); color: var(--purple); }
.tag-blue   { background: var(--blue-light);   color: var(--blue); }
.tag-gray   { background: var(--gray-light);   color: var(--gray); }

/* ---- CITA ITEMS ---- */
.cita-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--bg);
  border-radius: var(--radius-md); margin-bottom: 8px;
}
.cita-hora { font-size: 13px; font-weight: 600; min-width: 44px; }
.cita-info { flex: 1; }
.cita-name { font-size: 13px; font-weight: 500; }
.cita-desc { font-size: 12px; color: var(--text-muted); }
.cita-actions { display: flex; gap: 6px; }

/* ---- TIMELINE ---- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content:''; position:absolute; left:7px; top:0; bottom:0; width:1px; background: var(--border-md); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-dot { position:absolute; left:-18px; top:3px; width:10px; height:10px; border-radius:50%; background: var(--teal); }
.tl-date { font-size:11px; color:var(--text-hint); margin-bottom:3px; }
.tl-title { font-size:13px; font-weight:500; }
.tl-desc { font-size:12px; color:var(--text-muted); margin-top:2px; }

/* ---- TABLE ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 8px 12px; font-size:11px; font-weight:600; color:var(--text-hint); text-transform:uppercase; letter-spacing:0.05em; border-bottom: 2px solid var(--border); }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* ---- MINI STATS ---- */
.mini-stat { background: var(--bg); border-radius: var(--radius-md); padding: 10px 12px; }
.mini-stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.mini-stat-val { font-size: 16px; font-weight: 600; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---- ROWS (par llave/valor) ---- */
.kv-row { display:flex; align-items:center; padding:8px 0; border-bottom:1px solid var(--border); }
.kv-row:last-child { border-bottom:none; }
.kv-label { font-size:12px; color:var(--text-muted); min-width:140px; flex-shrink:0; }
.kv-val { font-size:13px; flex:1; }

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.page-title { font-size: 20px; font-weight: 600; color: var(--text); }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1a1a18; color: white;
  padding: 10px 20px; border-radius: var(--radius-md);
  font-size: 14px; z-index: 999; box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.toast.success { background: var(--teal-dark); }
.toast.error   { background: var(--red); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg-card); border-radius: var(--radius-lg);
  padding: 24px; max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 17px; font-weight: 600; }

/* ---- BÚSQUEDA ---- */
.search-bar { position: relative; margin-bottom: 16px; }
.search-bar input { padding-left: 36px; }
.search-bar::before {
  content: ''; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%236b6b67' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ---- LOADING ---- */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 48px; color: var(--text-muted); font-size: 14px; gap: 10px;
}
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border-md);
  border-top-color: var(--teal); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- EMPTY STATE ---- */
.empty-state { text-align:center; padding:48px 24px; color:var(--text-muted); }
.empty-state svg { width:48px; height:48px; opacity:0.3; margin-bottom:12px; }
.empty-state p { font-size:14px; }

/* ---- CALENDARIO ---- */
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:3px; margin-bottom:12px; }
.cal-cell { text-align:center; padding:5px 2px; font-size:12px; border-radius:var(--radius-sm); cursor:pointer; }
.cal-cell.header { color:var(--text-muted); font-weight:500; cursor:default; font-size:11px; }
.cal-cell:not(.header):not(.empty):hover { background:var(--bg); }
.cal-cell.has-event { background:var(--teal-light); color:var(--teal-text); font-weight:500; }
.cal-cell.today { background:var(--teal); color:white; font-weight:600; }
.cal-cell.selected { background:var(--purple); color:white; font-weight:600; }
.cal-cell.empty { cursor:default; }

/* ---- HORARIOS ---- */
.horarios-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:16px; }
.horario-btn {
  padding:8px; border:1px solid var(--border-md); border-radius:var(--radius-md);
  background:var(--bg-card); font-size:13px; cursor:pointer; text-align:center;
  transition:all 0.12s;
}
.horario-btn:hover { border-color:var(--teal); background:var(--teal-light); }
.horario-btn.selected { background:var(--teal); color:white; border-color:var(--teal); }
.horario-btn.ocupado { opacity:0.4; cursor:not-allowed; text-decoration:line-through; }
@media(max-width:480px){ .horarios-grid { grid-template-columns:repeat(3,1fr); } }

/* ---- NOTIF ITEMS ---- */
.notif-item { display:flex; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.notif-item:last-child { border-bottom:none; }
.notif-dot { width:8px; height:8px; border-radius:50%; background:var(--teal); margin-top:5px; flex-shrink:0; }
.notif-dot.leida { background:var(--border-md); }
.notif-text { font-size:13px; }
.notif-time { font-size:11px; color:var(--text-hint); margin-top:2px; }

/* ---- PACIENTE HEADER ---- */
.pac-header { display:flex; align-items:flex-start; gap:14px; margin-bottom:16px; }
.pac-avatar { width:52px; height:52px; border-radius:50%; background:var(--purple-light); color:var(--purple); display:flex; align-items:center; justify-content:center; font-size:18px; font-weight:600; flex-shrink:0; }
.pac-name { font-size:17px; font-weight:600; }
.pac-meta { font-size:12px; color:var(--text-muted); margin-top:3px; }
.pac-tags { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 3px; }

/* ================================================
   v2 — Componentes nuevos
   ================================================ */
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 980px; }
.modal-close { background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: var(--radius-sm); }
.modal-close:hover { background: var(--bg); }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.btn-row.between { justify-content: space-between; }
.btn-link { background: none; border: none; color: var(--teal); cursor: pointer; font-size: 13px; padding: 0; text-decoration: underline; }
.btn-danger:hover { background: #f7d5d5; }
button:disabled { opacity: .6; cursor: not-allowed; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tab { padding: 8px 14px; font-size: 13px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.tab.active { border-bottom-color: var(--teal); color: var(--teal-text); font-weight: 600; }
.tab:hover { color: var(--text); }

.form-section { font-size: 11px; font-weight: 600; color: var(--text-hint); text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.field-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media(max-width:600px){ .field-row, .field-row3 { grid-template-columns: 1fr; } }
.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin-bottom: 12px; cursor: pointer; line-height: 1.4; }
.check-row input { width: auto; margin-top: 2px; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.aviso { border-radius: var(--radius-md); padding: 10px 14px; font-size: 13px; margin-bottom: 14px; line-height: 1.45; }
.aviso-info { background: var(--blue-light); color: var(--blue); }
.aviso-ok { background: var(--teal-light); color: var(--teal-text); }
.aviso-warn { background: var(--amber-light); color: var(--amber); }
.aviso-error { background: var(--red-light); color: var(--red); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border-md); background: var(--bg-card); font-size: 12px; cursor: pointer; }
.chip.active { background: var(--teal); border-color: var(--teal); color: white; }
.count { background: var(--red); color: white; border-radius: 10px; font-size: 10px; padding: 1px 6px; font-weight: 600; }

.table-wrap { overflow-x: auto; }
.data-table.compact td, .data-table.compact th { padding: 6px 8px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* Agenda semanal */
.semana { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 6px; overflow-x: auto; }
.semana-dia { background: var(--bg); border-radius: var(--radius-md); padding: 8px; min-height: 160px; }
.semana-dia.hoy { outline: 2px solid var(--teal); }
.semana-dia h4 { font-size: 12px; font-weight: 600; margin-bottom: 6px; display: flex; justify-content: space-between; }
.cita-mini { background: var(--bg-card); border-left: 3px solid var(--teal); border-radius: 6px; padding: 5px 7px; margin-bottom: 5px; font-size: 11px; cursor: pointer; }
.cita-mini.pendiente { border-left-color: var(--amber); }
.cita-mini.cancelada, .cita-mini.rechazada, .cita-mini.no_asistio { border-left-color: var(--gray); opacity: .55; }
.cita-mini.completada { border-left-color: var(--purple); }
.cita-mini b { display: block; font-size: 12px; }
.bloqueo-mini { background: repeating-linear-gradient(45deg, var(--gray-light), var(--gray-light) 6px, #e6e3da 6px, #e6e3da 12px); border-radius: 6px; padding: 5px 7px; margin-bottom: 5px; font-size: 11px; color: var(--gray); }

/* Horarios de atención */
.horario-dia { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.horario-rangos { display: flex; flex-direction: column; gap: 6px; }
.horario-rango { display: flex; gap: 6px; align-items: center; }
.horario-rango input { width: 110px; }

/* Gráficas */
.chart { width: 100%; height: auto; color: var(--text); display: block; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* Autocompletar */
.autocomplete { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--bg-card); border: 1px solid var(--border-md); border-radius: var(--radius-md); box-shadow: 0 6px 20px rgba(0,0,0,.1); max-height: 260px; overflow-y: auto; }
.ac-item { padding: 8px 10px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--border); }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--teal-light); }
.ac-item small { color: var(--text-muted); }
.sel-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--teal-light); border-radius: var(--radius-md); font-size: 13px; }

/* Firma */
.firma-pad { width: 100%; height: 180px; border: 2px dashed var(--border-md); border-radius: var(--radius-md); background: #fff; touch-action: none; cursor: crosshair; }
.doc-preview { white-space: pre-wrap; font-size: 12px; line-height: 1.5; background: var(--bg); border-radius: var(--radius-md); padding: 12px; max-height: 260px; overflow-y: auto; }

/* Portal / login */
.login-links { display: flex; justify-content: space-between; font-size: 13px; margin-top: 10px; }
.login-consultorio { text-align: center; margin-bottom: 24px; }
.login-consultorio img { max-height: 64px; margin-bottom: 10px; }
.stat-card-link { cursor: pointer; transition: box-shadow .12s; }
.stat-card-link:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.pill-num { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--bg); font-size: 12px; font-weight: 600; text-align: center; }
.kv-row .kv-val.pre { white-space: pre-wrap; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.badge-soft { font-size: 10px; padding: 2px 7px; border-radius: 10px; background: var(--gray-light); color: var(--gray); }
@media(max-width:700px){ .main-content { padding: 14px; } .horario-dia { grid-template-columns: 1fr; } }
@media print { .sidebar, .topbar, #mc-floating-assistant, .no-print { display: none !important; } .app-body { margin: 0; height: auto; } .main-content { overflow: visible; } }

/* ---- Correcciones y anulaciones ---- */
.anulada .tl-title, .anulada .tl-desc, .list-row.anulada .rx-cuerpo { text-decoration: line-through; color: var(--text-hint); }
.cambio-antes { text-decoration: line-through; color: var(--red); white-space: pre-wrap; margin-top: 2px; }
.cambio-despues { color: var(--green); white-space: pre-wrap; }

/* ---- Botones de WhatsApp (envío manual) ---- */
.btn-wa { background: #25D366; color: #fff; border: none; border-radius: var(--radius-sm); padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-wa:hover { background: #1ebe5b; }
.btn-wa.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-wa.wa-enviado, .btn-secondary.wa-enviado { background: var(--teal-light, #e1f5ee); color: var(--teal-text, #0f6e56); }
.btn-wa.wa-enviado::after, .btn-secondary.wa-enviado::after { content: ' ✓'; }
.rw-row { flex-wrap: wrap; row-gap: 8px; }
