/* ==========================================================
   WEEY  CSS LIMPIO (sin duplicados ni parches repetidos)
   - 1 sola fuente de verdad para anchos del registro (--auth-w)
   - 1 sola definiciÃ³n de tabbar / desktop-hint / IA / auth-locked
   - Mantiene tu look actual (oscuro por defecto + theme-light)
   ========================================================== */

:root{
  --bg:#0B0F19;
  --panel:#111827;
  --panel2:#0F172A;
  --card:#0B1220;
  --text:#E5E7EB;
  --muted:#9CA3AF;
  --brand:#7C3AED;
  --brand2:#22C55E;
  --danger:#EF4444;
  --border:rgba(255,255,255,.08);
  --shadow: 0 12px 35px rgba(0,0,0,.45);
  --radius: 18px;
  --radius2: 24px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Alturas dinÃ¡micas (JS las ajusta, especialmente en iOS)
     - --tabbar-h: alto real del menÃº inferior (incluye safe-area)
     - --ia-compose-h: alto real del composer de IA
  */
  --tabbar-h: 86px;
  --ia-compose-h: 64px;

  /* Ancho maestro para el registro (install + card perfectamente alineados) */
  --auth-w: min(420px, calc(100vw - 32px)); /* 16px + 16px padding laterales */
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background:
    radial-gradient(1200px 800px at 30% 10%, rgba(124,58,237,.25), transparent 55%),
    radial-gradient(1200px 800px at 70% 90%, rgba(34,197,94,.18), transparent 55%),
    var(--bg);
  color:var(--text);
}

a{color:inherit}
button, input, select, textarea{font:inherit}

/* ===== Desktop wrapper ===== */
.desktop-stage{
  min-height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:30px;
  padding:24px;
}

.device-frame{
  width:min(420px, 94vw);
  height:min(860px, 92vh);
  border-radius: 48px;
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.03));
  padding:14px;
  box-shadow: var(--shadow);
  position:relative;
}

.device-notch{
  position:absolute;
  top:14px;
  left:50%;
  transform:translateX(-50%);
  width: 180px;
  height: 28px;
  border-radius: 0 0 18px 18px;
  background: rgba(0,0,0,.45);
  border:1px solid rgba(255,255,255,.06);
  z-index:3;
}

.device-screen{
  width:100%;
  height:100%;
  background: #070A12;
  border-radius: 38px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.06);
}

.app{height:100%}

.screen{
  height:100%;
  display:flex;
  flex-direction:column;
}

/* ===== TOPBAR ===== */
.topbar{
  padding:18px 16px 12px 16px;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:12px;
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
}

.topbar--sticky{
  position:sticky;
  top:0;
  background: linear-gradient(180deg, rgba(7,10,18,.92), rgba(7,10,18,.65));
  backdrop-filter: blur(10px);
  z-index:5;
  border-bottom:1px solid rgba(255,255,255,.06);
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
}

#topTitle,
.topbar__title{
  margin-right:auto;
  text-align:left;
  font-weight:800;
  letter-spacing:.2px;
  font-size:18px;
}

.brand{display:flex; align-items:center; gap:12px;}
.brand__logo{width:42px; height:42px; border-radius:12px; border:1px solid rgba(255,255,255,.10); background:rgba(255,255,255,.06)}
.brand__name{font-weight:900; letter-spacing:.2px}
.brand__tag{font-size:12px; color:var(--muted)}

/* Botonera topbar (logout + tema) */
.topbar__actions{
  margin-left:auto;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}
#btnTheme{ margin-left:8px; }
#btnTheme, #btnLogout{
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

/* ===== CONTENT ===== */
.content{
  flex:1;
  padding: 0 16px 16px 16px;
  overflow: visible; /* evita scroll anidado (iOS) */
}


.content--with-tabs{
  /* el tabbar ya incluye safe-area en su propio alto */
  padding-bottom: var(--tabbar-h);
}

/* ===== COMPONENTS ===== */
.card{
  background: linear-gradient(180deg, rgba(17,24,39,.92), rgba(11,18,32,.92));
  border:1px solid var(--border);
  border-radius: var(--radius2);
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  padding:16px;
  margin: 12px 0;
}

.card--flat{ padding:14px 14px; }

.card__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}

.h1{margin:0 0 8px 0; font-size:22px; letter-spacing:.2px}
.h2{margin:0; font-size:16px; letter-spacing:.2px}
.muted{color:var(--muted)}
.tiny{font-size:12px; line-height:1.35}

.label{display:block; margin: 12px 0 8px 0; color: #c7cce0; font-size:12px; letter-spacing:.3px}

.select, .input, .textarea{
  background: rgba(255,255,255,.06);
  color:var(--text);
  border:1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  padding: 12px 12px;
  outline:none;
}

.select{min-width:100%}
.select--wide{width: 100%}
.input{flex:1}
.textarea{width:100%; resize:none}

.phone-row{
  display:flex;
  gap:10px;
  align-items:center;
  margin-bottom:12px;
  width:100%;
}

/* FIX Android overflow en flex */
.phone-row .input{
  min-width:0;
  width:100%;
}

.btn{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color:var(--text);
  border-radius: 16px;
  padding: 12px 14px;
  cursor:pointer;
  transition: transform .06s ease, filter .12s ease, background .12s ease;
  font-weight:700;
}
.btn:active{transform: translateY(1px)}
.btn:hover{filter: brightness(1.08)}

.btn-primary{
  background: linear-gradient(135deg, rgba(124,58,237,.95), rgba(34,197,94,.65));
  border-color: rgba(255,255,255,.16);
}
.btn-ghost{ background: transparent; }
.btn-block{width:100%}

.btn__icon{margin-right:8px}

/* Icono telÃ©fono (si usas SVG con currentColor dentro) */
.btn__icon--phone{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-right:8px;
  color:#fff; /* oscuro */
}


.btn--wide{
  width:100%;
}

.linkish{
  margin-top:10px;
  background:transparent;
  border:none;
  padding:10px 0 2px 0;
  color:#cbd5ff;
  text-decoration:underline;
  cursor:pointer;
  font-weight:700;
}

.icon-btn{
  width:38px; height:38px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  cursor:pointer;
}

/* ===== Call UI ===== */
.hero{margin-top:10px}
.hero__row{display:flex; gap:10px; margin-bottom:10px}
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 12px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  font-size:12px;
  font-weight:800;
}
.pill--live{border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.12)}
.pill--service{border-color: rgba(124,58,237,.35); background: rgba(124,58,237,.12)}
.dot{
  width:8px; height:8px; border-radius:999px; background: var(--brand2);
  box-shadow: 0 0 0 3px rgba(34,197,94,.16);
}

.call-card{
  border-radius: var(--radius2);
  background:
    radial-gradient(800px 300px at 20% 20%, rgba(124,58,237,.22), transparent 50%),
    radial-gradient(800px 300px at 80% 80%, rgba(34,197,94,.15), transparent 45%),
    rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
  padding:14px;
}
.call-card__title{font-weight:900; margin-bottom:10px}
.call-card__meta{display:grid; gap:6px; color:#dbe3ff}

/* Caja destacada "Para" */
.call-card--to{
  margin-top: 12px;
  background:
    radial-gradient(900px 340px at 20% 20%, rgba(34,197,94,.20), transparent 50%),
    radial-gradient(900px 340px at 80% 80%, rgba(124,58,237,.18), transparent 45%),
    rgba(255,255,255,.05);
}
.call-to__text{ font-size: 16px; font-weight: 900; letter-spacing: .2px; }

.list{padding: 8px 0 20px 0}
.call-item{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
  margin: 10px 0;
}
.call-item__left{display:grid; gap:4px}
.call-item__title{font-weight:900}
.call-item__meta{font-size:12px; color:var(--muted)}
.call-item__right{text-align:right}

/* Botones explícitos dentro de items (scroll-safe) */
/* Llamadas: badge + botón en la MISMA LÍNEA */
.call-item__right{
  display:flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Cobros: se mantiene en columna */
.withdraw-item__right{
  display:flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.item-action-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}
.item-action-btn:active{ transform: scale(.98); }

body.theme-light .item-action-btn{
  border:1px solid rgba(0,0,0,.10);
  background: rgba(0,0,0,.04);
}

.badge{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  font-size:12px;
  font-weight:900;
}

.stat{text-align:center; padding: 10px 0;}
.stat__label{color:var(--muted); font-weight:800; letter-spacing:.2px}
.stat__value{font-size:34px; font-weight:950; margin-top:4px}
.stat__unit{font-size:12px; color:var(--muted)}
.stat--big .stat__value{font-size:42px}

.divider{ height:1px; background: rgba(255,255,255,.10); margin: 14px 0; }
.section-title{ font-weight:900; margin-bottom:10px; }

.kv{
  display:grid;
  grid-template-columns: 110px 1fr;
  gap:10px 12px;
  font-size:14px;
}
.kv__k{color:var(--muted); font-weight:900}
.kv__v{color:#eaf0ff}

/* ==========================================================
   TABBAR (MENÃ INFERIOR) â UNA SOLA VEZ
   ========================================================== */
.tabbar{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom: 0;
  width: min(420px, 94vw);
  padding: 10px 10px calc(10px + var(--safe-bottom)) 10px;
  background: linear-gradient(180deg, rgba(7,10,18,.15), rgba(7,10,18,.92));
  backdrop-filter: blur(12px);
  border-top:1px solid rgba(255,255,255,.06);
  display:grid;
  grid-template-columns: repeat(5, 1fr);
  gap:8px;
  z-index:10;
}

.tabbar__item{
  border: 1px solid transparent; /* ð mantiene la altura fija */
  background: transparent;
  color: var(--muted);
  padding: 10px 6px;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tabbar__item.is-active{
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-color: rgba(255,255,255,.08); /* ð solo cambia el color */
}

.tabbar__label{
  font-size:10px;
  font-weight:700;
  letter-spacing:.15px;
  white-space:nowrap;
}
.tabbar__icon{display:grid; place-items:center}

@media (max-width: 360px){
  .tabbar__label{ font-size:9px; }
  .tabbar__icon svg{ width:20px; height:20px; }
}

/* ==========================================================
   DESKTOP HINT â UNA SOLA VEZ
   ========================================================== */
.desktop-hint{
  display:none;
  max-width: 380px;
  color: rgba(229,231,235,.9);
}
.desktop-hint__title{font-weight:950; font-size:24px; margin-bottom:6px}
.desktop-hint__text{color:var(--muted); line-height:1.5}

/* En escritorio web preferimos mantener el “móvil” centrado.
   El hint suma ancho a la derecha y desplaza el marco. */
@media (min-width: 980px){
  .desktop-hint{display:none}
}

@media (max-width: 520px){
  .desktop-stage{padding:0}
  .device-frame{
    width:100vw;
    /* iOS: 100vh es inestable (teclado / barras). Usamos alto real calculado en JS */
    height: var(--app-h, 100dvh);
    min-height: -webkit-fill-available;
    border-radius: 0;
    padding:0;
    background: transparent;
    box-shadow:none;
  }
  .device-notch{display:none}
  .device-screen{border-radius:0; border:none}
  .tabbar{
    width:100vw;
    border-radius: 0;
  }
}

/* ==========================================================
   REGISTRO (AUTH) â LIMPIO y CONSISTENTE
   ========================================================== */
#screen-auth{ overflow:hidden; }
#screen-auth .content{
  overflow:hidden;
  padding: 0 16px 16px 16px;
}

/* Cabecera fija del registro */
#screen-auth .topbar{
  position: sticky;
  top: 0;
  z-index: 60;
}

/* Alineación: install + card con el MISMO ancho
   IMPORTANTE: usamos 100% del contenedor (no 100vw) para que en escritorio
   no desborde el marco del “móvil”. */
#screen-auth .install--top,
#screen-auth .content > .card{
  width: min(420px, 100%);
  margin-left: auto;
  margin-right: auto;
}

/* Install box arriba: aire y tipografÃ­a */
#screen-auth .install--top{
  padding: 0;
  margin-top: 12px;
  margin-bottom: 10px;
}

#screen-auth .install{
  border-radius: 22px;
  padding: 14px 14px 12px 14px;
  border: 1px solid rgba(255,255,255,.12);
  background:
    radial-gradient(900px 240px at 20% 10%, rgba(255,180,0,.16), transparent 55%),
    radial-gradient(900px 240px at 80% 90%, rgba(255,122,24,.14), transparent 55%),
    rgba(255,255,255,.04);
  box-shadow: 0 12px 26px rgba(0,0,0,.18);
}

#screen-auth .install__title{
  margin: 0 0 6px 0;
  font-weight: 950;
  font-size: 18px;
  letter-spacing: .2px;
  text-align: left;
}
#screen-auth .install__text{
  margin: 0 0 12px 0;
  font-size: 15px;
  line-height: 1.35;
  text-align: left;
}

/* BotÃ³n instalar naranja (SIN sombras raras) */
#screen-auth #btnInstall{
  width: 100%;
  height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(135deg, #FF7A18 0%, #FFB800 100%);
  color: #111;
  font-weight: 950;
  box-shadow: none !important;
  filter: none !important;
  outline: none;
}
#screen-auth #btnInstall:hover{ filter: brightness(1.04) !important; }
#screen-auth #btnInstall:active{ transform: translateY(1px); }

/* Card RegÃ­strate */
#screen-auth .content > .card{ text-align:center; }

/* Inputs del registro (alto consistente) */
#screen-auth #prefix,
#screen-auth #phone,
#screen-auth #code{
  height:48px;
  min-height:48px;
  box-sizing:border-box;
}

/* CÃ³digo centrado y âbonitoâ */
#screen-auth #code{
  width: 100%;
  text-align: center;
  font-weight: 900;
  letter-spacing: .25em;
}

