/* ================================================================
   PRECIFIKA — MOBILE OPTIMIZATIONS v6
   Breakpoints:
     ≤ 900px  → tablet / phablet (sidebar vira overlay)
     ≤ 680px  → smartphone landscape
     ≤ 480px  → smartphone portrait (≤ 390px iPhone SE)

   Princípios v6:
   - Cobertura total: todos os módulos (finance, DRE, receipts,
     reports, team, SI, admin, planos, referral, auth)
   - Touch targets mínimos de 44 × 44 px em toda ação interativa
   - Safe area (notch/home bar) respeitada via env()
   - Modais viram bottom-sheets com slide-up nativo
   - Sem ellipsis em conteúdo de negócio (nomes, descrições)
   - Scroll horizontal suave em tabelas (touch-action: pan-x)
   - Zero !important desnecessário
   ================================================================ */

/* ── Variáveis globais mobile ─────────────────────────────────── */
:root {
  --bottom-nav-h:   64px;
  --topbar-h-mob:   56px;
  --safe-top:       env(safe-area-inset-top,    0px);
  --safe-bottom:    env(safe-area-inset-bottom, 0px);
  --safe-left:      env(safe-area-inset-left,   0px);
  --safe-right:     env(safe-area-inset-right,  0px);
  --mob-px:         16px;
  --mob-radius:     16px;
  --mob-gap:        12px;
  --mob-sheet-r:    20px;       /* border-radius dos bottom-sheets */
  --mob-touch:      44px;       /* altura mínima de toque */

  /* Z-index layers — fonte única de verdade */
  --z-base:         1;
  --z-sticky:       40;
  --z-topbar:       50;
  --z-sidebar-ov:   99;
  --z-sidebar:      100;
  --z-bottom-nav:   200;
  --z-dropdown:     300;
  --z-modal:        1000;
  --z-modal-hi:     1100;
  --z-modal-top:    2000;
  --z-toast:        9000;
  --z-overlay-top:  9999;
}

/* ── Reset base mobile ── */
@media (max-width: 900px) {
  *, *::before, *::after { box-sizing: border-box; }
  img, video, svg { max-width: 100%; height: auto; }

  /* iOS: evita zoom automático em inputs (único !important legítimo) */
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  input[type="date"],
  input[type="tel"],
  input[type="search"],
  input[type="url"],
  textarea,
  select { font-size: 16px !important; }

  /* Overscroll nativo no body */
  body { overscroll-behavior-y: contain; }
}

/* ================================================================
   1. BOTTOM NAVIGATION BAR
   ================================================================ */
.mobile-bottom-nav { display: none; }

@media (max-width: 900px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 20px rgba(0,0,0,.08);
    z-index: var(--z-bottom-nav);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
    align-items: stretch;
  }

  .mob-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    background: none;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 8px 4px 6px;
    transition: color .15s;
    text-decoration: none;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    min-height: var(--mob-touch);
  }

  .mob-nav-item i { font-size: 20px; transition: transform .15s, color .15s; }
  .mob-nav-item.active { color: #2563eb; }
  .mob-nav-item.active i { transform: translateY(-2px); }
  .mob-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 3px;
    background: #2563eb;
    border-radius: 0 0 4px 4px;
  }

  /* Botão central +Novo */
  .mob-nav-item--primary { color: #ffffff; }
  .mob-nav-item--primary .mob-nav-icon-wrap {
    width: 46px; height: 46px;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(37,99,235,.4);
    margin-top: -12px;
    transition: transform .15s, box-shadow .15s;
  }
  .mob-nav-item--primary:active .mob-nav-icon-wrap {
    transform: scale(.93);
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
  }
  .mob-nav-item--primary i { font-size: 20px; transform: none; }
  .mob-nav-item--primary::before { display: none; }

  .mob-nav-badge {
    position: absolute;
    top: 6px; right: calc(50% - 18px);
    background: #ef4444; color: white;
    font-size: 9px; font-weight: 800;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white;
  }

  /* Padding global para não cobrir conteúdo com a barra fixa */
  .page-content,
  .page > .page-content {
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  }
  .adm-tab {
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
  }
}

/* ================================================================
   2. SIDEBAR — overlay mobile
   ================================================================ */
