/* ══════════════════════════════════════════════════════════
   FINANCEPRO · MOBILE-FIRST LAYER v1.0
   Mobile, Tablet, Touch UX, PWA, Safe Areas
   Carregado DEPOIS de style.css — sobreescreve onde necessário
══════════════════════════════════════════════════════════ */

/* ── TOKENS MOBILE ─────────────────────────────────────── */
:root {
  --bn-h: 64px;          /* altura bottom nav */
  --bn-safe: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --drawer-z: 400;
  --fab-size: 54px;
  --touch-min: 44px;     /* iOS HIG mínimo */
}

/* ── PWA STANDALONE: Safe Areas ────────────────────────── */
@media (display-mode: standalone) {
  body {
    padding-top: var(--safe-top);
  }
  .mobile-topbar {
    padding-top: calc(var(--safe-top) + 12px);
    height: calc(56px + var(--safe-top));
  }
  .bottom-nav {
    padding-bottom: calc(var(--bn-safe) + 6px);
    height: calc(var(--bn-h) + var(--bn-safe));
  }
}

/* ══════════════════════════════════════════════════════════
   TABLET (768–1024px) — Sidebar compacta
══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) and (min-width: 769px) {
  :root { --sw: 200px; }

  .view { padding: 20px 20px 32px; }

  .kpi-8 { grid-template-columns: repeat(4, 1fr); }
  .kpi-4 { grid-template-columns: repeat(2, 1fr); }

  .stats-6 { grid-template-columns: repeat(3, 1fr); }
  .stats-4 { grid-template-columns: repeat(2, 1fr); }

  .company-cards-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .pf-cards-grid      { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .folder-mini-grid   { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

  .form-grid { grid-template-columns: 1fr 1fr; }

  .proj-card-body { grid-template-columns: 1fr 1fr; }

  /* Tabela tablet: scroll suave */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Modal tablet */
  .modal { width: min(560px, 90vw); }
}