/* TelÃ©fono: no desborda en Android */
#screen-auth .phone-row{
  width: 100%;
  margin: 0 auto 12px auto;
  align-items: stretch;
}
#screen-auth #prefix{
  min-width:92px;
  max-width:120px;
}
#screen-auth #phone{ font-size:18px; }
#screen-auth .phone-row .input{ min-width:0; width:100%; }

/* BotÃ³n llamar: mismo ancho */
#screen-auth #btnCallValidate{
  display:block;
  width:100%;
  margin:18px auto 0;
}

/* Link entrar */
#screen-auth #btnEnterAnyway{
  display:inline-block;
  margin-top:16px;
}

/* Texto final */
#screen-auth .auth-foot{
  text-align:center;
  margin-top:14px;
}
.nowrap{ white-space: nowrap; }

/* ==========================================================
   MAIN: scroll del contenedor #screen-main
   ========================================================== */
#screen-main{
  overflow:auto;
  -webkit-overflow-scrolling: touch;
   height: 100dvh;               /*  iOS viewport estable */
  overscroll-behavior-y: contain; /* reduce âreboteâ/atascos */
	
}
#screen-main .content{ overflow:visible; }
#screen-main .tab{ overflow:visible; }

/* ==========================================================
   IA: una sola configuraciÃ³n
   ========================================================== */
#tab-ia{ padding:0 !important; }

#tab-ia .ia-wrap{
  display:flex;
  flex-direction:column;
  min-height: 100%;
}

#tab-ia .ia-top{
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 12px 10px 12px;
  background: linear-gradient(180deg, rgba(7,10,18,.92), rgba(7,10,18,.70));
  backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(255,255,255,.06);
}
#tab-ia .ia-top__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
#tab-ia .ia-top__title{
  font-weight:900;
  letter-spacing:.2px;
}

#tab-ia .ia-log{
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible; /* deja que scrollee #screen-main */
  padding: 12px;

  /* espacio para composer fijo + menÃº */
}


/* Composer fijo encima del menÃº */
#tab-ia .ia-compose{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--tabbar-h);
  width: min(420px, 94vw);
  z-index: 999;
  background: rgba(7,10,18,.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 10px 12px 12px 12px;
}

#tab-ia .ia-compose__row{
  height: 64px;
  display:flex;
  align-items:center;
  gap:10px;
}

#tab-ia .ia-input{
  flex:1;
  resize:none;
  max-height: 120px;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: inherit;
  padding: 10px 12px;
  outline: none;
  box-sizing: border-box;
  line-height: 1.35;
  font-size: 16px;
}

/* â IA SEND: estilo icono (sin fondos ni degradados) */
#tab-ia .ia-send{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
#tab-ia .ia-send svg{
  display:block;
  stroke: currentColor;
}
#tab-ia .ia-send:active{ transform: scale(.98); }

/* Mensajes IA */
.ia-msg{
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  max-width: 92%;
}
.ia-msg--me{
  margin-left:auto;
  background: rgba(0,212,255,.10);
  border-color: rgba(0,212,255,.18);
}
.ia-msg--bot{
  margin-right:auto;
  background: rgba(108,92,231,.10);
  border-color: rgba(108,92,231,.18);
}
.ia-msg__meta{
  font-size: 13px;
  opacity: .75;
  margin-bottom: 4px;
}
.ia-msg__body{
  font-size: 16px;
  line-height: 1.45;
}


/* =========================
   IA: cabecera fija tipo cristal (como Llamadas)
   ========================= */
#tab-ia{ --ia-font: 16px; --ia-top-h: 64px; } /* defaults */

#tab-ia .ia-top--fixed{
  position: fixed;
  left: 0;
  right: 0;
  top: env(safe-area-inset-top, 0px);
  z-index: 80;

  padding: 12px 14px;
  background: rgba(17,24,39,.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  transform: translateZ(0);
}

body.theme-light #tab-ia .ia-top--fixed{
  background: rgba(255,255,255,.72);
  border-bottom: 1px solid rgba(0,0,0,.08);
}

#tab-ia .ia-top__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

#tab-ia .ia-top__brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
}

#tab-ia .ia-top__icon{
  width: 22px;
  height: 22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  opacity: .95;
}
#tab-ia .ia-top__icon svg{
  width: 22px;
  height: 22px;
  display:block;
}

#tab-ia .ia-top__title{
  font-weight: 900;
  letter-spacing: .2px;
  font-size: 18px;
}

#tab-ia .ia-top__actions{
  display:flex;
  gap: 10px;
  margin-left:auto;
}

#tab-ia .ia-font{
  height: 36px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: inherit;
  font-weight: 900;
  line-height: 36px;
}
body.theme-light #tab-ia .ia-font{
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(0,0,0,.04);
}

/* Dejar espacio para que el log no quede bajo la cabecera fija */
#tab-ia .ia-log{
  padding-top: calc(var(--ia-top-h) + 12px);
}

/* Aplicar tamaÃ±o variable al texto del chat */
#tab-ia .ia-msg__body{
  font-size: var(--ia-font);
}


/* Composer solo visible en tab IA */
#tab-ia .ia-compose{ display:none; }
#tab-ia:not([hidden]) .ia-compose{ display:block; }
#tab-ia[hidden]{ display:none !important; }

/* ==========================================================
   ERRORES + TOAST (si lo usas en JS)
   ========================================================== */
.is-error{
  border-color: rgba(239,68,68,.95) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.18) !important;
}

#weeyToast{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  /* evita tapar el tabbar (copy prompt / avisos, etc.) */
  bottom: calc(var(--tabbar-h) + 18px);
  width: min(420px, 92vw);
  z-index: 99999;
  display: none;
}
#weeyToast .weeyToast__inner{
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(7,10,18,.92);
  color: #fff;
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
  font-weight: 900;
  text-align: center;
}

/* ==========================================================
   BLOQUEO HORIZONTAL: overlay en landscape
   ========================================================== */
#orientationBlock{
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: rgba(0,0,0,.88);
  color: white;
}
#orientationBlock .box{
  max-width: 340px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  padding: 16px;
}
@media (orientation: landscape){
  #orientationBlock{ display: flex; }
}

/* ==========================================================
   iOS PWA: anti âreboteâ SOLO si activas body.auth-locked
   (no afecta IA / main si no aÃ±ades esa clase)
   ========================================================== */
body.auth-locked{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
  touch-action: none;
}
body.auth-locked .device-screen,
body.auth-locked #screen-auth,
body.auth-locked #screen-auth .content{
  overflow: hidden !important;
  overscroll-behavior: none;
}
/* ==========================================================
   TEMA CLARO (theme-light) â basado en variables
   ========================================================== */
body.theme-light{
  --bg:#F3F4F6;
  --panel:#FFFFFF;
  --panel2:#F9FAFB;
  --card:#FFFFFF;
  --text:#0F172A;
  --muted:#475569;
  --border:rgba(15,23,42,.10);
  --shadow: 0 12px 35px rgba(2,6,23,.12);

  background:
    radial-gradient(1200px 800px at 30% 10%, rgba(124,58,237,.10), transparent 55%),
    radial-gradient(1200px 800px at 70% 90%, rgba(34,197,94,.08), transparent 55%),
    var(--bg);
  color: var(--text);
}

/* Icono telÃ©fono negro en claro */
body.theme-light .btn__icon--phone{ color:#0F172A; }

body.theme-light .device-screen{
  background: #FFFFFF;
  border: 1px solid rgba(15,23,42,.10);
}

body.theme-light .topbar--sticky{
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(249,250,251,.90));
  border-bottom: 1px solid rgba(15,23,42,.10);
}

body.theme-light .card{
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(249,250,251,.98));
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: 0 10px 24px rgba(2,6,23,.08);
}

body.theme-light .select,
body.theme-light .input,
body.theme-light .textarea{
  background: rgba(15,23,42,.04);
  color: var(--text);
  border: 1px solid rgba(15,23,42,.12);
  width: 100%;
}

body.theme-light .btn{
  background: rgba(15,23,42,.04);
  border-color: rgba(15,23,42,.12);
  color: var(--text); 
}

body.theme-light .icon-btn{
  background: rgba(15,23,42,.04);
  border-color: rgba(15,23,42,.12);
  color: var(--text);
}

body.theme-light .label{ color: rgba(15,23,42,.70); }
body.theme-light .brand__tag{ color: var(--muted); }

body.theme-light .pill{
  background: rgba(15,23,42,.03);
  border-color: rgba(15,23,42,.10);
  color: var(--text);
}
body.theme-light .pill--live{ background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.25); }
body.theme-light .pill--service{ background: rgba(124,58,237,.10); border-color: rgba(124,58,237,.25); }

body.theme-light .badge{
  background: rgba(15,23,42,.03);
  border-color: rgba(15,23,42,.10);
  color: var(--text);
}

body.theme-light .call-card{
  background:
    radial-gradient(800px 300px at 20% 20%, rgba(124,58,237,.10), transparent 50%),
    radial-gradient(800px 300px at 80% 80%, rgba(34,197,94,.08), transparent 45%),
    rgba(15,23,42,.03);
  border-color: rgba(15,23,42,.10);
}
body.theme-light .call-card__meta{ color: rgba(15,23,42,.80); }

body.theme-light .call-item{
  background: rgba(15,23,42,.03);
  border-color: rgba(15,23,42,.10);
}
body.theme-light .call-item__meta{ color: var(--muted); }

body.theme-light .divider{ background: rgba(15,23,42,.10); }

body.theme-light .tabbar{
  background: linear-gradient(180deg, rgba(255,255,255,.70), rgba(255,255,255,.96));
  border-top: 1px solid rgba(15,23,42,.10);
}
body.theme-light .tabbar__item{ color: rgba(15,23,42,.60); }
body.theme-light .tabbar__item.is-active{
  background: rgba(15,23,42,.06);
  color: var(--text);
  border-color: rgba(15,23,42,.10);
}

/* Install en claro */
body.theme-light #screen-auth .install{
  border: 1px solid rgba(15,23,42,.12);
  background:
    radial-gradient(900px 240px at 20% 10%, rgba(255,180,0,.16), transparent 55%),
    radial-gradient(900px 240px at 80% 90%, rgba(255,122,24,.14), transparent 55%),
    rgba(15,23,42,.03);
  box-shadow: 0 10px 18px rgba(2,6,23,.10);
}
body.theme-light #screen-auth #btnInstall{
  border-color: rgba(15,23,42,.12);
}

/* IA claro */
body.theme-light #tab-ia .ia-top{
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(249,250,251,.92));
  border-bottom: 1px solid rgba(15,23,42,.10);
}
body.theme-light #tab-ia .ia-compose{
  background: rgba(255,255,255,.96);
  border-top: 1px solid rgba(15,23,42,.10);
}
body.theme-light .ia-msg{
  background: rgba(15,23,42,.03);
  border-color: rgba(15,23,42,.10);
}
body.theme-light .ia-msg__meta{ color: rgba(15,23,42,.65); }

/* â IA claro: input con borde visible */
body.theme-light #tab-ia .ia-input{
  background: rgba(15,23,42,.05);
  border: 1px solid rgba(15,23,42,.22);
  color: var(--text);
}
body.theme-light #tab-ia .ia-input::placeholder{
  color: rgba(15,23,42,.55);
}
body.theme-light #tab-ia .ia-input:focus{
  border-color: rgba(15,23,42,.40);
  background: rgba(15,23,42,.07);
}

/* Toast claro */
body.theme-light #weeyToast .weeyToast__inner{
  background: rgba(255,255,255,.96);
  color: #0F172A;
  border: 1px solid rgba(15,23,42,.12);
  box-shadow: 0 12px 24px rgba(2,6,23,.12);
}

/* ===== Llamada activa (API) ===== */
.pill--ended{
  border-color: rgba(239,68,68,.45);
  background: rgba(255,122,24,.18);
  color: var(--text);
}
.dot--ended{
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,.16);
}

/* Detalles / Liruch: mÃ¡s cÃ³modo */
.kv--call{ grid-template-columns: 140px 1fr; }

/* GalerÃ­a 2 por fila (â Ãºnica fuente de verdad) */
.gallery{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.thumb{
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
}
.thumb img{
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  display: block;
}

/* Modal fullscreen (â usar hidden como hace tu JS/HTML) */
.img-modal{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.86);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
  z-index: 100000;
}
.img-modal__img{
  max-width: 100%;
  max-height: 100%;
  border-radius: 18px;
}
.img-modal__close{
  position: fixed;
  top: 16px;
  right: 16px;

  z-index: 100001;
  color: #fff;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.25);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


/* Modal respeta [hidden] */
#imgModal[hidden]{ display:none !important; }
#imgModal:not([hidden]){ display:flex; }

/* ===== FIX MIS DATOS â MODO CLARO ===== */
.theme-light #tab-me .kv,
.theme-light #tab-me .kv strong,
.theme-light #tab-me .kv span,
.theme-light #tab-me .kv div {
  color: #111827 !important; /* gris oscuro, legible */
  opacity: 1 !important;
}

/* ===== CONTACTA CON TU ASESOR ===== */
.advisor-box {
  text-align: center;
}

.advisor-box h3 {
  margin-bottom: 14px;
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 12px 20px;
  border-radius: 999px;

  background: #25d366;
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;

  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp:active {
  transform: scale(0.97);
}
/* === FIX DEFINITIVO MIS DATOS EN TEMA CLARO === */
body.theme-light #tab-me .kv__k{
  color: rgba(15,23,42,.70) !important;
}
body.theme-light #tab-me .kv__v{
  color: #0F172A !important;
  opacity: 1 !important;
}
/* === ASESOR: layout limpio (no se monta) === */
.advisor-box{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  text-align:center;
}

.advisor-box h3{
  margin:0;
}
.btn-whatsapp .wa-ico{
  width:18px;
  height:18px;
  color:#fff;
  display:block;
}
/* === SKELETON === */
.skeleton{
  position:relative;
  overflow:hidden;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  border-radius:12px;
}
body.theme-light .skeleton{
  background: rgba(15,23,42,.06); 
  border-color: rgba(15,23,42,.12);
}

