/* =========================================================================
   Panel admin de Nyxel · estilos propios (se cargan después de /styles.css)
   Mobile-first. Escritorio a partir de 1000px. Pensado para Android e iOS
   (áreas seguras, inputs de 16px, objetivos táctiles de 44px, sin zoom).
   ========================================================================= */

:root {
  --adm-nav: 60px;                 /* alto de la cabecera en móvil */
  --adm-tabs: 48px;                /* alto de la tira de pestañas en móvil */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

html { -webkit-text-size-adjust: 100%; }
.adm [hidden] { display: none !important; } /* el atributo hidden gana a cualquier display de clase */
body.adm { overscroll-behavior-y: none; caret-color: var(--accent); scrollbar-color: rgba(255,255,255,0.18) transparent; scrollbar-width: thin; }
.adm ::selection { background: rgba(124, 92, 255, 0.35); color: var(--text); }
.adm :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.adm input:focus-visible, .adm textarea:focus-visible, .adm select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.adm ::-webkit-scrollbar { width: 8px; height: 8px; }
.adm ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
.adm ::-webkit-scrollbar-track { background: transparent; }
.adm small, .adm time { font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .adm .btn--sm { min-height: 44px; } }
.adm button, .adm input, .adm select, .adm textarea { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.adm .btn:active { transform: scale(0.97); }
.adm .btn { transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 160ms var(--ease-out); }

/* ---------- cabecera: logo + iconos; tira de pestañas debajo en móvil ---------- */
.adm .nav { padding-top: var(--sat); }
.adm .nav__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0 12px;
  height: auto;
  min-height: var(--adm-nav);
}
.adm .nav__inner .logo { font-size: 20px; }
.adm__badge { margin-left: 10px; font-family: var(--font-body); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 3px 7px; }
.adm__icons { display: flex; gap: 6px; }
.adm__icon { background: none; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); width: 40px; height: 40px; display: inline-grid; place-items: center; cursor: pointer; padding: 0; transition: transform 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out); }
.adm__icon:active { transform: scale(0.94); }
.adm__icon.is-on { color: var(--accent); border-color: var(--accent); }
.adm__icon:disabled { opacity: .5; cursor: wait; }
.adm__user { display: none; font-size: 13px; color: var(--faint); }

.adm__tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 4px;
  height: var(--adm-tabs);
  align-items: center;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter);
  mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - 24px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - 24px), transparent);
}
.adm__tabs::-webkit-scrollbar { display: none; }
.adm__tab {
  flex: none; scroll-snap-align: center;
  background: none; border: 1px solid transparent; border-radius: 10px;
  color: var(--muted); font: inherit; font-size: 15px; font-weight: 500;
  padding: 8px 13px; min-height: 38px; cursor: pointer; white-space: nowrap;
  position: relative;
}
.adm__tab.is-on { color: var(--text); background: var(--surface); border-color: var(--line); }
.adm__tab .adm__dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

