/* Panel del negocio. Mobile first:
 *   < 768 px   móvil: barra superior, barra de accesos abajo y menú lateral desplegable.
 *   768–1023   tablet: barra superior y menú desplegable.
 *   ≥ 1024 px  escritorio: menú lateral fijo. */

:root {
  --sidebar-w: 248px;
  --appbar-h: 56px;
  --tabbar-h: 62px;
  --accent: #2f6fed;
  --radius: 12px;
  --surface-2: color-mix(in srgb, var(--pico-muted-border-color) 45%, transparent);
}

/* --- Estructura --------------------------------------------------------------------- */
body.app { min-height: 100dvh; }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; padding: .5rem 1rem;
  background: var(--pico-background-color); }
.skip:focus { left: .5rem; top: .5rem; }

.appbar { position: sticky; top: 0; z-index: 30; height: var(--appbar-h);
  display: flex; align-items: center; gap: .5rem; padding: 0 .75rem;
  padding-top: env(safe-area-inset-top);
  background: var(--pico-background-color);
  border-bottom: 1px solid var(--pico-muted-border-color); }
.appbar .brand { font-weight: 700; text-decoration: none; color: var(--pico-color); }
.appbar-title { margin-left: auto; font-weight: 600; color: var(--pico-muted-color);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-toggle { width: 44px; height: 44px; padding: 0; margin: 0; font-size: 1.3rem;
  background: transparent; border: 0; color: var(--pico-color); }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(86vw, var(--sidebar-w));
  display: flex; flex-direction: column; gap: 1rem; padding: 1rem .75rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  background: var(--pico-background-color); border-right: 1px solid var(--pico-muted-border-color);
  overflow-y: auto; transform: translateX(-100%); transition: transform .2s ease;
  visibility: hidden; }
body.nav-open .sidebar { transform: none; visibility: visible;
  box-shadow: 0 0 40px rgb(0 0 0 / 30%); }
.sidebar .brand { font-weight: 700; font-size: 1.15rem; text-decoration: none;
  color: var(--pico-color); padding: .25rem .75rem; }
.sidebar nav, .sidebar nav ul { display: block; margin: 0; padding: 0; }
.sidebar nav li { display: block; list-style: none; padding: 0; margin: 0 0 2px; }
.sidebar a:not(.brand) { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem;
  border-radius: 10px; text-decoration: none; color: var(--pico-color); min-height: 44px; }
.sidebar a:not(.brand):hover { background: var(--surface-2); }
.sidebar a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent); font-weight: 600; }
.sidebar .ico { width: 1.4rem; text-align: center; }
.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--pico-muted-border-color);
  display: grid; gap: .6rem; }
.sidebar .sidebar-foot a.me { display: flex; align-items: center; gap: .7rem; min-width: 0;
  padding: .55rem .6rem; border-radius: 12px; }
.avatar { flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid;
  place-items: center; font-weight: 700; font-size: .95rem; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.me-text { display: grid; min-width: 0; line-height: 1.25; }
.me-text strong { font-size: .92rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.me-text small { color: var(--pico-muted-color); font-size: .76rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot form { margin: 0; }
.logout { width: 100%; margin: 0; padding: .5rem .75rem; font-size: .88rem; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  background: transparent; border: 1px solid var(--pico-muted-border-color);
  color: var(--pico-muted-color); }
.logout:hover, .logout:focus-visible { color: #e5484d; border-color: #e5484d;
  background: color-mix(in srgb, #e5484d 8%, transparent); }
.sheet-grip { display: none; }

/* Móvil: el menú completo sale desde abajo («Más») y arriba no hay otro botón de menú. */
@media (max-width: 767px) {
  .app:not(.no-tabbar) .appbar .menu-toggle { display: none; }
  .no-tabbar .content { padding-bottom: 2rem; }
  .appbar { padding-left: 1rem; }
  .sidebar { inset: auto 0 0 0; width: 100%; max-height: 85dvh; border-right: 0;
    border-radius: 18px 18px 0 0; transform: translateY(100%);
    padding-bottom: calc(1rem + env(safe-area-inset-bottom)); gap: .5rem; }
  body.nav-open .sidebar { transform: none; }
  .sidebar > .brand { display: none; }
  .sheet-grip { display: block; width: 2.5rem; height: 4px; border-radius: 2px; margin: 0 auto .5rem;
    background: var(--pico-muted-border-color); }
  .sidebar nav ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px .5rem; }
}
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / 45%); }

.tabbar { position: fixed; inset: auto 0 0 0; z-index: 30; display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--pico-background-color); border-top: 1px solid var(--pico-muted-border-color); }
.tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--pico-muted-color); font-size: .72rem;
  text-decoration: none; width: auto; height: auto; }