.skeleton::after{
  content:"";
  position:absolute;
  inset:0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
  animation: skShimmer 1.2s infinite;
}
body.theme-light .skeleton::after{
  background: linear-gradient(90deg, transparent, rgba(15,23,42,.10), transparent);
}

@keyframes skShimmer{
  100%{ transform: translateX(100%); }
}

.sk-line{ height:14px; margin:10px 0; }
.sk-line.big{ height:18px; }
.sk-line.w40{ width:40%; }
.sk-line.w60{ width:60%; }
.sk-line.w80{ width:80%; }
.sk-line.w100{ width:100%; }

/* === LOADER (spinner) === */
.spinner{
  width:16px;
  height:16px;
  border-radius:999px;
  border:2px solid rgba(255,255,255,.45);
  border-top-color: rgba(255,255,255,1);
  animation: spin .8s linear infinite;
}

/* ===== LOGIN: botÃ³n Entrar en modo carga ===== */
#screen-auth #btnCallValidate.is-loading{
  opacity: .9;
  cursor: wait;
}

#screen-auth #btnCallValidate .btn__loading{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}

body.theme-light .spinner{
  border-color: rgba(15,23,42,.25);
  border-top-color: rgba(15,23,42,.70);
}
@keyframes spin{ to{ transform: rotate(360deg); } }

.doc-wrap{ display:flex; flex-direction:column; gap:10px; }
.doc-thumb{
  width: 100%;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
  background: transparent;
}
.doc-thumb img{ width:100%; height:auto; display:block; }
/* =========================
   MIS DATOS  AJUSTES UI
   ========================= */

/* --- Ttulos de secciÃ³n --- */
.section-title {
  font-weight: 600;
  margin: 1px 0 15px;
  font-size: 15px;
}

/* --- Skeleton Loader --- */
.md-loading {
  display: grid;
  gap: 10px;
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(0,0,0,.06) 25%,
    rgba(0,0,0,.12) 37%,
    rgba(0,0,0,.06) 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: 8px;
}

.theme-dark .skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,.08) 25%,
    rgba(255,255,255,.15) 37%,
    rgba(255,255,255,.08) 63%
  );
}

@keyframes skeleton-loading {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.sk-line { height: 14px; }
.sk-line.big { height: 18px; }
.w100 { width: 100%; }
.w80 { width: 80%; }
.w60 { width: 60%; }

/* --- Documento (miniatura) --- */
.doc-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-thumb {
  width: 100%;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.08);
  background: transparent;
}

.theme-dark .doc-thumb {
  border-color: rgba(255,255,255,.12);
}

.doc-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- BotÃ³n WhatsApp --- */
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #25D366;
  color: #ffffff;
  font-weight: 800;
  padding: 14px 18px;
  border-radius: 999px;
  text-decoration: none;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.btn-whatsapp:hover {
  filter: brightness(1.05);
}

.btn-whatsapp .wa-ico {
  width: 20px;
  height: 20px;
}

/* --- Advisor box centrado --- */
.advisor-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- Ajuste KV (labels mÃ¡s claras en light) --- */
.theme-light .kv__k {
  color: #4b5563;
  font-weight: 700;
}

.theme-dark .kv__k {
  color: #9ca3af;
}

/* --- Valores KV --- */
.kv__v {
  font-weight: 700;
}
/* ===== PATCH 2026-01-08: Mis datos layout + WhatsApp + modo claro ===== */
#tab-me{
  padding-bottom: calc(20px + var(--safe-bottom)); /* evita que el botÃ³n quede bajo la tabbar */
}

#tab-me .card{
  width: 100%;
  max-width: 720px;          /* misma âcajaâ y ancho consistente */
  margin-left: auto;
  margin-right: auto;
}

#tab-me .card + .card{
  margin-top: 14px;
}

/* WhatsApp centrado y bonito */
#tab-me .advisor-box{
  text-align: center;
}
#tab-me .btn-whatsapp{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
}
#tab-me .btn-whatsapp .wa-ico{
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

/* Modo claro: mejora contraste en valores */
body.theme-light #tab-me .kv__v{
  color: #111827 !important;
  opacity: 1 !important;
}
body.theme-light #tab-me .kv__k{
  color: rgba(15,23,42,.65) !important;
  opacity: 1 !important;
}
/* ===== ConexiÃ³n ===== */
.phone-btn{
  transition: color .2s ease, background .2s ease;
}

.phone-btn.is-on{
  color: #16a34a; /* verde */
}

.phone-btn.is-off{
  color: #dc2626; /* rojo */
}

#conn_status_text{
  font-weight: 600;
}

#conn_status_text.on{
  color: #16a34a;
}

#conn_status_text.off{
  color: #dc2626;
}

/* ===== Estado Cuenta Activa ===== */
.account-active {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
}

.account-active__dot {
  color: var(--brand2);
  font-size: 14px;
  line-height: 1;
}

/* ===== Estado Cuenta Activa (dentro de Ajustes) ===== */
.account-active {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 12px;
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
}

.account-active__dot {
  color: #16a34a; /* verde fijo */
  font-size: 14px;
  line-height: 1;
}

/* ===== Ajustes: 2 líneas (user_type + status) ===== */
.acct-lines { margin-top: 6px; margin-bottom: 12px; }
.acct-lines .account-active { margin: 0; }
.acct-lines .account-active + .account-active { margin-top: 6px; }

/* Colores por clase (no fijo en verde) */
.account-active.is-green .account-active__dot { color: #16a34a; }
.account-active.is-red .account-active__dot { color: #dc2626; }
.account-active.is-orange .account-active__dot { color: #f59e0b; }


/* ===== Ajustes: 2 lÃ­neas de estado (user_type + status) ===== */
.acct-lines{
  margin-top: 6px;
  margin-bottom: 12px;
}

.acct-line{
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
}

.acct-line + .acct-line{
  margin-top: 6px;
}

.acct-dot{
  font-size: 14px;
  line-height: 1;
}

.acct-line.is-green .acct-dot{ color:#16a34a; }
.acct-line.is-red .acct-dot{ color:#dc2626; }
.acct-line.is-orange .acct-dot{ color:#f59e0b; }

/* ===== Loading animado para el estado de ConexiÃ³n ===== */
#conn_status_text.is-loading{
  position: relative;
  padding-right: 18px;   /* espacio para el spinner */
  opacity: .9;
}

#conn_status_text.is-loading::after{
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;  /* usa el color actual (on/off) */
  border-top-color: transparent;
  border-radius: 50%;
  transform: translateY(-50%);
  animation: wee-spin .8s linear infinite;
}

@keyframes wee-spin{
  to { transform: translateY(-50%) rotate(360deg); }
}
/* ===== Mis datos: botÃ³n editar (lÃ¡piz) en cabecera ===== */
#tab-me #btnEditMisDatos{
  flex: 0 0 auto;            /* evita que se estire raro */
}

/* Si quieres un pelÃ­n menos de separaciÃ³n bajo el tÃ­tulo en Mis datos */
#tab-me .card > .card__head{
  margin-bottom: 12px;       /* (por defecto ya es 10px) */
}

/* Hover/active suave (no rompe temas) */
#tab-me #btnEditMisDatos:hover{
  filter: brightness(1.08);
}
#tab-me #btnEditMisDatos:active{
  transform: translateY(1px);
}

/* =========================================================
   MODAL FULLSCREEN â Editar Mis Datos  (WEEY)
   Scopeado a #mdEditModal para no romper nada
   ========================================================= */

/* Overlay */
#mdEditModal.fs-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

/* Panel */
#mdEditModal .fs-modal__panel{
  width: 100%;
  height: 100%;
  background: var(--card);
  border-radius: 0;
  display: flex;
  flex-direction: column;

  /* animaciÃ³n: arranca abajo */
  transform: translateY(100%);
  transition: transform .22s ease;
  will-change: transform;
}

/* Abierto (sube) */
#mdEditModal.is-open .fs-modal__panel{
  transform: translateY(0);
}

/* Cabecera */
#mdEditModal .fs-modal__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;

  /* borde suave compatible claro/oscuro */
  border-bottom: 1px solid rgba(255,255,255,.10);
}

/* TÃ­tulo */
#mdEditModal .fs-modal__title{
  font-weight: 900;
  font-size: 16px;
  color: var(--text);
}

/* Cuerpo con scroll */
#mdEditModal .fs-modal__body{
  padding: 14px 14px 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Inputs dentro del kv */
#mdEditModal .kv--form .kv__v{
  display: flex;
}
#mdEditModal .kv--form .input{
  width: 100%;
}

/* Separadores (usa tu .divider si ya existe; esto es por si acaso) */
#mdEditModal .divider{
  margin: 14px 0;
}

/* ===== Documento editor ===== */
#mdEditModal .doc-edit{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Miniatura clicable (edit) */
#mdEditModal .doc-thumb--edit{
  width: 100%;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.03);
  padding: 0;
}

#mdEditModal #ed_doc_preview{
  width: 100%;
  height: auto;
  display: block;
}

#mdEditModal .doc-placeholder{
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
  text-align: center;
}

#mdEditModal .doc-placeholder__icon{
  font-size: 24px;
}

/* ===== Checkbox contrato ===== */
#mdEditModal .contract-row{
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  opacity: .95;
  margin-top: 6px;
}

#mdEditModal .contract-row input{
  margin-top: 3px;
}

/* ===== BotÃ³n enviar deshabilitado (pro) ===== */
#mdEditModal #ed_send[disabled]{
  opacity: .55;
  cursor: not-allowed;
  filter: saturate(.8);
}


/* Respeta accesibilidad: reduce motion */
@media (prefers-reduced-motion: reduce){
  #mdEditModal .fs-modal__panel{
    transition: none;
  }
}

/* Mis datos: documento integrado (opcional) */
#tab-me #md_doc_empty{
  margin-top: 6px;
}



/* ==========================================================
   iOS: evitar zoom al enfocar inputs (Safari hace zoom <16px)
   ========================================================== */
@supports (-webkit-touch-callout: none) {
  /* Inputs generales */
  input, select, textarea {
    font-size: 16px;
  }

  /* Por si quieres limitarlo al modal ediciÃ³n */
  #mdEditModal .input,
  #mdEditModal input,
  #mdEditModal select,
  #mdEditModal textarea{
    font-size: 16px;
  }
}
/* ==========================================================
   Evitar double-tap zoom en iOS (mejora UX en cards/botones)
   ========================================================== */
	#app, .device-screen, .content, .card,
	button, a, .icon-btn, .doc-thumb {
	  touch-action: manipulation;
	}

	/* ===== Contrato + Enviar (modal editar) ===== */
	#mdEditModal .contract-block{
	  display:flex;
	  flex-direction:column;
	  gap:12px;
	  margin-top: 10px;
	}

	/* VER CONTRATO en azul */
	#mdEditModal .contract-link{
	  align-self: flex-start;
	  background: transparent;
	  border: 0;
	  padding: 0;
	  font-weight: 900;
	  letter-spacing: .3px;
	  color: #3b82f6;
	  cursor: pointer;
	}
	#mdEditModal .contract-link:hover{ text-decoration: underline; }

	/* Enviar debajo, centrado y mÃ¡s ancho */
	#mdEditModal #ed_send{
	  width: min(520px, 92%);
	  margin: 4px auto 0;    /* centrado */
	}

	/* â Quitar âespacio blancoâ al final del modal */
	#mdEditModal .fs-modal__body{
	  padding-bottom: 16px;  /* antes lo tenÃ­as enorme */
	}

	#mdEditModal .contract-link:hover{
	  text-decoration: underline;
	}

	/* â SUBIR botÃ³n Enviar ~60px: sticky dentro del scroll */
	#mdEditModal .fs-modal__body{
	  padding-bottom: calc(140px + var(--safe-bottom)); /* â aire abajo */
	}


/* ===== Modal contrato ===== */
#contractModal .contract-body{
  padding: 0; /* iframe a pantalla completa dentro del modal */
}

#mdEditModal #ed_send{
  margin-top: 14px;
  margin-bottom: 40px; /* â separa del final */
}

#contractModal .contract-frame{
  width: 100%;
  height: calc(100vh - 56px); /* resta la barra superior del modal */
  border: 0;
  display: block;
  background: transparent;
}

/* =========================================================
   MODAL FULLSCREEN â Contrato  (WEEY)
   Igual que #mdEditModal para que NO quede en el flujo normal
   ========================================================= */

/* Overlay */
#contractModal.fs-modal{
  position: fixed;
  inset: 0;
  z-index: 10050;              /* un poco mÃ¡s que mdEditModal */
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

/* Panel */
#contractModal .fs-modal__panel{
  width: 100%;
  height: 100%;
  background: var(--card);
  border-radius: 0;
  display: flex;
  flex-direction: column;

  transform: translateY(100%);
  transition: transform .22s ease;
  will-change: transform;
}

/* Abierto (sube) */
#contractModal.is-open .fs-modal__panel{
  transform: translateY(0);
}

/* Cabecera */
#contractModal .fs-modal__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

/* Cuerpo */
#contractModal .fs-modal__body{
  padding: 0;
  overflow: hidden; /* el scroll lo hace el iframe */
}

/* Iframe ocupa todo el alto Ãºtil */
#contractModal .contract-frame{
  width:100%;
  height: calc(100dvh - 56px);
  border:0;
  display:block;
  background: transparent;
}

@media (prefers-reduced-motion: reduce){
  #contractModal .fs-modal__panel{ transition:none; }
}

/* ===== Ajuste fino: VER CONTRATO + Enviar centrado y menos blanco abajo ===== */

/* El bloque */
#mdEditModal .contract-block{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top: 10px;
}

