/* Tablero del consultorio. La portada no carga esta hoja. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

body.in-app {
  overflow: hidden;
  background: #fff;
}
body.in-app .skip,
body.in-app .nav,
body.in-app #contenido,
body.in-app footer {
  display: none !important;
}

#app {
  --ok: #0d6b45;
  --ok-bg: #e5f6ee;
  --wait: #8a5a12;
  --wait-bg: #fff4df;
  --now: #0d3fae;
  --now-bg: #e7efff;
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.35;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: #fff;
  color: #24364a;
  padding: 0.75rem 0.5rem 0.7rem;
  border-right: 1px solid #e6edf5;
}
.mark {
  color: #102033;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 1.02rem;
  padding: 0.25rem 0.55rem 0.45rem;
}
.mark small {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0;
  color: #6b7c90;
}
.rail-nav, .dock {
  display: grid;
  gap: 0.25rem;
}
.rail a, .dock a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  border-radius: 0.7rem;
  padding: 0.4rem 0.55rem;
  font-weight: 600;
  font-size: 0.84rem;
  color: #3c5168;
}
.rail a svg, .dock a svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.rail a[aria-current="page"] {
  background: #e8f1ff;
  color: #1d4ed8;
}
.rail a:hover { background: #f4f7fb; }
.rail a[aria-current="page"]:hover { background: #e8f1ff; }
#btn-salir {
  margin-top: auto;
  border: 0;
  background: transparent;
  color: #5c7086;
  border-radius: 0.55rem;
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
#btn-salir:hover { background: #f4f7fb; color: #102033; }

.stage {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}
.top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 320px);
  gap: 0.8rem;
  align-items: center;
  padding: 0.75rem 1.1rem;
  background: white;
  border-bottom: 1px solid #d9e3ee;
}
.who { min-width: 0; }
.who strong {
  display: block;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.who span { color: var(--muted); font-size: 0.82rem; }
.finder { position: relative; }
#buscar {
  width: 100%;
  border: 1px solid #d5deea;
  background: #f6f9fc;
  border-radius: 0.7rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
}
#buscar:focus { outline: 2px solid #b9ccf5; background: white; }
.finder-list {
  position: absolute;
  z-index: 5;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d5deea;
  border-radius: 0.75rem;
  box-shadow: 0 12px 30px rgba(16, 32, 51, 0.12);
  padding: 0.3rem;
  display: grid;
  gap: 0.15rem;
}
.finder-list button {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 0.5rem;
  padding: 0.5rem 0.55rem;
  font: inherit;
  cursor: pointer;
}
.finder-list button:hover { background: #f3f7fc; }
.finder-list span { color: var(--muted); font-size: 0.8rem; }

.app-error { padding: 0.45rem 1.1rem 0; }
#clinic-root {
  overflow: auto;
  padding: 0.7rem 0.85rem 1rem;
  min-height: 0;
  background: #fff;
}
#clinic-root.fill {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
#app section { padding: 0; }
#app section.sheet { padding: 0.85rem 0.95rem; }
#app h1, #app h2, #app h3 {
  letter-spacing: -0.03em;
  line-height: 1.2;
  font-weight: 700;
}
#app h1 { font-size: 1.28rem; max-width: none; margin: 0; }
#app h2 { font-size: 0.95rem; margin: 0 0 0.45rem; }
#app p { margin: 0; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}
.stat {
  background: white;
  border: 1px solid #d9e3ee;
  border-radius: 0.8rem;
  padding: 0.55rem 0.7rem;
}
.stat b {
  display: block;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.stat.next b { font-size: 0.95rem; }
.stat.next small { display: block; color: var(--muted); font-weight: 600; }

.queue { display: grid; gap: 0.4rem; }
.row {
  display: grid;
  grid-template-columns: 3.3rem minmax(0, 1.4fr) auto auto;
  gap: 0.5rem 0.65rem;
  align-items: center;
  background: white;
  border: 1px solid #d9e3ee;
  border-radius: 0.75rem;
  padding: 0.45rem 0.6rem;
}
.marks, .actions { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.actions { justify-content: flex-end; }
.row time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.86rem; }
.row .name { min-width: 0; }
.row .name strong, .row .name span { display: block; }
.row .name span, .muted { color: var(--muted); }
.row .name span { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.16rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: #eef3f8;
  color: #3d5168;
  white-space: nowrap;
}
.tag.new { background: var(--ok-bg); color: var(--ok); }
.tag.wait { background: var(--wait-bg); color: var(--wait); }
.tag.now { background: var(--now-bg); color: var(--now); }
.tag.done { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: #fde8e8; color: #9f2d2d; }
.act, .ghost {
  border-radius: 0.6rem;
  padding: 0.38rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.act {
  border: 0;
  background: var(--ink);
  color: white;
}
.act:hover { background: #1d4ed8; }
.ghost {
  border: 1px solid #d5deea;
  background: white;
  color: var(--ink);
}
.ghost:hover { background: #f6f9fc; }
.row.current { border-color: #8eaff5; box-shadow: inset 3px 0 0 #1d4ed8; }

.sheet {
  background: white;
  border: 1px solid #d9e3ee;
  border-radius: 0.9rem;
  padding: 0.85rem 0.95rem;
}
.stack { display: grid; gap: 0.7rem; }
.split-page {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}
.mini { display: grid; gap: 0.35rem; }
.chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.15rem 0.45rem;
  text-align: left;
  border: 1px solid #d9e3ee;
  background: white;
  border-radius: 0.7rem;
  padding: 0.4rem 0.55rem;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.chip time { font-weight: 700; font-size: 0.78rem; }
.chip strong { font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.on { border-color: #1d4ed8; background: #f3f7ff; }
.head-row { display: flex; justify-content: space-between; gap: 0.7rem; align-items: flex-start; }
.pills { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.facts { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; color: var(--muted); font-size: 0.82rem; margin-top: 0.55rem; }
.note-grid { display: grid; gap: 0.45rem; margin-top: 0.7rem; }
.note-grid div { display: grid; gap: 0.1rem; }
.note-grid small { color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
#app label { display: grid; gap: 0.25rem; font-size: 0.78rem; font-weight: 700; color: #3d5168; }
#app input, #app select, #app textarea {
  width: 100%;
  border: 1px solid #d5deea;
  border-radius: 0.65rem;
  padding: 0.48rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  background: white;
}
#app textarea { min-height: 3.4rem; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.form-grid .wide { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.day-block { display: grid; gap: 0.4rem; margin-bottom: 0.9rem; }
.day-block h2 { text-transform: capitalize; }
.people { display: grid; gap: 0.35rem; }
.person {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid #d9e3ee;
  border-radius: 0.75rem;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.person:hover, .chip:hover { border-color: #b9ccf5; }
.person small { color: var(--muted); display: block; }
.recipe { display: grid; gap: 0.25rem; }
.recipe p { font-size: 0.9rem; }
.dock { display: none; }

@media (max-width: 980px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .row { grid-template-columns: 3.2rem minmax(0, 1fr); }
  .marks, .actions { grid-column: 2; }
  .actions { justify-content: flex-start; }
  .split-page { grid-template-columns: 1fr; }
  .mini {
    grid-auto-flow: column;
    grid-auto-columns: minmax(9.5rem, 46%);
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }
}
@media (max-width: 860px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .rail { display: none; }
  .dock {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: white;
    border-top: 1px solid #d9e3ee;
    padding: 0.25rem 0.2rem calc(0.3rem + env(safe-area-inset-bottom));
  }
  .dock a {
    flex-direction: column;
    gap: 0.12rem;
    justify-content: center;
    font-size: 0.68rem;
    padding: 0.4rem 0.15rem;
    color: #4c6074;
  }
  .dock a[aria-current="page"] { color: #1d4ed8; background: #eef3ff; }
  .top { grid-template-columns: 1fr; padding: 0.65rem 0.8rem; }
  #clinic-root { padding: 0.7rem 0.75rem 0.9rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .cal-sheet { min-width: 0; }
  .cal-sheet.week { min-width: 720px; }
  .dir-table { font-size: 0.78rem; }
}

.cal {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.cal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid #e6edf5;
}
.cal-bar strong { font-size: 0.95rem; margin-right: auto; text-transform: capitalize; }
.seg { display: flex; border: 1px solid #d5deea; border-radius: 0.55rem; overflow: hidden; }
.seg button {
  border: 0;
  background: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.32rem 0.6rem;
  cursor: pointer;
  color: #3c5168;
}
.seg button[aria-pressed="true"] { background: #e8f1ff; color: #1d4ed8; }
.cal-scroll { flex: 1; min-height: 0; overflow: auto; }
.cal-sheet {
  display: grid;
  grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: 28px repeat(12, minmax(46px, 1fr));
  height: 100%;
  min-height: 100%;
  background: #fff;
}
.dh, .gh {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  border-bottom: 1px solid #e6edf5;
  font-size: 0.72rem;
  font-weight: 700;
  color: #5c7086;
  display: flex;
  align-items: center;
  padding: 0 0.35rem;
}
.dh.today { color: #1d4ed8; }
.gl {
  border-top: 1px solid #eef2f6;
  color: #8aa0b5;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.35rem 0 0;
  text-align: right;
}
.col {
  position: relative;
  display: grid;
  grid-template-rows: repeat(12, minmax(0, 1fr));
  border-left: 1px solid #e6edf5;
  min-width: 0;
}
.slot {
  border: 0;
  border-top: 1px solid #eef2f6;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.slot:hover { background: #f7faff; }
.block {
  position: absolute;
  left: 4px;
  right: 6px;
  z-index: 2;
  border: 0;
  border-left: 3px solid #1d4ed8;
  border-radius: 6px;
  background: #e8f1ff;
  color: #102033;
  text-align: left;
  padding: 3px 6px;
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.2;
  overflow: hidden;
  cursor: pointer;
  min-height: 26px;
}
.block strong, .block span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block span { color: #3c5168; font-size: 0.68rem; }
.block.wait { background: #fff6e5; border-left-color: #b7791f; }
.block.now { background: #e7f0ff; border-left-color: #1d4ed8; }
.block.done { background: #e7f6ee; border-left-color: #0d6b45; }
.block.off { background: #f3f5f8; border-left-color: #8aa0b5; color: #5c7086; }

.dir { display: flex; flex-direction: column; min-height: 0; flex: 1; background: #fff; }
.dir-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #e6edf5;
}
.dir-bar h1 { font-size: 1.05rem; }
.dir-bar input { max-width: 240px; margin-left: auto; }
.dir-scroll { overflow: auto; flex: 1; }
.dir-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.dir-table th {
  text-align: left;
  font-size: 0.72rem;
  color: #6b7c90;
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #e6edf5;
  position: sticky;
  top: 0;
  background: #fff;
}
.dir-table td {
  padding: 0.48rem 0.75rem;
  border-bottom: 1px solid #f0f4f8;
  white-space: nowrap;
}
.dir-table tr { cursor: pointer; }
.dir-table tbody tr:hover { background: #f7faff; }
.dir-empty { padding: 1rem 0.85rem; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(16, 32, 51, 0.28);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.dialog {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 0.9rem;
  padding: 0.9rem;
  display: grid;
  gap: 0.55rem;
  box-shadow: 0 16px 40px rgba(16, 32, 51, 0.16);
}
.dialog h2 { margin: 0; }
.pick { position: relative; }
.pick-list {
  position: static;
  z-index: 2;
  background: #fff;
  border: 1px solid #d5deea;
  border-radius: 0.6rem;
  max-height: 168px;
  overflow: auto;
  display: grid;
}
.pick-list button {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #f0f4f8;
  background: #fff;
  font: inherit;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
}
.pick-list button span { color: var(--muted); font-size: 0.75rem; }
.pick-list button:hover, .pick-list button.on { background: #e8f1ff; }
.pick-list p { padding: 0.45rem 0.55rem; }
