/* ═══════════════════════════════════════════════════════════════
   Studio Cota & Acao — Mobile Responsive Layer
   Arquivo separado para nao impactar desktop (app.css)
   ═══════════════════════════════════════════════════════════════ */

/* ── Hamburger Button (hidden on desktop) ── */
.hamburger-btn{display:none;}

/* ── Sidebar Overlay (hidden on desktop) ── */
.sidebar-overlay{display:none;}

/* ── Kanban mobile toggle (hidden on desktop) ── */
.kb-mob-toggle{display:none;}

/* ── List cards (hidden on desktop, shown only on mobile) ── */
.lst-cards{display:none;}

/* ── Calendar mobile list (hidden on desktop) ── */
.cal-mobile-list{display:none;}

/* ═══════════════════════════════════════════════════════════════
   TIER 3: Tablet (max-width: 1024px)
   ═══════════════════════════════════════════════════════════════ */
@media(max-width:1024px){
  /* Analytics grid: 3 cols instead of 4 */
  .agrid{grid-template-columns:repeat(3,1fr);}
  /* Kanban columns slightly narrower */
  .col{min-width:240px;max-width:240px;}
}

/* ═══════════════════════════════════════════════════════════════
   TIER 2: Small tablet / landscape phone (max-width: 768px)
   ═══════════════════════════════════════════════════════════════ */
@media(max-width:768px){
  /* Analytics grid: 2 cols */
  .agrid{grid-template-columns:repeat(2,1fr);padding:16px;}
  /* Email KPIs: 2 cols */
  .em-kpi-grid{grid-template-columns:repeat(2,1fr);}
  .em-report-kpis{grid-template-columns:repeat(2,1fr);}
  /* Campaign grid */
  .em-camp-grid{grid-template-columns:1fr;}
  /* Automation grid */
  .em-aut-grid{grid-template-columns:1fr;}
  /* Prompts: stack */
  .prompts-wrap{flex-direction:column;height:auto;}
  .prompts-list{width:100%;border-right:none;border-bottom:1px solid var(--border);max-height:200px;overflow-y:auto;}
  /* Contact layout */
  .em-contact-layout{grid-template-columns:1fr;}
  /* Wizard cols */
  .em-wiz-cols{grid-template-columns:1fr;}
  /* Thumbgrid: 4 cols */
  .thumbgrid{grid-template-columns:repeat(4,1fr);}
  /* Template grid */
  .tmplgrid{grid-template-columns:repeat(auto-fill,minmax(160px,1fr));padding:16px;}
}

/* ═══════════════════════════════════════════════════════════════
   TIER 1: Mobile portrait (max-width: 600px)
   ═══════════════════════════════════════════════════════════════ */