/* ══════════════════════════════════════════════════════════
   MOBILE (≤768px) — Transformação completa
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── HTML/BODY ── */
  html { font-size: 14px; }
  body {
    overflow: hidden;
    /* Fix: iOS momentum scroll no elemento certo */
  }

  /* ── SIDEBAR → DRAWER ─────────────────────────────────── */
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: min(300px, 82vw) !important;
    min-width: 0 !important;
    height: 100dvh;
    z-index: var(--drawer-z);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.28s ease;
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-right: none !important;
  }

  .sidebar.drawer-open {
    transform: translateX(0);
    box-shadow: 0 0 60px rgba(0,0,0,.5);
  }

  /* Backdrop do drawer */
  .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: calc(var(--drawer-z) - 1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  .drawer-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* ── MAIN CONTENT ─────────────────────────────────────── */
  .main {
    margin-left: 0 !important;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* Espaço para topbar + bottom nav */
    padding-top: 56px;
    padding-bottom: calc(var(--bn-h) + var(--bn-safe) + 28px);
    scroll-behavior: smooth;
  }

  /* Ocultar save-indicator no mobile (integrado ao topbar) */
  .save-indicator { display: none !important; }

  /* ── TOP BAR MOBILE ────────────────────────────────────── */
  .mobile-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--sb-bg);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 350;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }

  .mobile-topbar-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
    min-width: 0;
  }

  .mobile-topbar-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-topbar-sub {
    font-size: 10px;
    color: var(--sb-text);
    font-weight: 400;
    white-space: nowrap;
  }

  .mobile-sync-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
    animation: pulse-sync 2.5s ease-in-out infinite;
  }
  .mobile-sync-dot.offline { background: var(--amber); }
  .mobile-sync-dot.error   { background: var(--red); }

  @keyframes pulse-sync {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(.7); }
  }

  /* Hamburger Button */
  .hamburger-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .hamburger-btn:active { background: rgba(255,255,255,.15); }

  .hamburger-icon {
    width: 18px; height: 14px;
    display: flex; flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
  }
  .hamburger-icon span {
    display: block;
    height: 2px;
    background: rgba(255,255,255,.85);
    border-radius: 99px;
    transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
  }
  .hamburger-btn.open .hamburger-icon span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  .hamburger-btn.open .hamburger-icon span:nth-child(2) {
    opacity: 0; transform: scaleX(0);
  }
  .hamburger-btn.open .hamburger-icon span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  /* FAB — Novo Lançamento */
  .fab-new {
    position: fixed;
    right: 16px;
    bottom: calc(var(--bn-h) + var(--bn-safe) + 14px);
    width: var(--fab-size);
    height: var(--fab-size);
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(29,78,216,.5);
    cursor: pointer;
    z-index: 300;
    transition: all 0.2s ease;
    border: none;
    -webkit-tap-highlight-color: transparent;
  }
  .fab-new:active {
    transform: scale(0.92);
    box-shadow: 0 2px 10px rgba(29,78,216,.4);
  }
  .fab-new svg { width: 22px; height: 22px; stroke: #fff; }

  /* ── BOTTOM NAVIGATION ─────────────────────────────────── */
  .bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bn-h);
    padding-bottom: var(--bn-safe);
    background: var(--sb-bg);
    border-top: 1px solid rgba(255,255,255,.07);
    display: flex;
    align-items: stretch;
    z-index: 300;
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
  }

  .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 8px 4px;
    color: var(--sb-text);
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: var(--touch-min);
    position: relative;
  }
  .bn-item:active { opacity: 0.7; }

  .bn-item.active { color: #fff; }
  .bn-item.active::before {
    content: '';
    position: absolute;
    top: 0; left: 25%; right: 25%;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
  }

  .bn-icon {
    width: 22px; height: 22px;
    stroke: currentColor; fill: none;
    stroke-width: 1.6;
    transition: transform 0.15s ease;
  }
  .bn-item.active .bn-icon { transform: scale(1.1); }

  .bn-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -.1px;
    white-space: nowrap;
  }

  .bn-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 18px);
    min-width: 16px; height: 16px;
    background: var(--red);
    border-radius: 99px;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 1.5px solid var(--sb-bg);
  }

  /* Ocultar sidebar-footer btn (substituído pelo FAB) */
  .sidebar-footer { display: none; }

  /* ── VIEW / PAGE ─────────────────────────────────────────── */
  .view {
    padding: 16px 16px 20px !important;
    animation: none; /* Reduz jank no mobile */
  }

  /* ── PAGE HEADER ─────────────────────────────────────────── */
  .page-header {
    margin-bottom: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-title {
    font-size: 18px;
  }

  .page-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .page-actions .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    min-height: var(--touch-min);
  }

  /* ── KPI STRIP ───────────────────────────────────────────── */
  .kpi-strip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    margin: 0 -16px 16px;
    padding: 0 16px;
    gap: 8px;
  }

  .kpi-8,
  .kpi-4 {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    width: max-content;
    min-width: 100%;
  }

  /* Mobile KPI: 2 columns stacked */
  @supports not (overflow-x: auto) {
    .kpi-8, .kpi-4 { grid-template-columns: 1fr 1fr; width: 100%; }
  }

  .kpi-card {
    scroll-snap-align: start;
    min-width: 130px;
    padding: 12px 13px;
  }
  .kpi-value { font-size: 14px; }

  /* ── STAT CARDS ──────────────────────────────────────────── */
  .stats-grid { gap: 8px; margin-bottom: 16px; }
  .stats-6,
  .stats-4 { grid-template-columns: 1fr 1fr; }
  .stats-3 { grid-template-columns: 1fr 1fr; }
  .stats-2 { grid-template-columns: 1fr 1fr; }

  .stat-card { padding: 12px 14px; }
  .stat-value { font-size: 16px; }

  /* ── CARDS ───────────────────────────────────────────────── */
  .company-cards-grid { grid-template-columns: 1fr 1fr; }
  .pf-cards-grid      { grid-template-columns: 1fr 1fr; }
  .folder-mini-grid   { grid-template-columns: 1fr 1fr; }

  /* ── TABELAS MOBILE ──────────────────────────────────────── */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--r);
    /* Indicador de scroll */
    background:
      linear-gradient(to right, var(--bg-card) 20%, transparent 80%),
      linear-gradient(to left, var(--bg-card) 20%, transparent 80%),
      linear-gradient(to right, var(--border), transparent),
      linear-gradient(to left, var(--border), transparent);
    background-position: left, right, left, right;
    background-size: 24px 100%, 24px 100%, 8px 100%, 8px 100%;
    background-repeat: no-repeat;
    background-attachment: local, local, scroll, scroll;
  }

  /* Células mínimas para touch */
  td { padding: 11px 12px; }
  th { padding: 9px 12px; }

  /* Botões de ação da tabela: sempre visíveis no mobile */
  .td-actions { opacity: 1 !important; }

  /* Coluna de checkbox: menor */
  td:first-child, th:first-child {
    padding-left: 14px;
  }

  /* ── MOBILE TABLE → CARDS ────────────────────────────────── */
  /* Classe aplicada via JS para transformar tabelas em cards */
  .mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .mobile-card-list table,
  .mobile-card-list thead,
  .mobile-card-list tbody,
  .mobile-card-list tfoot { display: block; }

  .mobile-card-list thead { display: none; }

  .mobile-card-list tr {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 12px 14px;
    gap: 6px;
    box-shadow: var(--sh-xs);
  }

  .mobile-card-list tr:hover td { background: transparent; }

  .mobile-card-list td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 2px 0;
    border: none;
  }

  .mobile-card-list td::before {
    content: attr(data-label);
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-3);
    min-width: 90px;
    flex-shrink: 0;
    padding-top: 1px;
  }

  .mobile-card-list td[data-label=""] { display: none; }
  .mobile-card-list td.td-checkbox { display: flex; }

  /* ── MODAL MOBILE ────────────────────────────────────────── */
  .modal-wrap {
    align-items: flex-end !important;
    padding: 0;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92dvh !important;
    border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
    transform: translateY(100%) !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Handle bar visual */
    padding-top: 4px;
  }

  .modal-wrap.open .modal {
    transform: translateY(0) !important;
  }

  /* Handle bar no topo do modal */
  .modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border-2);
    border-radius: 99px;
    margin: 0 auto 10px;
  }

  .modal-header {
    padding: 12px 18px 12px;
    border-radius: 0 !important;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 2;
  }

  .modal-title { font-size: 16px; }

  .modal-body {
    padding: 14px 18px 24px;
    /* Compensar bottom nav */
    padding-bottom: calc(24px + var(--bn-safe));
  }

  /* ── FORM MOBILE ─────────────────────────────────────────── */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-group.full { grid-column: 1; }

  .form-input,
  .form-select,
  .form-textarea {
    padding: 11px 13px;
    font-size: 16px; /* Previne zoom no iOS */
    border-radius: var(--r-sm);
    min-height: var(--touch-min);
  }

  .form-textarea { font-size: 16px; }

  .form-actions {
    flex-direction: column-reverse;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    padding-bottom: 8px;
    margin-bottom: -8px;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: var(--touch-min);
    font-size: 14px;
  }

  /* ── BUTTONS TOUCH ────────────────────────────────────────── */
  .btn {
    min-height: var(--touch-min);
    padding: 10px 16px;
    -webkit-tap-highlight-color: transparent;
  }

  .btn-sm {
    min-height: 36px;
    padding: 7px 13px;
  }

  .btn-icon {
    width: 38px; height: 38px;
    -webkit-tap-highlight-color: transparent;
  }

  /* ── FILTERS BAR MOBILE ───────────────────────────────────── */
  .filters-bar {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
  }

  .search-wrap { min-width: 0; width: 100%; }

  .search-input {
    font-size: 16px; /* Previne zoom iOS */
    padding: 10px 12px 10px 34px;
    min-height: var(--touch-min);
  }

  .filter-select {
    font-size: 16px;
    min-height: var(--touch-min);
    width: 100%;
  }

  /* ── MONTH NAV MOBILE ─────────────────────────────────────── */
  .month-nav {
    width: 100%;
    justify-content: center;
    padding: 6px 10px;
    margin-bottom: 12px;
  }

  .month-nav-label {
    min-width: 120px;
    font-size: 14px;
    text-align: center;
  }

  .month-nav button { min-height: var(--touch-min); padding: 4px 10px; font-size: 20px; }

  /* ── FOLDER SECTIONS MOBILE ───────────────────────────────── */
  .folder-header { padding: 12px 14px; }
  .folder-add    { padding: 9px 14px; }

  /* ── BULK BAR MOBILE ──────────────────────────────────────── */
  .bulk-bar {
    left: 50%;
    right: 0;
    bottom: calc(var(--bn-h) + var(--bn-safe));
    transform: translateX(-50%) translateY(100%);
    width: calc(100% - 24px);
    border-radius: var(--r-sm);
    flex-wrap: wrap;
    padding: 10px 16px;
  }

  .bulk-bar.visible {
    transform: translateX(-50%) translateY(0);
  }

  .bulk-actions { flex-wrap: wrap; gap: 6px; }

  .bulk-actions .btn { flex: 1; min-width: 80px; justify-content: center; }

  /* ── TOAST MOBILE ─────────────────────────────────────────── */
  .toast {
    bottom: calc(var(--bn-h) + var(--bn-safe) + 12px);
    right: 12px;
    left: 12px;
    max-width: none;
    text-align: center;
  }

  /* ── DASHBOARD MOBILE ─────────────────────────────────────── */
  .exec-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .exec-section-title { font-size: 11px; }

  /* Company cards: 1 coluna em mobile pequeno */
  @media (max-width: 400px) {
    .company-cards-grid { grid-template-columns: 1fr; }
    .pf-cards-grid      { grid-template-columns: 1fr; }
    .stats-6, .stats-4  { grid-template-columns: 1fr 1fr; }
  }

  /* Schedule panel mobile */
  .sched-value { min-width: 70px; font-size: 12px; }
  .sched-label { font-size: 12px; }

  /* ── PROJETOS MOBILE ──────────────────────────────────────── */
  .proj-card-body {
    grid-template-columns: 1fr 1fr;
  }

  /* ── CARTÕES MOBILE ───────────────────────────────────────── */
  .cc-card-body { padding: 10px 14px; }

  /* ── SETTINGS MOBILE ──────────────────────────────────────── */
  .settings-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .stab { white-space: nowrap; min-height: var(--touch-min); }

  .settings-item {
    padding: 12px 14px;
    min-height: var(--touch-min);
  }

  /* ── CRONOGRAMA MOBILE ────────────────────────────────────── */
  .tday-label { width: 48px; min-width: 48px; }
  .tday-num   { font-size: 16px; }

  .titem { padding: 10px; }
  .titem-desc { font-size: 12px; }

  /* ── REGULARIZAÇÃO MOBILE ─────────────────────────────────── */
  .reg-item-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── CONFIRM DIALOG MOBILE ────────────────────────────────── */
  .confirm-box {
    width: calc(100% - 32px) !important;
    max-width: 380px;
    padding: 24px 20px;
  }

  .confirm-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .confirm-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: var(--touch-min);
  }

  /* ── CARD COMPONENT MOBILE ────────────────────────────────── */
  .card-header { padding: 12px 16px; }

  /* ── LOGIN MOBILE ─────────────────────────────────────────── */
  #loginOverlay .login-card {
    width: calc(100% - 32px) !important;
    padding: 28px 24px;
    border-radius: var(--r-lg);
  }

  #loginOverlay .login-input {
    font-size: 16px; /* Previne zoom iOS */
    min-height: var(--touch-min);
    padding: 12px 14px;
  }

  #loginOverlay .login-btn {
    min-height: var(--touch-min);
    font-size: 15px;
  }

  /* ── NAVIGATION SIDEBAR DRAWER ────────────────────────────── */
  .nav-item {
    padding: 10px 12px;
    min-height: 42px;
    font-size: 13.5px;
  }

  .nav-section { padding: 18px 16px 6px; }

  /* ── SYNC INDICATOR ───────────────────────────────────────── */
  #syncIndicator {
    bottom: calc(var(--bn-h) + var(--bn-safe) + 4px) !important;
  }

  /* ── COMPANY BAND MOBILE ──────────────────────────────────── */
  .company-band {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 12px;
  }

  /* ── ALERT BANNERS ────────────────────────────────────────── */
  .alert-banner { padding: 12px 14px; gap: 9px; }
  .alert-banner-list { gap: 4px; }

  /* ── FOLDER MINI CARDS ────────────────────────────────────── */
  .folder-mini-card { padding: 10px 12px; }

  /* ── HIDE DESKTOP-ONLY ELEMENTS ───────────────────────────── */
  .desktop-only { display: none !important; }
  .mobile-only  { display: block !important; }
} /* end @media ≤768px */