/* Link azul */
#mdEditModal .contract-link{
  align-self: flex-start;
  background: transparent;
  border: 0;
  padding: 0;
  font-weight: 900;
  letter-spacing: .3px;
  color: #3b82f6;
  cursor: pointer;
}

/* â Enviar: centrado REAL y mÃ¡s ancho (manda sobre .btn--wide) */
#mdEditModal #ed_send{
  display: block;
  width: 100%;
  max-width: 560px;          /* mÃ¡s ancho âproâ */
  margin-left: auto;
  margin-right: auto;
  margin-top: 6px;
  margin-bottom: 0;          /* evita blanco extra */
}

/* â Quitar blanco del pie: reduce padding inferior del body */
#mdEditModal .fs-modal__body{
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}



/* =========================
   WEEY - AÃ±adidos Cobros + Historial + Llamadas
   (sin romper estilos existentes)
   ========================= */

/* Cobros: bloques */
.payBlock{ text-align:center; padding:10px 0; }
.payBlock--sp{ margin-top: 10px; }
.payBlock__label{ font-weight: 800; }
.payBlock__big{ font-size: 40px; line-height: 1.05; font-weight: 900; }
.payBlock__tiny{ margin-top: 6px; }
.payBlock__row{ margin-top: 6px; }

/* Historial de retiradas */
.withdraw-item{ display:flex; gap:12px; align-items:flex-start; justify-content:space-between; padding:14px; border-radius:16px; background: var(--card, rgba(255,255,255,.9)); box-shadow: var(--shadow, 0 8px 20px rgba(0,0,0,.08)); margin:12px 0; }
.withdraw-item__left{ min-width: 0; flex: 1; }
.withdraw-item__status{ font-weight: 900; }
.withdraw-item__meta{ margin-top: 4px; }
.withdraw-item__type{ margin-top: 8px; }
.withdraw-item__reason{ margin-top: 8px; }
.withdraw-item__right{ text-align:right; white-space:nowrap; }
.withdraw-item__amount{ font-size: 22px; font-weight: 900; }
.withdraw-item__coins{ margin-top: 6px; }

.wst--pending{ color: #d97706; }
.wst--done{ color: #16a34a; }
.wst--rejected{ color: #dc2626; }

.withdraw-item.is-clickable{ cursor:pointer; }

/* Modal PDF fullscreen (aprovecha tu modal actual) */
#payPdfModal .modal__sheet--full{ width:100%; height:100%; border-radius:0; }
/* =========================
   MODAL PDF (fullscreen)
   ========================= */
#payPdfModal .modal__sheet--full{
  width: 100%;
  height: 100%;
  border-radius: 0;
  overflow: hidden;              /* evita que nada se âsalgaâ */
  display: flex;                 /* clave: layout en columna */
  flex-direction: column;
}

#payPdfModal .modal__head{
  flex: 0 0 auto;
}

#payPdfFrame.modal__iframe{
  flex: 1 1 auto;                /* ocupa TODO el resto */
  width: 100%;
  height: auto;                  /* ya no dependemos del calc */
  min-height: 0;                 /* clave en iOS para flex + iframe */
  border: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: transparent;
}



/* ===== Llamadas: Skeleton (1 tarjeta) sustituyendo âCargandoâ¦â ===== */
#callsList > .muted{
  color: transparent !important;
  user-select: none;
  padding: 0 !important;
  background: transparent !important;
}

/* 1 tarjeta con lÃ­neas internas (tÃ­tulo + subtÃ­tulo + badge tokens) */
#callsList > .muted::before{
  content: "";
  display: block;
  height: 78px;
  border-radius: 16px;
  margin: 10px 0;

  background:
    /* badge derecha */
    linear-gradient(90deg, rgba(0,0,0,.06) 0%, rgba(0,0,0,.12) 50%, rgba(0,0,0,.06) 100%) 92% 22px / 56px 18px no-repeat,
    /* tÃ­tulo */
    linear-gradient(90deg, rgba(0,0,0,.06) 0%, rgba(0,0,0,.12) 50%, rgba(0,0,0,.06) 100%) 16px 18px / 160px 16px no-repeat,
    /* subtÃ­tulo */
    linear-gradient(90deg, rgba(0,0,0,.06) 0%, rgba(0,0,0,.12) 50%, rgba(0,0,0,.06) 100%) 16px 46px / 220px 12px no-repeat,
    /* fondo tarjeta */
    linear-gradient(90deg, rgba(0,0,0,.03) 0%, rgba(0,0,0,.06) 50%, rgba(0,0,0,.03) 100%) 0 0 / 200% 100% no-repeat;

  animation: weeyCallsShimmerOne 1.1s ease-in-out infinite;
}

@keyframes weeyCallsShimmerOne{
  0%   { background-position: 200% 22px, 200% 18px, 200% 46px, 200% 0; }
  100% { background-position: -200% 22px, -200% 18px, -200% 46px, -200% 0; }
}
/* =========================
   LLAMADAS: cabecera fija tipo cristal (sin sticky)
   (para el nuevo header .callsBar)
   ========================= */
#tab-list .callsBar--fixed{
  position: fixed;
  left: 0;
  right: 0;
  top: env(safe-area-inset-top);
  z-index: 80;

  border-radius: 0 !important;
  margin: 0 !important;

  background: rgba(255,255,255,.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);

  border-bottom: 1px solid rgba(0,0,0,.08);
}

#tab-list .callsBar{
  padding: 12px 14px 10px;
}

#tab-list .callsBar__row{
  display: flex;
  align-items: center;
  gap: 12px;
}

#tab-list .callsBar__title{
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

#tab-list .callsBar__h2{ margin: 0; }

#tab-list .callsBar__icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .9;
}

/* Mantener #filterRange pero oculto (compatibilidad) */
#tab-list .callsBar__select{
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

/* Botones Detalladas/Agrupadas */
#tab-list .callsBar__toggles{
  display: flex;
  gap: 10px;
  margin-left: auto;
}

#tab-list .callsToggle{
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.85);
  font-size: 15px;
  line-height: 40px;
  white-space: nowrap;
}

#tab-list .callsToggle[aria-pressed="true"]{
  opacity: .62;
  background: rgba(255,255,255,.55);
  border-color: rgba(0,0,0,.08);
}

#tab-list .callsToggle[aria-pressed="false"]{
  opacity: 1;
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}

#tab-list .callsBar__hint{
  margin-top: 8px;
  font-size: 12px;
  opacity: .75;
}

/* Espacio para que el listado no quede tapado por la cabecera fija */
#tab-list #callsList{
  padding-top: 110px;
}

/* Llamadas: cabecera fija - tema */
body.theme-light #tab-list .callsBar--fixed{
  background: rgba(255,255,255,.72);
  border-bottom: 1px solid rgba(0,0,0,.08);
}

body.theme-dark #tab-list .callsBar--fixed{
  background: rgba(7,10,18,.72);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

/* =========================
   COBROS: cabecera fija tipo cristal + layout
   ========================= */
#tab-pay .payBar--fixed{
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  padding-top: env(safe-area-inset-top);
  z-index: 80;
  border-radius: 0 !important;
  margin: 0 !important;

  /* Oscuro por defecto */
  background: rgba(17,24,39,.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  transform: translateZ(0);
}

body.theme-light #tab-pay .payBar--fixed{
  background: rgba(255,255,255,.72);
  border-bottom: 1px solid rgba(0,0,0,.08);
}

#tab-pay .payBar{
  padding: 12px 14px 10px;
}

#tab-pay .payBar__row{
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

#tab-pay .payBar__title{
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

#tab-pay #btnWithdraw{
  margin-left: auto;
}

#tab-pay .payBar__h2{ margin: 0; }

#tab-pay .payBar__icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .9;
}

#tab-pay .payBar__hint{
  margin-top: 4px;
  font-size: 12px;
  opacity: .75;
}

#tab-pay .payBar__hint--ok{
  opacity: 1;
  color: #22c55e;
}

#tab-pay .payContent{
  /* Dejar espacio para la cabecera fija */
  padding-top: 84px;
}

#tab-pay .payInvoicesTitle{
  margin: 14px 14px 8px;
  font-size: 13px;
  opacity: .75;
}

/* Ajuste de la fila superior en cada retirada (estado + fecha) */
#tab-pay .withdraw-item__top{
  display: flex;
  align-items: baseline;
  gap: 10px;
}

/* Skeleton loading (Cobros) */
#tab-pay #payCard.is-loading,
#tab-pay #withdrawHistory.is-loading{
  position: relative;
  overflow: hidden;
}

#tab-pay #payCard.is-loading > *{
  visibility: hidden;
}

#tab-pay #payCard.is-loading::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.18), rgba(255,255,255,.08));
  animation: weeyShimmer 1.1s infinite;
}

/* Skeleton: que ocupe toda la caja principal (alto similar al card real) */
#tab-pay #payCard.is-loading{ min-height: 420px; }

body.theme-light #tab-pay #payCard.is-loading::before{
  background: linear-gradient(90deg, rgba(0,0,0,.04), rgba(0,0,0,.08), rgba(0,0,0,.04));
}

#tab-pay #withdrawHistory.is-loading{
  min-height: 210px;
}

#tab-pay #withdrawHistory.is-loading > *{
  visibility: hidden;
}

#tab-pay #withdrawHistory.is-loading::before{
  content: "";
  display: block;
  height: 68px;
  border-radius: 16px;
  margin: 10px 14px;
  background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.18), rgba(255,255,255,.08));
  animation: weeyShimmer 1.1s infinite;
}

#tab-pay #withdrawHistory.is-loading::after{
  content: "";
  display: block;
  height: 68px;
  border-radius: 16px;
  margin: 10px 14px;
  background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.18), rgba(255,255,255,.08));
  animation: weeyShimmer 1.1s infinite;
}

body.theme-light #tab-pay #withdrawHistory.is-loading::before,
body.theme-light #tab-pay #withdrawHistory.is-loading::after{
  background: linear-gradient(90deg, rgba(0,0,0,.04), rgba(0,0,0,.08), rgba(0,0,0,.04));
}

@keyframes weeyShimmer{
  0%{ transform: translateX(-20%); }
  100%{ transform: translateX(20%); }
}



/* Places cards */
.place-card { border: 1px solid rgba(0,0,0,0.08); border-radius: 14px; padding: 12px; margin: 10px 0; }
.place-meta { margin-top: 4px; opacity: 0.85; font-size: 14px; }
.place-addr { margin-top: 6px; opacity: 0.8; font-size: 13px; }
.place-photo { margin-top: 10px; }
.place-photo img { width: 100%; height: auto; border-radius: 12px; display: block; }
.place-btn { margin-top: 10px; padding: 10px 12px; border-radius: 12px; border: 0; cursor: pointer; }
.ia-msg__body { overflow-wrap: anywhere; word-break: break-word; }

/* ==================================================
   PAY WITHDRAW MODAL â estilo app (iOS-like sheet)
   ================================================== */

#payWithdrawModal{
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 14px;
  padding-bottom: calc(14px + var(--safe-bottom));
  background: rgba(0,0,0,.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

#payWithdrawModal[hidden]{ display:none; }

#payWithdrawModal .modal__sheet{
  width: min(560px, 94vw);
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 18px 70px rgba(0,0,0,.55);
  overflow: hidden;

  /* anim */
  transform: translateY(26px);
  opacity: 0;
  transition: transform .22s ease, opacity .22s ease;
}

#payWithdrawModal.is-open .modal__sheet{
  transform: translateY(0);
  opacity: 1;
}

/* âhandleâ superior */
#payWithdrawModal .modal__sheet::before{
  content: "";
  display: block;
  width: 46px;
  height: 5px;
  border-radius: 999px;
  margin: 10px auto 2px auto;
  background: rgba(255,255,255,.22);
}

/* Cabecera */
#payWithdrawModal .modal__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 14px 12px 14px;
}

#payWithdrawModal .modal__title{
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .2px;
}

/* BotÃ³n cerrar âXâ redondo */
#payWithdrawClose{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.07);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  padding:0;
  font-size:0; /* oculta texto si lo hubiera */
}
#payWithdrawClose::before{
  content:"â";
  font-size: 16px;
  color: rgba(255,255,255,.92);
  line-height: 1;
}
#payWithdrawClose:active{
  transform: scale(.97);
  background: rgba(255,255,255,.11);
}

/* Cuerpo */
#payWithdrawModal .modal__body{
  padding: 4px 16px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Texto principal mÃ¡s legible */
#payWithdrawText{
  font-size: 15px;
  line-height: 1.45;
  opacity: .95;
  margin: 0;
}

/* Hint en pill */
#payWithdrawModalHint{
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.10);
  opacity: .92;
}

#payWithdrawModalHint.payWithdrawHint--ok{
  background: rgba(80, 200, 120, .12);
  border-color: rgba(80, 200, 120, .22);
  opacity: 1;
}

/* Zona acciones */
#payWithdrawModal .modal__actions{
  display:flex;
  justify-content:center;
  padding: 2px 16px 16px 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}

/* BotÃ³n principal centrado, ancho âappâ */
#payWithdrawConfirm{
  width: min(380px, 100%);
  height: 50px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .2px;
}

/* Disabled claro */
#payWithdrawConfirm:disabled{
  opacity: .45;
  cursor: not-allowed;
}

/* Loading (si tu JS aÃ±ade .is-loading) */
#payWithdrawConfirm.is-loading{
  cursor: wait;
  opacity: .85;
}

/* Evita que el modal se vea âcortadoâ en pantallas pequeÃ±as */
@media (max-height: 680px){
  #payWithdrawModal .modal__sheet{
    width: min(560px, 96vw);
  }
}

/* ===============================
   PAY WITHDRAW MODAL â ajustes MODO CLARO
   =============================== */
.theme-light #payWithdrawModal{
  background: rgba(0,0,0,.22);
}

.theme-light #payWithdrawModal .modal__sheet::before{
  background: rgba(0,0,0,.18); /* â barra iOS visible */
}