@media (max-width: 900px) {
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: var(--z-sidebar-ov);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  .sidebar-overlay.visible { display: block; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    width: 272px;
    border-radius: 0 20px 20px 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
    z-index: var(--z-sidebar);
    transition: transform .25s cubic-bezier(.32,1,.56,1);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-top: var(--safe-top);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* ================================================================
   3. TOPBAR MOBILE
   ================================================================ */
@media (max-width: 900px) {
  .topbar {
    height: calc(var(--topbar-h-mob) + var(--safe-top));
    padding: var(--safe-top) var(--mob-px) 0;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
  }

  .topbar-inner {
    display: flex;
    align-items: center;
    width: 100%;
    height: var(--topbar-h-mob);
    gap: 8px;
  }

  .topbar-breadcrumb { font-size: 15px; font-weight: 700; }
  .topbar-right { gap: 8px; }
  .topbar .btn-primary,
  .topbar > .topbar-right > .btn.btn-primary,
  #topbar-new-btn { display: none; }

  .topbar-usage { gap: 4px; }
  .topbar-usage-item { font-size: 11px; padding: 4px 8px; gap: 4px; }
  .install-app-btn-label { display: none; }
  .install-app-btn { padding: 6px 8px; font-size: 15px; }
  .topbar-user-avatar { width: 32px; height: 32px; font-size: 12px; }
  .topbar-usage-text { display: none; }
}

/* ================================================================
   4. DASHBOARD
   ================================================================ */
@media (max-width: 900px) {
  #page-dashboard .page-content {
    padding: 14px var(--mob-px) calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  }

  .db-hero {
    padding: 20px var(--mob-px) 16px;
    border-radius: var(--mob-radius);
    margin-bottom: var(--mob-gap);
  }
  .db-hero-greeting { font-size: 14px; }
  .db-hero-title    { font-size: 20px; line-height: 1.3; white-space: normal; overflow: visible; }
  .db-hero-sub      { font-size: 13px; }
  .db-hero-stats    { display: none; }
  .db-hero-actions  { flex-direction: row; gap: 8px; margin-top: 14px; }
  .db-hero-actions .btn { flex: 1; justify-content: center; font-size: 13px; padding: 10px; min-height: var(--mob-touch); }

  .db-insight-bar { flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
  .db-body        { grid-template-columns: 1fr; gap: var(--mob-gap); }
  .db-sidebar-col { display: none; }
  .db-list-head--desktop { display: none; }

  .db-row          { padding: 12px 14px; gap: 6px; }
  .db-row-name     { font-size: 13.5px; font-weight: 700; white-space: normal; }
  .db-row-client   { font-size: 12px; white-space: normal; }
  .db-row-date     { display: none; }
  .db-row-value    { font-size: 14px; font-weight: 800; white-space: nowrap; }
}

/* Ações rápidas mobile */
.db-mob-actions { display: none; }

@media (max-width: 900px) {
  .db-mob-actions {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 14px;
  }
}

.db-mob-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: white; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 10px 4px; cursor: pointer;
  font-size: 10.5px; font-weight: 600; color: #475569;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, transform .1s;
  min-height: var(--mob-touch);
}
.db-mob-action-btn:active { transform: scale(.94); background: #f8fafc; }
.db-mob-action-icon {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}

@media (max-width: 680px) {
  .db-kpis  { grid-template-columns: 1fr 1fr; gap: 10px; }
  .db-kpi   { padding: 14px 12px; border-radius: 14px; }
  .db-kpi-value { font-size: 20px; }
  .db-kpi-icon  { width: 36px; height: 36px; font-size: 15px; }
  .db-kpi-label { font-size: 11px; }
  .db-kpi-sub   { font-size: 10.5px; }
  .db-actions-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .db-action-btn   { padding: 12px 4px 10px; border-radius: 12px; min-height: var(--mob-touch); }
  .db-action-icon  { font-size: 20px; }
  .db-action-label { font-size: 10px; }
}

@media (max-width: 480px) {
  .db-kpis  { grid-template-columns: 1fr 1fr; gap: 8px; }
  .db-kpi   { padding: 12px 10px; }
  .db-kpi-value { font-size: 18px; }
  .db-kpi-spark { display: none; }
  .db-mob-action-btn  { font-size: 9.5px; padding: 8px 3px; }
  .db-mob-action-icon { width: 34px; height: 34px; font-size: 14px; border-radius: 10px; }
}

/* ================================================================
   5. LISTA DE ORÇAMENTOS
   ================================================================ */
@media (max-width: 900px) {
  #page-estimates .page-content {
    padding: 14px var(--mob-px) calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  }
  .table-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .search-box { max-width: 100%; width: 100%; }
  .filter-group { flex-wrap: wrap; gap: 6px; }
  .filter-group select,
  .filter-group .form-select { flex: 1; min-width: 120px; }
}

@media (max-width: 700px) {
  .est-table-wrap { display: none; }
  .est-cards-wrap { display: flex; }
  .cl-table-wrap > .cl-table { display: none; }
  #clients-cards  { display: flex; }
  .srv-table-wrap { display: none; }
  .srv-cards      { display: flex; }
}

/* Cards de orçamento */
.est-cards-wrap {
  display: none; flex-direction: column; gap: 10px; padding-bottom: 4px;
}

.est-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: #ffffff; border: 1px solid #e2e8f0;
  border-radius: var(--mob-radius); padding: 14px;
  cursor: pointer; transition: box-shadow .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.est-card:active { transform: scale(.985); box-shadow: 0 2px 10px rgba(0,0,0,.09); }

.est-card-avatar {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: white; flex-shrink: 0;
  margin-top: 2px;
}
.est-card-body  { flex: 1; min-width: 0; }
.est-card-name  { font-size: 14px; font-weight: 700; color: #0f172a; white-space: normal; margin-bottom: 3px; line-height: 1.35; }
.est-card-client { font-size: 12px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; max-width: 100%; }
.est-card-client i { margin-right: 3px; }
.est-card-code  { font-size: 11px; color: #2563eb; font-weight: 600; margin-bottom: 3px; display: flex; align-items: center; gap: 3px; }
.est-card-code i { font-size: 10px; }
.est-rev-badge  { display: inline-flex; align-items: center; gap: 3px; background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; border-radius: 10px; padding: 1px 6px; font-size: 10px; font-weight: 600; vertical-align: middle; margin-left: 4px; }
.est-code-badge { display: inline-block; background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; border-radius: 6px; padding: 1px 7px; font-size: 10.5px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.est-code-original { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.est-code-rev      { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.est-card-meta  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.est-card-date  { font-size: 11.5px; color: #94a3b8; }
.est-card-date i { margin-right: 3px; }
.est-card-status { font-size: 11.5px; font-weight: 600; }
.est-card-status i { margin-right: 3px; }

.est-card-right   { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.est-card-value   { font-size: 15px; font-weight: 800; color: #0f172a; white-space: nowrap; }
.est-card-actions { display: flex; gap: 6px; }
.est-card-btn {
  width: 36px; height: 36px; border-radius: 8px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: background .15s;
  -webkit-tap-highlight-color: transparent;
  min-height: var(--mob-touch); min-width: var(--mob-touch);
}
.est-card-btn--pdf { background: #eff6ff; color: #2563eb; }
.est-card-btn--pdf:active { background: #dbeafe; }
.est-card-btn--del { background: #fef2f2; color: #ef4444; }
.est-card-btn--del:active { background: #fee2e2; }

/* ================================================================
   6. EDITOR DE ORÇAMENTO
   ================================================================ */
@media (max-width: 900px) {
  .eb-layout  { grid-template-columns: 1fr; gap: 14px; }

  .eb-topbar {
    flex-wrap: wrap; gap: 8px; padding: 12px var(--mob-px);
    background: white; position: sticky;
    top: var(--topbar-h-mob); z-index: var(--z-sticky);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
  }
  .eb-topbar-left { flex: 1; min-width: 0; }
  .eb-title    { font-size: 15px; white-space: normal; overflow: visible; word-break: break-word; }
  .eb-subtitle { display: none; }
  .eb-subtitle.has-code { display: block; font-size: 11px; color: #2563eb; font-weight: 600; margin-top: 1px; }

  .eb-topbar .btn-group { width: 100%; gap: 6px; }
  .eb-topbar .btn-group .btn { flex: 1; justify-content: center; font-size: 12.5px; padding: 8px 6px; min-height: var(--mob-touch); }
  .eb-topbar .btn-group .btn span { display: none; }
  .eb-topbar .btn-group .btn i { margin: 0; font-size: 16px; }

  .eb-form-section  { padding: 16px; border-radius: 14px; }
  .eb-section-title { font-size: 14px; }
  .eb-aside    { order: 2; }
  .eb-main-col { order: 1; }

  .eb-add-item-btn-wrap {
    position: sticky;
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 8px);
    z-index: var(--z-sticky);
    padding: 8px 0;
    background: linear-gradient(to top, rgba(248,250,252,1) 60%, transparent);
  }

  .eb-action-bar { flex-wrap: wrap; gap: 8px; }
  .eb-action-bar .btn { flex: 1; justify-content: center; min-width: 120px; font-size: 13px; min-height: var(--mob-touch); }
}

@media (max-width: 680px) {
  .eb-layout .form-row,
  #page-estimate-builder .form-row { grid-template-columns: 1fr; }

  /* Item row no editor: layout mobile-card */
  .eb-item-row {
    flex-direction: column; gap: 10px; padding: 14px;
    border-radius: 12px; background: #f8fafc;
    border: 1px solid #e2e8f0; margin-bottom: 10px;
  }
  .eb-item-row .form-group { margin: 0; }

  /* Campos numéricos em linha dupla */
  .eb-item-numerics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .eb-item-qty,
  .eb-item-price { width: 100%; }

  /* Subtotal e botão delete em linha */
  .eb-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .eb-total-row   { font-size: 15px; }
  .eb-grand-total { font-size: 22px; }
  .eb-ai-card     { border-radius: 14px; }
  .eb-ai-output   { font-size: 13px; min-height: 120px; }

  .eb-items-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .eb-items-header-right { width: 100%; display: flex; gap: 6px; }
  .eb-items-header-right .btn { flex: 1; justify-content: center; font-size: 12.5px; min-height: var(--mob-touch); }
}

/* Etapas */
@media (max-width: 700px) {
  .eb-stage        { margin: 6px 8px; border-radius: 8px; }
  .eb-stage-header { padding: 8px 10px; gap: 6px; }
  .eb-stage-name   { font-size: 13px; white-space: normal; }
  .eb-stage-total  { font-size: 12px; padding: 2px 7px; white-space: nowrap; }
}

/* Library picker — bottom-sheet */
@media (max-width: 640px) {
  #library-picker-modal.modal-overlay { align-items: flex-end; padding: 0; }
  .modal-lib {
    max-width: 100%; border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0;
    max-height: 92vh; margin-top: auto; align-self: flex-end;
  }
  .lp-search-bar { flex-wrap: wrap; gap: 6px; }
  .lp-search-bar .form-input { min-width: 0; flex: 1; }
  .lp-cat-sel { width: 100%; padding: 9px 10px; }
  .lp-grid    { max-height: 52vh; }
  .lp-item    { padding: 11px 12px; gap: 10px; min-height: var(--mob-touch); }
  .lp-item-name  { font-size: 13px; white-space: normal; }
  .lp-item-price { font-size: 13px; white-space: nowrap; }
  .lp-item-desc  { font-size: 11px; white-space: normal; }
}

/* ================================================================
   7. CLIENTES
   ================================================================ */
@media (max-width: 900px) {
  #page-clients .page-content { padding: 14px var(--mob-px) calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px); }
  .cl-header { flex-wrap: wrap; gap: 8px; padding: 14px var(--mob-px); }
  .cl-header .btn-primary { width: 100%; justify-content: center; min-height: var(--mob-touch); font-size: 14px; }
  .cl-search-box { width: 100%; max-width: 100%; }
}

/* Cards de clientes */
#clients-cards {
  display: none; flex-direction: column; gap: 10px;
  padding: 0 var(--mob-px) 8px;
}

.cl-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: var(--mob-radius); padding: 14px;
  cursor: pointer; transition: box-shadow .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.cl-card:active { transform: scale(.985); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.cl-card-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: white; flex-shrink: 0;
}
.cl-card-body   { flex: 1; min-width: 0; }
.cl-card-name   { font-size: 14px; font-weight: 700; color: #0f172a; white-space: normal; margin-bottom: 4px; line-height: 1.3; }
.cl-card-email  { font-size: 12px; color: #64748b; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; }
.cl-card-email i, .cl-card-phone i { margin-right: 3px; color: #94a3b8; }
.cl-card-phone  { font-size: 12px; color: #64748b; }
.cl-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cl-card-btn {
  width: 36px; height: 36px; border-radius: 8px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: background .15s;
  -webkit-tap-highlight-color: transparent;
  min-height: var(--mob-touch); min-width: var(--mob-touch);
}
.cl-card-btn--edit { background: #eff6ff; color: #2563eb; }
.cl-card-btn--edit:active { background: #dbeafe; }
.cl-card-btn--del  { background: #fef2f2; color: #ef4444; }
.cl-card-btn--del:active  { background: #fee2e2; }

/* ================================================================
   8. SERVIÇOS
   ================================================================ */
@media (max-width: 900px) {
  #page-services .page-content { padding: 14px var(--mob-px) calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px); }
  .srv-header { flex-wrap: wrap; gap: 8px; padding: 14px var(--mob-px); }
  .srv-header .btn-primary { width: 100%; justify-content: center; min-height: var(--mob-touch); font-size: 14px; }
  .srv-search-box { width: 100%; max-width: 100%; }
}

.srv-cards { display: none; flex-direction: column; gap: 10px; padding: 0 var(--mob-px) 8px; }

.srv-card {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: var(--mob-radius); padding: 14px;
  transition: box-shadow .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.srv-card:active { transform: scale(.985); }

.srv-card-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: #ede9fe; color: #7c3aed;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.srv-card-body  { flex: 1; min-width: 0; }
.srv-card-name  { font-size: 14px; font-weight: 700; color: #0f172a; white-space: normal; margin-bottom: 3px; line-height: 1.3; }
.srv-card-meta  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.srv-card-cat   { font-size: 11px; color: #7c3aed; background: #ede9fe; border-radius: 6px; padding: 1px 6px; }
.srv-card-unit  { font-size: 11px; color: #94a3b8; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 1px 6px; }
.srv-card-price { font-size: 15px; font-weight: 800; color: #0f172a; white-space: nowrap; flex-shrink: 0; }
.srv-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.srv-card-btn {
  width: 36px; height: 36px; border-radius: 8px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  -webkit-tap-highlight-color: transparent;
  min-height: var(--mob-touch); min-width: var(--mob-touch);
}
.srv-card-btn--edit { background: #eff6ff; color: #2563eb; }
.srv-card-btn--edit:active { background: #dbeafe; }
.srv-card-btn--del  { background: #fef2f2; color: #ef4444; }
.srv-card-btn--del:active  { background: #fee2e2; }

/* ================================================================
   9. CONFIGURAÇÕES
   ================================================================ */
@media (max-width: 900px) {
  #page-settings .page-content { padding: 14px var(--mob-px) calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px); }
  .settings-grid    { grid-template-columns: 1fr; gap: 14px; }
  .settings-section { border-radius: var(--mob-radius); }
  .settings-header  { padding: 14px var(--mob-px); }
  .settings-body    { padding: 0 var(--mob-px) 14px; }
  .settings-field   { padding: 10px 0; }
  .settings-save-bar { padding: 12px var(--mob-px); gap: 8px; }
  .settings-save-bar .btn { flex: 1; justify-content: center; min-height: var(--mob-touch); }
}

@media (max-width: 680px) {
  .settings-two-col { grid-template-columns: 1fr; }
  .logo-upload-area { min-height: 120px; }
}

/* ================================================================
   10. FINANCEIRO DE OBRA
   ================================================================ */
@media (max-width: 900px) {
  #page-financial .page-content {
    padding: 14px var(--mob-px) calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  }

  /* Header da obra */
  .fin-page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .fin-page-header-left { width: 100%; }
  .fin-page-title { font-size: 18px; flex-wrap: wrap; gap: 6px; }
  .fin-page-subtitle { flex-wrap: wrap; gap: 6px 10px; font-size: 12px; }
  .fin-header-actions { width: 100%; flex-wrap: wrap; gap: 6px; }
  .fin-header-actions button { flex: 1; justify-content: center; min-height: var(--mob-touch); }

  /* KPIs */
  .fin-summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .fin-kpi-card  { padding: 14px 12px; border-radius: 12px; }
  .fin-kpi-value { font-size: 17px; }
  .fin-kpi-label { font-size: 11px; }

  /* Abas */
  .fin-tabs { width: 100%; }
  .fin-tab-btn { flex: 1; justify-content: center; font-size: 12px; padding: 8px 6px; min-height: 40px; }

  /* Toolbar filtros */
  .fin-toolbar { flex-direction: column; gap: 8px; }
  .fin-search-box   { min-width: 100%; width: 100%; }
  .fin-filter-select { width: 100%; min-height: var(--mob-touch); }

  /* Botões de ação */
  .fin-actions-bar { gap: 8px; flex-wrap: wrap; }
  #page-financial .btn-fin-receita,
  #page-financial .btn-fin-despesa { flex: 1; justify-content: center; min-height: var(--mob-touch); }

  /* Itens de lançamento */
  .fin-entry-item   { gap: 10px; padding: 14px; }
  .fin-entry-body   { min-width: 0; }
  .fin-entry-desc   { font-size: 13.5px; white-space: normal; overflow: visible; }
  .fin-entry-meta   { flex-wrap: wrap; gap: 6px; }
  .fin-entry-right  { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
  .fin-entry-amount { font-size: 15px; white-space: nowrap; }
  .fin-entry-date   { font-size: 11.5px; }
  .fin-entry-actions { display: flex; gap: 6px; }
  .fin-action-btn   { width: 36px; height: 36px; min-height: 36px; }

  /* Seletor de obras */
  .fin-selector-wrap { padding: var(--mob-px); }
  .fin-sel-card  { padding: 14px; gap: 12px; }
  .fin-sel-name  { font-size: 14px; white-space: normal; }
  .fin-sel-meta  { flex-wrap: wrap; gap: 4px 10px; font-size: 11px; }
  .fin-sel-value { font-size: 15px; font-weight: 800; white-space: nowrap; }
  .fin-back-btn  { font-size: 13px; padding: 7px 12px; min-height: 38px; align-self: flex-start; }

  /* Barra de lucro */
  .fin-profit-bar { margin-bottom: 16px; }
}

/* Modal de lançamento financeiro — bottom-sheet */
@media (max-width: 680px) {
  .fin-modal-overlay { align-items: flex-end; padding: 0; }
  .fin-modal-box {
    border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0;
    max-height: 96vh;
    width: 100%; max-width: 100%; margin: 0;
  }
  .fin-modal-header { padding: 16px 16px 12px; }
  .fin-modal-body   { padding: 16px; }
  .fin-modal-footer { padding: 12px 16px calc(20px + var(--safe-bottom)); }
  .fin-form-grid { grid-template-columns: 1fr; }
  .fin-type-toggle { width: 100%; }
  .fin-type-btn    { flex: 1; justify-content: center; min-height: var(--mob-touch); }
  #fin-save-btn    { width: 100%; min-height: 48px; font-size: 15px; }
}

@media (max-width: 480px) {
  .fin-summary-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .fin-kpi-value    { font-size: 15px; }
  .fin-kpi-label    { font-size: 10.5px; }
}

/* ================================================================
   11. RECIBOS
   ================================================================ */
@media (max-width: 900px) {
  /* Modal emissão */
  .receipt-modal-overlay { align-items: flex-end; padding: 0; }
  .receipt-modal-box {
    border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0;
    max-height: 96vh; width: 100%; max-width: 100%;
  }
  .receipt-modal-header { padding: 16px 16px 12px; border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0; }
  .receipt-form-grid { grid-template-columns: 1fr; }

  /* Modal histórico */
  .history-modal-overlay,
  .hist-modal-overlay { align-items: flex-end; padding: 0; }
  .history-modal-box,
  .hist-modal-box {
    border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0;
    max-height: 95vh; width: 100%; max-width: 100%;
  }
  .hist-modal-header,
  .history-modal-header { padding: 14px 16px 12px; border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0; }

  /* Modal edição */
  .edit-receipt-modal-overlay { align-items: flex-end; padding: 0; }
  .edit-receipt-modal-box {
    border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0;
    max-height: 95vh; width: 100%; max-width: 100%;
  }

  /* Banco */
  .bank-modal-overlay { align-items: flex-end; padding: 0; }
  .bank-modal-box {
    border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0;
    max-height: 90vh; width: 100%; max-width: 100%;
  }
  .bank-modal-header { border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0; }

  /* Itens de recibo: empilha em coluna */
  .receipt-item { flex-direction: column; gap: 10px; padding: 14px; }
  .receipt-item-right { flex-direction: row; justify-content: space-between; align-items: center; }
  .receipt-item-code  { font-size: 11px; }
  .receipt-item-desc  { white-space: normal; font-size: 13px; }
  .receipt-item-value { white-space: nowrap; font-size: 16px; font-weight: 800; }

  /* Footers */
  .receipt-modal-footer,
  .bank-modal-footer {
    flex-direction: column; gap: 8px;
    padding: 12px 16px calc(20px + var(--safe-bottom));
  }
  .receipt-modal-footer .btn,
  .receipt-modal-footer .btn-rec,
  .bank-modal-footer .btn,
  .bank-modal-footer .btn-rec {
    width: 100%; justify-content: center;
    min-height: 48px; font-size: 14px;
  }

  /* Grids formulário */
  .rec-form-grid     { grid-template-columns: 1fr; }
  .rec-form-grid--3  { grid-template-columns: 1fr 1fr; }
  .rec-estimate-summary { grid-template-columns: 1fr 1fr; }

  /* Resumo de faturamento */
  .hist-billing-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
  .hist-sum-item  { padding: 12px; border-radius: 10px; }
  .hist-sum-value { font-size: 16px; }

  /* Histórico — regras de receipts.css têm precedência; apenas reforços aqui */
  .history-modal-header-info { flex: 1; min-width: 0; }
  .history-modal-title    { font-size: 16px; }
  .history-modal-subtitle { white-space: normal; font-size: 12px; }
  /* hist-receipt-item: propriedades legacy removidas — receipts.css gerencia */
  .hist-receipt-right { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
  .hist-receipt-amount { font-size: 16px; }

  /* Banco selector */
  .rec-bank-selector { flex-direction: column; align-items: stretch; }
  .btn-rec-add-bank  { justify-content: center; min-height: var(--mob-touch); }

  /* Botões mínimos */
  .btn-rec { min-height: var(--mob-touch); }
}

@media (max-width: 480px) {
  .rec-form-grid--3     { grid-template-columns: 1fr; }
  .hist-billing-summary { grid-template-columns: 1fr; }
}

/* ================================================================
   12. DRE — DEMONSTRATIVO DE RESULTADO
   ================================================================ */
@media (max-width: 900px) {
  #page-dre .page-content {
    padding: 14px var(--mob-px) calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  }

  /* Topbar */
  .dre-page-topbar,
  .dre-header {
    flex-direction: column; align-items: flex-start;
    padding: 16px var(--mob-px) 14px; gap: 10px;
  }
  .dre-topbar-left,
  .dre-header-left { width: 100%; }
  .dre-page-title  { font-size: 18px; }
  .dre-page-sub    { flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }

  /* Botões de exportar */
  .dre-export-btns,
  .dre-header-actions {
    flex-direction: row; flex-wrap: wrap; gap: 6px; width: 100%;
  }
  .dre-btn-export { flex: 1; justify-content: center; min-height: var(--mob-touch); font-size: 12px; }
  .dre-header-actions .btn { flex: 1; justify-content: center; min-height: var(--mob-touch); font-size: 13px; }

  /* Filtros */
  .dre-filters-bar,
  .dre-filters {
    flex-direction: column; align-items: stretch;
    padding: 12px var(--mob-px); gap: 8px;
  }
  .dre-filters-row { display: flex; flex-direction: column; gap: 8px; }
  .dre-filter-select { width: 100%; max-width: 100%; min-height: var(--mob-touch); }
  .dre-filter-group  { flex-wrap: wrap; gap: 6px; }
  .dre-filters-actions { margin-left: 0; display: flex; gap: 8px; }
  .dre-filters-actions button { flex: 1; justify-content: center; min-height: var(--mob-touch); }

  /* KPIs */
  .dre-kpi-grid  { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dre-kpi-card,
  .dre-kpi       { padding: 14px 12px; border-radius: 14px; }
  .dre-kpi-value,
  .dre-kpi-val   { font-size: 15px; overflow: visible; }
  .dre-kpi-label { font-size: 11px; }
  .dre-kpi-sub   { font-size: 10.5px; overflow: visible; }

  /* Conteúdo */
  .dre-main-content { padding: 14px var(--mob-px); }
  .dre-section { border-radius: 14px; overflow: hidden; margin-bottom: 20px; }
  .dre-section-header h3 { font-size: 13.5px; }

  /* Tabelas → scroll horizontal suave */
  .dre-table-wrap,
  .dre-obras-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dre-table       { min-width: 380px; }
  .dre-obras-table { min-width: 420px; }
  .dre-table th, .dre-table td { padding: 9px 10px; font-size: 12px; }

  /* Gráfico evolução */
  .dre-evo-chart { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dre-evo-col   { min-width: 56px; }
  .dre-evo-label { font-size: 10px; }
}

@media (max-width: 480px) {
  .dre-kpi-grid   { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dre-kpi-val,
  .dre-kpi-value  { font-size: 13.5px; }
  .dre-page-title { font-size: 16px; }
  .dre-table th, .dre-table td { font-size: 11px; padding: 8px; }
}

/* ================================================================
   13. RELATÓRIOS FINANCEIROS (modal)
   ================================================================ */
@media (max-width: 720px) {
  .rpt-modal-overlay { padding: 0; align-items: flex-end; }
  .rpt-modal-box {
    border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0;
    max-height: 96vh; width: 100%; max-width: 100%;
  }
  .rpt-modal-header { padding: 14px 16px 10px; }
  .rpt-modal-tabs   {
    padding: 6px 12px 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .rpt-tab-btn      { padding: 8px 14px; font-size: 12.5px; white-space: nowrap; min-height: var(--mob-touch); }

  .rpt-tab-panel    { padding: 14px; max-height: calc(100vh - 260px); }
  .rpt-res-cards    { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .rpt-res-card     { padding: 12px; border-radius: 12px; }
  .rpt-res-card-value { font-size: 16px; overflow: visible; }
  .rpt-breakdown-grid { grid-template-columns: 1fr; }

  /* Tabela extrato: scroll */
  .rpt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .rpt-table      { min-width: 480px; }
  .rpt-table th, .rpt-table td { padding: 8px 10px; font-size: 12px; }

  /* Footer */
  .rpt-modal-footer {
    flex-direction: column; align-items: stretch;
    padding: 12px 16px calc(20px + var(--safe-bottom)); gap: 8px;
  }
  .rpt-export-btns  { flex-direction: column; gap: 8px; }
  .rpt-btn-export   { width: 100%; justify-content: center; min-height: 48px; font-size: 14px; }
}

@media (max-width: 480px) {
  .rpt-res-cards      { grid-template-columns: 1fr 1fr; }
  .rpt-res-card-value { font-size: 14px; }
  .rpt-table th, .rpt-table td { padding: 7px 8px; font-size: 11px; }
}

/* ================================================================
   14. PAINEL GESTOR / ADMIN
   ================================================================ */
@media (max-width: 900px) {
  .adm-header { padding: 16px var(--mob-px) 14px; }
  .adm-tabs-bar {
    padding: 0 var(--mob-px);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    white-space: nowrap; gap: 0;
  }
  .adm-tab-btn { padding: 12px 16px; font-size: 13px; white-space: nowrap; min-height: var(--mob-touch); }

  /* Métricas */
  .adm-metrics { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: var(--mob-px); }
  .adm-metric  { padding: 14px 12px; border-radius: 14px; }
  .adm-metric-value { font-size: 22px; }
  .adm-metric-label { font-size: 11px; }

  /* Tabelas: scroll */
  .adm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .adm-table      { min-width: 560px; }
  .adm-table th, .adm-table td { padding: 10px 12px; font-size: 12.5px; }
  .adm-tab        { padding: var(--mob-px); }
}

@media (max-width: 680px) {
  .adm-metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .adm-metric-value { font-size: 19px; }
  .adm-filter-bar { flex-direction: column; gap: 8px; }
  .adm-filter-bar .form-input,
  .adm-filter-bar .form-select { width: 100%; }
  .adm-bulk-actions { flex-wrap: wrap; gap: 6px; }
  .adm-bulk-actions .btn { flex: 1; justify-content: center; min-height: var(--mob-touch); font-size: 12.5px; }
}

/* ================================================================
   15. EQUIPE
   ================================================================ */
@media (max-width: 900px) {
  #page-team .page-content {
    padding: 14px var(--mob-px) calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  }

  .team-header { flex-direction: column; gap: 10px; padding: 14px var(--mob-px); }
  .team-header .btn-primary { width: 100%; justify-content: center; min-height: var(--mob-touch); }

  /* Lista de membros como cards */
  .team-member-item { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; }
  .team-member-info { width: 100%; }
  .team-member-name  { white-space: normal; font-size: 15px; font-weight: 700; line-height: 1.3; }
  .team-member-role  { font-size: 12px; color: #64748b; }
  .team-member-email { font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
  .team-member-actions { width: 100%; display: flex; gap: 8px; }
  .team-member-actions .btn { flex: 1; justify-content: center; min-height: var(--mob-touch); font-size: 12.5px; }
  .team-perms-list { flex-wrap: wrap; gap: 5px; margin-top: 6px; }

  /* Analytics da equipe */
  .team-analytics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .team-analytics-card { padding: 14px 12px; border-radius: 14px; }

  /* Log de atividade: scroll */
  .team-log-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .team-log-table { min-width: 420px; }
  .team-log-table th,
  .team-log-table td { padding: 8px 10px; font-size: 12px; }
}

@media (max-width: 700px) {
  /* Modal de membro: sheet */
  .team-modal-overlay { align-items: flex-end; padding: 0; }
  .team-modal-box {
    border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0;
    max-height: 95vh; width: 100%; max-width: 100%;
  }
  .team-modal-header { padding: 16px 16px 12px; }
  .team-modal-body   { padding: 16px; overflow-y: auto; }
  .team-modal-footer {
    padding: 12px 16px calc(20px + var(--safe-bottom));
    flex-direction: column; gap: 8px;
  }
  .team-modal-footer .btn { width: 100%; justify-content: center; min-height: 48px; font-size: 14px; }

  /* Permissões */
  .team-perm-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .team-perm-item { padding: 10px; border-radius: 10px; font-size: 12px; min-height: var(--mob-touch); }
}

@media (max-width: 600px) {
  .team-perm-grid      { grid-template-columns: 1fr; }
  .team-analytics-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   16. PLANOS & ASAAS
   ================================================================ */
@media (max-width: 900px) {
  #page-plans .page-content {
    padding: 14px var(--mob-px) calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  }
  .plans-grid { grid-template-columns: 1fr; gap: 16px; }
  .plan-card  { border-radius: var(--mob-radius); }
  .plan-card-header { padding: 20px 16px 14px; }
  .plan-cta-btn { min-height: 48px; font-size: 15px; border-radius: 12px; width: 100%; justify-content: center; }
}

/* Checkout Asaas: sheet */
@media (max-width: 680px) {
  .co-modal-overlay { align-items: flex-end; padding: 0; }
  .co-modal {
    border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0;
    max-height: 96vh; width: 100%; max-width: 100%; margin: 0;
  }
  .co-form-row     { flex-direction: column; }
  .co-form-group   { width: 100%; }
  .co-form-actions { flex-direction: column; }
  .co-form-actions .btn { width: 100%; justify-content: center; min-height: 48px; }
}

/* ================================================================
   17. PROGRAMA DE INDICAÇÕES
   ================================================================ */
@media (max-width: 900px) {
  #page-referral .page-content {
    padding: 14px var(--mob-px) calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  }
  .ref-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ref-stat-card  { padding: 14px 12px; border-radius: 14px; }
  .ref-share-box  { flex-direction: column; gap: 8px; }
  .ref-link-input { width: 100%; }
  .ref-copy-btn   { width: 100%; justify-content: center; min-height: var(--mob-touch); }
  .ref-history-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 480px) {
  .ref-stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* ================================================================
   18. SERVICE INTELLIGENCE
   ================================================================ */
@media (max-width: 900px) {
  .si-suggestions-popup {
    max-width: calc(100vw - 32px);
    left: 50%; transform: translateX(-50%); right: auto;
  }
  .si-save-modal-overlay { align-items: flex-end; padding: 0; }
  .si-save-modal-box {
    border-radius: var(--mob-sheet-r) var(--mob-sheet-r) 0 0;
    max-height: 90vh; width: 100%; max-width: 100%;
  }

  /* Match card mais compacto */
  .si-match-card { max-width: calc(100vw - 28px); }
  .si-match-header { font-size: 12px; }
  .si-match-name  { font-size: 13px; }

  /* Dashboard analítico */
  .si-dash-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .si-dash-kpi  { padding: 14px 12px; border-radius: 14px; }
  .si-dash-kpi-val { font-size: 18px; }
  .si-dash-charts  { grid-template-columns: 1fr; gap: 14px; }
  .si-dash-chart-card { border-radius: 14px; }

  /* Tabela ranking: scroll */
  .si-dash-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .si-rank-table { min-width: 440px; }
  .si-rank-table th,
  .si-rank-table td { padding: 8px 10px; font-size: 12px; }
}

@media (max-width: 640px) {
  .si-dash-kpis     { grid-template-columns: 1fr 1fr; gap: 8px; }
  .si-dash-kpi-val  { font-size: 16px; }
  .si-suggest-chips { gap: 6px; }
  .si-suggest-chip  { padding: 8px 10px; border-radius: 10px; }
  .si-suggest-name  { font-size: 12px; }
}

@media (max-width: 400px) {
  .si-dash-kpis { grid-template-columns: 1fr; }
}

/* ================================================================
   19. AUTENTICAÇÃO
   ================================================================ */
@media (max-width: 680px) {
  .auth-card  { border-radius: var(--mob-radius); padding: 28px 20px; }
  .auth-title { font-size: 22px; }
  .auth-tabs  { border-radius: 10px; }
  .auth-form-actions { flex-direction: column; gap: 8px; }
  .auth-form-actions .btn { width: 100%; justify-content: center; min-height: 48px; font-size: 15px; }
}

/* ================================================================
   20. MODAIS GLOBAIS — z-index e comportamento
   ================================================================ */
@media (max-width: 900px) {
  /* Confirm dialog sempre no topo */
  #confirm-dialog { z-index: var(--z-overlay-top); }

  /* Troca de senha de membro */
  #member-change-pwd-screen { z-index: var(--z-overlay-top); }

  /* Modais de recibos */
  #modal-emit-receipt    { z-index: var(--z-modal-hi); }
  #modal-receipt-history { z-index: var(--z-modal-hi); }
  #modal-edit-receipt    { z-index: var(--z-modal-hi); }
  #modal-bank-account    { z-index: var(--z-modal-top); }

  /* Modais de financeiro */
  #fin-modal-entry       { z-index: var(--z-modal-hi); }
  #fin-attachment-viewer { z-index: var(--z-modal-top); }

  /* Modal de relatórios */
  .rpt-modal-overlay { z-index: var(--z-modal-hi); }

  /* Toasts sempre visíveis */
  .toast-container,
  #toast-container { z-index: var(--z-toast); }

  /* Modais genéricos: 90% da viewport, sem cortar */
  .modal-overlay .modal { max-height: 90vh; overflow-y: auto; }
}

/* Animação slide-up para todos os bottom-sheets */
@media (max-width: 900px) {
  .fin-modal-overlay.active     .fin-modal-box,
  .receipt-modal-overlay.active .receipt-modal-box,
  .hist-modal-overlay.active    .hist-modal-box,
  .history-modal-overlay.active .history-modal-box,
  .bank-modal-overlay.active    .bank-modal-box,
  .edit-receipt-modal-overlay.active .edit-receipt-modal-box,
  .team-modal-overlay.active    .team-modal-box,
  .si-save-modal-overlay.active .si-save-modal-box,
  .rpt-modal-overlay.active     .rpt-modal-box,
  .co-modal-overlay.active      .co-modal {
    animation: _mobSlideUp .28s cubic-bezier(.32,1,.56,1);
  }
}

@keyframes _mobSlideUp {
  from { transform: translateY(100%); opacity: .5; }
  to   { transform: translateY(0);    opacity: 1;  }
}

/* ================================================================
   21. POPUP DE PROMOÇÃO
   ================================================================ */
@media (max-width: 680px) {
  .promo-popup     { width: 92%; border-radius: 20px; padding: 24px 20px; }
  .pp-title        { font-size: 20px; }
  .pp-subtitle     { font-size: 13px; }
  .pp-btn-primary  { width: 100%; justify-content: center; min-height: 48px; }
}

/* ================================================================
   22. TABELAS → CARDS (padrão data-label)
   ================================================================ */
@media (max-width: 640px) {
  /* Wrap sem scroll horizontal quando usando card-mode */
  .table-card-mobile-wrap { overflow: visible; }

  /* Oculta thead */
  .table-card-mobile thead {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
  }

  /* Cada linha vira um card */
  .table-card-mobile tbody tr {
    display: block;
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    border: 1px solid #e5e7eb;
    padding: 12px 14px; margin-bottom: 10px;
  }
  .table-card-mobile tbody tr:hover { box-shadow: 0 2px 10px rgba(0,0,0,.10); }

  /* Cada célula: label + valor em linha */
  .table-card-mobile tbody td {
    display: flex; align-items: flex-start;
    gap: 8px; padding: 5px 0;
    font-size: 13px; border: none;
  }
  .table-card-mobile tbody td::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 700; color: #6b7280;
    text-transform: uppercase; letter-spacing: .4px;
    min-width: 90px; flex-shrink: 0; padding-top: 1px;
  }

  /* Célula de ações */
  .table-card-mobile tbody td.td-actions {
    justify-content: flex-end; padding-top: 8px;
    border-top: 1px solid #f3f4f6; margin-top: 4px;
  }
  .table-card-mobile tbody td.td-actions::before { display: none; }
}

/* ================================================================
   23. UTILITÁRIOS MOBILE
   ================================================================ */

/* Ocultar em telas pequenas */
@media (max-width: 600px) { .hide-mobile { display: none; } }

/* Scroll horizontal suave universal */
.table-responsive,
.dre-table-wrap,
.adm-table-wrap,
.rpt-table-wrap,
.si-dash-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: none;
  border-radius: inherit;
}

/* Performance: will-change em elementos que animam */
.fin-modal-box,
.receipt-modal-box,
.hist-modal-box,
.history-modal-box,
.bank-modal-box,
.edit-receipt-modal-box,
.team-modal-box,
.rpt-modal-box,
.co-modal,
.sidebar,
.mobile-bottom-nav {
  will-change: transform;
}
