/* ═══ Lunamoon Suite · Ajustes para celular ═══
   Se carga al final de todas las hojas. Reglas generales para que ninguna
   pantalla se salga de lo ancho del teléfono, y ajustes puntuales por página. */

@media (max-width:900px){
  html,body{overflow-x:hidden;}
  html{-webkit-text-size-adjust:100%;text-size-adjust:100%;}
  .content-area{overflow-wrap:break-word;overflow-x:hidden;}
  /* Los elementos de grid/flex no crecen más que la pantalla por un texto largo */
  :where(.content-area,.modal) :where(div,section,article,aside,details,form,fieldset,li,p,h1,h2,h3,h4,label){min-width:0;}
  :where(.content-area,.modal) :where(select,input,textarea,img,video,iframe,pre){max-width:100%;}

  /* Encabezados de página: título arriba, botones abajo y en varias líneas */
  .page-header{flex-wrap:wrap!important;gap:10px 12px!important;}
  .page-header>div:first-child{flex:1 1 220px;}
  .page-header>div:not(:first-child){flex-wrap:wrap;}

  /* Ventanas: hoja que sube desde abajo, a todo lo ancho */
  .modal-overlay{align-items:flex-end;}
  .modal{width:100%!important;max-width:100%!important;max-height:92vh;max-height:92dvh;border-radius:18px 18px 0 0;}
  .modal-header{padding:14px 16px;gap:8px;}
  .modal-body{padding:16px;}
  .modal-footer{padding:12px 16px;flex-wrap:wrap;}
  .modal-back-bar{padding:10px 16px 0;}

  /* Cotizador: una sola columna, el resumen debajo */
  .cot-layout{grid-template-columns:minmax(0,1fr);}
  .cot-sidebar{position:static;max-height:none;overflow:visible;padding-right:0;}

  /* Ventas y Feedback ventas */
  .vnt-top,.vnt-cols{grid-template-columns:minmax(0,1fr);}
}