.theme-light #payWithdrawModal .modal__head{
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.theme-light #payWithdrawClose{
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(0,0,0,.04);
}

.theme-light #payWithdrawClose::before{
  color: rgba(0,0,0,.72); /* â la â se ve */
}

.theme-light #payWithdrawModalHint{
  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.08);
  color: rgba(0,0,0,.70);
}

.theme-light #payWithdrawModalHint.payWithdrawHint--ok{
  background: rgba(46, 204, 113, .12);
  border-color: rgba(46, 204, 113, .22);
  color: rgba(0,0,0,.78);
}


/* ===============================
   PDF MODAL: overlay fijo (no âempujaâ la pÃ¡gina)
   =============================== */
#payPdfModal{
  position: fixed;
  inset: 0;
  z-index: 40000;              /* por encima del tabbar */
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#payPdfModal[hidden]{ display:none !important; }

#payPdfModal .modal__sheet--full{
  width: min(920px, 100vw);
  height: 100dvh;              /* mejor que 100vh en mÃ³vil */
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#payPdfModal .modal__head{
  flex: 0 0 auto;
}

#payPdfModal .modal__iframe{
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ============================
   IA FINAL (ancho completo)
   Pegar al FINAL del week.css
   ============================ */

/* 1) Cabecera fija (cristal) */
#tab-ia .ia-top--fixed{
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  top: env(safe-area-inset-top, 0px) !important;
  z-index: 30 !important;

  /* cristal */
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

/* Claro */
body.theme-light #tab-ia .ia-top--fixed{
  background: rgba(255,255,255,.78) !important;
  border-bottom: 1px solid rgba(15,23,42,.10) !important;
}

/* Oscuro */
body.theme-dark #tab-ia .ia-top--fixed{
  background: rgba(7,10,18,.72) !important;
  border-bottom: 1px solid rgba(255,255,255,.08) !important;
}

/* 2) Log del chat: que NO quede bajo la cabecera + que NO quede bajo el composer */
#tab-ia .ia-log{
  /* si tu JS setea --ia-top-h perfecto; si no, fallback 56px */
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--ia-top-h, 56px) + 12px) !important;

  /* espacio para composer + tabbar (Safari normal) */
  padding-bottom: calc(var(--tabbar-h) + 96px) !important;
}

/* 3) Composer ancho completo (edge-to-edge, sin esquinas) */
#tab-ia:not([hidden]) .ia-compose{
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;

  bottom: var(--tabbar-h) !important;   /* Safari normal */
  z-index: 25 !important;

  border-radius: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;

  /* cristal */
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;

  transform: none !important;
}

/* Claro: composer cristal tipo menÃº */
body.theme-light #tab-ia:not([hidden]) .ia-compose{
  background: rgba(255,255,255,.78) !important;
  border-top: 1px solid rgba(15,23,42,.10) !important;
}

/* Oscuro: composer cristal tipo menÃº */
body.theme-dark #tab-ia:not([hidden]) .ia-compose{
  background: rgba(7,10,18,.72) !important;
  border-top: 1px solid rgba(255,255,255,.08) !important;
}

/* 4) Input: que no sea blanco opaco */
body.theme-light #tab-ia .ia-input{
  background: rgba(255,255,255,.35) !important;
  border: 1px solid rgba(15,23,42,.12) !important;
}
body.theme-dark #tab-ia .ia-input{
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
}

/* 5) PWA iOS (standalone): sumar safe-area abajo (en PWA suele faltar) */
@media (display-mode: standalone) {
  #tab-ia:not([hidden]) .ia-compose{
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)) !important;
  }
  #tab-ia .ia-log{
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 20px) !important;
  }
}
#mdDocsModal .fs-modal__title{
  font-weight: 900;
  font-size: 16px;
  color: var(--text);
}

#mdDocsModal .fs-modal__body{
  padding: 14px 14px 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce){
  #mdDocsModal .fs-modal__panel{ transition: none; }
}


#mdDocsModal.fs-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

#mdDocsModal .fs-modal__panel{
  width: 100%;
  height: 100%;
  background: var(--card);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .22s ease;
  will-change: transform;
}

#mdDocsModal.is-open .fs-modal__panel{
  transform: translateY(0);
}

#mdDocsModal .fs-modal__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

/* =========================================================
   MIS DOCUMENTOS (modal) - UI adjuntar + lista + cropper
   (scoped a #mdDocsModal para NO romper nada)
   ========================================================= */

#mdDocsModal .md-docs-list{
  display: grid;
  gap: 12px;
}

#mdDocsModal .md-doc-item{
  display: grid;
  grid-template-columns: 72px 1fr 40px;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}

#mdDocsModal .md-doc-thumb{
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

#mdDocsModal .md-doc-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#mdDocsModal .md-doc-meta{
  min-width: 0;
}

#mdDocsModal .md-doc-name{
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#mdDocsModal .md-doc-url{
  font-size: 12px;
  opacity: .75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#mdDocsModal .md-doc-del{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ===== Cropper ===== */
#mdDocsModal .md-crop{
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
}

#mdDocsModal .md-crop__stage{
  position: relative;
  width: 100%;
  height: 320px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,.35);
}

#mdDocsModal .md-crop__img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

#mdDocsModal .md-crop__box{
  position: absolute;
  border: 2px solid rgba(255,255,255,.95);
  box-shadow: 0 0 0 9999px rgba(0,0,0,.40);
  border-radius: 10px;
  touch-action: none;
}

#mdDocsModal .md-crop__handle{
  position: absolute;
  width: 18px;
  height: 18px;
  right: -9px;
  bottom: -9px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
}

#mdDocsModal .md-crop__actions{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

/* =========================================================
   MIS DOCUMENTOS  UI Añadir documento (FINAL LIMPIO)
   - Combo centrado
   - Mismo ancho y altura que el botón
   - Sin etiquetas
   ========================================================= */

/* Separación general */
#mdDocsModal .section-title{
  margin-bottom: 12px;
}

#mdDocsModal .kv{
  margin-bottom: 14px;
}

/* Oculta la etiqueta "Descripción" */
#mdDocsModal .kv__k{
  display: none;
}

/* Contenedor del combo centrado */
#mdDocsModal .kv__v{
  display: flex;
  justify-content: center;
}

/* COMBO: centrado y mismo tamaño que el botón */
#mdDocsModal #md_doc_desc{
  display: block;
  width: min(360px, 100%);
  height: 52px;
  line-height: 52px;
  margin: 0 auto;
}

/* BOTÓN: mismo ancho, centrado */
#mdDocsModal #md_doc_pick{
  display: block;
  width: min(360px, 100%);
  height: 52px;
  margin: 10px auto 0;
}

/* Aire antes del listado */
#mdDocsModal .divider{
  margin-top: 16px;
}

/* FIX: en Mis Documentos, el KV de Descripción debe ser 1 columna */
#mdDocsModal .kv{
  grid-template-columns: 1fr !important; /* elimina la columna 130px */
}

/* Oculta la etiqueta y evita que reserve hueco */
#mdDocsModal .kv__k{
  display: none !important;
}

/* El value ocupa toda la fila */
#mdDocsModal .kv__v{
  grid-column: 1 / -1 !important;
  display: block !important;
}

/* Combo centrado y mismo ancho que el botón */
#mdDocsModal #md_doc_desc{
  display: block !important;
  width: min(360px, 100%) !important;
  height: 52px !important;
  margin: 0 auto !important;
}

/* Botón centrado y mismo ancho */
#mdDocsModal #md_doc_pick{
  display: block !important;
  width: min(360px, 100%) !important;
  height: 52px !important;
  margin: 10px auto 0 !important;
}


/* Select iOS: igualar altura con inputs */
#mdEditModal select,
#mdEditModal .select{
  -webkit-appearance: none;   /* quita estilo nativo */
  appearance: none;

  height: 52px;               /* referencia visual */
  padding: 0 44px 0 16px;     /* CLAVE: iOS respeta padding, no height */
  line-height: 52px;

  display: flex;
  align-items: center;

  box-sizing: border-box;
}

/* ======================================================
   CONEXIÓN (SOLO #conn_card)  limpio, sin duplicados
   ====================================================== */

#conn_card .card__head > .conn-stack{
  flex: 1 1 auto;
  width: 100%;
}

#conn_card .conn-stack{
  display: flex;
  flex-direction: column;
  gap: 10px;                 /* aire entre título de card y secciones */
  align-items: stretch;
}

/* Cada bloque Voz / Video */
#conn_card .conn-section{
  display: flex;
  flex-direction: column;
  gap: 1px;                  /* casi pegado subtítulo -> texto */
  width: 100%;
  margin-top: -10px;         /* OJO: esto es agresivo; si ya no lo necesitas, quítalo */
}

/* Subtítulo: Llamadas de voz / Videollamadas */
#conn_card .conn-subtitle{
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .2px;
  line-height: 1.1;
  margin: 10px 0 -11px 0;
  opacity: .9;
}

/* Fila del estado + botón */
#conn_card .conn-row{
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
}

/* Texto a la izquierda */
#conn_card .conn-left{
  flex: 1 1 auto;
  min-width: 0;
}

#conn_card .conn-text{
  font-weight: 700;
  font-size: 12.5px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

#conn_card .conn-text.on{ color: #16a34a; }
#conn_card .conn-text.off{ color: #dc2626; }

/* Actualizando (si lo sigues usando) */
#conn_card .conn-updating{
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  opacity: .9;
}

#conn_card .conn-text.on + .conn-updating{ color: #16a34a; }
#conn_card .conn-text.off + .conn-updating{ color: #dc2626; }

#conn_card .conn-spinner{
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: wee-spin .8s linear infinite;
}

/* Botón a la derecha */
#conn_card .conn-btn{
  margin-left: auto;
  flex: 0 0 auto;
  transition: color .2s ease, background .2s ease;
  position: static !important;
  transform: none !important;
}

#conn_card .conn-btn.on{ color: #16a34a; }
#conn_card .conn-btn.off{ color: #dc2626; }

/* =========================================================
   MODAL FULLSCREEN: Conexiones automáticas
   Reutiliza el mismo patrón que #mdDocsModal
   ========================================================= */

#mdDocsModal.fs-modal,
#autoConnModal.fs-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

#mdDocsModal .fs-modal__panel,
#autoConnModal .fs-modal__panel{
  width: 100%;
  height: 100%;
  background: var(--card);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .22s ease;
  will-change: transform;
}

#mdDocsModal.is-open .fs-modal__panel,
#autoConnModal.is-open .fs-modal__panel{
  transform: translateY(0);
}

#mdDocsModal .fs-modal__head,
#autoConnModal .fs-modal__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

#autoConnModal .fs-modal__title{
  font-weight: 900;
  font-size: 16px;
  color: var(--text);
}

#mdDocsModal .fs-modal__body,
#autoConnModal .fs-modal__body{
  padding: 14px 14px 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce){
  #autoConnModal .fs-modal__panel{ transition: none; }
}

/* =========================================================
   Conexiones automáticas: Horarios (cards)
   CSS acotado al modal para no afectar a otras pantallas
   ========================================================= */

#autoConnModal .acs{
  display:flex;
  flex-direction:column;
  gap: 12px;
}

#autoConnModal .acs__list{
  display:flex;
  flex-direction:column;
  gap: 12px;
}

#autoConnModal .acs-card{
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
}

#autoConnModal .acs-card.is-saving{
  opacity: .75;
}

#autoConnModal .acs-card__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}

#autoConnModal .acs-card__title{
  font-weight: 900;
  font-size: 14px;
}

#autoConnModal .acs-card__del{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
}

#autoConnModal .acs-card__row--active{
  margin-bottom: 10px;
}


#autoConnModal .acs-switch{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

#autoConnModal .acs-switch__text{
  font-weight: 900;
}

#autoConnModal .acs-switch__wrap{
  position: relative;
  width: 52px;
  height: 32px;
  flex: 0 0 auto;
}

#autoConnModal .acs-switch__input{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  opacity:0;
  margin:0;
  cursor:pointer;
}

#autoConnModal .acs-switch__slider{
  position:absolute;
  inset:0;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid var(--border);
  transition: background .15s ease, border-color .15s ease;
}

#autoConnModal .acs-switch__slider::after{
  content:"";
  position:absolute;
  top: 50%;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: rgba(255,255,255,.85);
  transition: transform .15s ease;
}

#autoConnModal .acs-switch__input:checked + .acs-switch__slider{
  background: rgba(34,197,94,.25);
  border-color: rgba(34,197,94,.40);
}

#autoConnModal .acs-switch__input:checked + .acs-switch__slider::after{
  transform: translate(20px, -50%);
}

#autoConnModal .acs-switch__input:focus-visible + .acs-switch__slider{
  outline: 2px solid rgba(124,58,237,.45);
  outline-offset: 2px;
}

#autoConnModal .acs-card__del:active{ transform: translateY(1px); }


#autoConnModal .acs-card__grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 520px){
  #autoConnModal .acs-card__grid{
    grid-template-columns: 1.1fr 1fr;
    align-items:start;
  }
}

#autoConnModal .acs-days{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

#autoConnModal .acs-day{
  display:flex;
  align-items:center;
  gap: 10px;
  font-weight: 800;
}

#autoConnModal .acs-day__chk{
  width: 18px;
  height: 18px;
}

#autoConnModal .acs-times{
  display:flex;
  flex-direction:column;
  gap: 12px;
}

#autoConnModal .acs-time__label{
  font-weight: 900;
  margin-bottom: 6px;
}

#autoConnModal .acs-time__controls{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#autoConnModal .acs-time__controls .select{
  min-width: 0;
  width: 100%;
  height: 44px;
  padding: 10px 12px;
}



/* Ajustes tema claro (horarios) */
body.theme-light #autoConnModal .acs-card{
  background: rgba(15,23,42,.03);
  border-color: rgba(15,23,42,.12);
}

