:root {
  --bg: #F6F2EA;
  --surface: #FFFDF9;
  --ink: #2B2620;
  --muted: #776E62;
  --line: #E6DED1;
  --accent: #3E6B57;
  --accent-dark: #2F5544;
  --accent-soft: #E3ECE6;
  --terra: #C47A4E;
  --danger: #B4473A;
  --danger-soft: #F7E3DF;
  --warn: #9A6514;
  --warn-soft: #FBEFD9;
  --ok-soft: #E3ECE6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 38, 32, .05), 0 6px 20px rgba(43, 38, 32, .05);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.5 var(--sans);
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h1 em, .brand em { font-style: italic; font-weight: 500; color: var(--terra); }
p { margin: 0 0 .7em; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.big { font-size: 1.15rem; font-weight: 600; }
.mt { margin-top: 1rem; }
.pad { padding: 1.2rem; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .6rem max(16px, env(safe-area-inset-left));
  background: rgba(255, 253, 249, .94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.brand-mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff; font: 600 .9rem var(--serif); letter-spacing: .02em;
}
.brand-mark.big { width: 56px; height: 56px; font-size: 1.3rem; }
.mainnav { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.mainnav a { text-decoration: none; color: var(--ink); padding: .45rem .75rem; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.mainnav a:hover { background: var(--accent-soft); }
.mainnav a.active { background: var(--accent); color: #fff; }
.mainnav .who { display: flex; flex-direction: column; line-height: 1.1; margin: 0 .5rem 0 1rem; font-size: .9rem; font-weight: 600; }
.mainnav .who small { color: var(--muted); font-weight: 400; }
.mainnav .logout { color: var(--danger); }
.nav-toggle { display: none; margin-left: auto; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-block; background: none; border: 1px solid var(--line); border-radius: 999px; padding: .4rem .9rem; font: 600 .95rem var(--sans); color: var(--ink); }
  .mainnav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding: .4rem 0; }
  .nav-open .mainnav { display: flex; }
  .mainnav a { padding: .7rem .9rem; border-radius: 10px; }
  .mainnav .who { margin: .6rem .9rem; }
}

/* ---------- layout ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 1.5rem 16px 4rem; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pagehead p { max-width: 60ch; }
.small-head { align-items: center; }
.small-head h2 { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 760px; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::before { content: '✎ '; color: var(--accent); }
details.card[open] > summary { margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
.grid-2 .card { margin: 0; }
.back { text-decoration: none; font-weight: 600; font-size: .95rem; }

/* ---------- forms ---------- */
.form { display: grid; gap: .9rem; }
.form label { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; }
.form label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; font-size: 1rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; }
.row.three { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
input, select, textarea {
  font: 400 1rem var(--sans); color: var(--ink);
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  min-height: 46px;
}
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
input[type=color] { padding: 4px; height: 46px; }
select[size] { min-height: 0; padding: .3rem; }
select[size] option { padding: .45rem .5rem; border-radius: 6px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.inline { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.inline input, .inline select { width: auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; min-width: 200px; }
form.toolbar { justify-content: flex-start; }
.weeknav { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: 700 .97rem var(--sans); text-decoration: none; cursor: pointer;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  padding: .65rem 1.2rem; border-radius: 999px; min-height: 44px; white-space: nowrap;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.btn-link { background: none; border: none; color: var(--accent); padding: .4rem .5rem; min-height: 0; font-weight: 600; }
.btn-link:hover { background: none; text-decoration: underline; }
.danger { color: var(--danger) !important; }
.btn-ghost.danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.btn-wa { background: #25D366; border-color: #25D366; color: #fff; padding: .45rem .9rem; min-height: 38px; font-size: .9rem; }
.btn-wa:hover { background: #1DA851; border-color: #1DA851; }
form { margin: 0; }

.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; }
.flash-ok { background: var(--ok-soft); color: var(--accent-dark); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- auth ---------- */
.auth { min-height: 80vh; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 420px; padding: 2rem 1.6rem; }
.auth-card h1 { text-align: center; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 1rem; }

/* ---------- agenda ---------- */
.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; align-items: start; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; min-height: 120px; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.day.past { opacity: .72; }
.day header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.day h2 { font-size: 1.05rem; margin: 0; }
.day h2 span { color: var(--muted); font-family: var(--sans); font-weight: 600; font-size: .9rem; margin-left: .2rem; }
.day.today h2::after { content: 'Hoy'; margin-left: .5rem; font: 700 .7rem var(--sans); text-transform: uppercase; letter-spacing: .06em; background: var(--accent); color: #fff; padding: 2px 7px; border-radius: 999px; vertical-align: middle; }
.day .add { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; text-decoration: none; font-size: 1.3rem; color: var(--accent); background: var(--accent-soft); }
.day .add:hover { background: var(--accent); color: #fff; }
.empty { color: var(--muted); font-size: .9rem; margin: .3rem 0; }
.turno {
  display: grid; gap: 1px; text-decoration: none; color: var(--ink);
  padding: .55rem .7rem .55rem .85rem; margin-bottom: .45rem; border-radius: 10px;
  background: color-mix(in srgb, var(--c) 9%, #fff);
  border-left: 4px solid var(--c); position: relative;
}
.turno:hover { background: color-mix(in srgb, var(--c) 17%, #fff); }
.turno .hora { font-weight: 700; font-size: .88rem; font-variant-numeric: tabular-nums; }
.turno .serv { font-weight: 700; display: flex; justify-content: space-between; gap: .4rem; }
.turno .pac { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.turno .prof { font-size: .8rem; color: var(--muted); }
.turno .cupo { font-size: .78rem; font-weight: 700; background: #fff; border-radius: 999px; padding: 0 .45rem; border: 1px solid var(--line); align-self: center; }
.turno .cupo.lleno { background: var(--terra); color: #fff; border-color: var(--terra); }
.turno .tag { position: absolute; top: .5rem; right: .6rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.turno.estado-cancelado { opacity: .55; text-decoration: line-through; }
.turno.estado-cancelado .tag { color: var(--danger); text-decoration: none; }
.turno.estado-realizado .tag { color: var(--accent); }
.blk { background: repeating-linear-gradient(-45deg, #F1ECE3, #F1ECE3 8px, #EAE3D7 8px, #EAE3D7 16px); border-radius: 10px; padding: .5rem .7rem; margin-bottom: .45rem; font-weight: 700; font-size: .9rem; color: var(--muted); display: grid; }
.blk small { font-weight: 400; }

/* ---------- turno detalle ---------- */
.turno-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 6px solid var(--c); }
.turno-head .actions { display: flex; flex-direction: column; gap: .4rem; align-items: stretch; }
.notas { background: var(--bg); border-radius: 10px; padding: .6rem .8rem; }
.badge { display: inline-block; font: 700 .72rem var(--sans); text-transform: uppercase; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px; background: var(--line); color: var(--ink); margin-bottom: .5rem; }
.badge.estado-confirmado { background: var(--accent-soft); color: var(--accent-dark); }
.badge.estado-realizado { background: var(--accent); color: #fff; }
.badge.estado-cancelado { background: var(--danger-soft); color: var(--danger); }
.pacientes { list-style: none; padding: 0; margin: 0 0 1rem; }
.pacientes li { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.pac-info { display: grid; flex: 1 1 200px; }
.pac-info a { text-decoration: none; color: var(--ink); }
.pac-actions { display: flex; align-items: center; gap: .3rem; }
.asis { display: flex; gap: .3rem; }
.chip { font: 600 .85rem var(--sans); border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: .35rem .75rem; cursor: pointer; min-height: 36px; }
.chip.on { color: #fff; }
.chip-pendiente.on { background: var(--muted); border-color: var(--muted); }
.chip-presente.on { background: var(--accent); border-color: var(--accent); }
.chip-ausente.on { background: var(--danger); border-color: var(--danger); }
.addpac summary { cursor: pointer; font-weight: 700; color: var(--accent); padding: .5rem 0; }
.addpac .form { margin-top: .6rem; }

/* ---------- listas ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--bg); }
.table td { padding: .85rem 1.2rem; border-bottom: 1px solid var(--line); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--bg); }
.table tr:last-child td { border-bottom: none; }
.table a { color: var(--ink); font-weight: 600; text-decoration: none; }
.table tr.off { opacity: .5; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: .6rem; vertical-align: middle; }
.hist { list-style: none; padding: 0; margin: 0; }
.hist li { border-bottom: 1px solid var(--line); }
.hist li:last-child { border-bottom: none; }
.hist li a, .hist li > div { display: grid; padding: .6rem 0; text-decoration: none; color: var(--ink); }
.hist li.futuro { border-left: 3px solid var(--accent); padding-left: .6rem; }
.hist li.estado-cancelado { opacity: .55; }
.blk-item { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.card.prof { display: flex; flex-direction: column; justify-content: space-between; gap: .6rem; margin: 0; }
.card.prof h3 { margin-bottom: .1rem; }
.card.prof p { margin-bottom: .35rem; }
.card.prof .actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.card.prof.off { opacity: .65; }

@media (max-width: 600px) {
  h1 { font-size: 1.6rem; }
  .hide-sm { display: none; }
  .table th, .table td { padding: .75rem .9rem; }
  .pagehead .btn { width: 100%; }
  .turno-head .actions { flex-direction: row; flex-wrap: wrap; }
}

/* ---------- horarios y permisos ---------- */
fieldset.box { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem 1rem; margin: 0; min-width: 0; }
fieldset.box legend { font: 600 1.05rem var(--serif); padding: 0 .4rem; }
.hor-grid { display: grid; gap: .35rem; }
.hor-row { display: grid; grid-template-columns: 90px 1fr 1fr; gap: .5rem; align-items: center; }
.hor-range { display: flex; align-items: center; gap: .3rem; }
.hor-range input { min-height: 40px; padding: .4rem .5rem; }
.hor-range span { color: var(--muted); font-size: .85rem; }
.perm-row { display: grid !important; grid-template-columns: 1fr 200px; align-items: center; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--line); font-weight: 400 !important; font-size: 1rem !important; }
.perm-row:last-child { border-bottom: none; }
@media (max-width: 600px) {
  .hor-row { grid-template-columns: 1fr; }
  .perm-row { grid-template-columns: 1fr; }
}

/* ---------- calendario ---------- */
.cal-toolbar { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem 1rem; align-items: center; margin-bottom: 1rem; }
.cal-nav, .cal-right { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.cal-right { justify-content: flex-end; }
.cal-title { text-align: center; }
.cal-title h1 { font-size: 1.45rem; margin: 0; }
.cal-title p { margin: 0; }
.btn.sq { width: 44px; padding: 0; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg a { text-decoration: none; color: var(--ink); font-weight: 700; font-size: .9rem; padding: .45rem .8rem; border-radius: 999px; }
.seg a.on { background: var(--ink); color: #fff; }
@media (max-width: 1000px) {
  .cal-toolbar { grid-template-columns: 1fr; }
  .cal-title { text-align: left; order: -1; }
  .cal-right { justify-content: flex-start; }
}

.cal-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.cal { --tw: 52px; min-width: calc(var(--tw) + var(--cols) * 150px); }
.cal-head, .cal-body { display: grid; grid-template-columns: var(--tw) repeat(var(--cols), minmax(150px, 1fr)); }
.cal-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.cal-head .corner { position: sticky; left: 0; background: var(--surface); z-index: 3; }
.ch { padding: .55rem .5rem; text-align: center; border-left: 1px solid var(--line); display: grid; gap: 1px; line-height: 1.2; }
.ch-dia { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ch-prof { font-weight: 700; font-size: .95rem; }
.ch-ro { font-size: .7rem; color: var(--muted); }
.ch.hoy .ch-dia { color: var(--accent); }
.times { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--line); }
.tl { height: var(--hora); position: relative; }
.tl span { position: absolute; top: -.6em; right: 8px; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl:first-child span { top: 2px; }
.col { position: relative; height: var(--alto); border-left: 1px solid var(--line); background: var(--surface); }
.col::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hora) / 2 - 1px), rgba(120,105,85,.08) calc(var(--hora) / 2 - 1px), rgba(120,105,85,.08) calc(var(--hora) / 2), transparent calc(var(--hora) / 2), transparent calc(var(--hora) - 1px), rgba(120,105,85,.2) calc(var(--hora) - 1px), rgba(120,105,85,.2) var(--hora)); }
.col.cerrado { background: #E5DFD3; }
.col[data-manage="1"] { cursor: copy; }
.col .abierto { position: absolute; left: 0; right: 0; background: var(--surface); }
.bloq { position: absolute; inset: 0; z-index: 2; display: grid; place-items: start center; padding-top: 1rem;
  background: repeating-linear-gradient(-45deg, rgba(231,225,214,.92), rgba(231,225,214,.92) 10px, rgba(220,212,198,.92) 10px, rgba(220,212,198,.92) 20px); }
.bloq span { background: var(--surface); border-radius: 999px; padding: .3rem .8rem; font-weight: 700; font-size: .85rem; color: var(--muted); }
.bloq-mini { position: relative; z-index: 3; margin: 3px; padding: 2px 6px; font-size: .72rem; border-radius: 6px; background: #E7E1D6; color: var(--muted); font-weight: 700; }
.ev {
  position: absolute; z-index: 3; margin-left: 2px; overflow: hidden; text-decoration: none; color: var(--ink);
  background: color-mix(in srgb, var(--c) 16%, #fff); border-left: 4px solid var(--c); border-radius: 7px;
  padding: 3px 6px; font-size: .8rem; line-height: 1.2; display: flex; flex-direction: column; gap: 1px;
  box-shadow: 0 1px 2px rgba(43,38,32,.12);
}
.ev:hover { background: color-mix(in srgb, var(--c) 28%, #fff); z-index: 4; }
.ev-h { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .75rem; }
.ev-p { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-s { color: color-mix(in srgb, var(--c) 60%, var(--ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .74rem; }
.ev.corto { flex-direction: row; align-items: center; gap: 5px; padding-top: 1px; padding-bottom: 1px; }
.ev.corto .ev-s { display: none; }
.ev-ok { position: absolute; top: 2px; right: 5px; color: var(--accent); font-weight: 700; }
.ev.estado-realizado { opacity: .75; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: #D2453B; z-index: 5; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #D2453B; }
.cal-help { margin-top: .6rem; }

/* ---------- notas y archivos ---------- */
.pac-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pac-hero h1 { margin-bottom: .1rem; }
.notas-list { list-style: none; padding: 0; margin: .6rem 0 0; }
.nota { border-top: 1px solid var(--line); padding: .9rem 0; }
.nota-head { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; font-size: .9rem; }
.nota-head form { margin-left: auto; }
.nota-texto { margin-top: .4rem; white-space: normal; }
.adjuntos { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.thumb { display: block; width: 110px; height: 110px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.thumb:hover img { transform: scale(1.04); }
.filecard { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .6rem; align-items: center; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); max-width: 280px; background: #fff; }
.filecard .ext { grid-row: span 2; font: 700 .72rem var(--sans); background: var(--terra); color: #fff; border-radius: 6px; padding: .4rem .45rem; }
.filecard .fn { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filepick { border: 2px dashed var(--line); border-radius: 12px; padding: .8rem; cursor: pointer; }
.filepick:hover { border-color: var(--accent); }
.filepick input[type=file] { border: none; padding: .3rem 0; min-height: 0; background: none; }
.picked { color: var(--accent); }
.nota-form { margin-top: .6rem; }
.serv-row { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.serv-row:last-of-type { border-bottom: none; }
.serv-row .check { font-weight: 400 !important; }
.serv-row .dur { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .9rem; }
.serv-row .dur input { width: 86px; min-height: 38px; padding: .3rem .5rem; }
[hidden] { display: none !important; }
.bloq.parcial { inset: auto 0; left: 0; right: 0; place-items: center; padding: 0 4px; overflow: hidden; border-radius: 6px; }
.bloq.parcial span { font-size: .74rem; padding: .15rem .55rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.diag { margin: .3rem 0 0; max-width: 70ch; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- reportes y recordatorios ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: grid; gap: .1rem; }
.stat-n { font: 600 1.9rem/1.1 var(--serif); }
.stat-l { color: var(--muted); font-size: .88rem; }
.pad-h { padding: 1.1rem 1.2rem .3rem; }
.table-scroll { overflow-x: auto; }
.table.rep td, .table.rep th { white-space: nowrap; }
.table.rep tbody tr { cursor: default; }
.table .r { text-align: right; }
.barcell { display: flex; align-items: center; gap: .5rem; min-width: 140px; }
.barcell .bar { display: block; height: 10px; border-radius: 999px; background: var(--accent); min-width: 2px; }
.progress-head { display: grid; gap: .45rem; margin-bottom: .6rem; }
.progress { height: 8px; background: var(--accent-soft); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.recs li { gap: .6rem 1rem; }
.rec-hora { font-weight: 700; min-width: 3.2rem; }
.estado-rec { color: var(--warn); font-weight: 700; }
.recs li.hecho .estado-rec { color: var(--accent); }
.recs li.hecho .pac-info { opacity: .7; }
@media (prefers-reduced-motion: reduce) { .progress span { transition: none; } }
.progress-head p { margin: 0; }

/* ---------- menú "Más" ---------- */
.mas { position: relative; }
.mas summary { list-style: none; cursor: pointer; padding: .45rem .75rem; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.mas summary::-webkit-details-marker { display: none; }
.mas summary::after { content: ' ▾'; font-size: .8em; color: var(--muted); }
.mas summary:hover, .mas[open] summary { background: var(--accent-soft); }
.mas.active summary { background: var(--accent); color: #fff; }
.mas.active summary::after { color: #fff; }
.mas-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(43,38,32,.14); padding: .4rem; display: grid; z-index: 20; }
.mas-menu a { border-radius: 8px !important; padding: .55rem .75rem !important; }
.badge-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin-left: 3px; border-radius: 999px; background: var(--terra); color: #fff; font-size: .75rem; }
@media (max-width: 900px) {
  .mas summary { display: none; }
  .mas, .mas[open] { display: contents; }
  .mas-menu { position: static; display: contents; box-shadow: none; border: none; }
}

/* ---------- cobros, autorizaciones, espera ---------- */
.pac-li { flex-wrap: wrap; }
.pac-extra { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; }
.pac-extra:empty { display: none; }
.tagx { display: inline-flex; align-items: center; font-size: .82rem; font-weight: 700; padding: .2rem .65rem; border-radius: 999px; }
.tag-ok { background: var(--accent-soft); color: var(--accent-dark); }
.tag-mal { background: var(--warn-soft); color: var(--warn); }
.cobro summary { cursor: pointer; font-weight: 700; color: var(--accent); font-size: .9rem; list-style: none; }
.cobro summary::-webkit-details-marker { display: none; }
.cobro-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-top: .5rem; }
.cobro-form label { display: grid; gap: .2rem; font-size: .85rem; font-weight: 600; }
.cobro-form input { width: 120px; }
.cobro-form select { width: auto; }
.espera-box { background: var(--warn-soft); border-radius: 12px; padding: .8rem 1rem; margin: .4rem 0 .8rem; }
.espera-box ul { list-style: none; padding: 0; margin: .4rem 0 0; }
.espera-box li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.hist-log { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; font-size: .92rem; }
.saldo { font-weight: 700; padding: .25rem .8rem; border-radius: 999px; font-size: .95rem; }
.saldo.debe { background: var(--danger-soft); color: var(--danger); }
.saldo.ok { background: var(--accent-soft); color: var(--accent-dark); }
.movs { list-style: none; padding: 0; margin: .6rem 0; }
.movs li { display: grid; grid-template-columns: auto 1fr auto auto; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.mov-c { min-width: 0; overflow-wrap: anywhere; }
.mov-m { font-weight: 700; text-align: right; }
.mov-m.pago { color: var(--accent-dark); }
.mov-m.cargo { color: var(--danger); }
.auts { list-style: none; padding: 0; margin: .4rem 0 .6rem; display: grid; gap: .9rem; }
.auts li { display: grid; gap: .3rem; }
.auts li.off { opacity: .6; }
.aut-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.aut-bar { display: flex; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.aut-bar .u { background: var(--accent); }
.aut-bar .r { background: color-mix(in srgb, var(--accent) 40%, #fff); }
.wrap-row { flex-wrap: wrap; justify-content: flex-end; }
label.mini { display: grid; gap: .15rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.stat-warn .stat-n { color: var(--danger); }
.pad-x { padding: 0 1.2rem 1rem; }
h3 { font-family: var(--serif); }

/* ---------- reserva online (página pública) ---------- */
.pub { max-width: 760px; margin: 0 auto; font-size: 1.08rem; }
.pub-head { display: flex; gap: 1rem; align-items: center; margin: .5rem 0 1.4rem; }
.pub-head h1 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.2rem); }
.pub-head p { margin: .2rem 0 0; }
.pasos { list-style: none; display: flex; gap: .4rem; padding: 0; margin: 0 0 1.4rem; counter-reset: p; flex-wrap: wrap; }
.pasos li { counter-increment: p; font-size: .85rem; font-weight: 700; color: var(--muted); padding: .3rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.pasos li::before { content: counter(p) ". "; }
.pasos li.on { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent-soft); }
.pub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.pub-opt { display: grid; gap: .2rem; padding: 1.1rem 1.2rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--c, var(--accent)); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); font-size: 1.1rem; }
.pub-opt:hover, .pub-opt:focus-visible { border-color: var(--accent); }
.dias { display: grid; gap: 1rem; }
.dia-op h3 { margin: 0 0 .5rem; font-size: 1.1rem; }
.horas { display: flex; flex-wrap: wrap; gap: .5rem; }
.hora-btn { display: grid; justify-items: center; min-width: 84px; padding: .7rem .9rem; border-radius: 12px; background: var(--surface); border: 2px solid var(--accent-soft); color: var(--accent-dark); font-weight: 700; font-size: 1.1rem; text-decoration: none; font-variant-numeric: tabular-nums; }
.hora-btn small { font-weight: 600; font-size: .75rem; color: var(--muted); }
.hora-btn:hover, .hora-btn:focus-visible { background: var(--accent); color: #fff; border-color: var(--accent); }
.hora-btn:hover small { color: #fff; }
.resumen { border-left: 6px solid var(--accent); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pub-ok { text-align: center; }
.ok-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 2rem; margin: 0 auto .6rem; }
.pub-foot { text-align: center; margin-top: 2rem; }
.sol-list { display: grid; gap: 1rem; margin-bottom: 1rem; }
.sol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); gap: 1rem 1.5rem; border-left: 6px solid var(--c); margin: 0; }
.sol.off { opacity: .7; }
.sol h2 { margin: .2rem 0; }
.sol-main p { margin: .2rem 0; }
.sol-act { align-self: center; }
@media (max-width: 700px) { .sol { grid-template-columns: 1fr; } }
.wrap-cell { white-space: normal !important; min-width: 220px; }