@media(max-width:600px){

  /* ── SIDEBAR → DRAWER ── */
  .sidebar{
    position:fixed;
    top:0;left:0;bottom:0;
    width:280px;
    z-index:1000;
    transform:translateX(-100%);
    transition:transform .25s ease;
    box-shadow:none;
  }
  .sidebar.mobile-open{
    transform:translateX(0);
    box-shadow:4px 0 24px rgba(0,0,0,.5);
  }
  .sidebar-overlay{
    display:none;
    position:fixed;inset:0;
    background:rgba(0,0,0,.5);
    z-index:999;
  }
  .sidebar-overlay.active{display:block;}

  /* ── HAMBURGER VISIBLE ── */
  .hamburger-btn{
    display:flex;align-items:center;justify-content:center;
    width:36px;height:36px;
    background:var(--surface2);border:1px solid var(--border);border-radius:8px;
    color:var(--text);font-size:18px;cursor:pointer;
    flex-shrink:0;transition:all .15s;
    margin-right:4px;
  }
  .hamburger-btn:hover{background:var(--border);}

  /* ── TOPBAR COMPACT ── */
  .topbar{padding:0 12px;gap:8px;height:48px;}
  .topbar-title{font-size:14px;}

  /* ── MAIN CONTENT FULL WIDTH ── */
  .main{width:100%;}

  /* ── MODALS FULLSCREEN ── */
  .modal,.modal.sm,.modal.lg,.modal.xlg{
    width:100vw!important;max-width:100vw!important;
    height:100vh;max-height:100vh;
    border-radius:0;
    margin:0;
  }
  .overlay.open{align-items:stretch;}
  .mhd{padding:14px 16px 12px;}
  .mbody{padding:14px 16px 16px;}
  .mfoot{padding:10px 16px;}
  .mtitle{font-size:17px;}
  .mclose{font-size:24px;padding:8px;min-width:40px;min-height:40px;display:flex;align-items:center;justify-content:center;}

  /* ── POST EDITOR ── */
  .pe-split{flex-direction:column-reverse;gap:12px;min-height:auto;}
  .pe-campos{flex:none;max-height:none;padding-right:0;}
  .pe-preview{max-height:280px;overflow-y:auto;border-radius:8px;}
  .pe-header-meta{font-size:11px;gap:6px;flex-direction:column;}
  .pe-header-meta .pe-versions{margin-left:0;}
  .pe-slider-header button{padding:8px 16px;min-width:44px;min-height:44px;}
  /* Collapsible sections: open by default on mobile for visibility */
  .pe-section{border-radius:8px;}
  .pe-section summary{padding:12px 14px;font-size:14px;min-height:44px;display:flex;align-items:center;}
  .pe-section-body{padding:12px 14px;}
  /* Modal footer sticky on mobile */
  .modal .mfoot{position:sticky;bottom:0;background:var(--surface);z-index:10;border-top:1px solid var(--border);padding:12px 16px;}
  /* Legenda textarea auto-height */
  .pe-campos textarea{min-height:80px;}
  /* Slider dots bigger touch targets */
  .pe-slider-dots span{width:12px;height:12px;margin:0 4px;}
  .pe-slider-dots{padding:8px 0;gap:4px;}

  /* ── KANBAN (columns mode) ── */
  .kanban:not(.kanban-mobile-list){padding:12px 12px 0;gap:12px;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch;}
  .kanban:not(.kanban-mobile-list) .col{min-width:85vw;max-width:85vw;scroll-snap-align:start;}

  /* ── KANBAN MOBILE TOGGLE ── */
  .kb-mob-toggle{display:flex;gap:4px;padding:8px 12px 0;}
  .kb-mob-btn{padding:6px 14px;font-size:12px;font-weight:600;border:1px solid var(--border);border-radius:8px;background:transparent;color:var(--muted);cursor:pointer;min-height:36px;transition:all .15s;}
  .kb-mob-btn.active{background:var(--primary);color:#fff;border-color:var(--primary);}

  /* ── KANBAN MOBILE LIST ── */
  .kanban-mobile-list{display:flex;flex-direction:column;gap:0;padding:8px 12px 12px;overflow-x:hidden;overflow-y:auto;}
  .kb-section{border-bottom:1px solid var(--border);}
  .kb-section:last-child{border-bottom:none;}
  .kb-section-hd{display:flex;align-items:center;gap:8px;padding:14px 4px;cursor:pointer;-webkit-tap-highlight-color:transparent;}
  .kb-section-arrow{font-size:12px;color:var(--muted);width:14px;text-align:center;}
  .kb-section-label{font-size:14px;font-weight:600;flex:1;}
  .kb-section-hd .col-cnt{font-size:12px;background:var(--surface2);padding:2px 8px;border-radius:10px;}
  .kb-section-body{display:flex;flex-direction:column;gap:8px;padding:0 0 12px;}

  /* ── CARDS ── */
  .card{padding:12px;}
  .card-title{font-size:14px;}
  .card-meta{gap:4px;}
  .ctag{font-size:12px;padding:4px 8px;}
  .card-date{font-size:12px;}
  .card-type{font-size:11px;}
  /* Review actions always visible on mobile (no hover) */
  .card .card-review{display:flex!important;position:static!important;margin-top:8px;flex-wrap:wrap;}

  /* ── POSTS TOGGLE / FILTERS ── */
  #posts-toggle{padding:8px 12px 0;}
  .posts-view-btn{padding:8px 14px;font-size:13px;min-height:36px;}
  #filter-bar{padding:8px 12px 4px;}
  .filter-dd{min-width:70px;font-size:11px;padding:6px 8px;}
  .filter-search{width:100%;min-width:0;}
  .smart-toggle{font-size:12px;padding:6px 10px;}

  /* ── CALENDAR ── */
  .calhd{padding:10px 12px;gap:6px;flex-wrap:wrap;}
  .callabel{font-size:13px;min-width:auto;}
  .calfilt{margin-left:0;flex-wrap:wrap;}
  .calmonth{padding:8px 12px 12px;}
  .calday{min-height:44px;padding:3px;}
  .caldaynum{font-size:11px;text-align:center;}
  /* Pills → dots on mobile monthly */
  .calpill{font-size:0;padding:0;width:8px;height:8px;border-radius:50%;display:inline-block;margin:1px;overflow:hidden;min-height:0;line-height:0;}
  .calpill span{display:none;}
  .calmore{font-size:9px;text-align:center;}
  .calday .calpill{background:var(--muted);}
  .calday .calpill.industrial{background:#4caf50;}
  .calday .calpill.creative{background:#ff9800;}
  .calday .calpill.manual{background:var(--primary);}
  /* Weekly: horizontal scroll */
  .weekgrid{grid-template-columns:repeat(7,minmax(100px,1fr));overflow-x:auto;}

  /* ── CALENDAR MOBILE LIST ── */
  .cal-mobile-list{display:block;padding:8px 12px 12px;}
  .cal-mob-day{margin-bottom:12px;}
  .cal-mob-day-hd{font-size:13px;font-weight:600;color:var(--muted);padding:4px 0;border-bottom:1px solid var(--border);margin-bottom:6px;}
  .cal-mob-day-hd.today{color:var(--primary);}
  .cal-mob-item{display:flex;align-items:center;gap:8px;padding:10px 8px;border-radius:8px;cursor:pointer;transition:background .15s;}
  .cal-mob-item:active{background:var(--surface2);}
  .cal-mob-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;}
  .cal-mob-title{font-size:13px;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .cal-mob-status{font-size:10px;padding:2px 6px;border-radius:4px;color:#fff;flex-shrink:0;}

  /* ── LIST VIEW → CARDS ── */
  #list-container{padding:0 12px 12px;}
  /* Hide table on mobile, show cards */
  .lst-table{display:none;}
  .lst-cards{display:flex;flex-direction:column;gap:8px;}
  .lst-card{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:14px;cursor:pointer;transition:background .15s;}
  .lst-card:active{background:var(--surface2);}
  .lst-card-title{font-size:14px;font-weight:600;margin-bottom:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  .lst-card-row{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted);}
  .lst-card-row + .lst-card-row{margin-top:4px;}
  .lst-card-badge{font-size:10px;padding:2px 8px;border-radius:4px;color:#fff;}
  .lst-card-check{color:var(--success);}

  /* ── TEMPLATES / LAYOUTS GRID ── */
  .tmplgrid{grid-template-columns:1fr;padding:12px;gap:10px;}
  .tcard{padding:14px;}
  .tcard-actions{opacity:1;position:static;display:flex;gap:6px;margin-top:8px;}

  /* ── PROMPTS ── */
  .prompts-wrap{flex-direction:column;height:auto;}
  .prompts-list{width:100%;border-right:none;border-bottom:1px solid var(--border);max-height:200px;}
  .prompts-list-hd{padding:12px 14px;}
  .prompts-list .prompt-item{padding:10px 14px;font-size:13px;min-height:40px;}
  .prompts-editor-hd{padding:12px 16px;gap:8px;}
  .prompts-editor-body{padding:14px 16px;}
  .prompts-editor-body textarea,.prompts-editor-body .fta{min-height:150px;font-size:14px;}
  .prompts-editor-foot{padding:10px 16px;}

  /* ── MÍDIA / IMAGES ── */
  #images-content{padding:12px!important;}
  #images-content > div:first-child{flex-wrap:wrap;gap:8px;}
  #images-content .chip{font-size:12px;padding:6px 10px;}

  /* ── ANALYTICS ── */
  .agrid{grid-template-columns:1fr 1fr;gap:10px;padding:12px;}
  .aval{font-size:22px;}

  /* ── ADMIN ── */
  #view-admin > div{padding:12px!important;}
  #admin-tabs{overflow-x:auto;-webkit-overflow-scrolling:touch;flex-wrap:nowrap!important;padding-bottom:4px;}
  #admin-tabs .chip{flex-shrink:0;font-size:12px;padding:8px 12px;min-height:36px;}

  /* ── FONTES WEB ── */
  #view-sources-body{padding:12px!important;}
  #view-sources-body > div:first-child{overflow-x:auto;-webkit-overflow-scrolling:touch;flex-wrap:nowrap;padding-bottom:4px;}
  #view-sources-body .chip{flex-shrink:0;}

  /* ── EMAIL MODULE ── */
  .em-tabs-bar{padding:0 12px;gap:0;}
  .em-tab{padding:10px 12px;font-size:12px;}
  .em-topbar{padding:8px 12px;flex-wrap:wrap;}
  .em-body{padding:12px;}
  .em-kpi-grid{grid-template-columns:1fr 1fr;gap:8px;}
  .em-kpi{padding:12px 10px;}
  .em-kpi-val{font-size:22px;}
  .em-camp-grid{grid-template-columns:1fr;}
  .em-report-kpis{grid-template-columns:1fr 1fr;gap:8px;}
  .em-report-details{grid-template-columns:1fr;}
  .em-report{max-width:100%;}
  .em-report-summary{flex-direction:column;gap:8px;}
  .em-toolbar{gap:6px;flex-wrap:wrap;}
  .em-search{width:100%;}
  .em-preview-modal{width:100vw;max-width:100vw;height:100vh;border-radius:0;}
  .em-modal{width:100vw;max-width:100vw;max-height:100vh;border-radius:0;}
  .em-aut-editor{flex-direction:column;height:auto;}
  .em-aut-sidebar{width:100%;border-left:none;border-top:1px solid var(--border2);}
  .em-aut-step{width:100%;max-width:none;}
  .em-aut-canvas{padding:16px;}
  .em-camp-card{padding:14px;}
  .em-camp-card-stats{gap:12px;flex-wrap:wrap;}
  .em-wizard-steps{overflow-x:auto;-webkit-overflow-scrolling:touch;flex-wrap:nowrap;}
  .em-bulk-bar{flex-wrap:wrap;gap:6px;}
  .em-bulk-bar .btn{font-size:12px;}

  /* ── EMAIL: Contacts table → cards ── */
  .em-table{font-size:12px;}
  .em-table thead{display:none;}
  .em-table tbody{display:flex;flex-direction:column;gap:8px;}
  .em-table tbody tr{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;padding:12px;background:var(--surface);border:1px solid var(--border);border-radius:10px;}
  .em-table tbody td{padding:0;border:none;}
  /* Hide less important columns: listas (4th), tags (5th), criado em (7th) */
  .em-table tbody td:nth-child(4),
  .em-table tbody td:nth-child(5),
  .em-table tbody td:nth-child(7){display:none;}
  /* Checkbox */
  .em-table tbody td:nth-child(1){order:-1;}
  /* Name: full width */
  .em-table tbody td:nth-child(2){flex:1;min-width:60%;font-weight:600;}
  .em-table tbody td:nth-child(2) a{font-size:14px;}
  /* Email: full width below name */
  .em-table tbody td:nth-child(3){width:100%;font-size:12px;color:var(--muted);}
  .em-table tbody td:nth-child(3) a{color:var(--muted);}
  /* Status badge */
  .em-table tbody td:nth-child(6){order:1;}
  /* Detail button */
  .em-table tbody td:nth-child(8){order:2;margin-left:auto;}
  .em-table tbody td .btn-icon{min-width:36px;min-height:36px;}
  .em-table .em-empty-row{display:block;padding:20px;text-align:center;background:none;border:none;}

  /* ── EMAIL: Campaigns table → cards ── */
  .em-camp-table thead{display:none;}
  .em-camp-table tbody{display:flex;flex-direction:column;gap:8px;}
  .em-camp-table tbody tr.em-camp-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;padding:14px;background:var(--surface);border:1px solid var(--border);border-radius:10px;}
  .em-camp-table tbody td{padding:0;border:none;}
  /* Hide: preview (1st), sent date (3rd), sent count (4th), clicks (5th), last mod (6th) */
  .em-camp-table tbody td:nth-child(1),
  .em-camp-table tbody td:nth-child(3),
  .em-camp-table tbody td:nth-child(4),
  .em-camp-table tbody td:nth-child(5),
  .em-camp-table tbody td:nth-child(6){display:none;}
  /* Name + meta: full width */
  .em-camp-table tbody td:nth-child(2){width:100%;}
  .em-camp-row-name{font-size:14px;font-weight:600;}
  .em-camp-row-meta{margin-top:4px;}
  /* Actions: full width */
  .em-camp-table .em-camp-row-actions{width:100%;display:flex;gap:6px;margin-top:4px;}

  /* ── MONITOR ── */
  #monitor-root{padding:12px!important;}
  /* Logs/route-stats: horizontal scroll wrapper */
  #mon-logs,#mon-route-stats{overflow-x:auto;-webkit-overflow-scrolling:touch;}
  #mon-logs > div,#mon-route-stats > div{min-width:500px;}
  /* Crons: stack to 2 columns */
  #mon-crons > div{grid-template-columns:1fr auto!important;gap:6px 8px!important;}
  /* Health/KPI inline grids */
  #mon-health{grid-template-columns:repeat(auto-fill,minmax(110px,1fr))!important;gap:8px!important;}
  #mon-kpis .agrid{grid-template-columns:1fr 1fr;}

  /* ── BATCH ── */
  #view-batch > div{padding:12px!important;max-width:100%!important;}

  /* ── HOTMART / CUSTOMERS ── */
  /* These use ui-tabs which we handle below */

  /* ── TYPE SELECTOR (wizard) ── */
  .typeselector{grid-template-columns:1fr;gap:8px;}
  .typeopt{padding:12px;display:flex;align-items:center;gap:12px;text-align:left;}
  .typeopt-ico{font-size:20px;margin-bottom:0;}

  /* ── FORMS ── */
  .fg{grid-template-columns:1fr !important;} /* Force single column on mobile */
  .fi,.fs,.fta{font-size:14px;padding:10px 12px;} /* Bigger touch targets */
  .fl{font-size:13px;}

  /* ── BUTTONS ── */
  .btn{padding:10px 16px;font-size:14px;min-height:40px;}
  .btn-sm{padding:8px 12px;font-size:13px;min-height:36px;}
  .btn-icon{min-width:36px;min-height:36px;display:flex;align-items:center;justify-content:center;}
  .new-btn{padding:12px;font-size:14px;}
  .mfoot{flex-wrap:wrap;gap:8px;}
  .mfoot .btn{flex:1;justify-content:center;min-width:0;}

  /* ── TOGGLE ── */
  .tgl{width:40px;height:24px;}
  .tgl::after{width:18px;height:18px;}
  .tgl.on::after{transform:translateX(16px);}

  /* ── TABS ── */
  .ui-tabs{overflow-x:auto;-webkit-overflow-scrolling:touch;flex-wrap:nowrap;gap:0;padding-bottom:0;}
  .ui-tab{padding:10px 14px;font-size:13px;flex-shrink:0;}

  /* ── DROPDOWNS ── */
  .ac-dropdown,.bdd-dropdown,.ui-dropdown-menu,.em-seg-dropdown{
    position:fixed!important;
    left:8px!important;right:8px!important;
    bottom:8px!important;
    top:auto!important;
    max-height:50vh;
    border-radius:12px;
    z-index:1100;
  }

  /* ── TOAST ── */
  .toast{left:12px;right:12px;bottom:12px;max-width:none;text-align:center;}

  /* ── NAV ITEMS (within sidebar drawer) ── */
  .nav-item{padding:12px 14px;font-size:14px;gap:12px;}
  .ni{font-size:18px;width:24px;}
  .nav-sec{font-size:11px;padding:18px 14px 8px;}

  /* ── TOUCH TARGETS ── */
  .calnb{width:36px;height:36px;font-size:18px;}
  .bdd-check{width:24px;height:24px;}
  .alt-dot{width:32px;height:32px;font-size:12px;}
  .ep-color{width:32px;height:32px;}
  .tcard-actions{opacity:1;} /* Always visible on touch */
  .em-camp-card-actions{opacity:1;}
  .em-aut-card-actions{opacity:1;}
  .em-aut-step-del{opacity:1;}

  /* ── FONT SIZE MINIMUM ── */
  .col-cnt{font-size:12px;}
  .ep-label{font-size:11px;}
  .ep-slot-nm{font-size:12px;}
  .em-kpi-label{font-size:12px;}
  .em-report-kpi-label{font-size:12px;}

  /* ── THUMBGRID ── */
  .thumbgrid{grid-template-columns:repeat(3,1fr);gap:6px;}
  .ep-results{grid-template-columns:repeat(3,1fr);gap:4px;}
  .ep-results-5{grid-template-columns:repeat(3,1fr);}

  /* ── BATCH (batch dropdown) ── */
  .bdd-trigger{min-height:44px;}
  .bdd-item{padding:10px 14px;font-size:14px;}

  /* ── IMAGE PICKER ── */
  .ip-tab{padding:10px 0;font-size:12px;}
  .ip-grid{max-height:200px;}

  /* ── SLIDES VIEWER ── */
  .slide-card{padding:12px;}
  .slide-text{font-size:14px;}

  /* ── USER MENU ── */
  #user-menu{right:-8px!important;min-width:200px!important;}

  /* ── SCROLLBAR: wider for touch ── */
  ::-webkit-scrollbar{width:4px;height:4px;}

  /* ── SLIDE VIEWER DOTS ── */
  .pe-slider-dots span{width:10px;height:10px;}

  /* ── MONITOR ── */
  /* health cards and kpis handled by .agrid rules above */

  /* ── TABLE horizontal scroll wrapper ── */
  .dtable{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;}

  /* ── MISC PADDING REDUCTIONS ── */
  .calweek{padding:0 12px 12px;}
  .em-detail-card{padding:12px;}
  .em-wiz-card{padding:16px;margin-bottom:12px;}
  .em-aut-card{padding:14px;}
}

/* ═══════════════════════════════════════════════════════════════
   TIER 0: Very small phones (max-width: 375px)
   ═══════════════════════════════════════════════════════════════ */
@media(max-width:375px){
  .kanban:not(.kanban-mobile-list) .col{min-width:90vw;max-width:90vw;}
  .agrid{grid-template-columns:1fr;gap:8px;}
  .em-kpi-grid{grid-template-columns:1fr;}
  .thumbgrid{grid-template-columns:repeat(2,1fr);}
  .ep-results{grid-template-columns:repeat(2,1fr);}
  .topbar-title{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:140px;}
  .em-camp-card-stats{flex-direction:column;gap:6px;}
  .kb-section-label{font-size:13px;}
  .cal-mob-title{font-size:12px;}
  /* Email: even more compact */
  .em-table tbody td:nth-child(2) a{font-size:13px;}
  .em-table tbody td:nth-child(3){font-size:11px;}
  .em-camp-row-name{font-size:13px;}
}

/* ═══════════════════════════════════════════════════════════════
   LANDSCAPE PHONE (max-height: 500px + landscape)
   ═══════════════════════════════════════════════════════════════ */
@media(max-height:500px) and (orientation:landscape){
  .sidebar{width:220px;}
  .sidebar.mobile-open{width:220px;}
  .topbar{height:40px;}
  .hamburger-btn{width:32px;height:32px;font-size:16px;}
  .modal,.modal.sm,.modal.lg,.modal.xlg{height:100vh;max-height:100vh;overflow-y:auto;}
  .mbody{max-height:calc(100vh - 100px);overflow-y:auto;}
  .kanban-mobile-list .kb-section-hd{padding:10px 4px;}
  .pe-preview{max-height:180px;}
}

/* ═══════════════════════════════════════════════════════════════
   VIRTUAL KEYBOARD — prevent layout shift on input focus
   ═══════════════════════════════════════════════════════════════ */
@media(max-width:600px){
  /* Prevent viewport resize when keyboard opens (iOS/Android) */
  html{height:100%;overflow:hidden;}
  body{height:100%;overflow:auto;overscroll-behavior-y:contain;}

  /* Ensure focused inputs are visible above keyboard */
  input:focus,textarea:focus,select:focus,.fi:focus,.fs:focus,.fta:focus{
    scroll-margin-bottom:120px;
  }

  /* Fixed dropdowns: safe-area aware on bottom */
  .ac-dropdown,.bdd-dropdown,.ui-dropdown-menu,.em-seg-dropdown{
    bottom:calc(8px + env(safe-area-inset-bottom, 0px))!important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   PWA STANDALONE — pull-to-refresh prevention + status bar
   ═══════════════════════════════════════════════════════════════ */
@media(display-mode:standalone){
  body{overscroll-behavior-y:contain;} /* Disable pull-to-refresh */
  .topbar{padding-top:env(safe-area-inset-top, 0px);}
}

/* ═══════════════════════════════════════════════════════════════
   SAFE AREA (notch / home indicator)
   ═══════════════════════════════════════════════════════════════ */
@supports(padding-bottom: env(safe-area-inset-bottom)){
  @media(max-width:600px){
    .sidebar-footer{padding-bottom:calc(16px + env(safe-area-inset-bottom));}
    .mfoot{padding-bottom:calc(10px + env(safe-area-inset-bottom));}
    .toast{bottom:calc(12px + env(safe-area-inset-bottom));}
    /* Bulk bar safe area */
    #bulk-bar{bottom:calc(20px + env(safe-area-inset-bottom))!important;}
  }
}
