/* Historial de atenciones (ficha): una línea por atención, detalle en dos columnas al tocar. Colores de la app, claro y noche. */
.hu { --hu-acc: var(--accent-strong, #0369A1); --hu-accs: rgba(2, 132, 199, .12); --hu-ok: #1B7F4B; --hu-oks: rgba(27, 127, 75, .13); --hu-warn: #9A5B00; --hu-warns: rgba(194, 120, 22, .16); --hu-soft: rgba(120, 130, 150, .10); --hu-line: var(--line, rgba(15, 23, 42, .10)); }
html[data-theme="dark"] .hu { --hu-acc: #38BDF8; --hu-accs: rgba(56, 189, 248, .16); --hu-ok: #4ADE80; --hu-oks: rgba(74, 222, 128, .14); --hu-warn: #FFC857; --hu-warns: rgba(255, 200, 87, .16); }
.hu-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.hu-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--hu-oks); color: var(--hu-ok); font-weight: 700; font-size: 13px; }
.hu-seg { display: flex; gap: 2px; background: rgba(120, 130, 150, .16); border-radius: 10px; padding: 2px; margin-left: auto; }
.hu-seg button { min-height: 34px; border: 0; border-radius: 8px; background: transparent; font-weight: 600; font-size: 13px; font-family: inherit; color: var(--muted, #5A6580); cursor: pointer; white-space: nowrap; padding: 0 12px; box-shadow: none; }
.hu-seg button.on { background: var(--card, #fff); color: var(--hu-acc); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.hu .hu-btn { min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--hu-accs); color: var(--hu-acc); font-weight: 600; font-size: 13px; font-family: inherit; cursor: pointer; white-space: nowrap; box-shadow: none; }
.hu .hu-btn:hover { background: var(--hu-accs); filter: brightness(.96); }
.hu .hu-btn.sec { background: var(--hu-soft); color: var(--muted, #5A6580); }
.hu .hu-btn.del { background: rgba(220, 38, 38, .10); color: var(--bad, #DC2626); }
.hu-f { border-top: .5px solid var(--hu-line); }
.hu-r, .hu-hd { display: grid; grid-template-columns: 34px 86px minmax(0, 1fr) 130px 104px 162px; gap: 12px; align-items: center; padding: 8px 2px; cursor: pointer; }
.hu-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--hu-accs); color: var(--hu-acc); font-weight: 700; font-size: 13px; border: 1px solid rgba(3, 105, 161, .25); }
.hu-n.ab { background: var(--hu-warns); color: var(--hu-warn); border-color: rgba(154, 91, 0, .25); }
.hu-r .fe { font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.hu-r .tx { min-width: 0; }
.hu-r .tx > b { font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.hu-r .tx small { display: block; font-size: 12.5px; color: var(--muted, #5A6580); margin-top: 1px; line-height: 1.3; }
.hu-tag { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: var(--hu-warns); color: var(--hu-warn); font-size: 11.5px; font-weight: 700; }
.hu-mo { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.hu-mo b { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.hu-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.hu-pill.ok { background: var(--hu-oks); color: var(--hu-ok); } .hu-pill.deb { background: var(--hu-warns); color: var(--hu-warn); } .hu-pill.fav { background: var(--hu-accs); color: var(--hu-acc); }
.hu-ac { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.hu-ac .icon-btn, .hu-chev { width: 36px; height: 36px; flex: none; }
.hu-ac .icon-btn { border: 0; border-radius: 10px; background: var(--hu-accs); color: var(--hu-acc); display: inline-grid; place-items: center; padding: 0; margin: 0; cursor: pointer; }
.hu-ac .icon-btn svg { width: 16px; height: 16px; }
.hu-ac .icon-btn.hu-del { background: rgba(220, 38, 38, .10); color: var(--bad, #DC2626); }
html[data-theme="dark"] .hu-ac .icon-btn.hu-del { background: rgba(220, 38, 38, .18); color: #F87171; }
.hu-pg-acts { display: inline-flex; gap: 4px; margin-left: 6px; flex: none; }
.hu-pg-btn { width: 30px; height: 30px; border-radius: 8px; border: 0; padding: 0; margin: 0; display: inline-grid; place-items: center; background: var(--card, #fff); color: var(--hu-acc); box-shadow: 0 0 0 1px rgba(2, 132, 199, .22); cursor: pointer; }
.hu-pg-btn svg { width: 14px; height: 14px; }
.hu-pg-btn.del { color: var(--bad, #DC2626); box-shadow: 0 0 0 1px rgba(220, 38, 38, .25); }
.hu-chev { display: grid; place-items: center; border: 0; background: transparent; color: var(--muted, #5A6580); cursor: pointer; border-radius: 10px; padding: 0; transition: transform .15s; box-shadow: none; }
.hu-chev svg { width: 18px; height: 18px; }
.hu-f.open .hu-chev { transform: rotate(180deg); }
.hu-det { display: none; padding: 2px 2px 12px 46px; }
.hu-f.open .hu-det { display: block; }
.hu-dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.hu-col h5 { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted, #5A6580); }
.hu-pg { display: flex; flex-direction: column; gap: 3px; }
.hu-pg div { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted, #5A6580); padding: 5px 10px; border-radius: 9px; background: var(--hu-oks); }
.hu-pg div b { margin-left: auto; color: var(--hu-ok); font-variant-numeric: tabular-nums; }
.hu-pg div.neg { background: rgba(220, 38, 38, .10); } .hu-pg div.neg b { color: var(--bad, #DC2626); }
.hu-nota { padding: 8px 12px; border-radius: 11px; background: var(--hu-soft); border: .5px solid var(--hu-line); font-size: 13.5px; line-height: 1.35; min-height: 44px; }
.hu-nota em { font-style: normal; color: var(--muted, #5A6580); }
.hu-nota .det { color: var(--muted, #5A6580); margin-bottom: 3px; }
.hu-nota > button { float: right; min-height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--hu-acc); font-weight: 600; font-size: 13px; font-family: inherit; cursor: pointer; box-shadow: none; }
.hu-nota textarea { width: 100%; box-sizing: border-box; min-height: 72px; margin: 0; font: inherit; font-size: 14px; resize: vertical; }
.hu-bt { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.hu .hu-m { display: none; }
/* Columna «Atendió / Registró»: dos líneas si son personas distintas, una sola si es la misma; «—» en atenciones viejas sin dato */
.hu-hd { cursor: default; gap: 12px; padding: 2px 2px 4px; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted, #5A6580); }
.hu-qu { min-width: 0; font-size: 12.5px; line-height: 1.3; color: var(--ink, #0f172a); }
.hu-qu > span { display: block; overflow-wrap: anywhere; }
.hu-qu i { font-style: normal; font-size: 11.5px; color: var(--muted, #5A6580); margin-right: 3px; }
.hu-qu em { font-style: normal; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: rgba(124, 58, 237, .12); color: #6D28D9; }
.hu-qu .nd { color: var(--muted, #5A6580); }
/* Paneles angostos (el panel de la ficha mide ~520 px en una ventana de 1024): la columna pasa a una segunda línea bajo el detalle */
@media (max-width: 1180px) {
  .hu-hd { display: none; }
  .hu-r { grid-template-columns: 34px 86px minmax(0, 1fr) auto auto; }
  .hu-r .hu-qu { grid-column: 3 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 0 12px; }
  .hu-r .hu-qu:empty, .hu-r .hu-qu .nd { display: none; }
  .hu-r .hu-qu > span { display: inline; }
}
@media (max-width: 620px) {
  .hu-hd { display: none; }
  .hu-r .hu-qu { grid-column: 2 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 12.5px; }
  .hu-r .hu-qu:empty { display: none; }
  .hu-r .hu-qu > span { display: inline; } .hu-r .hu-qu .nd { display: none; }
  .hu-bar { gap: 6px; margin-bottom: 4px; } .hu-bar .hu-chip, .hu-bar .hu-btn { min-height: 34px; flex: 1; justify-content: center; font-size: 13px; padding: 0 8px; }
  .hu-seg { order: 3; margin-left: 0; width: 100%; } .hu-seg button { flex: 1; min-height: 32px; padding: 0 2px; font-size: 12.5px; }
  .hu-r { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 0 8px; padding: 7px 0; }
  .hu-r .fe, .hu-ac { display: none; }
  .hu-n { width: 26px; height: 26px; font-size: 12px; }
  .hu-r .tx > b { font-size: 14px; } .hu-r .tx .pill, .hu-r .tx .hu-tag, .hu-r .tx .esp-tag { display: none; }
  .hu-r .tx small { font-size: 12.5px; margin-top: 0; }
  .hu-mo { flex-direction: column; align-items: flex-end; gap: 2px; } .hu-mo b { font-size: 14px; }
  .hu-pill { min-height: 20px; padding: 0 8px; font-size: 11.5px; }
  .hu-det { padding: 0 0 8px; } .hu-dos { grid-template-columns: 1fr; gap: 6px; }
  .hu-col h5 { margin: 0 0 3px; font-size: 10.5px; }
  .hu-pg div { padding: 4px 8px; font-size: 12.5px; }
  .hu-nota { padding: 6px 10px; font-size: 13px; line-height: 1.3; } .hu-nota > button { min-height: 28px; padding: 0 6px; }
  .hu-bt { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; } .hu .hu-bt .hu-btn { min-height: 38px; padding: 0 6px; }
  .hu .hu-m { display: inline-flex; align-items: center; justify-content: center; }
}
.hu small .sm { display: none; } .hu small .sd { display: inline; }
@media (max-width: 620px) { .hu small .sd { display: none; } .hu small .sm { display: inline; } }
/* Los botones del historial no heredan el margen inferior global: sin huecos bajo el selector y los botones */
.hu button, .hu .hu-btn, .hu-seg button, .hu-chev, .hu-nota > button { margin: 0; }
.hu-seg { align-self: center; }
/* Control de ortodoncia dentro del historial */
.hu-n.ct { background: rgba(124, 58, 237, .12); color: #6D28D9; border-color: rgba(124, 58, 237, .28); }
.hu-tag.ort { background: rgba(124, 58, 237, .12); color: #6D28D9; }
html[data-theme="dark"] .hu-n.ct, html[data-theme="dark"] .hu-tag.ort { color: #C4B5FD; }
.hu-pg.hu-dt div { background: var(--hu-soft); } .hu-pg.hu-dt div b { color: var(--ink, #0f172a); font-variant-numeric: normal; }
.hu-nota.hu-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Quién hizo la atención y quién la asignó */
.hu-aud { margin-top: 8px; padding: 8px 12px; border-radius: 11px; background: rgba(124, 58, 237, .07); font-size: 13px; line-height: 1.35; color: var(--muted, #5A6580); }
.hu-aud b { color: var(--ink, #0f172a); font-weight: 600; }