body.theme-light #autoConnModal .acs-card__del{
  background: rgba(15,23,42,.04);
  border-color: rgba(15,23,42,.12);
}

body.theme-light #autoConnModal .acs-switch__slider{
  background: rgba(15,23,42,.10);
  border-color: rgba(15,23,42,.12);
}

body.theme-light #autoConnModal .acs-switch__slider::after{
  background: #FFFFFF;
  box-shadow: 0 6px 14px rgba(2,6,23,.12);
}

/* Mis documentos: el botón no debe heredar la rejilla */
#btnViewDocs{
  grid-column: 1 / -1; /* ocupa todas las columnas */
  width: 100%;
  display: block;
}

/* ==========================================================
   MIS DATOS – LOADING GLOBAL (FINAL)
   - Tapa TODAS las cards del tab #tab-me
   - Sustituye el loader viejo #md_loading/.md-loading
   ========================================================== */

/*  Apagar loader viejo (aunque exista en el HTML) */
#tab-me #md_loading,
#tab-me .md-loading{
  display: none !important;
}

/* Contenedor en carga */
#tab-me.is-loading{
  pointer-events: none; /* no tocar mientras carga */
}

/* Cada card: la “tapeamos” con shimmer */
#tab-me.is-loading .card{
  position: relative;
  overflow: hidden;
  min-height: 84px; /*  asegura que se vea el efecto aunque la card tenga poco contenido */
}

/* Ocultamos el contenido real pero mantiene el alto */
#tab-me.is-loading .card > *{
  visibility: hidden;
}

/* Shimmer encima (usa tu @keyframes weeyShimmer existente en Cobros) */
#tab-me.is-loading .card::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,.08),
    rgba(255,255,255,.18),
    rgba(255,255,255,.08)
  );
  animation: weeyShimmer 1.1s infinite;
}

/* Tema claro */
body.theme-light #tab-me.is-loading .card::before{
  background: linear-gradient(
    90deg,
    rgba(0,0,0,.04),
    rgba(0,0,0,.08),
    rgba(0,0,0,.04)
  );
}
.contract-link.is-disabled,
.contract-link:disabled{
  opacity: .45;
  cursor: not-allowed;
  text-decoration: none !important;
}

/* Estados de botones deshabilitados */
button.is-disabled,
button:disabled{
  opacity: .45;
  cursor: not-allowed;
}

/* Mis datos: campos obligatorios faltantes */
#mdEditModal .md-missing{
  border-color: rgba(239,68,68,.75) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.18) !important;
}

/* si son inputs con fondo oscuro, mejora contraste del placeholder */
#mdEditModal .md-missing::placeholder{
  opacity: .9;
}

/* Botón Leer contrato (modal Editar mis datos) */
.contract-link{
  display: block;
  width: 100%;
  margin: 14px 0 12px; /* ↑ separa del texto / ↓ separa del botón Enviar */
}

/* ===== FIX iOS: PDF siempre dentro del modal ===== */
#payPdfModal .modal__sheet--full{
  height: 100dvh !important;
}

#payPdfModal .modal__head{
  flex: 0 0 auto;
}

#payPdfModal .modal__iframe{
  display: block;
  width: 100%;
  height: calc(100dvh - var(--payPdfHeadH, 56px)) !important;
  border: 0;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #fff;
}

#payWithdrawClose::before{
  content: "×" !important;
  font-family: inherit !important;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}


/* ==========================================================
   DESKTOP BACKOFFICE
   - Solo se activa cuando body.desktop-backoffice está presente
   - No afecta al PWA (standalone) ni a móvil
   ========================================================== */

body.desktop-backoffice{
  --desk-sidebar-w: 260px;
  --desk-max-w: min(1280px, 96vw);
}

/* El “marco móvil” pasa a ser un contenedor normal centrado */
body.desktop-backoffice .desktop-stage{
  padding: 28px;
  gap: 0;
}

body.desktop-backoffice .device-frame{
  width: var(--desk-max-w);
  height: min(900px, 92vh);
  border-radius: 24px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

body.desktop-backoffice .device-notch{ display:none; }

body.desktop-backoffice .device-screen{
  height: 100%;
  border-radius: 24px;
  background: rgba(7,10,18,.88);
  border: 1px solid rgba(255,255,255,.08);
}

/* MAIN en 2 columnas: sidebar (nav.tabbar) + contenido */
body.desktop-backoffice #screen-main.screen{
  display: grid;
  grid-template-columns: var(--desk-sidebar-w) 1fr;
  grid-template-rows: 1fr;
  height: 100%;
}

/* Sidebar reutilizando la tabbar */
body.desktop-backoffice #screen-main .tabbar{
  position: sticky;
  top: 0;
  left: auto;
  bottom: auto;
  transform: none;

  width: 200px;          /* <-- antes auto */
  min-width: 200px;
  flex: 0 0 200px;       /* <-- clave: no crecer */

  height: 100%;
  padding: 18px 14px;
  border-top: 0;
  border-right: 1px solid rgba(255,255,255,.08);
  /*background: linear-gradient(180deg, rgba(17,24,39,.72), rgba(7,10,18,.92));*/
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 8;

  align-items: stretch;  /* botones a ancho completo */
}

/* Contenedor: sidebar izquierda + contenido derecha */
body.desktop-backoffice #screen-main{
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}


body.desktop-backoffice #screen-main .tabbar__item{
  flex-direction: row;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 16px;
}

body.desktop-backoffice #screen-main .tabbar__label{
  font-size: 13px;
}

/* Contenido a la derecha */
body.desktop-backoffice #screen-main > main.content{
  grid-column: 2;
  padding: 22px 22px 22px 22px;
  overflow: auto;
}

/* En escritorio ya no necesitamos “espacio para tabbar inferior” */
body.desktop-backoffice .content--with-tabs{
  padding-bottom: 22px;
}

/* Barras “fixed” pasan a sticky dentro del panel para no salirse */
body.desktop-backoffice #tab-ia .ia-top--fixed,
body.desktop-backoffice #tab-list .callsBar--fixed,
body.desktop-backoffice #tab-pay .payBar--fixed{
  position: sticky !important;
  top: 0 !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  transform: none !important;
}

body.desktop-backoffice #tab-ia:not([hidden]) .ia-compose{
  position: sticky !important;
  bottom: 0 !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  max-width: none !important;
  transform: none !important;
  margin: 0 !important;
  border-radius: 18px !important;
}

/* Modales: en backoffice mantenemos fullscreen (no embebido) */
body.desktop-backoffice #mdDocsModal.fs-modal,
body.desktop-backoffice #payPdfModal,
body.desktop-backoffice .img-modal{
  padding: 0;
}


/* ==========================================================
   FIX: Auth centrado en DESKTOP-SHELL (móvil embebido)
   Motivo: --auth-w usa 100vw (viewport) y puede desbordar el marco.
   Solución: en shell, medir contra el contenedor (100%) y no contra el viewport.
   ========================================================== */
body.desktop-shell #screen-auth .install--top,
body.desktop-shell #screen-auth .content > .card{
  width: min(420px, calc(100% - 32px)) !important;
}

body.desktop-shell{
  --shell-w: min(420px, 94vw);
  --shell-h: min(860px, 92vh);
}

/* Re-encapsular elementos fixed que en escritorio se van al viewport */
body.desktop-shell #tab-ia .ia-top--fixed,
body.desktop-shell #tab-list .callsBar--fixed,
body.desktop-shell #tab-pay .payBar--fixed{
  left: 50% !important;
  right: auto !important;
  width: var(--shell-w) !important;
  transform: translateX(-50%) !important;
}

body.desktop-shell #tab-ia:not([hidden]) .ia-compose{
  left: 50% !important;
  right: auto !important;
  width: var(--shell-w) !important;
  max-width: var(--shell-w) !important;
  transform: translateX(-50%) !important;
  margin: 0 !important;
  border-radius: 18px !important;
  border-left: 1px solid var(--border) !important;
  border-right: 1px solid var(--border) !important;
}

/* Docs modal: panel dentro del “móvil” */
/*body.desktop-shell #mdDocsModal.fs-modal{
  align-items: center;
  padding: 18px;
}
body.desktop-shell #mdDocsModal .fs-modal__panel{
  width: var(--shell-w);
  height: var(--shell-h);
  border-radius: 24px;
  overflow: hidden;
} */

/* PDF modal: sheet full centrada dentro del “móvil” */
body.desktop-shell #payPdfModal{
  padding: 18px;
  align-items: center;
}
body.desktop-shell #payPdfModal .modal__sheet--full{
  width: var(--shell-w);
  height: var(--shell-h);
  border-radius: 24px;
}

/* Withdraw modal: limitar ancho */
body.desktop-shell #payWithdrawModal .modal__sheet{
  width: var(--shell-w);
}

/* Image modal: limitar tamaño visible */
body.desktop-shell .img-modal{
  padding: 18px;
}
body.desktop-shell .img-modal__img{
  max-width: var(--shell-w);
  max-height: var(--shell-h);
}

/* ==========================================================
   DESKTOP BACKOFFICE (solo escritorio web)
   - Menu lateral a la izquierda
   - Cuerpo a la derecha (ancho normal)
   - NO afecta a PWA porque la clase la pone JS solo en web
   ========================================================== */
@media (min-width: 980px){
  body.desktop-backoffice .desktop-stage{
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    gap: 0;
  }

  body.desktop-backoffice .device-frame{
    width: min(1240px, 96vw);
    height: calc(100vh - 48px);
    border-radius: 28px;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  body.desktop-backoffice .device-notch{ display:none; }
  body.desktop-backoffice .desktop-hint{ display:none !important; }

  body.desktop-backoffice .device-screen{
    height: 100%;
    border-radius: 28px;
    overflow: hidden;
    position: relative;
    background:
      radial-gradient(1200px 800px at 30% 10%, rgba(124,58,237,.18), transparent 55%),
      radial-gradient(1200px 800px at 70% 90%, rgba(34,197,94,.12), transparent 55%),
      rgba(7,10,18,.92);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: var(--shadow);
  }

  body.desktop-backoffice #app,
  body.desktop-backoffice #screen-main{ height: 100%; }

  body.desktop-backoffice .tabbar{
    position: absolute;
    left: 18px;
    top: 82px;
    bottom: 18px;
    width: 220px;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(7,10,18,.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  body.desktop-backoffice .tabbar__item{
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 14px;
  }
  body.desktop-backoffice .tabbar__label{
    font-size: 13px;
    font-weight: 900;
  }

  body.desktop-backoffice #screen-main .content--with-tabs{
    padding-bottom: 18px;
    padding-left: 260px;
    padding-right: 24px;
  }

  body.desktop-backoffice .topbar,
  body.desktop-backoffice .payBar,
  body.desktop-backoffice .callsBar{
    padding-left: 24px;
    padding-right: 24px;
  }

  body.desktop-backoffice .topbar{
    position: sticky;
    top: 0;
    z-index: 90;
    background: linear-gradient(180deg, rgba(7,10,18,.92), rgba(7,10,18,.72));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255,255,255,.08);
  }

  body.theme-light.desktop-backoffice .tabbar{
    background: rgba(255,255,255,.78);
    border-color: rgba(0,0,0,.10);
  }
  body.theme-light.desktop-backoffice .device-screen{
    background:
      radial-gradient(1200px 800px at 30% 10%, rgba(124,58,237,.08), transparent 55%),
      radial-gradient(1200px 800px at 70% 90%, rgba(34,197,94,.06), transparent 55%),
      rgba(255,255,255,.92);
    border-color: rgba(0,0,0,.10);
  }
  body.theme-light.desktop-backoffice .topbar{
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(249,250,251,.86));
    border-bottom: 1px solid rgba(0,0,0,.08);
  }
}
/* En escritorio web: nunca mostrar el bloqueo “Solo vertical” */
body.desktop-backoffice #orientationBlock,
body.desktop-shell #orientationBlock{
  display: none !important;
}
/* En escritorio web: nunca mostrar el bloqueo “Solo vertical” */
body.desktop-backoffice #orientationBlock,
body.desktop-shell #orientationBlock{
  display: none !important;
}

/* Solo móvil: mostrar bloqueo en landscape */
@media (orientation: landscape) and (max-width: 979px){
  #orientationBlock{ display: flex; }
}

/* Seguridad: pantallas grandes nunca */
@media (min-width: 980px){
  #orientationBlock{ display: none !important; }
}
/* ==========================================================
   DESKTOP BACKOFFICE LAYOUT
   Sidebar izquierda + contenido derecha
   ========================================================== */
body.desktop-backoffice #screen-main{
  display: grid;
  grid-template-columns: 200px 1fr;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}
/* ==========================================================
   INSTALL OVERLAY (registro) - solo cuando NO está instalada
   - No afecta a PWA/standalone (se controla por JS)
   ========================================================== */
#screen-auth .installOverlay{
  position: fixed;
  inset: 0;
  z-index: 50000;
  display: grid;

  align-items: start; /* arriba */
  justify-items: center;

  padding: 16px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 62px); /* 12px + ~50px */

}

#screen-auth .installOverlay[hidden]{
  display: none !important;
}

#screen-auth .installOverlay__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  z-index: 1; /* ✅ NUEVO: siempre por debajo de la caja */
}

#screen-auth .install--sheet{
  position: relative;
  z-index: 2; /* ✅ NUEVO: siempre por encima del backdrop */

  width: min(520px, calc(100vw - 24px));

  margin-top: 0;     /* arriba */
  margin-bottom: 0;  /* ya no abajo */

  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(17,24,39,.92);
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  padding: 16px;
	
/* ✅ NUEVO: que NO se vea “lavado” */
  background: rgba(17,24,39,.98);   /* antes .92 */
  color: var(--text);
  opacity: 1 !important;
  filter: none !important;
}

