/* ═══════════════════════════════════════════════
   BitacorApp — Panel de médicos
   Extiende los tokens de styles.css
   ═══════════════════════════════════════════════ */

:root {
  --side-w: 258px;
  --top-h:  68px;
}

/* ══════════ LOGIN ══════════ */
.auth-body { background: var(--bg); }

.auth {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 40px 20px;

  /* Si no existe la imagen, queda el color de fondo */
  background-color: var(--ink);
  background-image: url('../img/login-background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Velo para que el texto siempre se lea sobre la foto */
.auth::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(10, 93, 91, .82), rgba(22, 36, 46, .88));
  z-index: 0;
}

.auth > * { position: relative; z-index: 1; }

.auth__card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--r-xl);
  padding: clamp(28px, 5vw, 40px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .3);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.auth__foot { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .75); }

.auth__head { display: flex; flex-direction: column; gap: 10px; }
.auth__head .pill { margin-bottom: 4px; }
.auth__sub { margin: 0; font-size: 14.5px; font-weight: 300; line-height: 1.6; color: var(--ink-soft); }

.auth__form { display: flex; flex-direction: column; gap: 18px; }

.auth__pin {
  text-align: center;
  font-family: var(--font-display);
  font-size: 30px !important;
  font-weight: 600;
  letter-spacing: 10px;
  padding-left: 25px !important;
}

.auth__back {
  background: none;
  border: 0;
  padding: 4px;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink-faint);
  cursor: pointer;
  text-decoration: underline;
}
.auth__back:hover { color: var(--teal); }

.auth__status {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}
.auth__status.is-ok    { background: var(--teal-tint); color: var(--teal-deep); }
.auth__status.is-error { background: rgba(199, 66, 63, .1); color: #a5322f; }

.auth__legal { margin: 0; font-size: 13.5px; color: var(--ink-faint); text-align: center; }

/* ══════════ ESTRUCTURA ══════════ */
.panel-body { background: var(--bg); }

.panel { display: flex; min-height: 100dvh; }

/* ── Sidebar ── */
.side {
  width: var(--side-w);
  flex-shrink: 0;
  background: var(--ink);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.side__brand { padding: 0 8px; }

.side__nav { display: flex; flex-direction: column; gap: 3px; }

.side__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--on-dark-soft);
  transition: background-color .16s ease, color .16s ease;
}
.side__link svg { width: 18px; height: 18px; flex-shrink: 0; }
.side__link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side__link.is-active { background: var(--teal); color: #fff; font-weight: 600; }

.side__foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side__user { display: flex; align-items: center; gap: 11px; padding: 0 4px; }
.side__avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  display: grid;
  place-items: center;
}
.side__user-text { display: flex; flex-direction: column; min-width: 0; }
.side__user-text strong {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side__user-text small { font-size: 11.5px; color: var(--on-dark-faint); }

.side__logout {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--on-dark-soft);
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease;
}
.side__logout svg { width: 16px; height: 16px; }
.side__logout:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ── Main ── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--top-h);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 clamp(18px, 3vw, 34px);
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
}
.topbar__code {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--teal-deep);
  background: var(--teal-tint);
  padding: 7px 13px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.topbar__menu {
  display: none;
  width: 40px;
  height: 40px;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  place-items: center;
}
.topbar__menu svg { width: 22px; height: 22px; }