@media (hover: hover) and (pointer: fine) {
  .adm .btn--primary:hover { background: #6E4CF5; } /* más oscuro al pasar: mantiene el contraste del texto blanco */
  .adm__icon:hover { color: var(--text); border-color: var(--line-strong); }
  .adm__tab:hover { color: var(--text); }
}

/* escritorio: todo en una fila */
@media (min-width: 1000px) {
  .adm .nav__inner { display: flex; gap: 20px; height: 72px; }
  .adm .nav__inner .logo { font-size: 22px; }
  .adm__tabs { height: auto; margin: 0 0 0 auto; padding: 0; overflow: visible; mask-image: none; -webkit-mask-image: none; }
  .adm__user { display: inline; }
  .adm__icon { width: 36px; height: 36px; border-radius: 10px; }
}

/* ---------- contenido ---------- */
.adm__main { padding: 24px 0 calc(64px + var(--sab)); }
@media (min-width: 1000px) { .adm__main { padding: 40px 0 96px; } }
.adm__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.adm__head .h3 { margin: 0; font-size: 24px; }
@media (min-width: 1000px) { .adm__head { margin-bottom: 20px; } .adm__head .h3 { font-size: 28px; } }
.adm__hint { color: var(--muted); font-size: 15px; margin-bottom: 16px; line-height: 1.5; }
.adm__hint--inline { margin: 0; font-size: 13px; color: var(--faint); }
.adm__seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.adm__seg button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; padding: 10px 14px; min-height: 40px; cursor: pointer; }
.adm__seg button.is-on { background: var(--surface); color: var(--text); }
.adm__pills { display: flex; gap: 6px; margin: 0 calc(-1 * var(--gutter)) 16px; padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none; }
.adm__pills::-webkit-scrollbar { display: none; }
@media (max-width: 999px) { .adm__pills { mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - 24px), transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - 24px), transparent); } }
.adm__pills button { flex: none; background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; padding: 8px 14px; min-height: 36px; cursor: pointer; }
.adm__pills button.is-on { color: var(--text); border-color: var(--accent); }
@media (min-width: 1000px) { .adm__pills { flex-wrap: wrap; margin: 0 0 16px; padding: 0; overflow: visible; } }