#screen-auth .install--sheet .install__text{
  color: rgba(229,231,235,.92);
}

#screen-auth .install--sheet.install{
  background: rgba(17,24,39,.98) !important;
}

#screen-auth .install--sheet .install__title{
  margin-bottom: 8px;
  color:#fff;
}

#screen-auth .iosIcon{
  display: inline-flex;
  width: 18px;
  height: 18px;
  vertical-align: -3px;
  margin: 0 6px;
  opacity: .95;
}
#screen-auth .iosIcon svg{
  width: 100%;
  height: 100%;
}
/* IA: Botón flotante para bajar al último mensaje */
.ia-fab-down{
  position: fixed;
  right: 16px;

  /* Lo subimos para que no choque con el composer inferior */
  bottom: calc(195px + env(safe-area-inset-bottom, 0px));

  width: 46px;
  height: 46px;
  border-radius: 999px;

  display: none; /* se muestra/oculta por JS */
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255,255,255,.14);
  background: rgba(20,20,20,.65);
  color: #fff;

  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  cursor: pointer;
  z-index: 9999;
}

.ia-fab-down:active{
  transform: translateY(1px);
}

.ia-fab-down svg{
  display: block;
}
@media (display-mode: standalone) {
  #tab-ia .ia-log{
    padding-bottom: calc(var(--ia-compose-h) + 26px) !important;
  }
}

/* ==========================================================
   PATCH: DESKTOP SHELL - Encapsular TODO lo "fixed" dentro del marco
   Motivo: en desktop, position:fixed se va al viewport (fuera del móvil).
   ========================================================== */

/* 1) El marco debe ser el "contenedor" de los fixed */
body.desktop-shell .device-screen{
  position: relative;         /* referencia para absolute */
  transform: translateZ(0);   /* hace que muchos fixed se "contengan" en desktop */
}

/* 2) TABBAR: en shell NO puede ser fixed al viewport */
body.desktop-shell .tabbar{
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  max-width: none !important;
  transform: none !important;
  border-radius: 0 0 38px 38px; /* opcional: respeta el marco */
}

/* 3) TOPBARS "fixed": deben vivir dentro del device-screen */
body.desktop-shell #tab-ia .ia-top--fixed,
body.desktop-shell #tab-list .callsBar--fixed,
body.desktop-shell #tab-pay .payBar--fixed{
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  width: 100% !important;
  transform: none !important;
}

/* 4) IA COMPOSER: dentro del marco, encima de la tabbar */
body.desktop-shell #tab-ia:not([hidden]) .ia-compose{
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: none !important;
  transform: none !important;

  bottom: var(--tabbar-h) !important; /* justo encima del menú */
  border-radius: 0 0 38px 38px;       /* opcional */
  margin: 0 !important;
}

/* 5) El log de IA necesita espacio para header + composer dentro del marco */
body.desktop-shell #tab-ia .ia-log{
  padding-top: calc(var(--ia-top-h, 64px) + 12px) !important;
  padding-bottom: calc(var(--tabbar-h) + var(--ia-compose-h) + 18px) !important;
}

/* 6) En desktop-shell NO queremos safe-area (es móvil). Evita offsets raros */
body.desktop-shell #tab-ia .ia-top--fixed{
  top: 0 !important;
}

/* ==========================================================
   FIX SCROLL: Desktop-shell debe scrollear dentro del “móvil”
   - No afecta a móvil ni a PWA standalone
   ========================================================== */
body.desktop-shell .device-screen{
  overflow: hidden; /* mantenemos el recorte del marco */
}

/* El contenedor scroll debe adaptarse al alto del marco, no al viewport */
body.desktop-shell #screen-main{
  height: 100% !important;          /* en vez de 100dvh */
  overflow: auto !important;         /* scroll dentro del móvil */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Asegura que el main de tabs ocupe bien el alto disponible */
body.desktop-shell #screen-main > main.content{
  height: 100%;
  min-height: 0;
}

/* Importante: evita que algún tab “bloquee” el scroll por overflow hidden */
body.desktop-shell #screen-main .tab{
  overflow: visible;
}
/* ==========================================================
   REMOVE FAKE IPHONE NOTCH / SPEAKER (DESKTOP SHELL ONLY)
   ========================================================== */

/* Notch / speaker decorativo */
body.desktop-shell .device-notch,
body.desktop-shell .device-top,
body.desktop-shell .iphone-notch,
body.desktop-shell .device-sensor,
body.desktop-shell .device-frame::before,
body.desktop-shell .device-frame::after,
body.desktop-shell .device-screen::before,
body.desktop-shell .device-screen::after {
  display: none !important;
  content: none !important;
}

/* Asegura que nada reserve espacio arriba */
body.desktop-shell .device-screen{
  padding-top: 0 !important;
}
/* ==========================================================
   DESKTOP SHELL: que el scroll llegue hasta el final
   - El tabbar va encima (overlay), así que reservamos espacio abajo
   ========================================================== */

/* El contenedor scroll dentro del marco */
body.desktop-shell #screen-main{
  padding-bottom: calc(var(--tabbar-h) + 18px) !important; /* espacio para no tapar el final */
  scroll-padding-bottom: calc(var(--tabbar-h) + 18px) !important; /* para anchors/scrollIntoView */
}

/* Por si algún tab tiene su propio padding o layout */
body.desktop-shell #screen-main .tab{
  padding-bottom: calc(var(--tabbar-h) + 18px) !important;
}

/* Si usas content con padding propio, esto evita que el último bloque quede oculto */
body.desktop-shell #screen-main > main.content{
  padding-bottom: calc(var(--tabbar-h) + 18px) !important;
}

/* ==========================================================
   FIX IA iOS: el scroll no llega al final (faltan ~20px)
   - Solo afecta a la pantalla IA
   - No rompe otras pantallas ni desktop
   ========================================================== */

#tab-ia .ia-log{
  /* reserva extra para: composer + tabbar + safe-area + margen */
  padding-bottom: calc(
    var(--tabbar-h) +
    var(--ia-compose-h) +
    env(safe-area-inset-bottom, 0px) +
    18px
  ) !important;
}

/* ==========================================================
   FIX IA: descripciones debajo de fotos no visibles
   - Asegura que el texto no quede colapsado por overflow/altura
   ========================================================== */

/* Contenedor de cada resultado IA con imagen */
#tab-ia .ia-log .ia-card,
#tab-ia .ia-log .ia-item,
#tab-ia .ia-log .ia-result{
  height: auto !important;
  min-height: unset !important;
  overflow: visible !important;
}

/* Imagen: que no se coma todo el alto */
#tab-ia .ia-log img{
  display: block;
  height: auto !important;
  max-height: none !important;
}

/* Texto descriptivo debajo de la imagen */
#tab-ia .ia-log .caption,
#tab-ia .ia-log .description,
#tab-ia .ia-log p,
#tab-ia .ia-log .text{
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  max-height: none !important;
  overflow: visible !important;

  /* por si había line-clamp */
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: unset !important;
}

/* Captions debajo de las fotos (IA gallery thumbs) */
.thumb { text-align: left; }

.thumb__cap{
  padding: 8px 6px 2px 6px;
}

.thumb__title{
  font-weight: 900;
  font-size: 13px;
  line-height: 1.15;
}

.thumb__addr{
  margin-top: 3px;
  opacity: .75;
  font-size: 12px;
  line-height: 1.2;
}

/* =========================================================
   MODAL FULLSCREEN: Mis notas
   (scoped a #notesModal para NO romper nada)
   ========================================================= */

#notesModal.fs-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

#notesModal[hidden]{ display:none !important; }

#notesModal .fs-modal__panel{
  width: 100%;
  height: 100%;
  background: var(--card);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .22s ease;
  will-change: transform;
}

#notesModal.is-open .fs-modal__panel{
  transform: translateY(0);
}

#notesModal .fs-modal__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

#notesModal .fs-modal__title{
  font-weight: 900;
  font-size: 16px;
  color: var(--text);
}

#notesModal .fs-modal__body{
  padding: 14px 14px 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce){
  #notesModal .fs-modal__panel{ transition: none; }
}


/* =========================================================
   MODAL Mis notas - layout correcto (solo #notesModal)
   Nueva nota izquierda | 0/250 derecha
   textarea ancho completo | botón debajo
   ========================================================= */

#notesModal.weey-notes-modal .weey-notes-modal__meta{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 12px 0;
}

/* Forzar: label a la izquierda, contador a la derecha
   (aunque en el HTML venga primero el contador) */
#notesModal.weey-notes-modal .weey-notes-modal__label{
  order: 1;
  font-weight: 900;
}

#notesModal.weey-notes-modal .weey-notes-modal__count{
  order: 2;
  margin-left: auto;
  font-weight: 900;
  opacity: .85;
}

/* Textarea: ancho completo */
#notesModal.weey-notes-modal .weey-notes-modal__ta{
  width: 100%;
  display: block;
  min-height: 140px;
  resize: none;
  margin: 0 0 12px 0;
}

/* Botón debajo del textarea */
#notesModal.weey-notes-modal .weey-notes-modal__save{
  width: 100%;
  display: block;
  margin: 0 0 14px 0;
}

/* Lista */
#notesModal.weey-notes-modal .weey-notes-modal__list{
  margin-top: 10px;
}
/* Conexiones automáticas – layout limpio */

#autoConnModal .fs-modal__body{
  padding-top: 0;
  padding-left: 14px;
  padding-right: 14px;
  padding-bottom: 20px;
}

#autoConnModal .acs-actions{
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card);
  padding: 14px 0 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

#autoConnModal .acs-list{
  display: flex;
  flex-direction: column;
  gap: 20px;
}
/* ===== Cobros: etiqueta "Fichas" con icono ===== */
.payTokensLabel{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.payTokensIcon{
  width: 18px;
  height: 18px;
  display: inline-flex;
}

.payTokensIcon svg{
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

/* ===== Cobros: "Llamadas:" en negrita y verde oscuro ===== */
.payCallsLabel{
  font-weight: 900;
  color: #14532d;
}
/* =========================================================
   MODAL FULLSCREEN: Mis Anuncios
   (scoped a #adsModal para NO romper nada)
   ========================================================= */

#adsModal.fs-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

#adsModal .fs-modal__panel{
  width: 100%;
  height: 100%;
  background: var(--card);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .22s ease;
  will-change: transform;
}

#adsModal.is-open .fs-modal__panel{
  transform: translateY(0);
}

#adsModal .fs-modal__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

#adsModal .fs-modal__title{
  font-weight: 900;
  font-size: 16px;
  color: var(--text);
}

#adsModal .fs-modal__body{
  padding: 14px 14px 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Grid 2 por fila */
#adsModal .ads-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Miniatura */
#adsModal .ads-item{
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  aspect-ratio: 1 / 1;
}

#adsModal .ads-item img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* City encima si existe */
#adsModal .ads-city{
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 6px 8px;
  border-radius: 300px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: .2px;
  background: rgba(0,0,0,.55);
  color: #fff;
  max-width: calc(100% - 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Placeholder si no hay foto */
#adsModal .ads-ph{
  width: 100%;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  opacity: .7;
}

@media (prefers-reduced-motion: reduce){
  #adsModal .fs-modal__panel{ transition: none; }
}
/* ===== Mis Anuncios: form vertical (como Mis Documentos) ===== */
#adsModal .ads-add-form{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Alto “campo normal” */
#adsModal #adsServiceSelect{
  height: 48px;
  min-height: 48px;
  width: 100%;
  display: block;
  box-sizing: border-box;
}

/* Botón debajo y ancho completo */
#adsModal #adsAddBtn{
  width: 100%;
  display: block;
}

/* =========================================================
   MODAL FULLSCREEN: Nuevo anuncio
   (scoped a #adNewModal para NO afectar nada fuera)
   ========================================================= */

#adNewModal.fs-modal{
  position: fixed;
  inset: 0;
  z-index: 10000; /* por encima de Mis Anuncios */
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

#adNewModal .fs-modal__panel{
  width: 100%;
  height: 100%;
  background: var(--card);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .22s ease;
  will-change: transform;
}

#adNewModal.is-open .fs-modal__panel{
  transform: translateY(0);
}

#adNewModal .fs-modal__head{
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: var(--card);
}

#adNewModal .fs-modal__title{
  font-weight: 900;
  font-size: 16px;
  color: var(--text);
}

#adNewModal .fs-modal__body{
  padding: 14px 14px 20px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce){
  #adNewModal .fs-modal__panel{ transition: none; }
}

/* =========================================================
   NUEVO ANUNCIO – Miniaturas (2 por fila)
   (scoped a #adNewModal)
   ========================================================= */

#adNewModal .ad-photos-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

#adNewModal .ad-photo{
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  aspect-ratio: 1 / 1;
}

#adNewModal .ad-photo img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== Imagen principal (miniaturas) ===== */
#adNewModal .ad-photo{
  cursor: pointer;
}

#adNewModal .ad-photo.is-principal{
  border: 2px solid #22c55e !important;
}

#adNewModal .ad-principal-badge{
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(0,0,0,.55);
  color: #fff;
  z-index: 2;
  pointer-events: none;
}

#adNewModal .ad-principal-badge .dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,.25);
}

/* =========================================================
   NUEVO ANUNCIO – Cropper overlay fullscreen (igual que Mis Documentos)
   (scoped a #adNewModal)
   ========================================================= */

#adNewModal.is-cropping #ad_crop_wrap.md-crop{
  position: fixed;
  inset: 0;
  z-index: 10050;
  margin: 0;
  border: 0;
  border-radius: 0;

  /* ✅ más parecido a Mis Documentos (menos margen) */
  padding: 12px;

  display: flex;
  flex-direction: column;
  gap: 14px;

  background: rgba(0,0,0,.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* Oculta lo de detrás mientras recortas */
#adNewModal.is-cropping .fs-modal__body{
  overflow: hidden;
}