.tabbar span { font-size: 1.25rem; line-height: 1; }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.content { width: 100%; max-width: 1240px; margin: 0 auto;
  padding: 1rem 1rem calc(var(--tabbar-h) + 1.5rem + env(safe-area-inset-bottom)); }
.content h1 { font-size: 1.5rem; margin-bottom: .75rem; }
.content h2 { font-size: 1.2rem; }

@media (min-width: 768px) {
  .tabbar { display: none; }
  .content { padding: 1.5rem 1.5rem 2.5rem; }
  .content h1 { font-size: 1.75rem; }
}

@media (min-width: 1024px) {
  .appbar, .backdrop { display: none; }
  .sidebar { transform: none; visibility: visible; width: var(--sidebar-w); box-shadow: none;
    transition: none; }
  body.app { padding-left: var(--sidebar-w); }
  .content { padding: 2rem 2.5rem 3rem; }
}

/* --- Piezas comunes ----------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0; color: var(--pico-muted-color); flex-basis: 100%; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.toolbar > * { margin: 0; }
.seg { display: inline-flex; width: auto; flex: 0 0 auto; margin: 0; }
.seg > a { flex: 0 0 auto; margin: 0; padding: .45rem .8rem; border-radius: 0; }
.seg a:first-child { border-radius: var(--pico-border-radius) 0 0 var(--pico-border-radius); }
.seg a:last-child { border-radius: 0 var(--pico-border-radius) var(--pico-border-radius) 0; }
.seg a + a { margin-left: -1px; }
.toolbar form { display: flex; gap: .4rem; margin: 0; }
@media (max-width: 767px) {
  .page-head .toolbar { width: 100%; flex-wrap: nowrap; }
  .toolbar .date-jump { flex: 1; min-width: 0; }
  .toolbar .date-jump input { width: 100%; min-width: 0; flex: 1; }
}
.toolbar input { margin: 0; height: auto; padding: .4rem .6rem; width: auto; }

form.inline { display: inline; margin: 0; }
form.inline button, button.small { padding: .3rem .7rem; font-size: .85rem; width: auto; margin: 0; }
.flash { padding: .75rem 1rem; border-radius: var(--pico-border-radius); }
.flash.ok { background: #e6f4ea; color: #1d5e33; }
.flash.error { background: #fdecec; color: #8a1f1f; }
.badge { display: inline-block; padding: .05rem .55rem; border-radius: 1rem; font-size: .75rem;
  background: var(--pico-muted-border-color); white-space: nowrap; }
.badge.alert { background: #c93636; color: #fff; }
.off { font-size: .85rem; color: var(--pico-muted-color); }
.muted { color: var(--pico-muted-color); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.narrow { max-width: 420px; margin: 3rem auto; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
code { overflow-wrap: anywhere; }

/* Dos columnas solo cuando hay sitio de verdad (Pico las pone ya desde 768 px). */
.split { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1200px) { .split { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.split > article { margin: 0; }

.searchbar { display: flex; gap: .5rem; }
.searchbar input { margin: 0; flex: 1; min-width: 0; }
.searchbar button { margin: 0; width: auto; }

/* Tablas: con scroll lateral si no caben y, en móvil, cada fila como una tarjeta. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { margin-bottom: 0; }
@media (max-width: 767px) {
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: .75rem 1rem; margin-bottom: .75rem; border-radius: var(--radius);
    border: 1px solid var(--pico-muted-border-color); background: var(--pico-card-background-color); }
  table.cards td { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .3rem 0; border: 0; background: transparent; text-align: right; }
  table.cards td::before { content: attr(data-label); font-weight: 600; text-align: left;
    color: var(--pico-muted-color); font-size: .85rem; }
  table.cards td:not([data-label])::before, table.cards td[data-label=""]::before { content: none; }
  table.cards td.main { font-size: 1.05rem; font-weight: 600; text-align: left; }
  table.cards td.empty { text-align: center; justify-content: center; }
  table.cards td form button { padding: .45rem .9rem; }
}

/* Botones más fáciles de pulsar con el dedo. */
@media (pointer: coarse) {
  form.inline button, button.small { min-height: 40px; padding: .45rem .9rem; }
}

/* --- Agenda ------------------------------------------------------------------------- */
.new-appt { margin-bottom: 1.25rem; }
.new-appt > summary { display: inline-block; width: auto; margin: 0; }
.new-appt[open] > summary { margin-bottom: 1rem; }
.new-appt form { padding: 1rem; border-radius: var(--radius);
  border: 1px solid var(--pico-muted-border-color); }

.agenda { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-items: start; }
.agenda-col { min-width: 0; padding: .75rem; border-radius: var(--radius);
  background: var(--surface-2); }
.agenda-col h2 { display: flex; align-items: center; justify-content: space-between;
  font-size: 1rem; margin: 0 0 .6rem; }
.agenda-col h2 small { color: var(--pico-muted-color); font-weight: 400; }
/* Filtro por profesional: útil con muchos profesionales, sobre todo en el móvil. */
.staff-filter { display: flex; gap: .4rem; overflow-x: auto; padding: 0 0 .75rem;
  scrollbar-width: none; }
.staff-filter::-webkit-scrollbar { display: none; }
.staff-filter { width: auto; }
.staff-filter .chip { flex: 0 0 auto; width: auto; margin: 0; padding: .4rem .9rem;
  border-radius: 999px; font-size: .9rem; background: transparent; color: var(--pico-color);
  border: 1px solid var(--pico-muted-border-color); }
.staff-filter .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent);
  color: #fff; }
.agenda-col[hidden] { display: none; }
/* Móvil: uno debajo de otro. Tablet: dos columnas. Escritorio: las que quepan. */
@media (max-width: 767px) { .agenda { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 768px) and (max-width: 1023px) {
  .agenda { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.appt { padding: .65rem .8rem; border-radius: 10px; margin-bottom: .5rem;
  background: var(--pico-card-background-color); border: 1px solid var(--pico-muted-border-color);
  border-left: 4px solid var(--accent); }
.appt-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.appt-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.appt-service { margin: .1rem 0; }
.appt-who { font-size: .9rem; overflow-wrap: anywhere; }
.appt-who small { color: var(--pico-muted-color); }
.appt.cancelled { opacity: .55; border-left-color: var(--pico-muted-border-color); }
.appt.cancelled .appt-service { text-decoration: line-through; }
.appt.completed { border-left-color: #1d7a46; }
.appt.no_show { border-left-color: #c93636; }
.appt .actions { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }
.appt .actions form { flex: 1 1 auto; }
.appt .actions button { width: 100%; margin: 0; }
article.appt { box-shadow: none; }

/* --- Filtros con búsqueda en vivo -------------------------------------------------- */
.filters { display: grid; gap: .5rem; margin-bottom: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.filters > * { margin: 0 !important; }
.filters input[type="search"] { grid-column: 1 / -1; }
.filters .check { font-size: .9rem; white-space: nowrap; }
.filters .clear { font-size: .9rem; justify-self: end; }
.filters.loading { opacity: .7; }
@media (min-width: 1200px) {
  .filters { grid-template-columns: minmax(10rem, 1fr) 10.5rem 12.5rem auto auto; }
  .filters input[type="search"] { grid-column: auto; }
}

/* --- Lista de conversaciones -------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.list li { list-style: none; margin: 0; }
.list .empty { padding: 2rem 1rem; text-align: center; color: var(--pico-muted-color); }
.list-item { display: flex; align-items: center; gap: .8rem; padding: .75rem .9rem;
  border-radius: var(--radius); border: 1px solid var(--pico-muted-border-color);
  background: var(--pico-card-background-color); color: var(--pico-color); text-decoration: none; }
.list-item:hover { border-color: var(--accent); }
.list-item.attention { border-left: 4px solid #c93636; }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-main strong, .list-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main small, .list-side small { color: var(--pico-muted-color); }
.list-side { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem;
  text-align: right; flex-shrink: 0; }
.avatar { flex-shrink: 0; width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid;
  place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #5b8cff, #2f6fed); }

/* --- Una conversación, como un chat ------------------------------------------------- */
.chat-view { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; }
.chat-head { display: flex; align-items: center; gap: .7rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--pico-muted-border-color); }
.chat-head .back { font-size: 1.3rem; text-decoration: none; padding: .25rem .4rem; }
.chat-who { flex: 1; min-width: 0; }
.chat-who h1 { font-size: 1.15rem !important; margin: 0 !important; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.chat-who small { display: block; color: var(--pico-muted-color); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.chat-control { margin: 0; }
.chat-control button { white-space: nowrap; }
.chat-banner { margin: .75rem 0 0; padding: .5rem .8rem; border-radius: 10px; font-size: .9rem;
  background: color-mix(in srgb, #e0a800 18%, transparent); }

.thread { list-style: none; margin: 0; padding: 1rem .25rem; display: flex; flex-direction: column;
  gap: .35rem; }
.thread li { list-style: none; margin: 0; }
.thread .empty { text-align: center; color: var(--pico-muted-color); padding: 2rem; }
.day-sep { align-self: center; margin: .75rem 0 .35rem !important; }
.day-sep span { font-size: .75rem; padding: .2rem .7rem; border-radius: 1rem;
  background: var(--surface-2); color: var(--pico-muted-color); }
.bubble { max-width: min(82%, 560px); display: flex; flex-direction: column; }
.bubble-text { padding: .55rem .85rem; border-radius: 18px; white-space: pre-wrap;
  overflow-wrap: anywhere; line-height: 1.4; }
.bubble-meta { font-size: .7rem; color: var(--pico-muted-color); margin: .15rem .6rem 0; }
.bubble.user { align-self: flex-start; }
.bubble.user .bubble-text { background: var(--surface-2); border: 1px solid var(--pico-muted-border-color);
  border-bottom-left-radius: 5px; }
.bubble.assistant, .bubble.owner { align-self: flex-end; align-items: flex-end; }
.bubble.assistant .bubble-text { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.bubble.owner .bubble-text { background: #1d7a46; color: #fff; border-bottom-right-radius: 5px; }
.bubble-text a { color: inherit; }
.trace { margin: .2rem .6rem 0; font-size: .75rem; max-width: 100%; }
.trace summary { color: var(--pico-muted-color); }
.trace pre { font-size: .7rem; padding: .4rem .6rem; margin: .25rem 0; max-height: 12rem;
  overflow: auto; }

.reply { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + .5rem);
  display: flex; gap: .5rem; align-items: flex-end; margin: 0; padding: .5rem;
  border-radius: 24px; border: 1px solid var(--pico-muted-border-color);
  background: var(--pico-background-color); box-shadow: 0 4px 18px rgb(0 0 0 / 18%); }
.reply textarea { margin: 0; flex: 1; resize: none; min-height: 2.6rem; max-height: 9rem;
  border: 0; background: transparent; box-shadow: none; }
.reply textarea:focus { box-shadow: none; }
.reply button { margin: 0; width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 50%;
  flex-shrink: 0; }
.reply-note { font-size: .75rem; color: var(--pico-muted-color); text-align: center; margin: .4rem 0 0; }
@media (min-width: 768px) { .reply { bottom: 1rem; } }

/* --- Profesionales y servicios ------------------------------------------------------ */
.days-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.days-grid input { margin-bottom: .5rem; }
.checks { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
details.item { border-bottom: 1px solid var(--pico-muted-border-color); padding: .4rem 0; }
details.item > summary { font-weight: 600; }

/* --- Probador del bot (Negocio y bot) ----------------------------------------------- */
.tester { border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); }
.tester .messages { list-style: none; padding: 1rem; margin: 0; max-height: 420px; overflow-y: auto; }
.tester .messages li { list-style: none; padding: .5rem .8rem; border-radius: .8rem;
  margin: .3rem 0; max-width: 85%; white-space: pre-wrap; }
.tester .messages .bot { background: var(--pico-muted-border-color); }
.tester .messages .user { background: #2f6fed; color: #fff; margin-left: auto; }
.tester .composer { display: flex; gap: .5rem; padding: .5rem; margin: 0; }
.tester .composer input { margin: 0; }
.tester .composer button { width: auto; margin: 0; }
.tester .messages .choices { background: none; padding: 0; }
.tester .chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.tester .chip, .tester .confirm button { width: auto; margin: 0; padding: .3rem .8rem; }
.tester .chip[aria-pressed="true"] { background: #2f6fed; color: #fff; }
.tester .chip { background: transparent; color: #2f6fed; border: 1px solid #2f6fed; }
.tester .chips.days { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.tester .day-chip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  gap: 1px; min-width: 58px; padding: .35rem .6rem; border-radius: 14px; line-height: 1.1; }
.tester .dc-week, .tester .dc-month { font-size: .72rem; text-transform: capitalize; opacity: .85; }
.tester .dc-num { font-size: 1.1rem; font-weight: 700; }
.tester .times:empty { display: none; }
.tester .confirm { margin-top: .5rem; display: grid; gap: .4rem; }
.tester .confirm p, .tester .choices p { margin: .2rem 0; }
.tester .confirm-actions { display: flex; gap: .4rem; }

/* --- Entrar, recuperar y elegir contraseña ------------------------------------------ */
body > main.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr;
  padding: 0; }
.auth-brand { background: linear-gradient(150deg, #3b82f6, #6d4fe0); color: #fff;
  padding: 3rem clamp(1.5rem, 5vw, 4rem); display: flex; flex-direction: column;
  justify-content: center; gap: .75rem; }
.auth-brand h2 { color: #fff; margin: 1rem 0 0; font-size: 1.9rem; }
.auth-brand p, .auth-brand li { color: rgb(255 255 255 / 88%); max-width: 32rem; }
.auth-brand ul { padding: 0; margin: .5rem 0; }
.auth-brand li { list-style: none; margin: .35rem 0; }
.auth-logo { color: #fff; font-weight: 700; font-size: 1.3rem; text-decoration: none; }
.auth-logo:hover { color: #fff; }
.auth-note { margin-top: 1rem; padding: .8rem 1rem; border-radius: .7rem;
  background: rgb(255 255 255 / 12%); }
.auth-card { align-self: center; justify-self: center; width: min(26rem, calc(100% - 2rem));
  margin: 2rem 1rem; padding: 2rem; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: .25rem; }
.auth-card .muted, .auth-links.muted { color: var(--pico-muted-color); }
.auth-card button[type="submit"] { width: 100%; }
.auth-links { margin: .6rem 0 0; font-size: .95rem; text-align: center; }
@media (max-width: 760px) {
  body > main.auth { grid-template-columns: 1fr; min-height: 0; }
  .auth-brand { padding: 1.5rem 1rem; gap: .4rem; }
  .auth-brand h2 { font-size: 1.3rem; margin-top: .5rem; }
  .auth-brand ul { display: none; }
  .auth-card { margin: 1rem auto 2rem; padding: 1.5rem; }
}

/* --- Horario semanal seleccionable -------------------------------------------------- */
.week-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem; margin: .5rem 0 .75rem; }
.week { display: grid; gap: .6rem; margin-bottom: 1rem; }
.day { margin: 0; padding: .7rem .9rem; border-radius: var(--radius);
  border: 1px solid var(--pico-muted-border-color); background: var(--pico-card-background-color);
  display: grid; grid-template-columns: 8.5rem 1fr; align-items: center; gap: .4rem 1rem; }
.day label { margin: 0; }
.day-name { font-weight: 600; }
.day-closed { color: var(--pico-muted-color); font-size: .9rem; }
.day-times { grid-column: 1 / -1; display: grid; gap: .5rem .75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr)); }
.day-times input[type="time"] { margin: .2rem 0 0; }
.breaks { grid-column: 1 / -1; display: grid; gap: .5rem; }
.break { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .25rem .6rem;
  align-items: end; padding: .45rem .6rem; border-radius: 10px; background: var(--surface-2); }
.break-label { grid-column: 1; grid-row: 1; align-self: center; font-size: .8rem; font-weight: 600;
  color: var(--pico-muted-color); }
.break label { margin: 0; font-size: .85rem; }
.break input { margin: .15rem 0 0 !important; }
.break-remove { grid-column: 2; grid-row: 1; justify-self: end; width: 2.2rem; height: 2.2rem;
  padding: 0; margin: 0; border-radius: 50%; font-size: .85rem;
  background: transparent; border: 1px solid var(--pico-muted-border-color);
  color: var(--pico-muted-color); }
.break-remove:hover { color: #e5484d; border-color: #e5484d; }
.break-add { justify-self: start; }
/* Lo que no aplica se oculta: un día cerrado no enseña horas. */
.day:has([name$="_abre"]:checked) .day-closed,
.day:not(:has([name$="_abre"]:checked)) .day-times { display: none; }
@media (min-width: 900px) {
  .day { grid-template-columns: 9rem 1fr; }
  .day-times { grid-column: 2; grid-template-columns: 9rem 9rem; }
  .breaks { grid-column: 1 / -1; }
  .break { grid-template-columns: auto 9rem 9rem auto; width: max-content; max-width: 100%;
    align-items: center; }
  .break-label, .break-remove { grid-column: auto; grid-row: auto; }
  .break label { display: flex; align-items: center; gap: .4rem; }
}
.form-error { color: #c93636; font-weight: 600; }

/* --- Campos numéricos en rejilla ---------------------------------------------------- */
.fields-3 { display: grid; gap: 0 1rem; grid-template-columns: minmax(0, 1fr); align-items: end; }
@media (min-width: 560px) { .fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.field-help { display: block; margin: -.4rem 0 1rem; color: var(--pico-muted-color); }
input.money:invalid:not(:placeholder-shown) { border-color: #c93636; }
.fields-2 { display: grid; gap: 0 1rem; grid-template-columns: minmax(0, 1fr); align-items: end; }
@media (min-width: 480px) { .fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.close-card { border-top: 4px solid var(--accent); }
.section-title { margin-top: 2rem; }
.day-actions { margin: -.5rem 0 1rem; font-size: .9rem; }

/* Logotipo: icono + «quedi» */
.wordmark { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800;
  letter-spacing: -.02em; text-decoration: none; }
.wordmark img { width: 28px; height: 28px; flex: none; border-radius: 8px; }

/* --- Nueva cita por pasos y huecos libres -------------------------------------------- */
.view-switch { margin: 0 0 1rem; }
.booker .step { margin: 0 0 1.1rem; padding: 0; border: 0; }
.booker legend { font-weight: 600; margin-bottom: .45rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chips .chip, .free-slots .chip { flex: 0 0 auto; width: auto; margin: 0; padding: .4rem .85rem;
  border-radius: 999px; font-size: .9rem; background: transparent; color: var(--pico-color);
  border: 1px solid var(--pico-muted-border-color); }
.chips .chip:hover, .free-slots .chip:hover { border-color: var(--accent); }
.chips .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips .chip[hidden] { display: none; }
.day-pick .day-other { width: auto; margin: 0; padding: .35rem .6rem; height: auto; font-size: .9rem; }
.slot-group { display: block; margin: .4rem 0 .3rem; text-transform: uppercase;
  letter-spacing: .04em; font-size: .72rem; }
.slots .chip { min-width: 4.4rem; text-align: center; font-variant-numeric: tabular-nums; }
.slot-staff { margin-top: .75rem; }
.slot-staff small { display: block; margin-bottom: .3rem; }
.next-day { margin-top: .5rem; }
.booker .manual { margin: .9rem 0 0; }
.booker .manual > summary { font-size: .88rem; color: var(--pico-muted-color); }
.booker-summary { min-height: 1.4em; font-weight: 600; color: var(--accent); margin: 0 0 .6rem; }
.suggest { position: relative; }
.suggest-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: -.6rem 0 0;
  padding: .25rem; border-radius: 10px; max-height: 15rem; overflow-y: auto;
  background: var(--pico-background-color); border: 1px solid var(--pico-muted-border-color);
  box-shadow: 0 8px 24px rgb(0 0 0 / 25%); }
.suggest-list li { list-style: none; padding: .5rem .65rem; border-radius: 8px; cursor: pointer;
  font-weight: 400; }
.suggest-list li:hover, .suggest-list li:focus { background: var(--surface-2); outline: none; }
.suggest-list[hidden] { display: none; }
.slot-service { max-width: 26rem; margin-bottom: .75rem; }
.free-slots { display: flex; flex-wrap: wrap; gap: .4rem; }
.free-slots .chip { min-width: 4.2rem; text-align: center; font-variant-numeric: tabular-nums;
  border-color: color-mix(in srgb, #2fb36b 60%, transparent); }

/* --- Suscripción y administración ---------------------------------------------------- */
.billing-banner { margin: 0 0 1rem; padding: .7rem 1rem; border-radius: 12px; font-size: .92rem; }
.billing-banner a { font-weight: 600; white-space: nowrap; }
.billing-banner.due { background: color-mix(in srgb, #e8850c 16%, transparent);
  border: 1px solid color-mix(in srgb, #e8850c 45%, transparent); }
.billing-banner.trial { background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }

.sub-hero { display: grid; gap: 1rem; margin: 0 0 1.25rem; padding: 1.25rem; border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, #3b82f6 14%, transparent),
    color-mix(in srgb, #8b5cf6 14%, transparent));
  border: 1px solid color-mix(in srgb, #6d4fe0 30%, transparent); }
.sub-hero.due { background: color-mix(in srgb, #e8850c 12%, transparent);
  border-color: color-mix(in srgb, #e8850c 40%, transparent); }
.sub-hero.suspended { background: color-mix(in srgb, #d93636 11%, transparent);
  border-color: color-mix(in srgb, #d93636 40%, transparent); }
.sub-hero h2 { margin: .5rem 0 .35rem; font-size: 1.3rem; }
.sub-hero p { margin: 0; color: var(--pico-muted-color); }
.sub-badge, .state { display: inline-block; padding: .2rem .65rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.sub-hero.active .sub-badge, .state.active { background: color-mix(in srgb, #1f9d55 18%, transparent); color: #2fb36b; }
.sub-hero.due .sub-badge, .state.due { background: color-mix(in srgb, #e8850c 20%, transparent); color: #f0a030; }
.sub-hero.suspended .sub-badge, .state.suspended { background: color-mix(in srgb, #d93636 20%, transparent); color: #f06060; }
.state.inactive { background: var(--surface-2); color: var(--pico-muted-color); }
.sub-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem;
  margin: 0; }
.sub-facts div { padding: .7rem .85rem; border-radius: 12px; background: var(--pico-background-color); }
.sub-facts dt { font-size: .75rem; color: var(--pico-muted-color); margin: 0; }
.sub-facts dd { margin: .15rem 0 0; font-weight: 700; }
.sub-facts small { font-weight: 400; color: var(--pico-muted-color); }
@media (min-width: 900px) {
  .sub-hero { grid-template-columns: 1.4fr 1fr; align-items: center; padding: 1.5rem 1.75rem; }
}

.pay-steps { padding-left: 1.2rem; }
.pay-steps li { margin-bottom: 1rem; }
.pay-data { display: grid; gap: .35rem; margin: .5rem 0 0; }
.pay-data div { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; }
.pay-data dt { min-width: 5.5rem; font-size: .85rem; color: var(--pico-muted-color); margin: 0; }
.pay-data dd { margin: 0; min-width: 0; }
code.copy { cursor: pointer; word-break: break-all; }
code.copy::after { content: " ⧉"; opacity: .6; }
code.copy.copied::after { content: " ✓ copiado"; color: #2fb36b; opacity: 1; }
.pay-how form small { display: block; margin-top: .4rem; color: var(--pico-muted-color); }

.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem;
  margin: 0 0 1rem; padding: 0; border: 0; }
.plan-card { position: relative; display: grid; gap: .2rem; padding: .9rem 1rem; margin: 0;
  border-radius: 14px; border: 1.5px solid var(--pico-muted-border-color); cursor: pointer; }
.plan-card:has(input:checked) { border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent); }
.plan-card input { position: absolute; top: .8rem; right: .8rem; margin: 0; }
.plan-name { font-weight: 700; }
.plan-name small { font-weight: 400; color: var(--pico-muted-color); }
.plan-price { font-size: 1.35rem; font-weight: 800; }
.plan-price small, .plan-meta { font-size: .8rem; font-weight: 400; color: var(--pico-muted-color); }
.cycle-pick { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: 0 0 1rem; padding: 0; border: 0; }
.cycle-pick legend { width: 100%; font-weight: 600; margin-bottom: .35rem; }
.cycle-pick label { margin: 0; }
.save { margin-left: .25rem; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem;
  font-weight: 700; background: color-mix(in srgb, #1f9d55 18%, transparent); color: #2fb36b; }
.export-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.export-links [role="button"] { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem;
  margin: 0 0 1.25rem; }
.kpi { display: grid; gap: .15rem; padding: .9rem 1rem; border-radius: 14px; background: var(--surface-2); }
.kpi span { font-size: .8rem; color: var(--pico-muted-color); }
.kpi strong { font-size: 1.6rem; line-height: 1.1; }
.kpi small { font-size: .72rem; color: var(--pico-muted-color); }
.kpi.warn strong { color: #f0a030; }
.kpi.danger strong { color: #f06060; }
.alerts { border-left: 4px solid #e8850c; }
.alerts ul { margin: 0; padding-left: 1.1rem; }
.alerts li { margin: .35rem 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; }
.inline-form input { max-width: 6rem; margin: 0; }
.inline-form button { width: auto; margin: 0; }

.email-gallery { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.email-card { margin: 0; padding: .75rem; }
.email-card header { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline;
  margin-bottom: .5rem; font-size: .9rem; }
.email-card header strong { margin-right: auto; }
.email-card iframe { width: 100%; height: 560px; border: 0; border-radius: 10px; background: #f2f4f8; }

/* --- Modo claro / oscuro (Pico aplica data-theme en <html>) ------------------------- */
.theme-toggle { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px;
  padding: 0; margin: 0 0 0 .25rem; border-radius: 50%; font-size: 1.05rem; line-height: 1;
  background: transparent; color: var(--pico-color);
  border: 1px solid var(--pico-muted-border-color); }
.theme-toggle:hover, .theme-toggle:focus-visible { background: var(--surface-2);
  border-color: var(--pico-muted-border-color); color: var(--pico-color); }
.theme-toggle.wide { display: flex; width: 100%; height: auto; gap: .45rem; justify-content: center;
  margin: 0; padding: .5rem .75rem; border-radius: 10px; font-size: .88rem;
  color: var(--pico-muted-color); }
@media (min-width: 1024px) { .appbar .theme-toggle { display: none; } }
@media (max-width: 1023px) { .sidebar-foot .theme-toggle.wide { display: flex; } }
.auth { position: relative; }
.auth-theme { position: absolute; top: max(1rem, env(safe-area-inset-top)); right: 1rem; z-index: 5; }

/* Pico redefine --pico-color dentro de los botones (texto blanco). Los botones «fantasma»
 * usan el color de texto de la página; si no, en modo claro quedan blanco sobre blanco. */
:root { --ink: var(--pico-color); --ink-muted: var(--pico-muted-color); }
:root button.theme-toggle,
:root .staff-filter button.chip:not([aria-pressed="true"]),
:root .chips button.chip:not([aria-pressed="true"]),
:root .free-slots button.chip { color: var(--ink); }
:root button.theme-toggle.wide { color: var(--ink-muted); }