/* ---------- filas (citas, mensajes, clientes, proyectos) ---------- */
.adm__list { display: grid; gap: 10px; }
.adm__empty { display: grid; gap: 6px; padding: 28px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); font-size: 15px; line-height: 1.5; text-align: center; }
.adm__empty strong { color: var(--text); font-family: var(--font-head); font-weight: 600; font-size: 17px; }
.adm__empty span { max-width: 44ch; margin: 0 auto; }
.adm__empty--sm { padding: 12px 14px; border-style: solid; border-color: var(--line); text-align: left; font-size: 14px; color: var(--faint); }
.adm__skel { display: grid; gap: 10px; }
.adm__skel span { display: block; height: 96px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, rgba(255,255,255,0.05) 50%, var(--surface) 100%); background-size: 200% 100%; animation: adm-shimmer 1.4s linear infinite; }
.adm__skel span:nth-child(2) { animation-delay: 120ms; }
.adm__skel span:nth-child(3) { animation-delay: 240ms; }
@keyframes adm-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.wa__list .adm__skel span { height: 60px; border-radius: 12px; }
.adm__row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.adm__row--cancelled { opacity: 0.55; }
.adm__row--done { opacity: 0.75; }
.adm__when { font-family: var(--font-head); font-weight: 600; font-size: 17px; line-height: 1.3; }
.adm__when small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 4px; }
.adm__who { font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.adm__contact { font-size: 14px; color: var(--muted); margin-top: 4px; line-height: 1.6; overflow-wrap: anywhere; }
.adm__contact a { color: var(--text); border-bottom: 1px solid var(--line-strong); }
.adm__note { margin-top: 10px; font-size: 15px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.adm__muted { color: var(--muted); font-weight: 400; }
.adm__ops { display: flex; flex-wrap: wrap; gap: 8px; }
.adm__ops button, .adm__ops select { background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); font: inherit; font-size: 15px; padding: 10px 14px; min-height: 44px; cursor: pointer; transition: transform 160ms var(--ease-out), border-color 160ms var(--ease-out); }
.adm__ops button:active { transform: scale(0.97); }
.adm__ops button.danger:active { border-color: #ff6b6b; color: #ff6b6b; }
.adm__ops select { -webkit-appearance: none; appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23F2F2F5' stroke-opacity='.6' stroke-width='1.6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; }
@media (hover: hover) and (pointer: fine) {
  .adm__ops button:hover { border-color: rgba(255,255,255,0.32); }
  .adm__ops button.danger:hover { border-color: #ff6b6b; color: #ff6b6b; }
}
@media (min-width: 800px) {
  .adm__row { grid-template-columns: 180px 1fr auto; align-items: start; padding: 18px 20px; }
  .adm__ops button, .adm__ops select { min-height: 40px; padding: 8px 12px; font-size: 14px; }
}
.adm__status { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line-strong); }
.adm__status--diagnostico { color: var(--muted); }
.adm__status--presupuesto { color: #F2C94C; border-color: rgba(242,201,76,.5); }
.adm__status--piloto { color: var(--accent); border-color: var(--accent); }
.adm__status--soporte { color: #4CD3A5; border-color: rgba(76,211,165,.5); }
.adm__status--cerrado { color: var(--faint); }
.adm__when .adm__status + small { margin-top: 8px; }

/* ---------- presupuestos ---------- */
.adm__dlg--wide { }
@media (min-width: 700px) { .adm__dlg--wide { width: min(880px, calc(100% - 32px)); } }
.q__top { display: grid; gap: 14px; }
@media (min-width: 700px) { .q__top { grid-template-columns: 1fr 1.4fr; } }
.q__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 700px) { .q__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.q__items { display: grid; gap: 8px; }
.q__row { display: grid; grid-template-columns: 1fr 64px 92px 96px 32px; gap: 6px; align-items: start; }
.q__row--head { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 0 2px; }
.q__row > span { display: grid; gap: 4px; }
.q__row input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 9px 10px; font: inherit; font-size: 15px; min-width: 0; }
.q__row input[data-k="detail"] { font-size: 13px; color: var(--muted); }
.q__row input:focus { outline: none; border-color: var(--accent); }
.q__amt { font-variant-numeric: tabular-nums; padding-top: 10px; text-align: right; font-size: 15px; }
.q__row .adm__del { padding: 6px 0; min-width: 32px; }
@media (max-width: 599px) { .q__row { grid-template-columns: 1fr 56px 76px; } .q__row > span:nth-child(4), .q__row--head > span:nth-child(4) { display: none; } .q__row > span:nth-child(5) { grid-column: 3; } }
.q__totals { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: flex-end; font-size: 15px; color: var(--muted); padding: 8px 0; border-top: 1px solid var(--line); }
.q__totals strong { color: var(--text); font-family: var(--font-head); font-size: 18px; }
#qLink { font-size: 14px; border-bottom: 1px solid var(--line-strong); }

/* ---------- bots web ---------- */
.adm__code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; overflow-wrap: anywhere; }
.bot__detail { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 10px; }
.bot__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
.bot__list li { padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; line-height: 1.5; }
.bot__list a { color: var(--text); border-bottom: 1px solid var(--line-strong); }
.bot__list small { color: var(--faint); margin-left: 6px; }
.bot__thread { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; padding: 4px 0; }
.bot__upload { display: grid; gap: 6px; justify-items: start; }
.bot__upload small { color: var(--faint); font-size: 12px; line-height: 1.4; }

/* ---------- ajustes: menú de secciones ---------- */
.set { display: grid; gap: 14px; }
.set__head { gap: 10px; justify-content: flex-start; }
.set__menu { display: grid; gap: 8px; }
.set__menu button { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 14px 16px; min-height: 68px; color: var(--text); font: inherit; cursor: pointer; transition: transform 160ms var(--ease-out), border-color 160ms var(--ease-out), background-color 160ms var(--ease-out); }
.set__menu button:active { transform: scale(0.985); }
.set__menu button > svg:first-child { flex: none; color: var(--accent); }
.set__menu button > span { flex: 1; min-width: 0; display: grid; gap: 2px; }
.set__menu strong { font-family: var(--font-head); font-weight: 600; font-size: 16px; }
.set__menu small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.set__chev { flex: none; color: var(--faint); }
.set.is-open .set__menu { display: none; }
.set__body { display: grid; gap: 14px; }
.set__body:empty { display: none; }
.set__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; display: grid; gap: 14px; scroll-margin-top: calc(var(--adm-nav) + var(--adm-tabs) + 12px); }
.set__card > h2 { margin: 0; font-size: 19px; }
.set__card > p { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0; }
.set__row { display: grid; gap: 8px; }
.set__row > span { font-size: 14px; font-weight: 500; color: var(--muted); }
.set__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.set__grid > * { min-width: 0; }
.set__switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 4px 0; font-size: 16px; }
.set__switch small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.set__switch input { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: rgba(255,255,255,0.14); position: relative; cursor: pointer; transition: background-color 200ms var(--ease-out); margin: 0; }
.set__switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 200ms var(--ease-out); }
.set__switch input:checked { background: var(--accent); }
.set__switch input:checked::after { transform: translateX(20px); }
.set__days { display: flex; gap: 6px; }
.set__days label { flex: 1; text-align: center; }
.set__days input { display: none; }
.set__days span { display: block; padding: 10px 0; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; }
.set__days input:checked + span { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.set__actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.set__msg { color: var(--muted); font-size: 14px; min-height: 1.4em; margin: 0; }
.set__soon { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 2px 8px; margin-left: 8px; vertical-align: middle; }
.set input[type=text], .set input[type=number], .set input[type=time], .set input[type=date], .set select, .set textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 12px 14px; font: inherit; font-size: 16px; min-height: 46px;
}
.set select, .adm__dlgform .field select { -webkit-appearance: none; appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23F2F2F5' stroke-opacity='.6' stroke-width='1.6'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; }
.set__form + .set__form { border-top: 1px solid var(--line); padding-top: 18px; }
.set__form { display: grid; gap: 14px; }
.set textarea { resize: vertical; line-height: 1.5; }
.set input:focus, .set select:focus, .set textarea:focus { outline: none; border-color: var(--accent); }
@media (min-width: 1000px) {
  .set { grid-template-columns: 280px minmax(0, 720px); align-items: start; gap: 24px; }
  .set.is-open .set__menu { display: grid; }
  .set__menu { position: sticky; top: 88px; gap: 4px; }
  .set__menu button { background: none; border-color: transparent; border-radius: 12px; padding: 10px 12px; min-height: 56px; }
  .set__menu button.is-on { background: var(--surface); border-color: var(--line); }
  .set__menu .set__chev { display: none; }
  .set__back { display: none; }
  .set__card { padding: 24px; }
  .set__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (hover: hover) and (pointer: fine) { .set__menu button:hover { border-color: var(--line-strong); } .set__menu button.is-on:hover { border-color: var(--line); } }
.adm__approve { display: flex; gap: 8px; }
.adm__approve input { flex: 1; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.adm__devices { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.adm__devices li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.adm__devices small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* disponibilidad (dentro de ajustes) */
.adm__week { display: grid; }
.adm__day { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.adm__dayname { font-weight: 600; }
.adm__ranges { display: flex; flex-wrap: wrap; gap: 8px; }
.adm__range { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; }
.set .adm__range input { width: auto; min-height: 36px; padding: 6px 8px; font-size: 16px; border-radius: 8px; }
.adm__range span { color: var(--faint); }
.adm__del { background: none; border: 0; color: var(--faint); font-size: 20px; line-height: 1; cursor: pointer; padding: 6px 8px; min-width: 36px; min-height: 36px; }
.adm__add { background: none; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--muted); font: inherit; font-size: 14px; padding: 8px 12px; min-height: 36px; cursor: pointer; justify-self: start; }
@media (min-width: 700px) {
  .adm__day { grid-template-columns: 110px 1fr auto; align-items: start; gap: 12px; }
  .adm__dayname { padding-top: 8px; }
}
.adm__block { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.adm__block .btn { grid-column: 1 / -1; }
@media (min-width: 700px) { .adm__block { grid-template-columns: 170px 1fr auto; } .adm__block .btn { grid-column: auto; } }
.adm__blocked { display: grid; gap: 6px; font-size: 15px; list-style: none; padding: 0; margin: 0; }
.adm__blocked li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.adm__blocked .adm__del { font-size: 18px; }

/* ---------- diálogo: hoja inferior en móvil, centrado en escritorio ---------- */
.adm__dlg {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); padding: 0;
  width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0;
  max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain;
  transition: transform 320ms var(--ease-sheet), opacity 320ms var(--ease-sheet);
}
.adm__dlg[open] { transform: translateY(0); opacity: 1; }
@starting-style { .adm__dlg[open] { transform: translateY(100%); opacity: 1; } }
.adm__dlg::backdrop { background: rgba(5, 8, 16, 0.7); }
.adm__dlgform { padding: 20px 16px calc(20px + var(--sab)); display: grid; gap: 14px; }
.adm__dlgform .h3 { margin-bottom: 2px; font-size: 22px; }
.adm__dlgform .field select { background-color: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 12px 14px; font: inherit; font-size: 16px; min-height: 46px; }
.adm__dlgform .field input, .adm__dlgform .field textarea { padding: 12px 14px; font-size: 16px; }
.adm__dlgform textarea[name=memo] { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.5; }
.adm__dlgops { display: flex; align-items: center; gap: 8px; margin-top: 8px; position: sticky; bottom: 0; background: var(--surface); padding-top: 8px; }
.adm__spacer { flex: 1; }
.adm__del-btn { background: none; border: 0; color: #ff6b6b; font: inherit; font-size: 15px; cursor: pointer; padding: 10px 0; min-height: 44px; }
@media (min-width: 700px) {
  .adm__dlg { width: min(720px, calc(100% - 32px)); margin: auto; border-radius: var(--radius); max-height: calc(100vh - 48px); transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out); }
  @starting-style { .adm__dlg[open] { transform: scale(0.96); opacity: 0; } }
  .adm__dlgform { padding: 28px; }
  .adm__dlgops { position: static; padding-top: 0; }
}

/* ---------- WhatsApp: lista ↔ hilo en móvil, dos columnas en escritorio ---------- */
.wa { display: grid; grid-template-columns: 1fr; gap: 16px; }
.wa__list { display: grid; gap: 6px; align-content: start; }
.wa__item { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-height: 60px; color: var(--text); font: inherit; cursor: pointer; display: grid; gap: 2px; position: relative; transition: transform 160ms var(--ease-out), border-color 160ms var(--ease-out); }
.wa__item:active { transform: scale(0.985); }
.wa__item.is-on { border-color: var(--accent); }
.wa__item small { color: var(--muted); font-size: 13px; }
.wa__badge { position: absolute; right: 12px; top: 12px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 8px; }
.wa__thread { display: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); flex-direction: column; min-height: 0; }
.wa__head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.wa__head a { color: var(--text); border-bottom: 1px solid var(--line-strong); }
.wa__head .wa__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa__back { background: none; border: 1px solid var(--line); border-radius: 10px; color: var(--text); width: 40px; height: 40px; display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.wa__msgs { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.wa__msg { max-width: 84%; padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.wa__msg small { display: block; margin-top: 4px; font-size: 11px; color: var(--faint); }
.wa__msg--in { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.wa__msg--out { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.wa__msg--out small { color: rgba(255,255,255,.7); }
.wa__msg--auto { align-self: flex-end; background: var(--accent-soft); color: var(--text); border: 1px solid rgba(124,92,255,.35); border-bottom-right-radius: 4px; }
.wa__send { display: flex; gap: 8px; align-items: flex-end; padding: 10px 10px calc(10px + var(--sab)); border-top: 1px solid var(--line); }
.wa__send textarea { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; color: var(--text); padding: 11px 12px; font: inherit; font-size: 16px; line-height: 1.4; resize: none; min-height: 46px; max-height: 140px; }
.wa__send textarea:focus { outline: none; border-color: var(--accent); }
.wa__send .btn { min-height: 46px; }
/* móvil: en modo hilo, el hilo ocupa toda la pantalla bajo la cabecera */
@media (max-width: 999px) {
  .wa.is-thread .wa__list, .wa.is-thread ~ .adm__head { display: none; }
  .wa.is-thread .wa__thread { display: flex; height: calc(100dvh - var(--adm-nav) - var(--adm-tabs) - var(--sat) - 24px); }
  body.adm.is-wa-thread .adm__main { padding-bottom: 0; }
  body.adm.is-wa-thread [data-panel="wa"] .adm__head { display: none; }
}
@media (min-width: 1000px) {
  .wa { grid-template-columns: 320px 1fr; align-items: start; }
  .wa__list { max-height: 70vh; overflow: auto; }
  .wa__thread { display: flex; min-height: 480px; height: 70vh; }
  .wa__back { display: none; }
  .wa__msg { max-width: 72%; }
  .wa__send { padding: 12px; }
}

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--sat)) 16px calc(24px + var(--sab)); }
.login__card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 22px; display: grid; gap: 14px; }
@media (min-width: 600px) { .login__card { padding: 32px 28px; } }
.login__card .logo { margin-bottom: 10px; }
.login__hint { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0 0 6px; }
.login__btn { width: 100%; justify-content: center; gap: 10px; min-height: 52px; }
.login__msg { min-height: 1.4em; font-size: 14px; color: var(--muted); margin: 0; line-height: 1.5; }
.login__msg.is-err { color: #ff8a8a; }
.login__alt { font-size: 14px; color: var(--faint); margin: 8px 0 0; }
.login__link { background: none; border: 0; padding: 8px 0; font: inherit; color: var(--text); border-bottom: 1px solid var(--line-strong); cursor: pointer; }
.login__code { font-family: var(--font-head); font-size: 40px; font-weight: 700; letter-spacing: 0.18em; text-align: center; margin: 8px 0; font-variant-numeric: tabular-nums; user-select: all; }
.login__foot { font-size: 12px; color: var(--faint); margin: 12px 0 0; text-align: center; }
.login__foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .adm__dlg, .adm .btn, .adm__icon, .wa__item, .set__switch input, .set__switch input::after { transition: none; }
  .adm__skel span { animation: none; background: var(--surface); }
  @starting-style { .adm__dlg[open] { transform: none; opacity: 1; } }
}

/* presupuesto: cuotas mensuales y precio por valor */
.q__mrow { display: grid; grid-template-columns: 1fr 96px 32px; gap: 6px; align-items: start; }
.q__mrow > span { display: grid; gap: 4px; }
.q__mrow input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 9px 10px; font: inherit; font-size: 15px; min-width: 0; }
.q__mrow input[data-k="detail"] { font-size: 13px; color: var(--muted); }
.q__mrow input:focus { outline: none; border-color: var(--accent); }
.q__mrow .adm__del { padding: 6px 0; min-width: 32px; }
.q__val { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.q__val strong { color: var(--text); }
.q__val--off { color: var(--faint); border-style: dashed; }
.q__warn { font-style: normal; color: #E5A93C; }
.q__mtot { flex-basis: 100%; text-align: right; color: var(--text); font-size: 14px; }
.set__sub { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 18px 0 8px; }
.set__hint { font-size: 13px; color: var(--muted); margin: 0 0 10px; line-height: 1.5; }

/* ---------- estadísticas de la web ---------- */
.st__head { align-items: flex-end; }
.st__live { margin: 6px 0 0; font-size: 14px; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.st__live.is-on { color: var(--text); }
.st__live i { width: 8px; height: 8px; border-radius: 50%; background: #3DDC97; box-shadow: 0 0 0 0 rgba(61, 220, 151, .5); animation: stPulse 2s var(--ease-out) infinite; }
@keyframes stPulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, .45); } 100% { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0); } }
@media (prefers-reduced-motion: reduce) { .st__live i { animation: none; } }
.st__seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.st__seg button { font: inherit; font-size: 14px; color: var(--muted); background: none; border: 0; border-radius: 9px; padding: 8px 12px; min-height: 36px; cursor: pointer; transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out); }
.st__seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); }
@media (pointer: coarse) { .st__seg button { min-height: 44px; } }
.st__tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) { .st__tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.st__tile { display: grid; gap: 4px; align-content: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.st__tile span { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.st__tile b { font-family: var(--font-head); font-weight: 700; font-size: 28px; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.st__tile small { font-size: 13px; color: var(--muted); line-height: 1.4; }
.st__tile--hero { border-color: rgba(124, 92, 255, .45); }
.st__tile--win b { color: #3DDC97; }
.st__card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px; margin-bottom: 14px; min-width: 0; }
.st__card h2 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 14px; font-weight: 600; }
.st__grid { display: grid; gap: 14px; margin-bottom: 14px; }
.st__grid .st__card { margin-bottom: 0; }
@media (min-width: 1000px) { .st__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.st__chart { display: grid; grid-template-columns: auto 1fr; gap: 8px; height: 190px; }
.st__axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--faint); text-align: right; padding-bottom: 22px; font-variant-numeric: tabular-nums; }
.st__plot { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; align-items: end; padding-bottom: 22px; background: linear-gradient(to top, var(--line) 1px, transparent 1px) 0 calc(100% - 22px) / 100% 1px no-repeat, linear-gradient(to top, var(--line) 1px, transparent 1px) 0 calc((100% - 22px) / 2) / 100% 1px no-repeat, linear-gradient(to top, var(--line) 1px, transparent 1px) 0 0 / 100% 1px no-repeat; }
.st__col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline: none; }
.st__col i { display: block; width: min(100%, 28px); background: var(--accent); border-radius: 4px 4px 0 0; transition: filter 160ms var(--ease-out); }
.st__col:hover i, .st__col.is-on i, .st__col:focus-visible i { filter: brightness(1.25); }
.st__col:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-soft); border-radius: 4px; }
.st__col em { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; font-style: normal; font-size: 11px; color: var(--faint); white-space: nowrap; }
.st__tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--bg); border: 1px solid var(--line-strong); color: var(--text); font-size: 13px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none; z-index: 2; }
.st__bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.st__bars li { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; font-size: 14px; min-height: 36px; }
.st__bar { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent-soft); border-radius: 6px; }
.st__k { position: relative; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.st__bars b { position: relative; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.st__funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.st__fl { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; color: var(--text); margin-bottom: 6px; }
.st__fl small { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }
.st__fl b { font-family: var(--font-head); font-size: 18px; font-variant-numeric: tabular-nums; text-align: right; }
.st__fl b small { font-family: var(--font-body); font-weight: 500; }
.st__fb { display: block; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.st__fb i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.st__note { margin: 12px 0 0; font-size: 12px; color: var(--faint); line-height: 1.5; }
.st__none { margin: 0; font-size: 14px; color: var(--faint); }
.st__rh { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.st__rh h2 { margin: 0; }
.st__only { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; min-height: 36px; }
.st__only input { width: 18px; height: 18px; accent-color: var(--accent); }
.st__recent { list-style: none; margin: 0; padding: 0; display: grid; }
.st__recent li { padding: 12px 0 12px 12px; border-top: 1px solid var(--line); border-left: 2px solid transparent; display: grid; gap: 8px; }
.st__recent li:first-child { border-top: 0; }
.st__recent li.is-act { border-left-color: var(--line-strong); }
.st__recent li.is-win { border-left-color: #3DDC97; }
.st__who { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; color: var(--muted); }
.st__who time { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.st__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.st__chip { font: inherit; font-size: 13px; line-height: 1.3; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: transparent; text-decoration: none; }
.st__chip--act { color: var(--text); border-color: rgba(124, 92, 255, .45); background: var(--accent-soft); }
.st__chip--win { color: var(--text); border-color: rgba(61, 220, 151, .5); background: rgba(61, 220, 151, .1); }
.st__chip--maybe { color: var(--text); border-style: dashed; border-color: rgba(61, 220, 151, .5); }
.st__chip--link { cursor: pointer; }
.st__chip--link:hover, a.st__chip:hover { filter: brightness(1.2); }
.st__thread { display: grid; gap: 8px; max-height: 60vh; overflow: auto; margin: 12px 0; }
.st__foot { font-size: 13px; color: var(--faint); line-height: 1.55; margin: 4px 0 0; }
.st__foot a { color: var(--muted); }

/* ---------- tirar para recargar ---------- */
.ptr { position: fixed; left: 50%; z-index: 40; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-strong); color: var(--muted); box-shadow: 0 6px 18px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transform: translate3d(-50%, -44px, 0); will-change: transform; }
.ptr svg { display: block; }
.ptr__spin { display: none; transform-origin: 12px 12px; }
.ptr.is-armed { color: var(--accent); border-color: rgba(124, 92, 255, .55); }
.ptr.is-busy { color: var(--accent); }
.ptr.is-busy .ptr__arrow { display: none; }
.ptr.is-busy .ptr__spin { display: block; animation: ptrSpin 700ms linear infinite; }
@keyframes ptrSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ptr.is-busy .ptr__spin { animation-duration: 1.6s; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* extras opcionales del presupuesto: concepto+detalle+nota+enlace | € inicio | €/mes | quitar */
.q__orow { display: grid; grid-template-columns: 1fr 88px 88px 32px; gap: 6px; align-items: start; }
.q__orow > span { display: grid; gap: 4px; }
.q__orow input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 9px 10px; font: inherit; font-size: 15px; min-width: 0; }
.q__orow input[data-k="detail"], .q__orow input[data-k="note"], .q__orow input[data-k="link"] { font-size: 13px; color: var(--muted); }
.q__orow.q__row--head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 14px; }

/* ---------- Asistente de voz (pestaña Llamadas) ---------- */
.voz { display: grid; gap: 12px; margin-bottom: 24px; }
@media (min-width: 900px) { .voz { grid-template-columns: 1fr 1fr; align-items: start; } }
.voz__h { font-family: var(--font-head); font-size: 17px; font-weight: 600; margin: 8px 0 12px; }
.voz__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.voz__f { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.voz__f select, .voz__f input, .voz__tel { background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); font: inherit; font-size: 15px; padding: 10px 12px; min-height: 44px; min-width: 0; }
.voz__f--sm input { max-width: 120px; }
.voz__tel { flex: 1 1 180px; }
.voz__st { margin: 0; min-height: 20px; font-size: 14px; color: var(--muted); }
.voz__live { position: relative; }
.voz__live.talking { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; transition: border-color 200ms var(--ease-out); }
.voz__log { display: grid; gap: 6px; }
.voz__log:empty { display: none; }
.voz__log p { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 14px; line-height: 1.45; max-width: 92%; }
.voz__log p.a { background: rgba(255, 255, 255, 0.05); justify-self: start; }
.voz__log p.u { background: var(--accent-soft, rgba(124, 92, 255, .14)); justify-self: end; }
.voz__fase2 summary { cursor: pointer; list-style: none; display: grid; gap: 2px; }
.voz__fase2 summary::-webkit-details-marker { display: none; }
.voz__fase2 summary small { color: var(--muted); font-size: 13px; }
.voz__steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.voz__steps .voz__tel { display: block; margin-top: 8px; width: 100%; max-width: 260px; }
.voz__copy { background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); font: inherit; font-size: 13px; padding: 4px 10px; cursor: pointer; }
.voz__codes { display: grid; gap: 6px; }
.voz__codes div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); padding: 8px 12px; background: var(--bg); border-radius: 10px; }
.voz__codes code, .voz__fase2 code { color: var(--text); font-size: 14px; user-select: all; }