#adNewModal.is-cropping .md-crop__stage{
  flex: 1 1 auto;
  height: auto;
  max-height: calc(100dvh - 170px);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
}

#adNewModal.is-cropping .md-crop__img{
  width: 100%;
  height: 100%;
  object-fit: contain;

  /* ❌ eliminado: transform: none; (NO vale, puede estorbar y romper ajustes) */
  filter: none;
}

#adNewModal.is-cropping .md-crop__box{
  border: 2px solid rgba(255,255,255,.92);
  border-radius: 14px;
  box-shadow:
    0 16px 60px rgba(0,0,0,.55),
    0 0 0 9999px rgba(0,0,0,.55);
}

#adNewModal.is-cropping .md-crop__actions{
  position: sticky;
  bottom: 0;
  z-index: 10060;

  display: flex;
  gap: 12px;
  justify-content: space-between;

  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-radius: 16px;

  background: rgba(10,10,10,.92);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
}

#adNewModal.is-cropping .md-crop__actions button{
  flex: 1 1 0;
  height: 44px;
  border-radius: 14px;
  font-weight: 700;
  letter-spacing: .2px;
  opacity: 1 !important;
  filter: none !important;
}

#adNewModal.is-cropping .md-crop__actions button:first-child{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
}

#adNewModal.is-cropping .md-crop__actions button:last-child{
  background: #fff;
  border: 1px solid rgba(255,255,255,.22);
  color: #111;
}

#adNewModal.is-cropping .md-crop__actions button:active{
  transform: scale(.98);
}

/* ===== Mis Documentos: Cropper fullscreen SOLO cuando está activo ===== */
#mdDocsModal.is-cropping #md_crop_wrap.md-crop{
  position: fixed;
  inset: 0;
  z-index: 10010;              /* por encima del panel */
  background: rgba(0,0,0,.86); /* el “fondo negro bonito” */
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* el escenario ocupa el espacio disponible */
#mdDocsModal.is-cropping .md-crop__stage{
  flex: 1 1 auto;
  height: auto;               /* deja de ser 320px */
  max-height: calc(100dvh - 140px);
  border-radius: 18px;
  padding-bottom: 64px;
}

/* acciones abajo */
#mdDocsModal.is-cropping .md-crop__actions{
  flex: 0 0 auto;
}
/* ===== Cropper fullscreen: acciones visibles ===== */
#mdDocsModal.is-cropping .md-crop__actions{
  position: sticky;
  bottom: 0;
  z-index: 10020;              /* por encima del fondo negro */
  background: rgba(0,0,0,.86);
  padding: 12px 0 env(safe-area-inset-bottom);
}

/* =========================================================
   MIS DOCUMENTOS – CROP OVERLAY BONITO (FULLSCREEN)
   ========================================================= */

/* 1) El cropper pasa a overlay fullscreen */
#mdDocsModal.is-cropping #md_crop_wrap.md-crop{
  position: fixed;
  inset: 0;
  z-index: 10050;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;

  /* Fondo “pro” */
  background: rgba(0,0,0,.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* 2) Oculta el footer del modal base mientras recortas
      (esto elimina los botones “tenues” de debajo) */
#mdDocsModal.is-cropping .fs-modal__footer{
  visibility: hidden;
}

/* 3) El escenario del crop ocupa el alto disponible */
#mdDocsModal.is-cropping .md-crop__stage{
  flex: 1 1 auto;
  height: auto;
  max-height: calc(100dvh - 170px); /* deja sitio a la barra inferior */
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
}

/* 4) Imagen centrada y sin “cosas raras” */
#mdDocsModal.is-cropping .md-crop__img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
  filter: none;
}

/* 5) Marco del recorte más “premium” */
#mdDocsModal.is-cropping .md-crop__box{
  border: 2px solid rgba(255,255,255,.92);
  border-radius: 14px;
  box-shadow:
    0 16px 60px rgba(0,0,0,.55),
    0 0 0 9999px rgba(0,0,0,.55);
}

/* 6) Barra inferior propia (no transparente) */
#mdDocsModal.is-cropping .md-crop__actions{
  position: sticky;
  bottom: 0;
  z-index: 10060;

  display: flex;
  gap: 12px;
  justify-content: space-between;

  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-radius: 16px;

  background: rgba(10,10,10,.92);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
}

/* 7) Botones bonitos y legibles (sin tenues) */
#mdDocsModal.is-cropping .md-crop__actions button{
  flex: 1 1 0;
  height: 44px;
  border-radius: 14px;
  font-weight: 700;
  letter-spacing: .2px;

  opacity: 1 !important;
  filter: none !important;
}

/* Cancelar */
#mdDocsModal.is-cropping .md-crop__actions button:first-child{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
}

/* Aceptar */
#mdDocsModal.is-cropping .md-crop__actions button:last-child{
  background: #fff;
  border: 1px solid rgba(255,255,255,.22);
  color: #111;
}

/* 8) Pequeño feedback al tocar */
#mdDocsModal.is-cropping .md-crop__actions button:active{
  transform: scale(.98);
}
/* =========================================================
   AD NEW – Cropper (base + overlay) – FIX definitivo
   scoped a #adNewModal para NO afectar nada fuera
   ========================================================= */

#adNewModal .md-crop__card{
  /* en tu HTML existe md-crop__card, necesitamos que sea columna */
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

/* Stage con layout real (como mdDocs) */
#adNewModal .md-crop__stage{
  position: relative;
  width: 100%;
  height: 320px;              /* base (fuera de overlay) */
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,.35);
}

/* Imagen: SIEMPRE ocupa el stage */
#adNewModal .md-crop__img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 1;
}

/* 🔥 ESTA es la culpable del “no se ve nada” en tu screenshot */
#adNewModal .md-crop__shade{
  display: none !important;
}

/* Caja encima */
#adNewModal .md-crop__box{
  position: absolute;
  z-index: 3;
  border: 2px solid rgba(255,255,255,.92);
  border-radius: 14px;
  box-shadow:
    0 16px 60px rgba(0,0,0,.55),
    0 0 0 9999px rgba(0,0,0,.55);
  touch-action: none;
}

/* Handle encima de todo */
#adNewModal .md-crop__handle{
  position: absolute;
  width: 18px;
  height: 18px;
  right: -9px;
  bottom: -9px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  z-index: 4;
}

/* ===== Overlay fullscreen cuando recortas ===== */
#adNewModal.is-cropping #ad_crop_wrap.md-crop{
  position: fixed;
  inset: 0;
  z-index: 10050;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(0,0,0,.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* Oculta scroll del body del modal base */
#adNewModal.is-cropping .fs-modal__body{
  overflow: hidden;
}

/* El stage ahora ocupa el alto disponible (aquí SI funciona porque md-crop__card es flex) */
#adNewModal.is-cropping .md-crop__stage{
  flex: 1 1 auto;
  height: auto;
  min-height: 220px;
  max-height: calc(100dvh - 170px);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,.06);
}

/* Acciones abajo */
#adNewModal.is-cropping .md-crop__actions{
  position: sticky;
  bottom: 0;
  z-index: 10060;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-radius: 16px;
  background: rgba(10,10,10,.92);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
}

#adNewModal.is-cropping .md-crop__actions button{
  flex: 1 1 0;
  height: 44px;
  border-radius: 14px;
  font-weight: 700;
  letter-spacing: .2px;
  opacity: 1 !important;
  filter: none !important;
}

#adNewModal.is-cropping .md-crop__actions button:first-child{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
}

#adNewModal.is-cropping .md-crop__actions button:last-child{
  background: #fff;
  border: 1px solid rgba(255,255,255,.22);
  color: #111;
}

#adNewModal.is-cropping .md-crop__actions button:active{
  transform: scale(.98);
}
/* ===============================
   BOTONES FULL WIDTH  SOLO LOS GRANDES
   =============================== */

/* Botn Aadir foto / Subir vdeo */
#adNewModal .btn-add-photo,
#adNewModal .btn-add-video {
  width: 100%;
  display: block;
}

/* Botn Guardar / Publicar */
#adNewModal .btn-save,
#adNewModal .btn-publish {
  width: 100%;
  display: block;
  margin-top: 16px;
  margin-bottom: 20px;
}

/* ===============================
   EXCLUSIONES EXPLCITAS
   =============================== */

/* Botn cerrar (X) */
#adNewModal .fs-modal__close,
#adNewModal .btn-close {
  width: auto !important;
  display: inline-flex;
}

/* Botn Mejorar con IA */
#adNewModal .btn-ai,
#adNewModal .btn-improve-ai {
  width: auto !important;
  display: inline-flex;
}
/* ===============================
   BOTONES INFERIORES  FULL WIDTH
   SOLO MODAL NUEVO / EDITAR ANUNCIO
   =============================== */

/* Contenedor de los botones inferiores */
#adNewModal .ad-new-actions,
#adNewModal .ad-actions,
#adNewModal .fs-modal__actions {
  display: flex;
  flex-direction: column;   /* CLAVE */
  gap: 12px;
}

/* Botones grandes */
#adNewModal .btn-add-photo,
#adNewModal .btn-add-video,
#adNewModal .btn-publish,
#adNewModal .btn-save {
  width: 100%;
  display: block;
}

/* Seguridad: NO afectar botones pequeos */
#adNewModal .fs-modal__close,
#adNewModal .btn-ai,
#adNewModal .btn-improve-ai {
  width: auto !important;
}
/* =========================================
   FIX DEFINITIVO: BOTONES GRANDES FULL WIDTH
   SOLO EN #adNewModal (no afecta a otros)
   ========================================= */

#adNewModal #adMediaSelect,
#adNewModal #adPublishBtn{
  width: 100% !important;
  display: block !important;
}

/* Si alguna regla los convierte en inline-flex, esto lo neutraliza */
#adNewModal #adMediaSelect,
#adNewModal #adPublishBtn{
  flex: 0 0 auto !important;
  align-self: stretch !important;
  margin-top: 20px;
}
#adNewModal .input::placeholder,
#adNewModal .textarea::placeholder{
  font-weight: 400;
  opacity: .75;
}
#adNewModal .input,
#adNewModal .textarea{
  font-weight: 400;
}
#adNewModal .ad-video-ph{
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
}
#adNewModal .ad-video-ph img{
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  display: block;
}


.img-modal {
  position: fixed;
}

.img-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  font-size: 20px;
  line-height: 36px;
}

/* FIX: botn cerrar visible tambin en theme-light */
#imgModal .img-modal__close{
  color: #fff !important;
  border-color: rgba(255,255,255,.25) !important;
  background: rgba(0,0,0,.35) !important;
}
/* ===== Barra fake subida video (modal anuncios) ===== */
#adNewModal .ad-upload{
  width: 100%;
  margin-top: 12px;
  margin-bottom: 10px;
}

#adNewModal .ad-upload__meta{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  font-weight: 900;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

#adNewModal .ad-upload__track{
  width:100%;
  height: 10px;
  border-radius: 999px;
  overflow:hidden;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
}

body.theme-light #adNewModal .ad-upload__track{
  background: rgba(15,23,42,.06);
  border-color: rgba(15,23,42,.12);
}

#adNewModal .ad-upload__fill{
  height:100%;
  width:0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(124,58,237,.95), rgba(34,197,94,.75));
  transition: width .18s linear;
}

/* Formato del recorte (fcil de cambiar) */
#ad_crop_wrap{
  --crop-ar-w: 3;
  --crop-ar-h: 5;
}
/* Nuevo anuncio: botones aadir foto / vdeo en la misma lnea */
#adNewModal .ad-media-actions{
  display: flex;
  gap: 12px;
}

#adNewModal .ad-media-actions .btn{
  flex: 1;
  width: auto;
}

/* Nuevo anuncio: botones Aadir fotos / Aadir video en la misma lnea */
#adNewModal .ad-media-row{
  display: flex;
  gap: 12px;
}

#adNewModal .ad-media-row > button{
  flex: 1;
  width: auto !important;   /* pisa .btn--wide */
  min-width: 0;
}
.ad-mod-badge{
  position: absolute;
  left: 8px;      /*  ABAJO A LA IZQUIERDA */
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: rgba(0,0,0,.55);
  color: #fff;
  z-index: 3;
  pointer-events: none;
}

#adNewModal .ad-mod-badge.is-normal{ background: rgba(34,197,94,.70); }
#adNewModal .ad-mod-badge.is-erotica{ background: rgba(245,158,11,.75); }
#adNewModal .ad-mod-badge.is-porno{ background: rgba(239,68,68,.80); }
#adNewModal .ad-mod-badge.is-pending{ background: rgba(59,130,246,.70); }

/* Mis Anuncios: 2 lneas encima de la miniatura */
#adsModal .ads-top{
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .2px;
  background: rgba(0,0,0,.60);
  color: #fff;
  max-width: calc(100% - 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#adsModal .ads-sub{
  position: absolute;
  left: 8px;
  top: 38px;
  padding: 5px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: .2px;
  background: rgba(0,0,0,.50);
  color: #fff;
  max-width: calc(100% - 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* === Nuevo anuncio: campos bloqueados (solo edad editable) === */
#adNewModal .weey-locked{
  background: transparent !important;   /* como la pantalla */
  cursor: default;
}

/* Evita que el caret parpadee en algunos mviles */
#adNewModal .weey-locked:focus{
  caret-color: transparent;
}

/* DESKTOP-SHELL: Notas 100% dentro del marco, sin bordes negros */
body.desktop-shell #notesModal.fs-modal{
  position: absolute;
  inset: 0;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 38px;     /* mismo radio que el marco */
  overflow: hidden;        /* recorta en esquinas */
  background: transparent; /* backdrop por ::before */
  z-index: 9999;
}

/* Backdrop dentro del marco */
body.desktop-shell #notesModal.fs-modal::before{
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}

/* Panel por encima */
body.desktop-shell #notesModal .fs-modal__panel{
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 0;
}



