/* CARAVELLO SHOP DETAILING — responsive comercial V4
   TINCHI DEVELOPER ELITE SCRIPT
   Solo presentación e interacción responsive. No altera ventas ni backend. */
.mobile-bottom-nav,.mobile-cart-dock,.mobile-cart-scrim,.mobile-nav-scrim,.cart-grab,.cart-close,.mobile-top-brand{display:none}

/* El escritorio es un panel operativo: navegación y caja lateral siempre visibles. */
@media(min-width:1001px){
  .topbar{position:sticky;top:0;z-index:30}
  .main-area{min-height:100vh}
  .content{padding-bottom:85px}
}
@media(max-width:1000px){
  body.menu-open .sidebar{z-index:92}
  .mobile-nav-scrim{position:fixed;inset:0;z-index:85;border:0;background:rgba(8,19,32,.53);opacity:0;pointer-events:none;display:block;transition:opacity .18s ease}
  body.menu-open .mobile-nav-scrim{opacity:1;pointer-events:auto}
}

/* El móvil tiene una experiencia independiente: navegación inferior y caja en bandeja. */
@media(max-width:760px){
  :root{--mobile-nav-size:66px}
  html{-webkit-text-size-adjust:100%}
  body{min-width:320px;background:#f4f6f9}
  body.mobile-cart-open,body.menu-open{overflow:hidden}
  .app-shell{display:block;min-height:100dvh}
  .main-area{width:100%;min-height:100dvh}
  .sidebar{width:min(310px,88vw)!important;max-width:310px;height:100dvh;min-height:0;overflow-y:auto;padding-bottom:calc(20px + env(safe-area-inset-bottom));z-index:92}
  .sidebar .brand{padding-bottom:26px}
  .sidebar .side-credit{margin-bottom:12px}
  .topbar{height:65px;position:sticky;top:0;z-index:36;display:flex;align-items:center;justify-content:space-between;padding:0 16px!important;background:#0b1625;border-bottom:1px solid #1b2a3c;box-shadow:0 2px 15px rgba(8,19,30,.07)}
  .topbar-left{order:2;gap:0}
  .topbar-right{order:3;gap:0}
  .topbar .breadcrumb,.topbar .location-label,.topbar .topbar-divider,.topbar .session-user,.topbar #current-date{display:none!important}
  .topbar .mobile-menu{display:none!important}
  .topbar .logout-btn{border:1px solid #30425c;background:#14243a;color:#dbe8f7;min-width:55px;padding:9px 11px;font-size:12px}
  .mobile-top-brand{display:flex;flex-direction:column;order:1;color:#f3f7fc;font-size:15px;letter-spacing:1.2px;font-weight:850;line-height:1.25}
  .mobile-top-mark{color:#55aaff;font-size:11px;letter-spacing:0}
  .mobile-top-brand small{color:#93a7c1;font-weight:600;font-size:8px;letter-spacing:2.15px;margin-top:3px}
  .content{padding:22px 15px calc(var(--mobile-nav-size) + env(safe-area-inset-bottom) + 38px)!important;max-width:640px}
  .page-heading{margin-bottom:20px;gap:14px}
  .page-heading h1{font-size:27px;letter-spacing:-.9px}
  .page-heading p{font-size:12px;line-height:1.55;margin-top:5px}
  .page-heading .button{width:auto;min-height:44px}
  .eyebrow{margin-bottom:7px}
  .inline-toolbar{align-items:center;gap:8px}
  .inline-toolbar .section-label{font-size:12px}
  .inline-toolbar .select.slim{min-width:128px;max-width:53%;font-size:12px}
  .hero{padding:22px 19px 35px;min-height:0;margin-bottom:21px;background:#101d2e;border-color:#101d2e;border-radius:10px;overflow:hidden}
  .hero h1,.hero h1 span{color:#fff;font-size:clamp(27px,7.3vw,36px);letter-spacing:-1.25px}
  .hero h1 span{color:#5dadff}
  .hero .hero-kicker{color:#80b9ff;font-size:9px}
  .hero p{color:#b7c7da;line-height:1.55;max-width:330px;font-size:12px}
  .hero-art{display:none}
  .hero-buttons{margin-top:17px}
  .hero-buttons .button.primary{background:#127deb;border-color:#127deb;color:#fff;min-height:44px}
  .hero-buttons .hero-secondary{background:#1b2f47;border-color:#2d4965;color:#e1edfa;min-height:44px}
  .hero-bottom{left:19px;right:19px;bottom:10px;color:#6e88a6;border-color:#284059;font-size:8px}
  .metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .metric{min-height:126px;padding:17px 14px;border-radius:8px;overflow:hidden}
  .metric-label{font-size:10px;gap:4px}
  .metric-label .ico{width:14px;height:14px}
  .metric-value{font-size:clamp(19px,5.25vw,26px);margin-top:17px;overflow-wrap:anywhere}
  .metric-foot{font-size:9px;line-height:1.3}
  .dashboard-grid{grid-template-columns:1fr;gap:14px}
  .panel,.cart-panel,.data-panel{border-radius:9px}
  .panel-heading{padding:17px 15px}
  .panel-heading h2{font-size:14px}
  .stock-list{min-height:90px}
  .pos-layout{display:block}
  .pos-catalog{min-height:unset;padding-bottom:10px}
  .pos-search-row{display:flex;flex-wrap:wrap;gap:7px;padding:12px 12px 8px}
  .pos-search-row .search-field{flex:1 1 100%;height:47px;min-width:0}
  .pos-search-row .search-field input{font-size:16px}
  .catalog-count{margin-left:3px}
  .product-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;padding:10px}
  .product-card{min-height:154px;padding:12px;gap:0;border-radius:8px;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
  .product-card-top{margin-bottom:10px}
  .product-icon{flex-shrink:0}
  .product-card-name{font-size:12px;line-height:1.35;min-height:33px}
  .product-card-code{font-size:10px}
  .product-card-bottom{display:flex;align-items:flex-start;flex-direction:column;gap:4px;padding-top:10px}
  .product-card-price{font-size:17px;color:#076dd5}
  .product-card-stock{font-size:10px}
  .category-chip{max-width:90px}
  .mobile-bottom-nav{display:flex;position:fixed;z-index:76;bottom:0;left:0;right:0;height:calc(var(--mobile-nav-size) + env(safe-area-inset-bottom));padding:6px 6px calc(7px + env(safe-area-inset-bottom));gap:0;background:#fff;border-top:1px solid #dfe5ed;box-shadow:0 -8px 28px rgba(25,38,56,.055);justify-content:space-around}
  .mobile-bottom-nav .mobile-tab{display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1;min-width:0;gap:4px;border:0;background:transparent;color:#8190a1;padding:3px 0;border-radius:7px;min-height:47px;font-size:10px;font-weight:650;position:relative}
  .mobile-bottom-nav .mobile-tab .ico{height:20px;width:20px;stroke-width:1.85}
  .mobile-bottom-nav .mobile-tab.active{color:#0878ed}
  .mobile-bottom-nav .mobile-tab.active:before{position:absolute;top:-6px;width:25px;height:3px;content:"";background:#0878ed;border-radius:0 0 3px 3px}
  .mobile-bottom-nav .mobile-tab:active{background:#edf5ff}
  .mobile-cart-dock{display:none;align-items:center;gap:10px;position:fixed;z-index:75;left:12px;right:12px;bottom:calc(var(--mobile-nav-size) + env(safe-area-inset-bottom) + 9px);height:62px;padding:10px 14px;border:1px solid #0878ed;border-radius:9px;color:#fff;background:#0769d5;box-shadow:0 7px 24px rgba(10,80,161,.25);text-align:left}
  body.mobile-pos-page.authenticated .mobile-cart-dock{display:flex}
  .mobile-cart-count{height:27px;min-width:27px;padding:0 5px;border-radius:6px;background:#fff;color:#0769d5;display:grid;place-items:center;font-size:13px;font-weight:800}
  .mobile-cart-copy{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
  .mobile-cart-copy strong{font-size:13px}
  .mobile-cart-copy small{font-size:10px;opacity:.83;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .mobile-cart-total{font-size:16px;font-weight:800;white-space:nowrap;letter-spacing:-.3px}
  .mobile-cart-dock .ico{height:16px;width:16px;flex:none}
  body.mobile-pos-page .content{padding-bottom:calc(var(--mobile-nav-size) + env(safe-area-inset-bottom) + 110px)!important}
  .mobile-cart-scrim{display:block;position:fixed;inset:0;background:rgba(7,16,29,.53);z-index:96;opacity:0;pointer-events:none;border:0;transition:opacity .18s}
  body.mobile-cart-open .mobile-cart-scrim{opacity:1;pointer-events:auto}
  .pos-layout .cart-panel{position:fixed!important;top:auto;bottom:0;left:0;right:0;width:100%;max-width:none;height:auto;max-height:min(90dvh,850px);display:flex;flex-direction:column;overflow:hidden;z-index:97;border:0;border-radius:17px 17px 0 0;transform:translateY(110%);visibility:hidden;transition:transform .22s ease,visibility .22s;background:#fff;box-shadow:0 -14px 44px rgba(4,15,27,.21)}
  body.mobile-cart-open .pos-layout .cart-panel{visibility:visible;transform:translateY(0)}
  .cart-grab{display:block;align-self:center;flex:0 0 4px;width:36px;border-radius:10px;background:#d2d9e2;margin-top:9px}
  .cart-head{padding:12px 18px 12px;flex:none}
  .cart-head-actions{display:flex;align-items:center;gap:8px}
  .cart-close{display:grid;place-items:center;min-height:35px;min-width:35px;border:1px solid #dce4ee;background:#f8fafc}
  .cart-items{min-height:70px;max-height:25dvh;overflow:auto;flex:0 1 auto;padding:5px 18px}
  .cart-qty{gap:13px}
  .qty-button{min-height:34px;min-width:34px;font-size:20px}
  .qty-value{font-size:13px}
  .pos-layout .cart-panel form{overflow-y:auto;overscroll-behavior:contain;flex:0 1 auto;padding-bottom:max(10px,env(safe-area-inset-bottom))}
  .cart-fields{padding:13px 18px}
  .cart-fields .input{min-height:44px;font-size:16px}
  .cart-fields label{font-size:12px}
  .cart-totals{padding:13px 18px}
  .checkout{min-height:49px;margin:12px 18px 0;width:calc(100% - 36px);font-size:13px}
  .checkout-note{padding:8px 0 5px}
  .toast-area{bottom:calc(var(--mobile-nav-size) + env(safe-area-inset-bottom) + 18px);left:12px;right:12px;max-width:none}
  body.mobile-cart-open .toast-area{bottom:24px}
  .modal-layer{padding:0;align-items:flex-end}
  .modal{padding:19px 17px calc(18px + env(safe-area-inset-bottom));width:100%;max-height:93dvh;border-radius:18px 18px 0 0;overflow-y:auto}
  .modal-actions{gap:8px}
  .modal-actions .button{min-height:45px;white-space:normal}
  .modal-heading h2{font-size:20px}
  .form-grid{grid-template-columns:1fr 1fr;gap:0 10px}
  .form-grid .input{font-size:16px;min-height:45px}
  .form-grid label{font-size:12px}
  .users-layout,.settings-grid{grid-template-columns:1fr;gap:14px}
  .settings-form{padding:17px}
  .settings-form .input{min-height:46px;font-size:16px}
  .report-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  .report-metrics>div{padding:18px 14px}
  .report-metrics strong{font-size:clamp(17px,5vw,24px)}
  .report-metrics span{font-size:10px}
  .filter-row{padding:12px}
  .filter-row .search-field{height:47px;flex:1 1 100%}
  .filter-row input{font-size:16px}
  .filter-row .table-caption{margin-top:0}
  /* En celulares las tablas de inventario/ventas/reportes son fichas legibles,
     manteniendo los mismos tbody, botones, permisos y datos. */
  .data-panel .table-scroll{overflow:visible}
  .data-panel table{display:block;width:100%;min-width:0!important;border-spacing:0}
  .data-panel thead{display:none}
  .data-panel tbody{display:grid;gap:9px;padding:10px;background:#f7f9fb}
  .data-panel tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));padding:12px 13px;gap:9px;border:1px solid #e2e8ef;background:#fff;border-radius:8px;min-width:0}
  .data-panel tbody tr:hover{background:#fff}
  .data-panel tbody td{display:flex;flex-direction:column;gap:5px;text-align:left!important;min-width:0;min-height:0;padding:0;border:0;overflow-wrap:anywhere;font-size:12px;color:#333f4c}
  .data-panel tbody td:before{font-size:9px;letter-spacing:.7px;font-weight:750;text-transform:uppercase;color:#8793a2}
  .data-panel tbody td:first-child{grid-column:1/-1;padding-bottom:8px;border-bottom:1px solid #edf0f4}
  .data-panel tbody td.empty-table{grid-column:1/-1;padding:25px 10px!important;text-align:center!important;display:block}
  .data-panel tbody .row-actions{justify-content:flex-start;flex-wrap:wrap;gap:7px}
  .data-panel tbody .row-actions .icon-btn{min-width:40px;min-height:40px;border:1px solid #dce4ed}
  .inventory-table tbody td:nth-child(2):before{content:'Código'}
  .inventory-table tbody td:nth-child(3):before{content:'Costo'}
  .inventory-table tbody td:nth-child(4):before{content:'Precio de venta'}
  .inventory-table tbody td:nth-child(5):before{content:'Ganancia / unidad'}
  .inventory-table tbody td:nth-child(6):before{content:'Stock'}
  .inventory-table tbody td:nth-child(7):before{content:'Acciones'}
  .inventory-table tbody td:nth-child(7){grid-column:1/-1}
  #sales-body td:nth-child(2):before{content:'Fecha'}
  #sales-body td:nth-child(3):before{content:'Cliente'}
  #sales-body td:nth-child(4):before{content:'Pago'}
  #sales-body td:nth-child(5):before{content:'Estado'}
  #sales-body td:nth-child(6):before{content:'Total'}
  #sales-body td:nth-child(7):before{content:'Acciones'}
  #sales-body td:nth-child(7){grid-column:1/-1}
  #reports-body td:nth-child(2):before{content:'Código'}
  #reports-body td:nth-child(3):before{content:'Unidades'}
  #reports-body td:nth-child(4):before{content:'Ventas'}
  #reports-body td:nth-child(5):before{content:'Costo'}
  #reports-body td:nth-child(6):before{content:'Ganancia'}
  #reports-body td:nth-child(7):before{content:'Margen'}
  #users-body td:nth-child(2):before{content:'Usuario'}
  #users-body td:nth-child(3):before{content:'Permiso'}
  #users-body td:nth-child(4):before{content:'Estado'}
  #users-body td:nth-child(5):before{content:'Gestionar'}
  #users-body td:nth-child(5){grid-column:1/-1}
  .row-actions .user-small{min-height:39px!important}
  .data-panel .table-footer{padding:12px;flex-wrap:wrap}
  .auth-screen{position:fixed;inset:0;overflow-y:auto;display:flex;flex-direction:column;background:#f5f8fc}
  .auth-side{display:flex!important;flex:none;height:164px;min-height:164px;padding:22px;justify-content:center;background:#091a2e}
  .auth-side img{height:105px;width:min(100%,350px);object-fit:contain;filter:none}
  .auth-side-note{display:none}
  .auth-panel{display:block;flex:1;padding:27px 22px max(25px,env(safe-area-inset-bottom));overflow:visible;background:#f5f8fc}
  .auth-panel-inner{max-width:460px;margin:0 auto}
  .auth-panel h1{font-size:30px;margin-top:12px}
  .auth-panel p{font-size:13px;margin-bottom:25px}
  .auth-form{gap:17px}
  .auth-form .input{font-size:16px;height:50px}
  .auth-submit{min-height:52px;font-size:13px!important}
  .auth-footer{margin-top:43px;font-size:9px}
}
@media(max-width:390px){
  .content{padding-left:11px!important;padding-right:11px!important}
  .product-cards{gap:7px;padding:8px}
  .product-card{padding:10px;min-height:151px}
  .product-card-price{font-size:15px}
  .metric{padding:14px 11px}
  .mobile-cart-dock{left:9px;right:9px}
  .mobile-cart-total{font-size:14px}
  .mobile-bottom-nav .mobile-tab{font-size:9px}
}
@media(prefers-reduced-motion:reduce){
  .pos-layout .cart-panel,.mobile-cart-scrim,.mobile-nav-scrim{transition:none}
}
