:root {
  --bg: #f4f7f8; --card: #fff; --ink: #14262b; --muted: #5d7279; --line: #dde5e8;
  --brand: #0f766e; --brand-d: #0b5d57; --brand-l: #e0f2f0;
  --red: #b42318; --red-l: #fde8e6; --amber: #92600a; --amber-l: #fdf0d5;
  --blue: #1d5fa8; --blue-l: #e3eefb; --green: #1f7a3d; --green-l: #e1f4e7; --gray-l: #eceff1;
  --r: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 .6rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .4rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }

.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-inner { max-width: 1180px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.logo { font-size: 1.3rem; }
nav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
nav a { color: var(--muted); padding: .35rem .7rem; border-radius: 8px; font-weight: 500; }
nav a:hover { background: var(--bg); text-decoration: none; }
nav a.on { background: var(--brand-l); color: var(--brand-d); }
.who { display: flex; align-items: center; gap: .8rem; color: var(--muted); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.page-head h1 { margin-bottom: .2rem; }
.page-head p { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 480px; }
.card.empty { text-align: center; color: var(--muted); padding: 2rem; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--green-l); border-color: #b9e2c5; color: #14532d; }
.flash.error { background: var(--red-l); border-color: #f6c3be; color: #7a1a12; }

.btn { display: inline-block; font: inherit; font-weight: 600; cursor: pointer; padding: .5rem .95rem;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger { color: var(--red); border-color: #f1b8b3; }
.btn.danger:hover { background: var(--red-l); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
button.link:hover { text-decoration: underline; }
.danger-text { color: var(--red) !important; }
form.inline { display: inline; margin: 0; }

label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; }
input, select, textarea { font: inherit; padding: .5rem .65rem; border: 1px solid #c3d0d4; border-radius: 8px;
  background: #fff; color: var(--ink); width: 100%; font-weight: 400; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
input[readonly] { background: var(--gray-l); }
input.short { max-width: 140px; }
small { font-weight: 400; }

.stack { display: flex; flex-direction: column; gap: .9rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.span2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; }
.form-row { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.form-row label { flex: 1 1 140px; }
.form-row label.grow { flex: 3 1 240px; }
.filters { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; padding: .9rem 1.1rem; }
.filters label { flex: 1 1 160px; }
.filter-actions { display: flex; gap: .4rem; }

.auth { max-width: 400px; margin: 4rem auto; text-align: center; }
.auth .stack { text-align: left; }
.auth-logo { font-size: 2.6rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafcfc; white-space: nowrap; }
tbody tr:hover { background: #fafcfc; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { text-align: right; white-space: nowrap; }
tr.muted-row { opacity: .6; }
tfoot td { font-weight: 600; background: #fafcfc; border-top: 2px solid var(--line); }
tr.pago td { background: #f6fbf8; }
.neg { color: var(--red); } .pos { color: var(--green); }
td input[name=name] { min-width: 220px; }

.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .12rem .6rem; border-radius: 999px; white-space: nowrap; }
.badge.gray { background: var(--gray-l); color: #3d4b50; }
.badge.blue { background: var(--blue-l); color: var(--blue); }
.badge.amber { background: var(--amber-l); color: var(--amber); }
.badge.green { background: var(--green-l); color: var(--green); }
.badge.teal { background: var(--brand-l); color: var(--brand-d); }
.badge.red { background: var(--red-l); color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; align-items: start; }
.facts { display: grid; grid-template-columns: 150px 1fr; gap: .4rem .8rem; margin: 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.detail-text { white-space: pre-wrap; margin: 0; background: var(--bg); padding: .8rem; border-radius: 8px; }
.timeline { list-style: none; margin: 0 0 1rem; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; display: flex; flex-direction: column; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; left: 0; top: .3rem; width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2px solid #c3d0d4; }
.timeline li::after { content: ""; position: absolute; left: 5px; top: 1.1rem; bottom: -.1rem; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done { color: var(--ink); }
.timeline li.done::before { background: var(--brand); border-color: var(--brand); }
.timeline li.cancel { color: var(--red); } .timeline li.cancel::before { background: var(--red); border-color: var(--red); }
.timeline li span { font-size: .85rem; color: var(--muted); }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat { display: flex; flex-direction: column; gap: .2rem; }
.stat strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat.due strong { color: var(--red); } .stat.ok strong { color: var(--green); }
.pay-form h2 { margin-bottom: .6rem; }

@media (max-width: 760px) {
  .grid-2, .stats, .form-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 110px 1fr; }
  .who { margin-left: auto; }
}
@media print {
  .top, .no-print, .flash { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .wrap { max-width: none; padding: 0; }
  .card { border-color: #bbb; break-inside: avoid; }
  a { color: inherit; }
}

/* ---- agenda ---- */
.day-nav { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .7rem 1rem; }
.day-nav .inline-date { margin-left: auto; }
.day-nav input[type=date] { width: auto; padding: .3rem .5rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; margin-bottom: 1rem; }
.wday { display: flex; flex-direction: column; align-items: center; padding: .5rem .2rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink); line-height: 1.2; }
.wday:hover { text-decoration: none; background: var(--bg); }
.wday span { font-size: .78rem; color: var(--muted); text-transform: uppercase; }
.wday b { font-size: 1.15rem; }
.wday small { color: var(--muted); font-size: .72rem; }
.wday.today b { color: var(--brand); }
.wday.sel { background: var(--brand-l); border-color: var(--brand); }
.appts { display: flex; flex-direction: column; gap: .6rem; }
.appt { display: grid; grid-template-columns: 70px 1fr auto; gap: 1rem; align-items: start; margin: 0; }
.appt.cancelado, .appt.ausente { opacity: .65; }
.appt.atendido { border-left: 4px solid var(--green); }
.appt.programado { border-left: 4px solid var(--brand); }
.appt-time { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.appt-time b { font-size: 1.15rem; } .appt-time span { color: var(--muted); font-size: .85rem; }
.appt-title { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.appt-notes { margin-top: .3rem; font-size: .9rem; background: var(--bg); padding: .4rem .6rem; border-radius: 6px; white-space: pre-wrap; }
.appt-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; max-width: 320px; }
@media (max-width: 760px) {
  .appt { grid-template-columns: 56px 1fr; }
  .appt-actions { grid-column: 1 / -1; justify-content: flex-start; max-width: none; }
  .week { gap: .2rem; } .wday small { display: none; }
}
.hint { margin: 0; background: var(--bg); padding: .6rem .8rem; border-radius: 8px; }

/* ================= versión 2: elegir perfil, inicio, cuadrante, calendario, listas ================= */
.choose { max-width: 720px; margin: 3rem auto; text-align: center; }
.choose h1 { justify-content: center; font-size: 1.9rem; }
.choose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.4rem; }
.choose-card { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 2rem 1.2rem;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px; color: var(--ink); }
.choose-card:hover { text-decoration: none; border-color: var(--brand); background: var(--brand-l); }
.choose-card .ci { font-size: 2.8rem; line-height: 1; }
.choose-card strong { font-size: 1.25rem; }
.auth p.muted { margin-bottom: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.tile { display: flex; flex-direction: column; gap: .2rem; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.4rem 1.3rem; color: var(--ink); min-height: 150px; }
.tile:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 2px 10px rgba(15,118,110,.12); }
.tile .ti { font-size: 2rem; line-height: 1.1; }
.tile h2 { margin: .3rem 0 .1rem; font-size: 1.25rem; }
.tile p { margin: 0; color: var(--muted); }

.tabs { display: flex; gap: .3rem; margin: .2rem 0 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .5rem 1rem; border-radius: 8px 8px 0 0; color: var(--muted); font-weight: 600; border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; }
.tabs a:hover { text-decoration: none; background: var(--card); }
.tabs a.on { background: var(--card); color: var(--brand-d); border-color: var(--line); }
.filters .f-wide { flex: 2 1 240px; }
.teeth-cell { font-variant-numeric: tabular-nums; max-width: 150px; color: var(--muted); font-size: .88rem; }
small.hint-line, .hint { font-weight: 400; }

/* --- cuadrante dental --- */
.teeth-field { display: flex; flex-direction: column; gap: .5rem; }
.teeth-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.teeth-head .btn { margin-left: auto; }
.odonto { background: #fbfdfd; border: 1px solid var(--line); border-radius: 12px; padding: .8rem .6rem; }
.odonto-scroll { overflow-x: auto; }
.odonto-inner { min-width: 560px; max-width: 760px; margin: 0 auto; }
.odonto-caps { display: grid; grid-template-columns: 1fr 1fr; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); text-align: center; }
.odonto-arch { display: grid; grid-template-columns: 1fr 1fr; padding: .35rem 0; }
.odonto-arch.lower { border-top: 2px dashed #c3d0d4; }
.odonto-half { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 0 .3rem; }
.odonto-half + .odonto-half { border-left: 2px dashed #c3d0d4; }
.tooth { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 0; margin: 0;
  background: none; border: 1px solid transparent; border-radius: 8px; font: inherit; color: var(--ink); cursor: default; }
.tooth.lower { flex-direction: column-reverse; }
.tooth .tn { font-size: .72rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tooth svg { width: 100%; max-width: 34px; height: auto; }
.tooth.lower svg { transform: scaleY(-1); }
.tooth svg .root { fill: #e3e9ec; stroke: #9db0b6; stroke-width: .8; }
.tooth svg .crown { fill: #fff; stroke: #7d9399; stroke-width: 1; }
.odonto.interactive .tooth { cursor: pointer; }
.odonto.interactive .tooth:hover { background: var(--brand-l); border-color: #9fd3cd; }
.odonto.interactive .tooth:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.tooth.on { background: var(--brand-l); border-color: var(--brand); }
.tooth.on .tn { color: var(--brand-d); }
.tooth.on svg .crown { fill: var(--brand); stroke: var(--brand-d); }
.tooth.on svg .root { fill: #b5ddd8; stroke: var(--brand); }

/* --- calendario --- */
.cal-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.cal-head strong { flex: 1; text-align: center; font-size: 1.05rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; padding: .2rem 0; }
.cal-day { background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); min-width: 0; }
.cal-day.out { background: #f6f8f9; opacity: .55; }
.cal-day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-day.sel { background: var(--brand-l); border-color: var(--brand); }
.cal-legend { font-size: .82rem; margin: .6rem 0 0; }
.dot { display: inline-block; min-width: 1.15rem; height: 1.15rem; line-height: 1.15rem; padding: 0 .3rem; border-radius: 999px;
  font-style: normal; font-size: .72rem; font-weight: 700; text-align: center; vertical-align: middle; }
.cal-legend .dot { min-width: .7rem; width: .7rem; height: .7rem; padding: 0; line-height: 1; }
.dot.amber { background: #f2b84b; color: #4a3000; }
.dot.green { background: #4cae6e; color: #fff; }
.cal-compact .cal-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .3rem .1rem; min-height: 54px; }
.cal-compact a.cal-day:hover { text-decoration: none; background: var(--bg); }
.cal-compact .cal-num { font-weight: 600; font-size: .9rem; }
.cal-compact .dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.cal-big .cal-day { min-height: 104px; padding: .3rem; display: flex; flex-direction: column; gap: 3px; }
.cal-big .cal-num { font-weight: 700; font-size: .9rem; color: var(--ink); align-self: flex-start; padding: 0 .25rem; border-radius: 6px; }
.cal-big .cal-day.today .cal-num { background: var(--brand); color: #fff; }
.chip { display: block; font-size: .76rem; font-weight: 600; padding: .1rem .4rem; border-radius: 6px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { text-decoration: none; filter: brightness(.95); }
.chip.recibido { background: var(--amber-l); color: var(--amber); }
.chip.entregado { background: var(--green-l); color: var(--green); }
.chip.more { background: var(--gray-l); color: #3d4b50; }

/* --- fichas / listas / saldos --- */
.stats-2 { grid-template-columns: repeat(2, 1fr); }
.split { display: grid; grid-template-columns: 330px 1fr; gap: 1.2rem; align-items: start; }
.split.split-wide { grid-template-columns: 1fr 340px; }
.split h2 { margin-top: .2rem; }
.split .two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.pills { display: flex; gap: .4rem; flex-wrap: wrap; margin: .8rem 0; }
.pill { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .9rem; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.pill:hover { text-decoration: none; background: var(--bg); }
.pill.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pill small { font-weight: 500; opacity: .8; }
.pill .count { background: rgba(0,0,0,.1); border-radius: 999px; padding: 0 .45rem; font-size: .78rem; }
.pill:not(.on) .count { background: var(--gray-l); }
.new-list summary { cursor: pointer; }
.list-panel .list-head { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; }
.list-panel .list-head form.form-row { flex: 1 1 340px; }
.list-panel .hint { margin-top: .8rem; }
.assign { display: flex; flex-direction: column; gap: .3rem; max-height: 420px; overflow-y: auto; }
.assign label.check { align-items: flex-start; padding: .3rem .2rem; border-radius: 6px; font-weight: 500; }
.assign label.check:hover { background: var(--bg); }
table.balances tr.opening td { color: var(--muted); background: #fafcfc; font-style: italic; }
table.balances tr.future td { color: #9aa9ae; }
table.balances tr.on td { background: var(--brand-l); }
h2 .btn { vertical-align: middle; margin-left: .5rem; }
.card h2 + .cal { margin-top: 0; }

@media (max-width: 900px) {
  .split, .split.split-wide { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .choose-grid, .stats-2 { grid-template-columns: 1fr; }
  .cal-big .cal-day { min-height: 70px; }
  .chip { font-size: .68rem; padding: .05rem .25rem; }
}
@media print {
  .tabs, .filters, .pills, .new-list { display: none !important; }
}

.form-grid > *, .split > *, .grid-2 > *, .two > * { min-width: 0; }
.two input[type=date] { min-width: 0; }
@media (max-width: 760px) {
  .top-inner { gap: .5rem 1rem; }
  nav { flex: 1 1 100%; order: 3; }
}

.requests h2 { margin-bottom: .2rem; }
.request { display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; align-items: end; padding: .8rem 0; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .request { grid-template-columns: 1fr; } }
.card.narrow-lg { max-width: 640px; }

/* ---- facturación (hoja imprimible, estilo resumen de cuenta) ---- */
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.4rem 1.6rem; margin: 1rem 0; }
.sheet-date { text-align: right; font-weight: 700; margin: 0 0 1.2rem; }
.sheet-who { font-size: 1.05rem; line-height: 1.5; margin-bottom: 1rem; }
.sheet-title { text-align: center; font-weight: 700; margin: 1rem 0 .8rem; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.sheet-table th { text-align: left; border-bottom: 1px solid #888; padding: .25rem .4rem; }
.sheet-table td { padding: .15rem .4rem; font-weight: 600; }
.sheet-table th.num, .sheet-table td.num { text-align: right; }
.sheet-foot { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; margin-top: 1.6rem;
  padding-top: .8rem; border-top: 1px solid #888; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.sheet-foot dl { display: grid; grid-template-columns: auto auto; gap: .15rem 1.2rem; margin: 0; }
.sheet-foot dt { text-transform: uppercase; }
.sheet-foot dd { margin: 0; text-align: right; }
@media print {
  .split { display: none !important; }
  .sheet { border: 0; border-radius: 0; padding: 0; margin: 0; page-break-after: always; break-after: page; min-height: 95vh; position: relative; }
  .sheet:last-of-type { page-break-after: auto; break-after: auto; }
  .sheet-foot { position: absolute; bottom: 0; left: 0; right: 0; }
  .sheet-table td a { text-decoration: none; }
}
.cal-billing .cal-legend { display: none; }

/* ---- mensajes y comentarios ---- */
nav .count { display: inline-block; min-width: 1.2em; padding: 0 .35em; border-radius: 999px; background: #d97706; color: #fff; font-size: .72rem; text-align: center; }
.thread { max-height: 55vh; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; padding: .3rem 0 .8rem; }
.msg { display: flex; }
.msg.mine { justify-content: flex-end; }
.bubble { max-width: 78%; padding: .5rem .75rem; border-radius: 12px; background: #eef2f1; border: 1px solid var(--line); }
.msg.mine .bubble { background: var(--brand-l); border-color: #b9dfda; }
.bubble p { margin: .15rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble time { font-size: .72rem; color: #6b7a78; }
.who-msg { font-size: .75rem; font-weight: 700; color: #3d4f4c; }
.empty-thread { margin: auto; }
.compose { display: flex; gap: .6rem; align-items: flex-end; margin-top: .5rem; }
.compose textarea { flex: 1; resize: vertical; }
.convs { list-style: none; margin: 0; padding: 0; }
.convs a { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); color: inherit; }
.convs a:hover { background: var(--brand-l); text-decoration: none; }
.remito-bar { display: flex; gap: 1rem; align-items: center; margin: .6rem 0 1.2rem; }
.note-title { margin: 0; }
.note-total { text-align: right; font-weight: 700; margin: .8rem 0; }
.signs { display: flex; gap: 3rem; margin-top: 4rem; }
.signs div { flex: 1; text-align: center; font-size: .85rem; }
.signs span { display: block; border-top: 1px solid #444; margin-bottom: .3rem; }
.row-link { cursor: default; } .row-link:hover td { background: #f3f8f7; }

.send-box { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.attach a { font-weight: 600; }
.rep-sector { margin: 1.1rem 0 .3rem; font-size: 1rem; }
.rep-sector small { color: var(--muted); font-weight: 400; }
.rep-table { font-size: .82rem; }
.rep-table td small { color: #555; }
th.chk, td.chk { text-align: center; width: 3.4rem; }
.box { display: inline-block; width: 15px; height: 15px; border: 1.5px solid #333; border-radius: 3px; }
@media print { .rep-table { font-size: 9pt; } .rep-table tr { break-inside: avoid; } .rep-sector { break-after: avoid; } }
.tile.alert { border-color: #e7b4b4; background: #fff7f7; }
.ctrl-tiles { margin-bottom: 1rem; }
.appt-chip.programado { background: var(--brand-l); color: var(--brand); }
.appt-chip.atendido { background: var(--green-l); color: var(--green); }
.appt-chip.ausente { background: var(--amber-l); color: var(--amber); }
.acal { margin-bottom: 1rem; }
.slots-card { margin: 1rem 0; }
.slots-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.slots-head h2 { margin: 0; }
.slots-head p { margin: 0; flex: 1; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .4rem; }
.slot { display: flex; align-items: center; gap: .6rem; padding: .45rem .7rem; border-radius: 8px; border: 1px solid var(--line); min-width: 0; color: var(--ink); }
.slot b { font-variant-numeric: tabular-nums; }
.slot span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.free { background: #f2fbf8; border-color: #b9dfda; color: var(--brand); font-weight: 600; }
.slot.free i { font-style: normal; font-size: .78rem; background: var(--brand); color: #fff; padding: .1rem .5rem; border-radius: 999px; }
.slot.free:hover { text-decoration: none; background: var(--brand-l); }
.slot.busy { background: #eef2fb; border-color: #c6d3ee; }
.slot.busy.cont { opacity: .7; }
.slot.past { background: #f6f8f9; color: var(--muted); }
@media print { .slot.free, .slot.past { display: none; } .slots { grid-template-columns: 1fr 1fr; } }
.lab-search { display: flex; gap: .6rem; align-items: flex-end; margin: 1rem 0; }
.lab-search label { flex: 1; }
.lab-results { display: grid; gap: .5rem; }
.lab-result { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* ---- celular ---- */
@media (max-width: 640px) {
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; padding: .8rem; }
  .filters label, .filters .f-wide { flex: none; min-width: 0; }
  .filters .f-wide, .filters .filter-actions { grid-column: 1 / -1; }
  .filters select, .filters input { width: 100%; }
  .tiles { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .tile { padding: .8rem .9rem; }
  .tile .ti { font-size: 1.5rem; }
  .tile h2 { font-size: 1rem; }
  .tile p { font-size: .85rem; }
  .ctrl-tiles { grid-template-columns: 1fr 1fr 1fr; }
  .ctrl-tiles .tile p { font-size: .75rem; }
  .ctrl-tiles .tile h2 { font-size: .9rem; }
  .page-head h1 { font-size: 1.45rem; }
  .head-actions { width: 100%; }
  .slots { grid-template-columns: 1fr; }
}
[hidden] { display: none !important; }

/* piezas del paciente */
.tooth-notes { display: grid; gap: .4rem; margin: .8rem 0 .4rem; }
.tooth-note { display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: center; gap: .5rem; }
.tooth-note[hidden] { display: none !important; }
.tooth-note b { background: var(--brand, #0f766e); color: #fff; border-radius: 6px; text-align: center; padding: .2rem 0; font-size: .85rem; }
.tooth-note input { margin: 0; }
#teeth-form .teeth-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; }

/* aviso de retiro */
.pickup-dialog { border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem; width: min(440px, 92vw); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.pickup-dialog::backdrop { background: rgba(15,30,35,.45); }
.bubble.pickup { background: #fff4d6 !important; border-color: #f0c85a !important; font-weight: 600; }
.radio-row { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: .6rem; font-weight: 400; }
.radio-row input { margin-top: .25rem; width: auto; }
.request { flex-wrap: wrap; }
.pickup-warn { background: #fff4d6; border: 1px solid #f0c85a; border-radius: 10px; padding: .6rem .8rem; color: #6b4a00; }
.pickup-warn[hidden] { display: none !important; }

/* agenda de retiros (laboratorio) */
.pk-day { margin: 1.2rem 0 .5rem; display: flex; align-items: center; gap: .5rem; }
.pk-day.late { color: #b42318; }
.pk-list { display: grid; gap: .6rem; }
.pk { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.pk.done { opacity: .65; }
.pk-main { display: grid; gap: .2rem; min-width: 0; }
.pk-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* selector de laboratorio (control del odontólogo) */
.lab-pick { position: relative; }
.lab-panel { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: .3rem; margin-top: 2px; max-height: 260px; overflow: auto; }
.lab-panel[hidden], .lab-group[hidden], .lab-opt[hidden] { display: none !important; }
.lab-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #5b6b70); padding: .4rem .6rem .15rem; }
.lab-opt { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: .55rem .6rem; font: inherit; cursor: pointer; margin: 0; }
.lab-opt:hover, .lab-opt:focus { background: var(--brand-l, #e0f2ef); outline: none; }
.lab-hint { font-size: .8rem; color: var(--muted, #5b6b70); padding: .3rem .6rem .4rem; }

/* días anteriores anulados en la agenda del odontólogo */
.cal-day.past { background: repeating-linear-gradient(135deg, #f3f5f6, #f3f5f6 6px, #eaeef0 6px, #eaeef0 12px); opacity: .6; cursor: not-allowed; }
.slot.past { opacity: .55; }

.btn.wa { background: #25d366; border-color: #25d366; color: #063; font-weight: 600; text-decoration: none; }
.btn.wa:hover { filter: brightness(.95); }
.btn.wa.off { background: #eef1f2; border-color: var(--line); color: var(--muted, #5b6b70); font-weight: 400; cursor: help; }

.lab-opt.active { background: var(--brand-l, #e0f2ef); outline: 2px solid var(--brand, #0f766e); outline-offset: -2px; }
.key-hint { font-size: .8rem; margin: 0; }

/* ---- vista previa de impresión (en pantalla, antes de imprimir) ---- */
body.preview-mode { background: #8a9391; }
body.preview-mode .top, body.preview-mode .no-print, body.preview-mode .flash,
body.preview-mode .tabs, body.preview-mode .filters, body.preview-mode .pills,
body.preview-mode .new-list, body.preview-mode .split { display: none !important; }
body.preview-mode .preview-bar { display: flex !important; }
body.preview-mode .wrap { max-width: 794px; margin: 4.5rem auto 2rem; background: #fff; padding: 12mm 12mm;
  box-shadow: 0 2px 14px rgba(0,0,0,.4); min-height: 1050px; font-size: 12px; }
body.preview-mode .card { border-color: #bbb; }
body.preview-mode .sheet { border: 0; border-radius: 0; padding: 0; margin: 0 0 1rem; min-height: 980px; position: relative; }
body.preview-mode .sheet-foot { position: absolute; bottom: 0; left: 0; right: 0; }
.preview-bar { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 9999; justify-content: space-between;
  align-items: center; gap: 1rem; padding: .7rem 1.2rem; background: #1f2937; color: #fff; }
.preview-btns { display: flex; gap: .5rem; }
@media print { .preview-bar { display: none !important; } }

/* ---- ítems múltiples y bonificación ---- */
.items-box { border: 1px dashed var(--line); border-radius: 8px; padding: .7rem .8rem; display: flex; flex-direction: column; gap: .5rem; }
.item-row { display: grid; grid-template-columns: 2fr 80px 1fr 90px auto; gap: .4rem; align-items: center; }
.item-row > * { min-width: 0; }
.items-total { margin: 0; text-align: right; }
.items-total strong { font-size: 1.1rem; margin-left: .5rem; }
@media (max-width: 760px) { .item-row { grid-template-columns: 1fr 1fr; } .item-row select { grid-column: 1 / -1; } }
.disc-tag { color: #b45309; font-size: .8rem; }
.wt-block { display: flex; flex-direction: column; gap: .35rem; }
.wt-block > label { font-weight: 600; }
.wt-row { display: flex; gap: .5rem; }
.wt-row select { flex: 1; min-width: 0; }
.wt-block #extra-items { display: flex; flex-direction: column; gap: .4rem; }