@media (max-width:700px){
  .page-title{font-size:21px;}

  /* Inicio */
  .ini-grid{grid-template-columns:minmax(0,1fr);}
  .ini-hero-t{min-width:0;}

  /* Usuarios: la tarjeta acomoda rol y botones en otra línea */
  .user-card{flex-wrap:wrap;align-items:flex-start;}
  .user-card>div:nth-child(2){flex:1 1 calc(100% - 60px)!important;}
  .user-card>.role-pill{margin-left:57px;order:1;}
  .user-card::after{content:'';flex-basis:100%;order:2;}
  .user-card>.btn{order:3;}
  .user-card>button:first-of-type{margin-left:57px;}
  .user-card{row-gap:8px;}

  /* Contratos y firmas */
  .frm-card-h{flex-wrap:wrap;}

  /* Embudo: barra para soltar al arrastrar */
  .fun-dropbar{left:8px;right:8px;transform:none;}
  .fun-drop{flex:1;justify-content:center;padding:14px 8px;font-size:13px;}

  /* Agenda / marketing: selectores de vista */
  .ag-toggle{max-width:100%;overflow-x:auto;scrollbar-width:none;}
  .ag-toggle::-webkit-scrollbar{display:none;}
  .ag-toggle button{flex-shrink:0;}
  .mkt-last{white-space:normal;margin-left:0;flex-wrap:wrap;}

  /* Usuarios: organigrama con sangría corta y botones que bajan de línea */
  .org-node{flex-wrap:wrap;margin-left:calc(var(--d,0) * 10px)!important;}
  .org-node .rsv-sub{flex-basis:100%;padding-left:34px;}

  /* Gráficas de dona: la leyenda baja debajo de la dona */
  :is(#page-analiticas,#page-mktapps) .donut-wrap{flex-wrap:wrap;}
  :is(#page-analiticas,#page-mktapps) .donut-legend{flex-basis:100%;}

  /* Tablas: con 4 columnas o más conservan un ancho legible y se deslizan de lado */
  :where(.content-area,.modal) :where(div,section,details):has(> table){overflow-x:auto;-webkit-overflow-scrolling:touch;}
  :where(.content-area,.modal) table:has(> thead > tr > :nth-child(4), > tbody > tr > :nth-child(4), > tr > :nth-child(4)){min-width:600px;}
  :where(.content-area,.modal) table:has(> thead > tr > :nth-child(7), > tbody > tr > :nth-child(7)){min-width:760px;}

  /* Barra superior: el título no ocupa dos líneas */
  .topbar{gap:10px;}
  .topbar-title{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .topbar-right{flex-shrink:0;gap:8px;}

  /* Pestañas con subrayado: se deslizan de lado en vez de bajar de línea */
  .frm-tabs,.apt-tabs{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;}
  .frm-tabs::-webkit-scrollbar,.apt-tabs::-webkit-scrollbar{display:none;}
  .frm-tabs>*,.apt-tabs>*{flex-shrink:0;}

  /* Rejillas escritas en la propia pantalla: 3 o 4 columnas pasan a 2 */
  :where(.content-area,.modal) [style*="grid-template-columns:repeat(4,1fr)"],
  :where(.content-area,.modal) [style*="grid-template-columns:repeat(3,1fr)"]{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  :where(.content-area,.modal) [style*="grid-template-columns:1fr 1.6fr 72px auto"],
  :where(.content-area,.modal) [style*="grid-template-columns:1fr 1fr 80px auto"],
  :where(.content-area,.modal) [style*="grid-template-columns:1fr 1fr 1.1fr 1.8fr"],
  .rsv-pay[style]{grid-template-columns:repeat(2,minmax(0,1fr))!important;}

  /* Clientes: correo y estado debajo del nombre */
  .crm-card{flex-wrap:wrap;align-items:flex-start;}
  .crm-card>div:nth-child(2){flex:1 1 calc(100% - 60px)!important;}
  .crm-card>div:last-child{flex-direction:row!important;flex-wrap:wrap;align-items:center!important;margin-left:57px;}

  /* Cotizador: botones de arriba en fila; paquetes con el nombre completo y precios abajo */
  .cot-export-actions{display:flex;flex-wrap:wrap;gap:8px;width:100%;justify-content:flex-start;}
  .cot-export-actions .btn{flex:1 1 auto;justify-content:center;}
  .cot-pkg-row{flex-wrap:wrap;row-gap:6px;}
  .cot-pkg-info{flex:1 1 calc(100% - 40px);}
  .cot-pkg-name{white-space:normal;}
  .cot-pkg-prices{margin-left:36px;}
  .cot-pkg-sel-price[style*="hidden"]{display:none;}
  .cot-pkg-sel-price{margin-left:auto;}

  /* Fechas importantes: el nombre a todo lo ancho, el ajuste y el lápiz debajo */
  .fecha-top{flex-wrap:wrap;}
  .fecha-top>div:first-child{flex:1 1 100%!important;}
  .fecha-adj{text-align:left;}
  .fecha-acts{margin-left:auto;}

  /* Ficha del lead: nombre a todo lo ancho; franja de ganado/perdido en dos líneas */
  .lead-title{flex:1 1 100%;font-size:22px;min-width:0;}
  .lead-banner{flex-wrap:wrap;align-items:flex-start;}
  .lead-banner-t{flex:1 1 200px;}

  /* Itinerarios finales → Configuración: los selects de contactos caben en su columna */
  .fin-contact>*{min-width:0;}

  /* Ayuda: novedades con la fecha arriba del texto */
  .ay-nov-i{grid-template-columns:minmax(0,1fr);gap:2px;}
}

/* Pantallas táctiles: los botones que en compu salen al pasar el mouse, aquí se ven siempre */
@media (hover:none){
  .hotel-del-btn,.itin-day-actions,.lead-act-x,.dest-cand-use,.mn-acts,.tdo-rowadd,.cc-file button,.adp-x,.cc-add{opacity:1!important;}
  .pkgd-day-del{display:block;}
}

/* Celular con pantalla táctil: los campos con letra de 16px para que el iPhone no haga zoom al escribir */
@media (max-width:700px) and (pointer:coarse){
  input.input,select.input,textarea.input,.input,.login-input,input[type="text"],input[type="email"],input[type="search"],input[type="number"],input[type="tel"],input[type="password"],input[type="date"],input[type="time"],select,textarea{font-size:16px!important;}
}
