/* MUELITA — estilos */
:root {
  --bg: #f1f5f7;
  --panel: #ffffff;
  --panel-2: #f7fafb;
  --line: #d9e2e7;
  --fg: #16262e;
  --muted: #5b6e7f;
  --accent-ink: #0b6f71;
  --accent: #0f8b8d;
  --accent-fg: #ffffff;
  --accent-soft: #dff2f2;
  --warn: #d9534f;
  --warn-soft: #fbe7e6;
  --ok: #3a9d5d;
  --ok-soft: #e3f4e8;
  --amber: #c98a1a;
  --amber-soft: #fbf0d9;
  --violet: #6a5acd;
  --violet-soft: #ebe8fa;
  --shadow: 0 1px 2px rgba(10, 30, 40, .06), 0 6px 20px rgba(10, 30, 40, .06);
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Code", Consolas, ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1518; --panel: #161e23; --panel-2: #1b252b; --line: #2a3740; --fg: #e3ebf0; --muted: #98aab7; --accent-ink: #7fe3e5;
    --accent: #3cc0c2; --accent-fg: #06222c; --accent-soft: #163b3d;
    --warn: #ff7a6b; --warn-soft: #3d2320; --ok: #7bd48f; --ok-soft: #1f3a27; --amber: #f0b64a; --amber-soft: #3d3119;
    --violet: #9f93ff; --violet-soft: #2a2748; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.45 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.55rem; font-weight: 650; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: .78rem; }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: .9em; }

/* layout */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--fg); font-weight: 500; }
.sidebar a:hover { background: var(--panel-2); text-decoration: none; }
.sidebar a.activo { background: var(--accent-soft); color: var(--accent-ink); }
.sidebar .ic { width: 20px; text-align: center; opacity: .8; }
.sidebar .espacio { flex: 1; }
.marca { margin-bottom: 14px; padding: 6px 8px !important; }
.marca span { display: flex; flex-direction: column; line-height: 1.1; }
.marca strong { font-size: 1.1rem; letter-spacing: .06em; }
.marca small { font-size: .72rem; }
.marca:hover { background: transparent !important; }
.menu-btn { display: none; position: fixed; top: 10px; left: 10px; z-index: 50; }
.main { padding: 22px 26px 40px; min-width: 0; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 230px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.abierto { transform: none; }
  .menu-btn { display: block; }
  .main { padding: 56px 16px 40px; }
}

/* componentes */
.encabezado { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 18px; }
.encabezado h1 { margin: 0; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 1.7rem; font-weight: 650; color: var(--accent); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }

button, .btn { font: 500 .9rem var(--font); color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; }
button:hover, .btn:hover { background: var(--panel-2); text-decoration: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-primario:hover { filter: brightness(1.08); background: var(--accent); }
.btn-peligro { color: var(--warn); border-color: var(--warn); }
.btn-peligro:hover { background: var(--warn-soft); }
.btn-chico { padding: 4px 9px; font-size: .8rem; }
.btn-icono { padding: 5px 8px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }

input, select, textarea { font: .95rem var(--font); color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; }
textarea { min-height: 76px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; }
input[type="range"] { padding: 0; accent-color: var(--accent); }
label { display: block; font-size: .82rem; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.campo { margin-bottom: 12px; }
.campo.inline { display: flex; align-items: center; gap: 8px; }
.campo.inline label { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.form-grid .ancho { grid-column: 1 / -1; }
.buscador { position: relative; max-width: 420px; flex: 1; }
.buscador input { padding-left: 32px; }
.buscador::before { content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-55%); color: var(--muted); font-size: 1.15rem; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tr.clic { cursor: pointer; }
tr.clic:hover td { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.programado { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.badge.confirmado { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.badge.atendido { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.cancelado { background: var(--panel-2); color: var(--muted); text-decoration: line-through; }
.badge.ausente { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.alto, .badge.bajo { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.badge.normal { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.faltan, .badge.sin_escala { color: var(--muted); }

.vacio { text-align: center; color: var(--muted); padding: 30px 10px; }
.vacio p { margin: 6px 0 12px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; border-radius: 8px 8px 0 0; background: transparent; padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.lista li:last-child { border-bottom: 0; }
.lista .hora { font-family: var(--mono); font-weight: 600; min-width: 48px; color: var(--accent); }
.lista .cuerpo { flex: 1; min-width: 0; }
.lista .cuerpo p { margin: 2px 0 0; white-space: pre-wrap; }
.evol { border-left: 3px solid var(--accent); padding-left: 12px; margin-bottom: 14px; }
.evol .fecha { font-weight: 600; font-size: .85rem; }
.evol p { margin: 4px 0; white-space: pre-wrap; }

/* modal */
.modal-fondo { position: fixed; inset: 0; background: rgba(8, 20, 26, .5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 100; overflow: auto; }
.modal { background: var(--panel); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); width: 100%; max-width: 620px; padding: 20px 22px; animation: modal-in .15s ease-out; }
.modal.ancho { max-width: 900px; }
.modal header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal header h2 { margin: 0; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal footer .izq { margin-right: auto; }
@keyframes modal-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: .9rem; animation: modal-in .15s; }
.toast.error { background: var(--warn); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* autocompletar paciente */
.ac { position: relative; }
.ac-lista { position: absolute; left: 0; right: 0; top: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 20; max-height: 220px; overflow: auto; margin-top: 2px; }
.ac-lista div { padding: 8px 10px; cursor: pointer; }
.ac-lista div:hover, .ac-lista div.sel { background: var(--accent-soft); }
.ac-lista small { display: block; }
.ac-sel { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--accent-soft); padding: 7px 10px; border-radius: 8px; }

/* agenda */
.agenda-barra { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.agenda-barra .titulo { font-weight: 650; font-size: 1.05rem; min-width: 200px; }
.agenda-barra .titulo::first-letter { text-transform: uppercase; }
.agenda { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); max-height: calc(100vh - 170px); }
.agenda-grid { display: grid; min-width: 700px; position: relative; }
.agenda-grid .esq { position: sticky; top: 0; left: 0; z-index: 4; background: var(--panel); border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.agenda-grid .dia-h { position: sticky; top: 0; z-index: 3; background: var(--panel); border-bottom: 1px solid var(--line); text-align: center; padding: 8px 4px; font-size: .85rem; text-transform: capitalize; }
.agenda-grid .dia-h b { display: block; font-size: 1.1rem; }
.agenda-grid .dia-h.hoy b { color: var(--accent); }
.agenda-grid .horas { position: sticky; left: 0; z-index: 2; background: var(--panel); border-right: 1px solid var(--line); }
.agenda-grid .hora-l { font-family: var(--mono); font-size: .72rem; color: var(--muted); text-align: right; padding-right: 6px; border-bottom: 1px dashed var(--line); display: flex; align-items: flex-start; justify-content: flex-end; }
.agenda-grid .col { position: relative; border-right: 1px solid var(--line); }
.agenda-grid .col.hoy { background: color-mix(in srgb, var(--accent-soft) 35%, transparent); }
.agenda-grid .slot { border-bottom: 1px dashed var(--line); cursor: pointer; }
.agenda-grid .slot:hover { background: var(--accent-soft); }
.turno { position: absolute; left: 2px; right: 2px; border-radius: 6px; padding: 3px 6px; font-size: .78rem; line-height: 1.25; overflow: hidden; cursor: pointer; border-left: 3px solid var(--accent); background: var(--accent-soft); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.turno b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turno.confirmado { border-left-color: var(--violet); background: var(--violet-soft); }
.turno.atendido { border-left-color: var(--ok); background: var(--ok-soft); }
.turno.cancelado { border-left-color: var(--muted); background: var(--panel-2); opacity: .6; text-decoration: line-through; }
.turno.ausente { border-left-color: var(--warn); background: var(--warn-soft); }
.turno:hover { filter: brightness(.97); z-index: 5; }
.ahora { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--warn); z-index: 1; pointer-events: none; }
.ahora::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }

/* ficha paciente */
.ficha-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 16px; }
.avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 1.2rem; }
.ficha-head .datos { flex: 1; min-width: 200px; }
.ficha-head .datos h1 { margin-bottom: 2px; }
.datos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 20px; }
.datos-grid div small { display: block; text-transform: uppercase; letter-spacing: .05em; font-size: .7rem; }
.datos-grid div span { white-space: pre-wrap; }
.cef-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cef-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; }
.cef-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #000; }
.cef-card .info { padding: 8px 10px; font-size: .85rem; }

/* editor cefalométrico */
.cef-editor { display: grid; grid-template-columns: 1fr 360px; gap: 12px; height: calc(100vh - 120px); min-height: 520px; }
.cef-stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); touch-action: none; user-select: none; }
.cef-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.cef-stage.pan canvas { cursor: grab; }
.cef-stage .hud { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.6); color: #fff; padding: 6px 10px; border-radius: 6px; font-size: .85rem; pointer-events: none; max-width: 70%; }
.cef-stage .hud b { color: #7fe3e5; }
.cef-stage .ayuda { position: absolute; left: 10px; bottom: 8px; color: #cfd8dc; font-size: .72rem; font-family: var(--mono); background: rgba(0,0,0,.5); padding: 3px 7px; border-radius: 4px; pointer-events: none; }
.cef-stage .zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; }
.cef-stage .zoom button { background: rgba(255,255,255,.9); color: #000; border: 0; width: 30px; height: 30px; justify-content: center; padding: 0; }
.cef-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cef-panel .tabs { margin: 0; padding: 0 8px; flex-shrink: 0; }
.cef-panel .contenido { overflow: auto; padding: 10px 12px; flex: 1; }
.puntos-lista { list-style: none; margin: 0; padding: 0; }
.puntos-lista .grupo { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
.puntos-lista li.p { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: .88rem; }
.puntos-lista li.p:hover { background: var(--panel-2); }
.puntos-lista li.p.activo { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.puntos-lista li.p .ok { width: 18px; text-align: center; color: var(--ok); }
.puntos-lista li.p .ok.no { color: var(--line); }
.puntos-lista li.p .id { font-family: var(--mono); font-size: .78rem; min-width: 36px; color: var(--muted); }
.puntos-lista li.p .quitar { margin-left: auto; opacity: 0; border: 0; background: none; padding: 0 4px; color: var(--muted); }
.puntos-lista li.p:hover .quitar { opacity: 1; }
.herr { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.controles { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; font-size: .82rem; margin-bottom: 10px; }
.controles label { margin: 0; }
.controles output { font-family: var(--mono); font-size: .75rem; min-width: 34px; text-align: right; }
.capas { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: .85rem; margin-bottom: 10px; }
.capas label { display: inline-flex; align-items: center; gap: 5px; margin: 0; color: var(--fg); }
.res-tabla td, .res-tabla th { padding: 5px 6px; font-size: .84rem; }
.res-tabla tr.analisis td { background: var(--panel-2); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 9px; }
.res-tabla .alto .val, .res-tabla .bajo .val { color: var(--amber); font-weight: 600; }
.res-tabla .normal .val { color: var(--ok); }
.res-tabla .interp { color: var(--muted); font-size: .78rem; }
.res-tabla .faltan .val, .res-tabla .sin_escala .val { color: var(--muted); }
.resumen { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; font-size: .9rem; margin-bottom: 12px; }
.resumen ul { margin: 4px 0 0; padding-left: 18px; }
.calib-aviso { background: var(--amber-soft); color: var(--amber); padding: 8px 10px; border-radius: 8px; font-size: .82rem; margin-bottom: 10px; }
@media (max-width: 1000px) {
  .cef-editor { grid-template-columns: 1fr; height: auto; }
  .cef-stage { height: 60vh; }
  .cef-panel { max-height: 70vh; }
}

/* informe */
.informe { max-width: 900px; margin: 0 auto; background: var(--panel); padding: 28px 34px; border-radius: var(--radius); border: 1px solid var(--line); }
.informe .cab { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--accent); padding-bottom: 10px; margin-bottom: 14px; }
.informe .cab h1 { font-size: 1.3rem; }
.informe .pac { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px 16px; font-size: .9rem; margin-bottom: 14px; }
.informe img { width: 100%; max-height: 560px; object-fit: contain; background: #000; border-radius: 8px; margin: 8px 0 14px; }
.informe table { font-size: .85rem; }
.informe .firma { margin-top: 36px; display: flex; justify-content: flex-end; }
.informe .firma div { border-top: 1px solid var(--fg); padding-top: 6px; min-width: 240px; text-align: center; font-size: .85rem; }
.no-print { }
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; font-size: 12px; }
  .sidebar, .menu-btn, .no-print, .toasts { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .informe { border: 0; padding: 0; max-width: none; box-shadow: none; }
  .informe img { max-height: 420px; }
  .res-tabla tr.analisis td { background: #eee; }
  .resumen { background: #eef6f6; }
  tr { break-inside: avoid; }
}

/* ---- estudios: historial, odontograma, fotos, modelos ---- */
.historial-barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-bottom: 12px; }
.historial-barra h2 { margin: 0; }
.form-sec .card { margin-top: 0; margin-bottom: 14px; }
.form-sec .campo .capas { padding-top: 4px; }
.paleta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 12px; }
.paleta-grupo { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.paleta-grupo > small { width: 100%; text-transform: uppercase; letter-spacing: .05em; font-size: .68rem; color: var(--muted); font-weight: 600; }
.paleta button.sel { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--accent-soft); }
.paleta .sw { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid; font-size: .6rem; font-weight: 700; line-height: 1; }
.odo-wrap { overflow-x: auto; padding: 4px 0; }
.odo-svg { width: 100%; min-width: 640px; max-width: 980px; height: auto; display: block; margin: 0 auto; }
.odo-svg .diente polygon { cursor: pointer; transition: opacity .1s; }
.odo-svg .diente:hover polygon { stroke-width: 1.6; }
.odo-resumen { margin-top: 10px; font-size: .9rem; }
.odo-resumen p { margin: 8px 0 0; }
.indices { display: flex; gap: 8px; flex-wrap: wrap; }
.indices .badge b { font-size: .95rem; margin: 0 2px; }
.fotos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.foto-card { margin: 0; cursor: pointer; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.foto-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #000; }
.foto-card figcaption { padding: 5px 8px; font-size: .78rem; }
.archivo-fila { display: grid; grid-template-columns: 56px 1fr 220px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.archivo-fila img { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; background: #000; }
.archivo-fila .nombre { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visor { display: grid; grid-template-columns: 40px 1fr 40px; gap: 8px; align-items: center; }
.visor img { width: 100%; max-height: 70vh; object-fit: contain; background: #000; border-radius: 8px; }
.visor .nav { height: 60px; justify-content: center; font-size: 1.4rem; }
.visor-info { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.visor-info select { width: auto; }
.visor-info input { flex: 1; min-width: 160px; }
table.anchos td { padding: 3px 2px; text-align: center; }
table.anchos td small { display: block; font-family: var(--mono); color: var(--muted); font-size: .68rem; }
table.anchos input { width: 52px; padding: 4px; text-align: center; font-size: .85rem; }
table.anchos th { font-size: .75rem; }
.fila-sup td:nth-child(7), .fila-inf td:nth-child(7) { border-right: 2px dashed var(--line); }
.modelos-grid > div > .card { margin-top: 0; margin-bottom: 14px; }
.presupuesto-resumen { margin-top: 6px; }
.pagos-form .campo { margin-bottom: 8px; }
tfoot th { border-top: 2px solid var(--line); }
@media print {
  .historial-barra .acciones, .paleta, .pagos-form, #b-prom { display: none !important; }
  .form-sec .card, .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .odo-svg { min-width: 0; }
  input, select, textarea { border: 0; border-bottom: 1px solid #999; border-radius: 0; background: transparent; }
}

/* ---- versiones (historial), periodontograma, línea de tiempo ---- */
.versiones { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 12px; }
.chip { display: inline-flex; flex-direction: column; align-items: flex-start; padding: 4px 10px; border-radius: 999px; font-size: .8rem; line-height: 1.15; }
.chip small { font-size: .68rem; color: var(--muted); }
.chip.activo { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.chip.activo small { color: var(--accent-fg); opacity: .85; }
.perio-grafico svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.perio-wrap { max-height: none; }
.perio-tabla { border-collapse: separate; border-spacing: 0; min-width: 1000px; font-size: .78rem; }
.perio-tabla th { position: sticky; left: 0; background: var(--panel); z-index: 2; text-align: left; font-size: .7rem; padding: 2px 8px 2px 4px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.perio-tabla td { padding: 1px 2px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.perio-tabla td.aus { background: var(--panel-2); }
.perio-tabla input.ps { width: 19px; padding: 2px 0; text-align: center; font-size: .78rem; border-radius: 3px; font-family: var(--mono); }
.perio-tabla input[type="checkbox"] { margin: 0 1px; width: 14px; height: 14px; }
.perio-tabla select { width: auto; padding: 1px 2px; font-size: .75rem; }
.perio-tabla tr.sec th { background: var(--accent-soft); color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.perio-tabla tr.sec td { background: var(--accent-soft); }
.perio-tabla tr.num-fila th.pieza { position: static; cursor: pointer; text-align: center; font-family: var(--mono); font-size: .8rem; background: var(--panel-2); user-select: none; }
.perio-tabla th.pieza.ausente { text-decoration: line-through; color: var(--muted); }
.perio-tabla th.pieza.implante { color: var(--violet); }
.perio-tabla th.pieza small { display: block; font-size: .55rem; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; border-left: 2px solid var(--line); }
.timeline .tl-fecha { font-weight: 600; font-size: .8rem; color: var(--accent); margin: 14px 0 4px 10px; }
.timeline .tl-item { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0 5px 10px; position: relative; }
.timeline .tl-item::before { content: ""; position: absolute; left: -11px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline .tl-ic { width: 22px; text-align: center; }
.timeline .tl-item p { margin: 2px 0 0; font-size: .85rem; color: var(--muted); white-space: pre-wrap; }

/* ---- visor de imágenes ---- */
.main.sin-padding { padding: 0 !important; }
.visor-app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; background: #0d1114; color: #e3ebf0; }
.visor-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #26313a; flex-wrap: wrap; }
.visor-top .btn, .visor-top button { background: #1b252b; color: #e3ebf0; border-color: #2a3740; }
.visor-titulo { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; flex: 1; }
.visor-titulo small { color: #8ea0ad; font-size: .75rem; }
.visor-herr { display: flex; gap: 4px; align-items: center; padding: 6px 10px; border-bottom: 1px solid #26313a; overflow-x: auto; scrollbar-width: thin; }
.visor-herr button { background: #1b252b; color: #e3ebf0; border: 1px solid #2a3740; min-width: 38px; height: 36px; justify-content: center; padding: 0 8px; font-size: 1rem; flex-shrink: 0; }
.visor-herr button[aria-pressed="true"] { background: #3cc0c2; color: #06222c; border-color: #3cc0c2; }
.visor-herr .sep { width: 1px; height: 26px; background: #2a3740; margin: 0 4px; flex-shrink: 0; }
.visor-herr .colores { display: flex; gap: 4px; }
.visor-herr .colores button { min-width: 24px; width: 24px; height: 24px; border-radius: 50%; padding: 0; border: 2px solid #2a3740; }
.visor-herr .colores button[aria-pressed="true"] { border-color: #fff; transform: scale(1.15); }
.visor-cuerpo { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 320px; }
.visor-stage { position: relative; background: #000; touch-action: none; user-select: none; overflow: hidden; }
.visor-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.visor-stage .hud { position: absolute; left: 10px; bottom: 8px; font-size: .75rem; color: #cfd8dc; background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 4px; pointer-events: none; max-width: 80%; }
.visor-panel { background: #161e23; border-left: 1px solid #26313a; padding: 12px; overflow: auto; }
.visor-panel h3 { color: #8ea0ad; }
.visor-panel input, .visor-panel textarea { background: #1b252b; color: #e3ebf0; border-color: #2a3740; }
.visor-panel .controles label { color: #8ea0ad; }
.visor-panel .controles output { color: #e3ebf0; }
.anot-item { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; cursor: pointer; }
.anot-item:hover { background: #1b252b; }
.anot-item.sel { background: #163b3d; }
.anot-item .sw { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.anot-item > div { flex: 1; min-width: 0; }
.anot-item b { font-size: .82rem; display: block; }
.anot-item input { font-size: .82rem; padding: 3px 6px; margin-top: 2px; }
.anot-item button { background: transparent; border: 0; color: #8ea0ad; padding: 2px 6px; }
@media (max-width: 900px) {
  .visor-cuerpo { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .visor-panel { display: none; border-left: 0; border-top: 1px solid #26313a; max-height: 45vh; }
  .visor-panel.abierto { display: block; }
  .visor-top { padding: 8px 10px 8px 10px; }
}

/* ---- ajustes responsive generales (teléfono) ---- */
@media (max-width: 860px) {
  .main { padding-top: 52px; }
  .encabezado h1 { font-size: 1.25rem; }
  .acciones button, .acciones .btn { padding: 7px 10px; font-size: .85rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 12px 12px; }
  .ficha-head .acciones { width: 100%; }
  .modal { padding: 16px 14px; }
  .modal-fondo { padding: 2vh 8px; }
  .cef-editor { height: auto; }
  .cef-stage { height: 62vh; }
  .cef-stage .ayuda { display: none; }
  .agenda { max-height: calc(100vh - 210px); }
  .agenda-grid { min-width: 560px; }
  .datos-grid { grid-template-columns: 1fr; }
  table { font-size: .85rem; }
  th, td { padding: 7px 6px; }
  input, select, textarea, button { font-size: 16px; } /* evita zoom automático de iOS */
  .btn-chico, .chip { font-size: .8rem !important; }
  .perio-tabla input.ps { font-size: 14px; width: 22px; }
  .perio-tabla select { font-size: 13px; }
  .visor-herr button { font-size: 16px; }
}
@media (hover: none) and (pointer: coarse) {
  .puntos-lista li.p .quitar { opacity: 1; }
  .odo-svg .diente polygon { stroke-width: 1; }
}
.timeline .tl-fecha::first-letter { text-transform: uppercase; }


/* ---- acceso con PIN ---- */
.login-fondo { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 300; padding: 16px; }
.login { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 32px 28px; width: 100%; max-width: 340px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.login h1 { margin: 0; letter-spacing: .08em; }
.login p { margin: 0; }
.login input { text-align: center; font-size: 1.6rem; letter-spacing: .5em; padding: 10px; max-width: 220px; }
.login button { width: 100%; max-width: 220px; justify-content: center; padding: 10px; font-size: 1rem; }
.login .error { color: var(--warn); font-size: .85rem; min-height: 1.2em; }
.archivo-fila.error .nombre { color: var(--warn); }

/* ---- visor: barra en filas con etiquetas, sin botón de menú global ---- */
body.modo-visor .menu-btn, body.modo-visor .sidebar { display: none !important; }
body.modo-visor .app { grid-template-columns: 1fr; }
.visor-herr { flex-wrap: wrap; gap: 6px 10px; overflow: visible; }
.visor-herr .grupo-h { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.visor-herr .grupo-h + .grupo-h { border-left: 1px solid #2a3740; padding-left: 10px; }
.visor-herr button { flex-direction: column; gap: 0; height: 44px; min-width: 52px; padding: 2px 6px; line-height: 1.05; }
.visor-herr button .ic { font-size: 1rem; }
.visor-herr button small { font-size: .58rem; color: #8ea0ad; letter-spacing: .01em; }
.visor-herr button[aria-pressed="true"] small { color: #06222c; }
.visor-herr .colores button { height: 24px; min-width: 24px; }
@media (max-width: 900px) {
  .visor-top { flex-wrap: nowrap; padding: 6px 8px; }
  .visor-top .visor-titulo b { font-size: .9rem; }
  .visor-top .acciones { gap: 4px; }
  .visor-top .acciones button, .visor-top .acciones .btn { padding: 6px 8px; font-size: .78rem; }
  .visor-top #b-guardar:not([hidden]) { display: inline-flex; }
  .visor-herr { padding: 4px 6px; gap: 4px 6px; }
  .visor-herr .grupo-h + .grupo-h { border-left: 0; padding-left: 0; }
  .visor-herr button { min-width: calc((100vw - 12px - 6 * 4px) / 6 - 1px); height: 42px; }
  .visor-herr .colores button { min-width: 24px; }
}
@media (max-width: 900px) {
  .visor-top { flex-wrap: wrap; row-gap: 6px; }
  .visor-titulo { flex: 1; min-width: 0; }
  .visor-titulo b, .visor-titulo small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .visor-top .acciones { flex-basis: 100%; justify-content: flex-start; }
}

/* ---- popover / hoja inferior ---- */
.popover { position: fixed; z-index: 150; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.25); padding: 6px; animation: modal-in .12s ease-out; max-height: 80vh; overflow: auto; }
.popover.hoja { left: 0; right: 0; bottom: 0; top: auto; width: auto; border-radius: 16px 16px 0 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); max-height: 85vh; }
.pop-fondo { position: fixed; inset: 0; background: rgba(8,20,26,.45); z-index: 149; }
.pop-titulo { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 6px 10px 4px; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; font-size: .92rem; }
.pop-item:hover { background: var(--accent-soft); }
.pop-item b { font-weight: 600; display: block; }
.pop-item small { color: var(--muted); display: block; font-size: .75rem; }
.pop-item.peligro b { color: var(--warn); }
.pop-ic { width: 24px; text-align: center; font-size: 1.05rem; flex-shrink: 0; }
.pop-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.pop-cerrar { width: 100%; margin-top: 8px; justify-content: center; }
.hoja .pop-item { padding: 12px 10px; font-size: 1rem; }
.paleta-colores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 6px; }
.paleta-colores button { height: 36px; border-radius: 8px; border: 2px solid var(--line); padding: 0; }
.paleta-colores button[aria-pressed="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 2px #fff; }
.visor-herr .sw-color { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; }

/* ---- cabecera de ficha compacta ---- */
.ficha-head { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); gap: 12px; margin-bottom: 12px; }
.ficha-head .avatar { width: 46px; height: 46px; font-size: 1.05rem; }
.ficha-head .datos h1 { font-size: 1.3rem; margin-bottom: 4px; }
.ficha-head .chips { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.chip-dato { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--fg); max-width: 100%; }
.chip-dato .ic { font-size: .8rem; opacity: .8; }
.chip-dato.motivo { color: var(--muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.ficha-head .acciones { gap: 6px; }
.ficha-head #b-mas { font-size: 1.2rem; line-height: 1; padding: 4px 10px; }
@media (max-width: 860px) {
  .ficha-head { padding: 10px 12px; gap: 10px; align-items: flex-start; }
  .ficha-head .avatar { width: 40px; height: 40px; font-size: .95rem; }
  .ficha-head .datos { flex: 1; min-width: 0; }
  .ficha-head .datos h1 { font-size: 1.1rem; }
  .ficha-head .acciones { width: auto; margin-left: auto; }
  .chip-dato.motivo { max-width: 100%; }
  .tabs { gap: 0; margin-bottom: 12px; }
  .tabs button { padding: 8px 10px; font-size: .85rem; }
}

/* ---- editor cefalométrico en teléfono ---- */
.cef-head .cef-titulo { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cef-head .volver { display: inline-flex; padding: 6px 12px; white-space: nowrap; }
.cef-head h1 { font-size: 1.15rem; }
.cef-tactil { display: none; position: absolute; left: 8px; right: 8px; bottom: 8px; gap: 6px; justify-content: center; }
.cef-tactil button { background: rgba(20,28,32,.85); color: #fff; border: 1px solid rgba(255,255,255,.2); height: 40px; padding: 0 12px; backdrop-filter: blur(4px); }
.cef-tactil button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
@media (hover: none) and (pointer: coarse) {
  .cef-tactil { display: flex; }
  .cef-stage .ayuda { display: none; }
}
@media (max-width: 860px) {
  .cef-head .volver { display: inline-flex; }
  .cef-head h1 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cef-head .cef-titulo > div { min-width: 0; }
  .cef-head .solo-escritorio { display: none; }
  .cef-editor { gap: 8px; }
  .cef-stage { height: 58vh; border-radius: 8px; }
  .cef-stage .hud { font-size: .78rem; max-width: 60%; }
  .cef-stage .zoom { top: 8px; right: 8px; }
  .cef-panel { max-height: 50vh; }
  .cef-panel .contenido { padding: 8px 10px; }
  .puntos-lista li.p { padding: 8px 8px; font-size: .95rem; }
}
/* cabecera de ficha: grilla avatar | nombre | acciones, chips debajo */
.ficha-head { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "avatar nombre acciones" "avatar chips chips"; align-items: center; column-gap: 12px; row-gap: 6px; }
.ficha-head .avatar { grid-area: avatar; align-self: start; }
.ficha-head .datos { grid-area: nombre; min-width: 0; }
.ficha-head .datos h1 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ficha-head .acciones { grid-area: acciones; }
.ficha-head .chips { grid-area: chips; }
@media (max-width: 860px) {
  .ficha-head { grid-template-areas: "avatar nombre acciones" "chips chips chips"; column-gap: 10px; }
  .ficha-head .datos h1 { white-space: normal; font-size: 1.05rem; line-height: 1.2; }
  .cef-stage .hud { max-width: calc(100% - 80px); }
}

/* ---- modo solo lectura (odontograma, periodontograma, visor) ---- */
.solo-lectura .odo-svg .diente polygon { cursor: default; }
.solo-lectura .perio-tabla input, .solo-lectura .perio-tabla select { background: transparent; border-color: transparent; color: var(--fg); opacity: 1; }
.solo-lectura .perio-tabla input.ps:disabled { font-weight: 600; }
.solo-lectura .perio-tabla th.pieza { cursor: default; }
.herr-actual { width: 100%; justify-content: flex-start; margin-bottom: 8px; }
.herr-actual .sw { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid; font-size: .6rem; font-weight: 700; background: #fff; }
.visor-app.solo-lectura [data-h="hallazgo"], .visor-app.solo-lectura [data-h="flecha"], .visor-app.solo-lectura [data-h="elipse"], .visor-app.solo-lectura [data-h="rect"], .visor-app.solo-lectura [data-h="lapiz"], .visor-app.solo-lectura [data-h="texto"], .visor-app.solo-lectura [data-h="distancia"], .visor-app.solo-lectura [data-h="angulo"], .visor-app.solo-lectura [data-h="calibrar"], .visor-app.solo-lectura #b-color, .visor-app.solo-lectura [data-a="deshacer"], .visor-app.solo-lectura [data-a="borrar"] { display: none; }
.visor-app.solo-lectura .visor-stage canvas { cursor: grab; }
.anot-item p { margin: 2px 0 0; font-size: .8rem; color: #cfd8dc; }
@media (max-width: 860px) {
  .odo-svg { min-width: 560px; }
  .perio-tabla { font-size: .8rem; }
  .perio-tabla th { font-size: .68rem; padding-right: 4px; }
  .perio-grafico svg { min-height: 120px; }
}

/* ---- estilo app móvil: barra inferior, tarjetas, botón flotante, vista de lectura ---- */
.solo-movil { display: none !important; }
.tabbar { display: none; }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 18px; margin: 0; }
.dl > div { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.dl dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.dl dd { margin: 2px 0 0; white-space: pre-wrap; }
.card.lectura h2 { font-size: 1rem; }
.fab { position: fixed; right: 18px; bottom: calc(74px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); border: 0; font-size: 1.9rem; line-height: 1; justify-content: center; box-shadow: 0 8px 24px rgba(15,139,141,.45); z-index: 60; }
.fab:hover { background: var(--accent); filter: brightness(1.08); }
.lista-tarjetas { display: flex; flex-direction: column; gap: 8px; }
.tarjeta-pac { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; color: var(--fg); text-decoration: none; }
.tarjeta-pac:active { background: var(--panel-2); }
.tarjeta-pac .avatar { width: 42px; height: 42px; font-size: .95rem; flex-shrink: 0; }
.tarjeta-pac .cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.tarjeta-pac .cuerpo b { font-size: 1rem; }
.tarjeta-pac .cuerpo small { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tarjeta-pac .flecha { color: var(--muted); font-size: 1.4rem; }
@media (max-width: 860px) {
  .solo-pc { display: none !important; }
  .solo-movil { display: block !important; }
  .lista-tarjetas.solo-movil { display: flex !important; }
  .fab.solo-movil { display: inline-flex !important; }
  .menu-btn, .sidebar { display: none !important; }
  .main { padding: 12px 14px calc(84px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--muted); text-decoration: none; font-size: .66rem; padding: 4px 0; border-radius: 10px; }
  .tabbar a .ic { font-size: 1.25rem; line-height: 1.1; }
  .tabbar a.activo { color: var(--accent-ink); background: var(--accent-soft); }
  body.sin-tabbar .tabbar { display: none; }
  body.sin-tabbar .main { padding-bottom: 0; }
  .encabezado { margin-bottom: 12px; }
  .encabezado h1 { font-size: 1.35rem; }
  .buscador { max-width: none; width: 100%; }
  .buscador input { padding: 11px 12px 11px 36px; border-radius: 12px; font-size: 16px; }
  .encabezado .acciones { width: 100%; }
  .encabezado .acciones #b-nuevo { display: none; } /* reemplazado por el botón flotante */
  .card { border-radius: 14px; }
  .stat { border-radius: 14px; }
  .stat b { font-size: 1.45rem; }
  .historial-barra .acciones input[type="text"] { max-width: 150px; }
  .tabs { position: sticky; top: 0; background: var(--bg); z-index: 5; padding-top: 4px; }
  .dl { grid-template-columns: 1fr; }
  .cef-editor { height: auto; }
}

/* ---- ficha como cuadrícula de módulos (app) ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 12px; color: var(--fg); text-decoration: none; box-shadow: var(--shadow); min-height: 104px; }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .ic { font-size: 1.5rem; line-height: 1; }
.tile b { font-size: .95rem; }
.tile small { color: var(--muted); font-size: .75rem; line-height: 1.25; }
.sub-barra { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sub-barra b { font-size: 1.05rem; }
.lista-registros { display: flex; flex-direction: column; gap: 8px; }
.registro { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--fg); text-decoration: none; }
.registro .cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.registro .cuerpo b { text-transform: none; }
.registro .etiqueta { font-size: .8rem; color: var(--accent); font-weight: 600; }
.registro small { color: var(--muted); font-size: .78rem; }
.registro .flecha { color: var(--muted); font-size: 1.4rem; }
a.fab { display: inline-flex; align-items: center; text-decoration: none; }
@media (max-width: 860px) {
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tile { min-height: 96px; padding: 12px; border-radius: 14px; }
  .tile .ic { font-size: 1.35rem; }
  .tile b { font-size: .9rem; }
  .historial-barra h2 { font-size: 1.05rem; }
  .ficha-head { margin-bottom: 10px; }
}

/* ---- inicio y agenda en teléfono ---- */
a.stat { text-decoration: none; display: block; }
a.stat:hover { border-color: var(--accent); text-decoration: none; }
.lista .lista-fecha { border: 0; padding: 10px 0 2px; }
.lista .lista-fecha small { font-weight: 600; display: inline-block; }
.lista .lista-fecha small::first-letter { text-transform: uppercase; }
.turno-item .flecha { color: var(--muted); font-size: 1.3rem; align-self: center; }
.tira-dias { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 12px; }
.tira-dias .dia { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 2px 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.tira-dias .dia small { font-size: .65rem; color: var(--muted); text-transform: uppercase; }
.tira-dias .dia b { font-size: 1.1rem; line-height: 1.1; }
.tira-dias .dia .puntos { font-size: .6rem; color: var(--accent); letter-spacing: -1px; min-height: .8em; line-height: 1; }
.tira-dias .dia.hoy b { color: var(--accent); }
.tira-dias .dia.sel { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.tira-dias .dia.sel small, .tira-dias .dia.sel .puntos { color: var(--accent-fg); }
.turno-card { border-left: 4px solid var(--accent); cursor: pointer; }
.turno-card.confirmado { border-left-color: var(--violet); }
.turno-card.atendido { border-left-color: var(--ok); }
.turno-card.ausente { border-left-color: var(--warn); }
.turno-card.cancelado { border-left-color: var(--muted); opacity: .6; }
.turno-card.pasado:not(.atendido) { opacity: .75; }
.turno-card .hora-col { display: flex; flex-direction: column; align-items: center; min-width: 52px; font-family: var(--mono); }
.turno-card .hora-col b { font-size: 1.05rem; color: var(--accent); }
.turno-card .hora-col small { color: var(--muted); font-size: .68rem; }
.turno-card .cuerpo .nota { white-space: normal; font-style: italic; }
@media (max-width: 860px) {
  .turno-item { cursor: pointer; }
  .encabezado .acciones .seg button { padding: 7px 12px; }
  .card h2 .btn-chico { font-size: .78rem; }
}
.cap::first-letter { text-transform: uppercase; }
#m-fecha { color: transparent; caret-color: transparent; }

/* ---- títulos compactos con separador de color ---- */
.encabezado { margin-bottom: 14px; padding-bottom: 8px; border-bottom: 2px solid var(--accent-soft); position: relative; }
.encabezado::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 56px; height: 2px; background: var(--accent); }
.encabezado h1 { font-size: 1.3rem; padding-left: 10px; border-left: 4px solid var(--accent); line-height: 1.15; }
.encabezado > div > small { padding-left: 14px; display: block; }
.historial-barra { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.historial-barra h2 { padding-left: 8px; border-left: 3px solid var(--accent); font-size: 1.05rem; line-height: 1.2; }
.sub-barra { padding-bottom: 6px; border-bottom: 2px solid var(--accent-soft); margin-bottom: 8px; }
.sub-barra b { font-size: 1rem; }
/* buscador plegable en teléfono */
#b-buscar { font-size: 1.3rem; line-height: 1; padding: 4px 10px; }
/* cabecera del paciente: datos en cuadrícula tipo tabla */
.datos-tabla { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.datos-tabla .celda { display: grid; grid-template-columns: 22px 1fr; grid-template-areas: "ic k" "ic v"; column-gap: 6px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); min-width: 0; }
.datos-tabla .celda .ic { grid-area: ic; align-self: center; font-size: .95rem; opacity: .85; }
.datos-tabla .celda .k { grid-area: k; font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.datos-tabla .celda .v { grid-area: v; font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.datos-tabla .celda.c0 { background: #e8f5f5; border-color: #cfe9ea; }
.datos-tabla .celda.c1 { background: #eef1fb; border-color: #d9dff5; }
.datos-tabla .celda.c2 { background: #fdf3e7; border-color: #f5e3c8; }
.datos-tabla .celda.c3 { background: #eef8ee; border-color: #d4ecd4; }
.datos-tabla .celda.motivo { grid-column: 1 / -1; background: #fff9e6; border-color: #f3e7b8; }
.datos-tabla .celda.motivo .v { white-space: normal; font-weight: 500; font-style: italic; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .datos-tabla .celda.c0, :root:not([data-theme="light"]) .datos-tabla .celda.c1, :root:not([data-theme="light"]) .datos-tabla .celda.c2, :root:not([data-theme="light"]) .datos-tabla .celda.c3, :root:not([data-theme="light"]) .datos-tabla .celda.motivo { background: var(--panel-2); border-color: var(--line); }
}
.ficha-head .datos h1 { font-size: 1.25rem; white-space: normal; }
.ficha-head #b-nuevo-reg { font-size: 1.3rem; line-height: 1; padding: 4px 11px; }
/* tarjetas de módulos: ícono a la izquierda */
.tile { flex-direction: row; align-items: center; gap: 12px; min-height: 0; padding: 12px 12px 12px 10px; }
.tile .ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); font-size: 1.25rem; flex-shrink: 0; }
.tile .tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tile .tx b { font-size: .92rem; }
.tile .tx small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .flecha { color: var(--muted); font-size: 1.3rem; }
/* acordeón */
.acordeon summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.acordeon summary::-webkit-details-marker { display: none; }
.acordeon summary::before { content: "▸"; color: var(--accent); font-size: .9rem; transition: transform .15s; }
.acordeon[open] summary::before { transform: rotate(90deg); }
.acordeon summary b { font-size: 1rem; }
.acordeon summary small { color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acordeon > .indices { margin-top: 10px; }
/* cefalometrías lista móvil */
.registro .miniatura { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; background: #000; flex-shrink: 0; }
@media (max-width: 860px) {
  .tabbar { grid-template-columns: repeat(4, 1fr); }
  .encabezado { margin-bottom: 10px; padding-bottom: 6px; align-items: center; }
  .encabezado h1 { font-size: 1.15rem; }
  .encabezado .acciones { width: auto; margin-left: auto; }
  .encabezado .acciones .buscador { display: none; }
  .encabezado .acciones .buscador.abierto { display: block; flex-basis: 100%; order: 10; margin-top: 6px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 10px 8px 10px 8px; gap: 8px; }
  .tile .ic { width: 36px; height: 36px; font-size: 1.1rem; border-radius: 10px; }
  .tile .tx b { font-size: .84rem; }
  .tile .tx small { font-size: .68rem; white-space: normal; }
  .tile .flecha { display: none; }
  .datos-tabla { grid-template-columns: 1fr 1fr; }
  .historial-barra { flex-direction: column; align-items: stretch; gap: 6px; }
  .historial-barra h2 { display: none; } /* el título ya está en la barra "‹ Ficha" */
  .historial-barra .acciones { flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 2px; scrollbar-width: none; }
  .historial-barra .acciones > * { flex-shrink: 0; }
  .historial-barra .acciones input[type="date"] { width: 130px !important; }
  .historial-barra .acciones input[type="text"] { max-width: 140px; }
  .historial-barra > a.btn { align-self: flex-start; }
  .historial-barra > small { order: -1; }
  .sub-barra b { flex: 1; }
  .acordeon summary b { font-size: .95rem; }
  .form-sec .card h2, .card h2 { font-size: 1rem; }
}
@media (max-width: 860px) {
  .ficha-head.compacta { padding: 8px 12px; grid-template-areas: "avatar nombre acciones"; }
  .ficha-head.compacta .datos-tabla { display: none; }
  .ficha-head.compacta .avatar { width: 34px; height: 34px; font-size: .85rem; }
  .ficha-head.compacta .datos h1 { font-size: 1.05rem; }
  .encabezado .acciones #b-nueva { display: none; }
}

/* ---- menú: cada opción como fila individual ---- */
.pop-item + .pop-item { border-top: 1px solid var(--line); border-radius: 0; }
.pop-item:first-child { border-radius: 8px 8px 0 0; }
.pop-item:last-child { border-radius: 0 0 8px 8px; }
.pop-sep + .pop-item, .pop-titulo + .pop-cuerpo > .pop-item:first-child { border-top: 0; border-radius: 8px 8px 0 0; }
.pop-sep { height: 0; margin: 8px 0; border-top: 2px solid var(--line); }
.hoja .pop-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px !important; margin-bottom: 6px; padding: 12px 12px; }
.hoja .pop-item:active { background: var(--accent-soft); }
.hoja .pop-item .pop-ic { width: 32px; height: 32px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.hoja .pop-item.peligro { border-color: var(--warn-soft); background: var(--warn-soft); }
.hoja .pop-sep { border: 0; height: 6px; margin: 0; }

/* ---- cabecera del paciente plegable en teléfono ---- */
.plegar-hint { display: none; color: var(--muted); font-size: .72rem; }
@media (max-width: 860px) {
  .ficha-head { padding: 8px 12px; grid-template-areas: "avatar nombre acciones" "chips chips chips"; cursor: pointer; }
  .ficha-head .datos-tabla { display: none; }
  .ficha-head.abierta .datos-tabla { display: grid; margin-top: 6px; }
  .ficha-head .datos h1 { font-size: 1.05rem; line-height: 1.2; }
  .ficha-head .avatar { width: 36px; height: 36px; font-size: .85rem; }
  .ficha-head .plegar-hint { display: block !important; line-height: 1.1; margin-top: 1px; }
  .ficha-head .acciones { cursor: default; }
}

/* ---- móvil: acciones de módulo en dos líneas, sin desborde horizontal ---- */
@media (max-width: 860px) {
  html, body { overflow-x: hidden; }
  .main { max-width: 100vw; overflow-x: clip; }
  .historial-barra { min-width: 0; }
  .historial-barra .acciones { display: flex; flex-wrap: wrap; overflow: visible; min-width: 0; gap: 6px; }
  .historial-barra .acciones input[type="date"] { flex: 1 1 42%; width: auto !important; min-width: 0; }
  .historial-barra .acciones input[type="text"] { flex: 1 1 50%; max-width: none; min-width: 0; }
  .historial-barra .acciones small { flex: 1 1 100%; order: 5; font-size: .72rem; }
  .historial-barra .acciones button, .historial-barra .acciones .btn { flex: 0 1 auto; order: 6; padding: 7px 10px; font-size: .82rem; }
  .historial-barra .acciones button.btn-primario { order: 6; }
  .historial-barra > small { flex: 1 1 100%; }
  .tabla-wrap, .perio-wrap, .odo-wrap, .fotos-grid, .modelos-grid { max-width: 100%; min-width: 0; }
  .modelos-grid { grid-template-columns: 1fr; }
  .card { min-width: 0; }
  .encabezado { min-width: 0; }
  .encabezado .acciones { flex-wrap: wrap; min-width: 0; }
}

/* ---- buscador de pacientes abierto en teléfono: campo a todo el ancho ---- */
@media (max-width: 860px) {
  .encabezado.con-buscador > div:first-child { display: none; }
  .encabezado.con-buscador .acciones { flex: 1 1 100%; width: 100%; margin-left: 0; display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
  .encabezado.con-buscador .acciones .buscador.abierto { display: block; flex: 1; order: 0; margin-top: 0; min-width: 0; }
  .encabezado.con-buscador #b-buscar { order: 1; flex-shrink: 0; }
  /* editor cefalométrico: cabecera en una línea */
  .cef-head { flex-wrap: nowrap; align-items: center; gap: 8px; }
  .cef-head .cef-titulo { flex: 1; min-width: 0; }
  .cef-head .cef-titulo small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .cef-head .acciones { width: auto; flex-shrink: 0; gap: 6px; }
  .cef-head .acciones .btn, .cef-head .acciones button { padding: 6px 10px; font-size: .82rem; }
  .cef-stage { height: 52vh; }
}

/* ---- datos del paciente más compactos en teléfono ---- */
@media (max-width: 860px) {
  .ficha-head.abierta .datos-tabla { grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 4px; }
  .datos-tabla .celda { grid-template-columns: 16px 1fr; padding: 3px 6px; border-radius: 8px; column-gap: 4px; }
  .datos-tabla .celda .ic { font-size: .75rem; }
  .datos-tabla .celda .k { font-size: .52rem; letter-spacing: .03em; }
  .datos-tabla .celda .v { font-size: .76rem; font-weight: 600; }
  .datos-tabla .celda.motivo .v { font-size: .74rem; }
  /* odontograma y periodontograma: controles compactos */
  .odo-wrap { margin: 0 -6px; }
  .odo-svg { min-width: 520px; }
  .herr-actual { padding: 6px 10px; font-size: .85rem; margin-bottom: 6px; }
  .paleta { margin: 6px 0 8px; }
  .seg button { padding: 6px 10px; font-size: .82rem; }
  .odo-resumen { font-size: .82rem; }
  .indices .badge { font-size: .7rem; padding: 2px 7px; }
  .perio-grafico svg { margin-bottom: 6px; }
  .perio-tabla { min-width: 900px; }
  .perio-tabla th { padding: 1px 6px 1px 3px; font-size: .62rem; }
  .perio-tabla input.ps { width: 21px; font-size: 13px; padding: 1px 0; }
  .perio-tabla input[type="checkbox"] { width: 13px; height: 13px; }
  .perio-tabla tr.num-fila th.pieza { font-size: .72rem; }
  .acordeon summary small { font-size: .72rem; }
  .card > p > small, .card .muted small { font-size: .74rem; }
}

/* ---- examen clínico y modelos compactos en teléfono ---- */
@media (max-width: 860px) {
  .form-sec .card { padding: 10px 12px; margin-bottom: 10px; }
  .form-sec .card h2 { font-size: .95rem; margin-bottom: 6px; }
  .form-sec .campo { margin-bottom: 8px; }
  .form-sec label { font-size: .74rem; margin-bottom: 2px; }
  .form-sec input, .form-sec select, .form-sec textarea { padding: 6px 8px; }
  .form-sec .capas { gap: 4px 8px; font-size: .8rem; }
  .form-sec .capas label { font-size: .8rem; padding: 3px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); }
  .form-sec .capas label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
  .form-sec .capas input { width: 14px; height: 14px; margin: 0; }
  .form-sec .capas button { padding: 2px 7px; font-size: .75rem; }
  .form-sec .campo small.muted { font-size: .68rem; }
  .card.lectura { padding: 10px 12px; }
  .card.lectura h2 { font-size: .92rem; margin-bottom: 4px; }
  .dl > div { padding: 4px 0; }
  .dl dt { font-size: .6rem; }
  .dl dd { font-size: .84rem; }
  .modelos-grid > div > .card { padding: 10px 12px; margin-bottom: 10px; }
  .modelos-grid .card h2 { font-size: .95rem; }
  .modelos-grid .card > p.muted { margin: 0 0 6px; }
  .modelos-grid .card > p.muted small { font-size: .68rem; }
  table.anchos input { width: 44px; padding: 3px; font-size: 13px; }
  table.anchos td small { font-size: .6rem; }
  .modelos-grid .form-grid { grid-template-columns: 1fr 1fr; gap: 0 8px; }
  .modelos-grid .campo { margin-bottom: 6px; }
  .modelos-grid .campo label { font-size: .68rem; }
  .modelos-grid .res-tabla td, .modelos-grid .res-tabla th { padding: 4px 4px; font-size: .76rem; }
  .modelos-grid .resumen { font-size: .8rem; padding: 8px 10px; }
  .modelos-grid .grid.c2 { gap: 8px; }
}

/* ---- fotos, plan y pagos compactos en teléfono; margen en anchos ---- */
@media (max-width: 860px) {
  table.anchos { margin-bottom: 10px; }
  .modelos-grid .tabla-wrap { padding-bottom: 6px; }
  /* fotos */
  .fotos-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .foto-card { border-radius: 10px; }
  .foto-card figcaption { padding: 3px 5px; font-size: .64rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .foto-card figcaption small { display: none; }
  .historial-barra .acciones #b-subir { display: none; } /* reemplazado por el botón flotante */
  .archivo-fila { grid-template-columns: 44px 1fr; gap: 6px; }
  .archivo-fila select { grid-column: 1 / -1; }
  /* plan y pagos */
  .presupuesto-resumen { font-size: .8rem; padding: 8px 10px; }
  .pagos-form { grid-template-columns: 1fr 1fr; gap: 0 8px; }
  .pagos-form .campo:nth-child(2) { grid-column: 1 / -1; }
  .pagos-form .campo:last-child { grid-column: 1 / -1; }
  .pagos-form .campo:last-child button { width: 100%; justify-content: center; }
  .pagos-tabla table { font-size: .8rem; }
  .pagos-tabla th, .pagos-tabla td { padding: 5px 4px; }
}

/* ---- logo en configuración ---- */
.logo-cfg { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-prev { width: 160px; height: 80px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---- mejoras del informe de diseño: legibilidad, objetivos táctiles, listas, visor, tabs ---- */
.tabs { flex-wrap: wrap; row-gap: 2px; } /* escritorio: las pestañas pasan a dos filas en vez de desbordar */
.registro .cuerpo .meta { font-size: .78rem; color: var(--muted); }
.registro .cuerpo .sin-etiqueta { color: var(--amber); font-weight: 600; }
.registro .cuerpo b { font-size: .95rem; }
.tile .tx small { font-size: .8rem; }
.turno-card .hora-col small { font-size: .74rem; }
.tira-dias .dia small { font-size: .7rem; }
.tira-dias .dia .puntos { font-size: .7rem; }
.dl dt { font-size: .68rem; }
.datos-tabla .celda .k { font-size: .66rem; }
.visor-herr button small { font-size: .7rem; color: #b6c3cc; }
.visor-titulo small { font-size: .8rem; }
.visor-stage .hud { font-size: .8rem; }
.historial-barra .acciones small { font-size: .8rem; }
.chip small { font-size: .72rem; }
.lista .cuerpo small, .lista li small { font-size: .82rem; }
.encabezado > div > small { font-size: .82rem; }
@media (pointer: coarse) {
  .btn-chico, .btn-icono, .seg button, .chip, .tabs button, .historial-barra .acciones button, .historial-barra .acciones .btn, .sub-barra .btn, .encabezado .acciones .seg button { min-height: 42px; }
  .btn-icono, .seg button { min-width: 42px; }
  .ficha-head #b-nuevo-reg, .ficha-head #b-mas { min-width: 44px; min-height: 40px; }
  .herr-actual { min-height: 44px; }
  .paleta-colores button { height: 44px; }
  .tabbar a small { font-size: .72rem; }
  .tabbar a { padding: 6px 0; }
  .datos-tabla .celda { padding: 5px 8px; }
  .datos-tabla .celda .k { font-size: .66rem; }
  .datos-tabla .celda .v { font-size: .84rem; }
  .plegar-hint { font-size: .78rem; }
  .tile .tx small { font-size: .74rem; }
  .perio-tabla input.ps { width: 26px; height: 30px; font-size: 15px; }
  .perio-tabla input[type="checkbox"] { width: 18px; height: 18px; }
  .odo-svg .diente polygon { stroke-width: 1.1; }
}
@media (max-width: 860px) {
  /* visor: una sola fila (Mover · Ventana · Lupa · herramientas de anotación en edición · Imagen ▾) */
  .visor-herr .grupo-h [data-a] { display: none !important; }
  .visor-herr #b-imagen-menu { display: inline-flex !important; }
  .visor-herr { flex-wrap: nowrap; overflow-x: auto; }
  .visor-herr .grupo-h { flex-wrap: nowrap; }
  .visor-herr button { min-width: 58px; height: 46px; }
  .visor-herr button small { font-size: .66rem; }
  .historial-barra .acciones .btn-icono { min-width: 44px; }
  .historial-barra .acciones small { flex: 0 1 auto; order: 0; }
  .sub-barra .btn { min-height: 40px; }
}
@media (max-width: 860px) {
  /* en edición, Deshacer y Borrar siguen a mano en la barra del visor */
  .visor-app:not(.solo-lectura) .visor-herr [data-a="deshacer"], .visor-app:not(.solo-lectura) .visor-herr [data-a="borrar"] { display: inline-flex !important; }
}

/* ---- Formulario 033 ---- */
table.f033 { font-size: .85rem; }
table.f033 th { text-align: left; font-size: .72rem; white-space: nowrap; }
table.f033 td { padding: 4px 6px; }
table.f033 input[type="text"], table.f033 input[type="date"], table.f033 select { padding: 5px 8px; font-size: .88rem; }
table.f033 input[type="number"] { width: 52px; padding: 4px; text-align: center; }
table.f033.higiene td, table.f033.higiene th { text-align: center; }
table.f033.higiene th:first-child { text-align: left; }
table.f033 .prom, table.f033 .tot { font-weight: 700; color: var(--accent-ink); text-align: center; }
table.f033 input[type="radio"] { width: 18px; height: 18px; }
table.f033.filas th { white-space: normal; }
@media (max-width: 860px) {
  table.f033 { min-width: 520px; }
  table.f033.filas { min-width: 640px; }
  table.f033 input[type="number"] { width: 44px; }
}

/* ---- pestañas de la ficha en PC: píldoras separadas con ícono ---- */
.tabs.tabs-pildoras { border-bottom: 0; gap: 6px; margin-bottom: 16px; padding: 2px 0; }
.tabs.tabs-pildoras button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--fg); padding: 7px 14px 7px 10px; margin: 0; font-weight: 500; box-shadow: var(--shadow); }
.tabs.tabs-pildoras button .ic { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--panel-2); font-size: .85rem; }
.tabs.tabs-pildoras button:hover { border-color: var(--accent); background: var(--accent-soft); }
.tabs.tabs-pildoras button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.tabs.tabs-pildoras button[aria-selected="true"] .ic { background: rgba(255,255,255,.25); }

/* ---- pestañas de la ficha en PC: estilo clásico (cajas + panel con título) ---- */
.tabs.tabs-pildoras { gap: 4px; margin-bottom: 0; padding: 0; border-bottom: 1px solid var(--line); align-items: flex-end; }
.tabs.tabs-pildoras button { border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--panel); color: var(--accent-ink); padding: 10px 16px; box-shadow: none; font-weight: 500; font-size: .92rem; margin-bottom: -1px; }
.tabs.tabs-pildoras button .ic { width: auto; height: auto; background: transparent; font-size: .95rem; }
.tabs.tabs-pildoras button:hover { background: var(--accent-soft); border-color: var(--line); }
.tabs.tabs-pildoras button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.tabs.tabs-pildoras button[aria-selected="true"] .ic { background: transparent; }
.panel-tab { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; background: var(--panel); padding: 12px; }
.panel-tab-titulo { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; font-weight: 500; color: var(--fg); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px 8px 0 0; padding: 10px 16px; margin-bottom: 0; }
.panel-tab-cuerpo { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; padding: 14px; background: var(--panel); }
.panel-tab-cuerpo > .card, .panel-tab-cuerpo .form-sec .card, .panel-tab-cuerpo .historial-barra { box-shadow: none; }
.panel-tab-cuerpo > .card:first-child { margin-top: 0; }

/* ---- ingreso (usuario + PIN) y asistente ---- */
.login input { max-width: 260px; font-size: 1rem; letter-spacing: normal; text-align: left; padding: 10px 12px; }
.login input[name="pin"] { text-align: center; letter-spacing: .4em; font-size: 1.3rem; }
.login.setup { max-width: 380px; }
/* ---- selector de archivo con tarjetas ---- */
.subir-tarjetas { display: grid; grid-template-columns: 1fr; gap: 10px; }
.subir-tarjeta { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 12px; border: 2px dashed var(--line); border-radius: 14px; background: var(--panel); cursor: pointer; text-align: center; }
.subir-tarjeta:hover, .subir.arrastrando .subir-tarjeta { border-color: var(--accent); background: var(--accent-soft); }
.subir-tarjeta .ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--panel-2); font-size: 1.4rem; }
.subir-tarjeta b { font-size: 1.05rem; }
.subir-tarjeta small { color: var(--muted); font-size: .82rem; }
.subir-ayuda { display: block; margin-top: 8px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.subir-lista { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
@media (max-width: 860px) { .subir-tarjetas { grid-template-columns: 1fr 1fr; } .subir-tarjeta.solo-movil { display: flex !important; } }

/* ---- solicitudes ---- */
.registro .ic-reg { font-size: 1.5rem; width: 36px; text-align: center; }
.cat-grupos { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.cat-grupo { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px 8px; margin: 0; min-width: 0; }
.cat-grupo legend { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); font-weight: 600; padding: 0 4px; }
.cat-item { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 8px; font-size: .9rem; cursor: pointer; margin: 0; color: var(--fg); }
.cat-item:hover { background: var(--panel-2); }
.cat-item.sel { background: var(--accent-soft); }
.cat-item input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex-shrink: 0; }
.cat-item .nombre { flex: 1; }
.cat-item .detalle { width: 130px; padding: 4px 6px; font-size: .82rem; }
@media (max-width: 860px) {
  .cat-grupos { grid-template-columns: 1fr; }
  .cat-item { padding: 9px 4px; flex-wrap: wrap; }
  .cat-item .detalle { width: 100%; margin-left: 26px; }
}