/* ══════════════════════════════════════════════════════════
   SMALL MOBILE (≤480px) — Ajustes extras
══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .kpi-card { padding: 10px 11px; }
  .kpi-value { font-size: 13px; }
  .kpi-label { font-size: 9px; }

  .page-title { font-size: 17px; }

  .co-card-body { grid-template-columns: 1fr 1fr; }

  .proj-stat-value { font-size: 12px; }

  .bn-label { font-size: 9.5px; }

  /* Esconder alguns textos do bottom nav em telas muito pequenas */
}

/* ══════════════════════════════════════════════════════════
   LANDSCAPE MOBILE
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) and (orientation: landscape) {
  .main {
    padding-top: 52px;
  }

  .mobile-topbar { height: 52px; }

  .bottom-nav { height: 52px; }

  /* Modal landscape: mais horizontal */
  .modal {
    max-height: 85dvh !important;
  }
}

/* ══════════════════════════════════════════════════════════
   DARK MODE ADAPTATION
══════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #141413;
    --bg-2:        #1C1C1A;
    --bg-card:     #1E1E1C;
    --bg-hover:    #252523;

    --border:      #2A2A28;
    --border-2:    #353533;

    --text:        #EDEDEB;
    --text-2:      #A8A8A0;
    --text-3:      #686860;
    --text-4:      #4A4A44;

    --sh-xs: 0 1px 2px rgba(0,0,0,.3);
    --sh-sm: 0 1px 4px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25);
    --sh:    0 4px 16px rgba(0,0,0,.4), 0 1px 4px rgba(0,0,0,.25);
    --sh-md: 0 8px 24px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.3);
    --sh-lg: 0 24px 64px rgba(0,0,0,.55), 0 4px 16px rgba(0,0,0,.4);
  }

  .folder-header:hover { background: #222220; }
}

/* ══════════════════════════════════════════════════════════
   REDUCED MOTION
══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .drawer-backdrop,
  .modal,
  .bottom-nav *,
  .hamburger-icon span { transition: none !important; }

  @keyframes pulse-sync { 0%, 100% { opacity: 1; } }
  @keyframes si-pulse   { 0%, 100% { opacity: 1; } }
}

/* ══════════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════════ */
.mobile-only { display: none; }
.desktop-only { display: block; }