.content {
  padding: clamp(20px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.tab { display: none; flex-direction: column; gap: 22px; }
.tab.is-active { display: flex; }

/* ══════════ COMPONENTES ══════════ */

.alert {
  margin: 0;
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: rgba(199, 66, 63, .1);
  color: #a5322f;
  font-size: 14px;
  font-weight: 500;
}

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.kpi--accent { border-color: var(--teal); background: var(--teal-tint); }
.kpi__label { font-size: 12.5px; font-weight: 500; color: var(--ink-faint); }
.kpi__num {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 600;
  line-height: 1.05;
  color: var(--ink);
}
.kpi--accent .kpi__num { color: var(--teal-deep); }
.kpi__foot { font-size: 12px; font-weight: 300; color: var(--ink-faint); }

/* Cards */
.cards2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card--dark { background: var(--ink); border-color: var(--ink); }
.card:has(.serie) { min-height: 260px; }
.card--dark .card__title { color: #fff; }

.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.card__hint { font-size: 12px; color: var(--ink-faint); }
.card__note { margin: 0; font-size: 13px; font-weight: 300; line-height: 1.6; color: var(--ink-faint); }
.card__note--light { color: var(--on-dark-faint); }
.card__note b { font-weight: 600; color: var(--ink); }

.money { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.money span   { font-size: 13.5px; color: var(--ink-soft); }
.money strong {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  color: var(--teal-deep);
}
.money--sm strong { font-size: 19px; color: var(--ink); }

.code__state { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: background-color .16s ease;
}
.btn-copy svg { width: 14px; height: 14px; }
.btn-copy:hover { background: rgba(255, 255, 255, .18); }
.btn-copy.is-done { background: var(--teal); border-color: var(--teal); }

/* ── Embudo del resumen (horizontal) ───────── */
.funnel {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.fstep {
  flex: 1 1 0;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fstep--win { border-color: var(--teal); background: var(--teal-tint); }

.fstep__label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-faint);
  line-height: 1.3;
}
.fstep--win .fstep__label { color: var(--teal-deep); }

.fstep__num {
  font-family: var(--font-display);
  font-size: clamp(30px, 3.4vw, 40px);
  font-weight: 600;
  line-height: 1.05;
  color: var(--ink);
}
.fstep--win .fstep__num { color: var(--teal-deep); }

.fstep__foot {
  font-size: 11.5px;
  font-weight: 300;
  line-height: 1.35;
  color: var(--ink-faint);
}

.fstep__track {
  margin-top: auto;
  padding-top: 14px;
  display: block;
  height: 6px;
  box-sizing: content-box;
}
.fstep__fill {
  display: block;
  height: 6px;
  width: 0;
  border-radius: 3px;
  background: var(--teal);
  opacity: .35;
  transition: width .7s cubic-bezier(.2, .8, .3, 1);
}
.fstep--win .fstep__fill { opacity: 1; }

/* Flechas entre pasos */
.fsep {
  flex: 0 0 auto;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--ink-ghost);
}
.fsep svg { width: 18px; height: 18px; }
.fsep__pct {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--teal-deep);
  background: var(--teal-tint);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

/* Tarjeta de dinero */
.fmoney {
  flex: 1.15 1 0;
  min-width: 0;
  background: var(--ink);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fmoney__label { font-size: 12.5px; font-weight: 500; color: var(--on-dark-faint); }
.fmoney__num {
  font-family: var(--font-display);
  font-size: clamp(32px, 3.8vw, 44px);
  font-weight: 600;
  line-height: 1.05;
  color: var(--mint);
}
.fmoney__foot { font-size: 11.5px; font-weight: 300; color: var(--on-dark-soft); }
.fmoney__foot b { font-weight: 600; color: #fff; }
.fmoney__paid {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: 11.5px;
  color: var(--on-dark-faint);
}
.fmoney__paid b { font-weight: 600; color: #fff; }

@media (max-width: 1100px) {
  .funnel { flex-wrap: wrap; }
  .fstep, .fmoney { flex: 1 1 calc(50% - 34px); }
}

@media (max-width: 620px) {
  .funnel { flex-direction: column; gap: 8px; }
  .fstep, .fmoney { flex: 1 1 auto; }
  .fsep { flex-direction: row; transform: rotate(90deg); padding: 2px 0; }
}

/* Mini gráfica de activaciones por mes */
.serie {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 150px;
  margin-top: auto;
}
.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  height: 100%;
}
.bar__n { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.bar__track {
  flex: 1;
  width: 100%;
  max-width: 44px;
  display: flex;
  align-items: flex-end;
  background: var(--bg);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.bar__fill {
  width: 100%;
  background: var(--teal);
  border-radius: var(--r-sm);
  animation: crecer .6s cubic-bezier(.2, .8, .3, 1) both;
}
.bar:last-child .bar__fill { background: var(--teal-deep); }
.bar__mes { font-size: 11.5px; color: var(--ink-faint); }

@keyframes crecer {
  from { transform: scaleY(0); transform-origin: bottom; }
  to   { transform: scaleY(1); transform-origin: bottom; }
}

/* Estado pausado del código */
.band__state--off {
  color: var(--on-dark-faint);
  background: rgba(255, 255, 255, .08);
}
.band__state--off i { background: var(--on-dark-faint); animation: none; box-shadow: none; }

/* Aviso de privacidad */
.privacy {
  background: var(--teal-tint);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.privacy__icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
}
.privacy__icon svg { width: 17px; height: 17px; }
.privacy p { margin: 0; font-size: 14px; font-weight: 300; line-height: 1.65; color: var(--ink); }
.privacy strong { font-weight: 600; }

/* Tablas */
.table-wrap { overflow-x: auto; margin-inline: -24px; padding-inline: 24px; }
.table { width: 100%; border-collapse: collapse; min-width: 480px; }
.table th {
  text-align: left;
  padding: 0 14px 11px 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 14px 14px 14px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.table tr:last-child td { border-bottom: 0; }
.table__id { font-family: var(--font-display); font-size: 13px; color: var(--ink-faint); }
.table__empty { text-align: center; color: var(--ink-faint); padding: 32px 0 !important; font-weight: 300; }

.state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.state--trial    { background: rgba(200, 147, 46, .14); color: #8a6412; }
.state--suscrito { background: var(--teal-tint);        color: var(--teal-deep); }
.state--vencido  { background: #F0F4F6;                 color: var(--ink-soft); }
.state--pagado   { background: rgba(47, 158, 100, .14); color: #1f7448; }
.state--pendiente{ background: rgba(200, 147, 46, .14); color: #8a6412; }
.state--cancelado{ background: rgba(199, 66, 63, .12);  color: #a5322f; }

/* Specs */
.specs { margin: 0; display: flex; flex-direction: column; gap: 0; }
.specs > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.specs > div:last-child { border-bottom: 0; }
.specs dt { font-size: 13.5px; color: var(--ink-faint); }
.specs dd { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); text-align: right; }

/* Switch */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--r-pill);
  background: var(--line);
  padding: 3px;
  transition: background-color .2s ease;
}
.switch__dot {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(22, 36, 46, .3);
  transition: transform .2s ease;
}
.switch input:checked + .switch__track { background: var(--teal); }
.switch input:checked + .switch__track .switch__dot { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--teal); outline-offset: 3px; }
.switch__text { font-size: 14.5px; font-weight: 500; color: var(--ink); }

/* ══════════ RESPONSIVE ══════════ */
@media (max-width: 860px) {
  .topbar__menu { display: grid; }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .26s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .3);
  }
  .side.is-open { transform: translateX(0); }

  .side__backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(22, 36, 46, .5);
    border: 0;
  }
}

@media (max-width: 560px) {
  .topbar__code { display: none; }
  .kpi__num { font-size: 32px; }
  .table-wrap { margin-inline: -20px; padding-inline: 20px; }
  .card { padding: 20px; }
}