/* Smooth scroll para mobile */
@media (max-width: 768px) {
  * { scroll-behavior: smooth; }
  .main { scroll-behavior: smooth; }
}

/* Previne double-tap zoom em botões/links no iOS */
@media (max-width: 768px) {
  button, a, input, select, textarea {
    touch-action: manipulation;
  }
}

/* Pull-to-refresh placeholder visual */
@media (max-width: 768px) {
  .ptr-indicator {
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: var(--text-3);
    display: none;
  }
  .ptr-indicator.visible { display: block; }
}

/* ══════════════════════════════════════════════════════════
   ANIMATIONS (usadas no mobile.js via inline style)
══════════════════════════════════════════════════════════ */
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes fadeInScale {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* ══════════════════════════════════════════════════════════
   SPLASH SCREEN PWA
══════════════════════════════════════════════════════════ */
#pwaSplash {
  position: fixed;
  inset: 0;
  background: var(--sb-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 9999;
  transition: opacity 0.4s ease;
}
#pwaSplash.hidden {
  opacity: 0;
  pointer-events: none;
}
.splash-logo {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 8px 32px rgba(29,78,216,.5);
  animation: fadeInScale 0.4s ease;
}
.splash-name {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.4px;
}
.splash-sub {
  font-size: 13px;
  color: rgba(255,255,255,.4);
}
.splash-loader {
  width: 40px;
  height: 3px;
  background: rgba(255,255,255,.1);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.splash-loader::after {
  content: '';
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent);
  border-radius: 99px;
  animation: splash-progress 1.2s ease-in-out infinite;
}
@keyframes splash-progress {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(350%); }
}
