/* =========================================================
   Sistema Acessa · camada mobile v8.7.18
   Escopo intencional: somente viewports de até 768px.
   Mantém desktop/tablet largo inalterados.
   ========================================================= */

@media (max-width: 768px) {
  :root {
    --mobile-nav-height: 74px;
    --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
    --mobile-page-gutter: 12px;
    --mobile-radius: 18px;
  }

  html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    scroll-padding-top: 66px;
    -webkit-text-size-adjust: 100%;
  }

  body,
  .app-body,
  .app-shell,
  .page-main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  body {
    overscroll-behavior-x: none;
  }

  *, *::before, *::after {
    box-sizing: border-box;
  }

  img, svg, video, canvas {
    max-width: 100%;
    height: auto;
  }

  /* ---------- estrutura principal ---------- */
  .app-shell {
    margin-left: 0 !important;
    padding-bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom));
  }

  .page-main,
  .project-management-mode .page-main {
    padding: 18px var(--mobile-page-gutter) calc(106px + var(--mobile-safe-bottom));
    margin: 0 auto;
  }

  .page-heading,
  .clean-heading,
  .commercial-head,
  .ro-page-title,
  .pm-page-heading,
  .pm-hero,
  .module-hero,
  .leadership-heading,
  .performance-heading,
  .performance-detail-heading,
  .section-heading-inline,
  .panel-title,
  .card-title-row,
  .social-client-toolbar,
  .client-sheet-toolbar,
  .employee-registry-toolbar,
  .result-list-heading,
  .social-work-inbox-header {
    min-width: 0;
  }

  .page-heading,
  .commercial-head,
  .ro-page-title,
  .pm-page-heading,
  .pm-hero,
  .module-hero,
  .performance-heading,
  .performance-detail-heading {
    gap: 12px;
  }

  .page-heading h1,
  .clean-heading h1,
  .commercial-head h1,
  .ro-page-title h1,
  .pm-page-heading h1,
  .module-hero h1,
  .performance-heading h1,
  .performance-detail-heading h1 {
    font-size: clamp(26px, 8vw, 34px) !important;
    line-height: 1.06;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
  }

  .page-heading p,
  .module-hero p,
  .commercial-head p,
  .ro-page-title p,
  .pm-page-heading p {
    max-width: 100%;
    line-height: 1.55;
  }

  .content-card,
  .commercial-card,
  .ro-card,
  .panel-card,
  .mark-card,
  .privacy-note,
  .month-calendar,
  .selected-day-panel,
  .calendar-toolbar,
  .settings-section-card,
  .client-sheet-card,
  .access-table-card {
    border-radius: var(--mobile-radius);
    padding: 16px;
  }

  .content-card + .content-card,
  .commercial-card + .commercial-card,
  .ro-card + .ro-card {
    margin-top: 12px;
  }

  /* Grid children must be allowed to shrink instead of forcing page overflow. */
  .dashboard-grid > *,
  .split-layout > *,
  .personal-room > *,
  .calendar-shell > *,
  .commercial-grid-main > *,
  .commercial-client-layout > *,
  .messages-layout > *,
  .scripts-layout > *,
  .config-layout-ro > *,
  .ro-dashboard-grid > *,
  .ro-two-columns > *,
  .ro-message-layout > *,
  .ro-message-layout-wide > *,
  .ro-config-grid > *,
  .social-dashboard-layout > *,
  .social-client-home-grid > *,
  .performance-layout > *,
  .mark-ai-layout > *,
  .business-main-grid > *,
  .business-settings-card > *,
  .pm-dashboard-grid > *,
  .pm-detail-grid > * {
    min-width: 0;
  }

  /* ---------- topbar ---------- */
  .topbar {
    position: sticky !important;
    top: 0;
    z-index: 90;
    min-height: 54px !important;
    padding: 7px 10px !important;
    gap: 8px;
    flex-wrap: wrap;
    background: rgba(245,239,230,.96);
    border-bottom: 1px solid rgba(82,61,46,.10);
    backdrop-filter: blur(16px);
  }

  .topbar-spacer {
    display: none !important;
  }

  .executive-panel-switcher {
    min-width: 0;
    max-width: 100%;
  }

  .executive-panel-switcher > summary {
    min-height: 44px;
    min-width: 0 !important;
    padding: 9px 13px;
  }

  .panel-switcher-menu,
  .executive-panel-menu {
    position: fixed !important;
    z-index: 200 !important;
    top: 62px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-height: calc(100dvh - 148px) !important;
    padding: 8px;
    border-radius: 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .panel-switcher-option {
    min-height: 56px;
    grid-template-columns: 38px minmax(0,1fr) 18px;
    padding: 9px;
  }

  .topbar-context-return {
    width: 100%;
    min-height: 44px;
    justify-content: space-between;
    border-radius: 14px;
    white-space: normal;
  }

  .topbar-context-return button {
    min-height: 36px;
  }

  /* ---------- bottom navigation ---------- */
  .sidebar {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    z-index: 150;
    width: 100% !important;
    height: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom)) !important;
    min-height: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom));
    padding: 6px 8px calc(6px + var(--mobile-safe-bottom)) !important;
    display: flex;
    flex-direction: row !important;
    align-items: stretch;
    justify-content: flex-start !important;
    gap: 4px !important;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    background: rgba(255,250,243,.98);
    border-top: 1px solid var(--line);
    border-right: 0;
    box-shadow: 0 -8px 28px rgba(77,45,22,.10);
  }

  .sidebar::-webkit-scrollbar,
  .side-nav::-webkit-scrollbar,
  .module-subnav::-webkit-scrollbar,
  .commercial-tabs::-webkit-scrollbar,
  .ro-tabs::-webkit-scrollbar,
  .mobile-table-scroll::-webkit-scrollbar {
    display: none;
  }

  .sidebar-person-identity,
  .brand {
    display: none !important;
  }

  .side-nav,
  .sidebar-performance-shortcut {
    flex: 0 0 auto;
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
    gap: 4px;
    padding: 0 !important;
    margin: 0 !important;
  }

  .sidebar .side-link {
    position: relative;
    flex: 0 0 68px;
    width: 68px;
    min-width: 68px;
    min-height: 56px;
    padding: 5px 5px 4px !important;
    display: flex;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 3px !important;
    border-radius: 13px;
    scroll-snap-align: center;
    text-align: center;
    white-space: normal;
    font-size: 9px !important;
    line-height: 1.08;
  }

  .sidebar .side-link > span {
    width: auto;
    min-height: 20px;
    display: grid;
    place-items: center;
    font-size: 18px;
    line-height: 1;
  }

  .sidebar .side-link.active {
    background: #e8d8c7;
    box-shadow: inset 0 0 0 1px rgba(85,49,38,.08);
  }

  .sidebar .nav-action-badge {
    position: absolute !important;
    top: 2px !important;
    right: 5px !important;
    margin: 0;
    min-width: 18px;
    height: 18px;
  }

  .sidebar-logout-form {
    flex: 0 0 auto;
    margin: 0 !important;
  }

  .sidebar-logout {
    width: 68px !important;
  }

  /* ---------- touch / forms ---------- */
  button,
  input,
  select,
  textarea {
    font-family: inherit;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
  select,
  textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    min-height: 44px;
    font-size: 16px !important; /* evita zoom automático em iOS */
  }

  textarea {
    min-height: 92px;
    resize: vertical;
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px;
  }

  button,
  .primary-btn,
  .secondary-btn,
  .commercial-primary,
  .ro-primary,
  .danger-btn,
  .danger-outline-btn,
  .table-action,
  .filter-chip,
  .month-nav a,
  .module-subnav a,
  .commercial-tabs a,
  .ro-tabs a,
  .text-link,
  .dialog-close,
  .day-modal-close,
  .chat-new-topic-button,
  .chat-members-toggle {
    min-height: 44px;
  }

  .primary-btn,
  .secondary-btn,
  .commercial-primary,
  .ro-primary,
  .danger-btn,
  .danger-outline-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .check-line,
  .checkbox-line,
  .checkbox-field,
  .product-funnel-options .check-line {
    min-height: 44px;
  }

  .form-grid-2,
  .form-duo,
  .ro-form-grid,
  .ro-form-split,
  .lead-info-grid,
  .lead-contact-grid,
  .lead-summary-grid,
  .lead-next-contact,
  .config-number-grid,
  .content-editor-grid,
  .employee-form-grid,
  .business-settings-form,
  .mark-tone-controls,
  .audit-filter-bar,
  .cleanup-confirm-form,
  .suggestion-status-form,
  .demand-reminder-editor > form,
  .demand-reminder-create .demand-form-row,
  .lead-flow-form,
  .lead-full-resolution-grid,
  .message-form-row,
  .message-lead-actions-grid {
    grid-template-columns: 1fr !important;
  }

  .field-wide,
  .wide,
  .pm-span-2,
  .content-field-wide,
  .lead-flow-wide {
    grid-column: auto !important;
  }

  .system-form-dialog-footer,
  .content-editor-footer {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
  }

  .system-form-dialog-footer > *,
  .content-editor-footer > * {
    width: 100%;
    margin: 0;
  }

  /* ---------- reusable action rows ---------- */
  .panel-title,
  .commercial-section-head,
  .selected-day-heading,
  .finance-message-card-head,
  .finance-action-title,
  .billing-workflow-summary,
  .product-funnel header,
  .lead-history-head,
  .campaign-performance-card > header,
  .lead-analysis-card > header,
  .ltv-client-card > header {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  .panel-title > a,
  .panel-title > button,
  .commercial-section-head > a,
  .selected-day-heading > a,
  .selected-day-heading > button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .commercial-actions,
  .message-actions,
  .call-actions,
  .commercial-call-actions,
  .commercial-call-status,
  .commercial-call-proof-done,
  .finance-answer-buttons,
  .lead-card-action-buttons,
  .employee-row-actions,
  .client-sheet-action-buttons,
  .google-calendar-actions,
  .mark-action-card-actions,
  .mark-call-actions,
  .chat-composer-footer {
    gap: 8px;
    flex-wrap: wrap;
  }

  .commercial-actions > a,
  .commercial-actions > button,
  .message-actions > a,
  .message-actions > button,
  .call-actions > a,
  .call-actions > button,
  .commercial-call-actions > a,
  .commercial-call-actions > button,
  .finance-answer-buttons > button,
  .finance-answer-buttons > form,
  .lead-card-action-buttons > a,
  .lead-card-action-buttons > button,
  .google-calendar-actions > a,
  .google-calendar-actions > button,
  .google-calendar-actions > form {
    flex: 1 1 140px;
    min-width: 0;
  }

  .commercial-actions form,
  .finance-answer-buttons form,
  .google-calendar-actions form {
    min-width: 0;
  }

  .commercial-actions form > button,
  .finance-answer-buttons form > button,
  .google-calendar-actions form > button {
    width: 100%;
  }

  .response-check-actions,
  .compact-response-message-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
  }

  .response-check-actions > *,
  .compact-response-message-actions > * {
    width: 100%;
    min-width: 0 !important;
    margin: 0;
  }

  /* ---------- tabs / subnav ---------- */
  .module-subnav,
  .commercial-tabs,
  .ro-tabs,
  .pm-project-toolbar nav,
  .commercial-settings-menu {
    width: calc(100% + (var(--mobile-page-gutter) * 2));
    margin-left: calc(-1 * var(--mobile-page-gutter));
    margin-right: calc(-1 * var(--mobile-page-gutter));
    padding-left: var(--mobile-page-gutter);
    padding-right: var(--mobile-page-gutter);
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .module-subnav a,
  .commercial-tabs a,
  .ro-tabs a,
  .pm-project-toolbar nav a,
  .commercial-settings-menu a {
    flex: 0 0 auto;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    scroll-snap-align: center;
  }

  /* ---------- metric cards ---------- */
  .metrics-row,
  .commercial-metrics,
  .ro-metrics-grid,
  .social-metrics,
  .room-stats,
  .pm-metrics,
  .performance-summary-grid,
  .performance-metric-grid,
  .auth-status-grid,
  .client-workspace-stats,
  .client-stage-overview,
  .client-production-summary,
  .mk-primary-metrics,
  .finance-metrics-grid,
  .people-metrics-grid,
  .business-metrics-grid,
  .ltv-summary-grid,
  .results-scoreboard,
  .revenue-summary-strip,
  .cleanup-counts {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
    gap: 8px;
  }

  .metric,
  .commercial-metrics article,
  .ro-metrics-grid article,
  .social-metrics article,
  .room-stats article,
  .pm-metrics article,
  .pm-metrics a {
    min-width: 0;
    padding: 12px;
    border-radius: 15px;
  }

  .metric strong,
  .commercial-metrics strong,
  .room-stats strong {
    font-size: clamp(23px, 7vw, 30px);
  }

  /* ---------- dashboards / cards ---------- */
  .dashboard-grid,
  .split-layout,
  .personal-room,
  .calendar-shell,
  .commercial-grid-main,
  .commercial-client-layout,
  .messages-layout,
  .scripts-layout,
  .config-layout-ro,
  .ro-dashboard-grid,
  .ro-two-columns,
  .ro-message-layout,
  .ro-message-layout-wide,
  .ro-config-grid,
  .commercial-settings-layout,
  .commercial-config-clean-layout,
  .social-dashboard-layout,
  .social-client-home-grid,
  .performance-layout,
  .mark-ai-layout,
  .business-main-grid,
  .business-main-grid.equal,
  .business-settings-card,
  .pm-dashboard-grid,
  .pm-detail-grid,
  .mark-room-grid,
  .commercial-mark-grid,
  .two-cols {
    grid-template-columns: 1fr !important;
  }

  .task-grid,
  .department-grid,
  .hub-grid,
  .dept-gallery-grid,
  .client-card-grid,
  .social-client-gallery,
  .pm-department-grid,
  .department-operations-grid,
  .product-funnel-grid,
  .approval-items,
  .mark-brief-list,
  .daily-mark-items,
  .report-metrics,
  .funnel-builder {
    grid-template-columns: 1fr !important;
  }

  .leadership-demand-card,
  .executive-supervision-row,
  .business-client-row,
  .business-service-row,
  .mark-alert-item {
    min-width: 0;
  }

  .leadership-demand-card {
    display: grid !important;
    gap: 12px;
    align-items: stretch !important;
  }

  .leadership-demand-card > a,
  .leadership-demand-card > form,
  .leadership-demand-card > form button {
    width: 100%;
  }

  .leadership-demand-copy {
    min-width: 0;
  }

  .leadership-demand-copy p,
  .leadership-demand-copy small,
  .mark-alert-item small,
  .business-client-row small {
    overflow-wrap: anywhere;
  }

  /* ---------- tables: intentional 2D scroll, never whole-page overflow ---------- */
  .content-card:has(> table),
  .commercial-card:has(> table),
  .ro-card:has(> table),
  .table-card,
  .responsive-table,
  .client-sheet-wrap,
  .employee-table-wrap,
  .pm-department-table,
  .mobile-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: visible;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .mobile-table-scroll {
    position: relative;
    border-radius: 12px;
  }

  .mobile-table-scroll:focus-visible {
    outline: 3px solid rgba(49,91,73,.24);
    outline-offset: 2px;
  }

  table {
    width: max-content;
    min-width: max(680px, 100%) !important;
    max-width: none;
  }

  th, td {
    padding: 11px 10px;
    vertical-align: top;
  }

  th:first-child,
  td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: inherit;
  }

  th:first-child {
    z-index: 3;
    background: #f7f1e9;
  }

  .client-sheet,
  .employee-registry-table,
  .product-service-card table,
  .commercial-table {
    min-width: 860px !important;
  }

  .results-table,
  .pm-department-table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .result-table-head,
  .result-table-row,
  .pm-department-table > header,
  .pm-department-table > div {
    min-width: 720px;
  }

  .row-action-details form {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: calc(86px + var(--mobile-safe-bottom)) !important;
    top: auto !important;
    width: auto !important;
    max-height: 65dvh;
    overflow-y: auto;
  }

  /* ---------- Kanban comercial ---------- */
  .commercial-kanban-page .lead-toolbar,
  .commercial-kanban-page .lead-search {
    width: 100%;
  }

  .commercial-kanban-page .lead-toolbar {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .commercial-kanban-page .lead-search.lead-search-polished {
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto auto;
    padding-left: 10px;
  }

  .commercial-kanban-page .lead-search-polished input {
    font-size: 16px !important;
  }

  .commercial-kanban-page .lead-kanban-board:not(.archive) {
    width: calc(100% + (var(--mobile-page-gutter) * 2)) !important;
    margin-left: calc(-1 * var(--mobile-page-gutter));
    margin-right: calc(-1 * var(--mobile-page-gutter));
    padding: 4px var(--mobile-page-gutter) 14px !important;
    grid-auto-flow: column !important;
    grid-auto-columns: minmax(280px, 88vw) !important;
    gap: 10px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scroll-snap-type: x mandatory !important;
    scroll-padding-left: var(--mobile-page-gutter);
    -webkit-overflow-scrolling: touch;
  }

  .commercial-kanban-page .lead-kanban-column {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    scroll-snap-align: start;
    border-radius: 16px;
  }

  .commercial-kanban-page .lead-kanban-column > header {
    position: sticky;
    top: 0;
    min-height: 48px;
    z-index: 4;
  }

  .commercial-kanban-page .lead-kanban-column-body {
    max-height: none !important;
    overflow: visible !important;
    padding: 10px;
  }

  .commercial-kanban-page .lead-kanban-card summary,
  .lead-stage-accordion > summary,
  .lead-flow-option > summary {
    min-height: 48px;
  }

  .commercial-kanban-page .lead-kanban-card {
    border-radius: 14px;
  }

  .commercial-kanban-page .lead-kanban-board.archive {
    grid-template-columns: 1fr !important;
  }

  .lead-fullscreen-dialog,
  .social-content-full-dialog,
  .product-process-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    height: min(96dvh, 960px) !important;
    max-height: 96dvh !important;
  }

  .lead-full-dialog-body {
    max-height: none !important;
  }

  /* ---------- dialogs as mobile bottom sheets ---------- */
  .system-form-dialog,
  .content-editor-dialog,
  .self-photo-dialog,
  .suggestion-dialog,
  .product-process-dialog,
  .lead-fullscreen-dialog,
  .social-content-full-dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 96dvh !important;
    margin: auto 0 0 !important;
    border-radius: 22px 22px 0 0 !important;
    overflow: hidden !important;
  }

  .system-form-dialog[open],
  .content-editor-dialog[open],
  .lead-fullscreen-dialog[open],
  .social-content-full-dialog[open] {
    display: flex;
    flex-direction: column;
  }

  .system-form-dialog-header,
  .content-editor-heading,
  .lead-fullscreen-dialog .system-form-dialog-header {
    flex: 0 0 auto;
    padding: 20px 18px 16px !important;
  }

  .system-form-dialog-header h2,
  .content-editor-heading h2,
  .lead-fullscreen-dialog .system-form-dialog-header h2 {
    padding-right: 36px;
    font-size: clamp(22px, 6vw, 28px) !important;
  }

  .system-form-dialog-body,
  .redesigned-content-form,
  .lead-full-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 14px !important;
  }

  .system-form-dialog > .dialog-close,
  .content-editor-dialog > .dialog-close {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    width: 44px;
    height: 44px;
    float: none;
  }

  .system-form-dialog-footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-left: -14px;
    margin-right: -14px;
    margin-bottom: -14px;
    padding: 12px 14px calc(12px + var(--mobile-safe-bottom));
    background: rgba(245,241,233,.98);
    box-shadow: 0 -8px 24px rgba(45,37,30,.06);
  }

  /* ---------- agenda ---------- */
  .calendar-form {
    position: static !important;
    top: auto !important;
  }

  .calendar-toolbar,
  .calendar-topbar,
  .selected-day-heading {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
  }

  .month-picker,
  .month-picker label,
  .month-picker input,
  .month-picker button,
  .calendar-create-dropdown,
  .calendar-create-summary,
  .ro-create-button {
    width: 100% !important;
  }

  /* Mantém leitura de mês como calendário real, em vez de 42 cards empilhados. */
  .week-labels {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0,1fr)) !important;
    gap: 3px;
    margin-bottom: 5px;
  }

  .week-labels span {
    min-width: 0;
    font-size: 8px;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: clip;
  }

  .month-grid {
    grid-template-columns: repeat(7, minmax(0,1fr)) !important;
    gap: 3px !important;
  }

  .month-day,
  .calendar-expanded .month-day {
    min-width: 0;
    min-height: 48px !important;
    padding: 5px 3px !important;
    gap: 3px;
    align-items: center;
    border-radius: 9px;
  }

  .month-day .day-number {
    width: 100%;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
  }

  .month-day .day-number::after {
    display: none !important;
  }

  .month-day .day-events {
    width: 100%;
    min-height: 7px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
  }

  .month-day .month-event {
    flex: 0 0 5px;
    width: 5px;
    height: 5px;
    min-height: 5px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font-size: 0;
    overflow: hidden;
    background: #9d7656;
  }

  .month-day .month-event:nth-of-type(n+4) {
    display: none;
  }

  .month-day .day-events small {
    display: none;
  }

  .calendar-event {
    grid-template-columns: 1fr !important;
    gap: 10px;
    padding: 14px;
    border-radius: 16px;
  }

  .event-date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
  }

  .event-date span {
    margin: 0;
  }

  .day-list {
    max-height: none;
  }

  .day-modal {
    padding: 0 !important;
    align-items: flex-end !important;
  }

  .day-modal-card {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 92dvh !important;
    border-radius: 22px 22px 0 0 !important;
  }

  .day-modal-header {
    padding: 18px 16px !important;
  }

  .day-modal-header h2 {
    font-size: 24px;
  }

  .day-modal-events {
    padding: 14px 12px calc(18px + var(--mobile-safe-bottom)) !important;
  }

  /* ---------- Financeiro / Marketing / Negócio ---------- */
  .module-hero {
    display: grid !important;
    align-items: stretch;
    padding: 18px;
    border-radius: 18px;
  }

  .module-hero .period-filter,
  .period-filter {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .period-filter label,
  .period-filter input,
  .period-filter select,
  .period-filter button {
    width: 100%;
    min-width: 0 !important;
  }

  .finance-message-summary,
  .projection-grid,
  .business-department-grid,
  .mark-context-metrics,
  .client-production-summary {
    grid-template-columns: 1fr !important;
  }

  .finance-debt-breakdown li,
  .billing-workflow-summary,
  .business-service-row {
    align-items: flex-start;
    flex-direction: column;
  }

  /* ---------- Social / conteúdo ---------- */
  .daily-mark-overlay {
    padding: 0;
  }

  .daily-mark-overlay[hidden] {
    display: none !important;
  }

  .daily-mark-close {
    position: fixed !important;
    top: calc(10px + env(safe-area-inset-top, 0px)) !important;
    right: 10px !important;
    z-index: 3010 !important;
    width: 48px !important;
    height: 48px !important;
    display: grid !important;
    place-items: center;
    border-radius: 999px !important;
    background: rgba(255,255,255,.92) !important;
    border: 1px solid rgba(49,72,61,.16) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    color: #2f211d !important;
    font-size: 30px !important;
    line-height: 1 !important;
    touch-action: manipulation;
  }

  .daily-mark-screen {
    width: 100%;
    min-height: 100dvh;
    border-radius: 0;
    padding: 26px 16px calc(96px + var(--mobile-safe-bottom));
    grid-template-columns: 1fr !important;
    align-content: start;
    overflow-y: auto;
  }

  .daily-mark-avatar {
    width: 112px;
    height: 112px;
    font-size: 54px;
  }

  .daily-mark-conversation h1 {
    font-size: 30px !important;
  }

  .client-workspace-main {
    grid-template-columns: 1fr !important;
    text-align: left !important;
  }

  .client-workspace-avatar {
    margin: 0 !important;
  }

  /* Fechamento de emergência do MARK no mobile. Fora do overlay e acima de qualquer camada. */
  .mobile-mark-emergency-close {
    position: fixed !important;
    top: calc(8px + env(safe-area-inset-top, 0px)) !important;
    right: 8px !important;
    z-index: 2147483647 !important;
    min-width: 132px;
    height: 52px;
    padding: 0 14px 0 10px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid rgba(49,72,61,.18) !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: #2f211d !important;
    box-shadow: 0 10px 30px rgba(0,0,0,.24) !important;
    font: 900 12px/1 Inter, Arial, sans-serif !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-mark-emergency-close span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    font-size: 28px;
    font-weight: 500;
    line-height: 1;
  }

  .mobile-mark-emergency-close b {
    font: inherit;
    white-space: nowrap;
  }

  /* Se qualquer MARK for fechado por JS, hidden sempre vence até estilos antigos. */
  [data-daily-mark][hidden],
  [data-mark-call][hidden],
  [data-mark-call].is-hidden {
    display: none !important;
    pointer-events: none !important;
  }

  /* ---------- MARK / floating actions ---------- */
  .floating-map,
  .floating-mark,
  .floating-team-chat,
  .floating-suggestion {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px;
    min-height: 46px;
    border-radius: 15px !important;
    bottom: calc(84px + var(--mobile-safe-bottom)) !important;
    z-index: 120;
  }

  .floating-mark {
    right: 10px !important;
  }

  .floating-team-chat {
    right: 64px !important;
  }

  .floating-map {
    left: 10px !important;
    right: auto !important;
  }

  .floating-suggestion {
    left: 64px !important;
    right: auto !important;
  }

  .mark-call-overlay {
    left: 8px !important;
    right: 8px !important;
    bottom: calc(136px + var(--mobile-safe-bottom)) !important;
    width: auto !important;
    max-height: calc(100dvh - 160px);
    overflow-y: auto;
  }

  .mark-call-box,
  .commercial-mark-room,
  .mark-settings-item {
    grid-template-columns: 1fr !important;
  }

  .mark-call-box {
    position: relative;
    padding-top: 54px !important;
  }

  .mark-call-dismiss {
    display: grid !important;
    place-items: center;
    width: 44px !important;
    height: 44px !important;
    right: 10px !important;
    top: 10px !important;
    font-size: 28px !important;
    touch-action: manipulation;
  }

  .mark-call-chat header button[data-mark-close] {
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px;
    font-size: 26px !important;
    touch-action: manipulation;
  }

  .mark-background-optin {
    width: 100% !important;
  }

  /* ---------- chat interno ---------- */
  .chat-page {
    width: calc(100% + (var(--mobile-page-gutter) * 2));
    margin: -18px calc(-1 * var(--mobile-page-gutter)) calc(-106px - var(--mobile-safe-bottom)) !important;
    min-height: calc(100dvh - 54px - var(--mobile-nav-height) - var(--mobile-safe-bottom));
    overflow: visible;
  }

  .chat-directory-head,
  .chat-conversation-head {
    padding: 13px 12px;
  }

  .chat-new-topic-button,
  .chat-members-toggle {
    min-width: 44px;
  }

  .chat-channel-list,
  .chat-people-list {
    scroll-snap-type: x proximity;
  }

  .chat-channel-link,
  .chat-person-link {
    min-height: 48px;
    scroll-snap-align: start;
  }

  .chat-conversation {
    min-height: 62dvh;
  }

  .chat-message-list {
    height: min(58dvh, 620px);
    padding: 14px 10px;
  }

  .chat-message,
  .chat-message.own {
    max-width: 100%;
  }

  .chat-composer {
    margin: 0 8px 10px;
    position: sticky;
    bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom) + 4px);
    z-index: 20;
  }

  .chat-composer textarea {
    font-size: 16px !important;
  }

  .chat-members {
    width: min(340px, 92vw);
    bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom));
  }

  /* ---------- login / convite ---------- */
  .auth-main {
    min-height: 100dvh;
    padding: 18px 12px;
  }

  .auth-shell,
  .auth-card {
    width: 100%;
    max-width: 460px;
  }

  /* ---------- feedback visual de interação ---------- */
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  summary:focus-visible {
    outline: 3px solid rgba(49,91,73,.28);
    outline-offset: 2px;
  }

  @media (hover: none) and (pointer: coarse) {
    .side-link:hover,
    .filter-chip:hover,
    .commercial-tabs a:hover,
    .ro-tabs a:hover,
    .module-subnav a:hover,
    .month-day:hover,
    .work-pile:hover {
      transform: none;
    }
  }
}

@media (max-width: 390px) {
  .metrics-row,
  .commercial-metrics,
  .ro-metrics-grid,
  .social-metrics,
  .room-stats,
  .pm-metrics,
  .performance-summary-grid,
  .performance-metric-grid,
  .auth-status-grid,
  .client-workspace-stats,
  .client-stage-overview,
  .mk-primary-metrics,
  .finance-metrics-grid,
  .people-metrics-grid,
  .business-metrics-grid,
  .ltv-summary-grid,
  .results-scoreboard,
  .revenue-summary-strip {
    grid-template-columns: 1fr !important;
  }

  .sidebar .side-link,
  .sidebar-logout {
    flex-basis: 64px;
    width: 64px !important;
    min-width: 64px;
  }

  .response-check-actions,
  .compact-response-message-actions,
  .system-form-dialog-footer,
  .content-editor-footer {
    grid-template-columns: 1fr !important;
  }

  .commercial-kanban-page .lead-search.lead-search-polished {
    grid-template-columns: auto minmax(0,1fr) auto;
  }

  .commercial-kanban-page .lead-search-polished button:not(.lead-search-clear) {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* v8.7.25 · compactação do fluxo comercial mobile */
@media (max-width:768px){
  .message-register-form .primary-btn.compact,.message-register-form .secondary-btn.compact,.lead-flow-form .primary-btn.compact,.lead-flow-form .secondary-btn.compact{width:auto!important;min-width:0!important;min-height:44px;padding:10px 14px!important;align-self:flex-start}
  .compact-response-message-actions{display:flex!important;align-items:center!important;gap:10px!important;flex-wrap:wrap}
  .blacklist-alert{border-radius:12px;padding:12px}
  .commercial-blacklist-page .ro-table-wrap{overflow-x:auto}
}


/* v8.7.26 · Lista Negra acessível no mobile */
@media (max-width:768px){
  .blacklist-entry-callout{align-items:stretch;flex-direction:column}
  .blacklist-entry-callout .blacklist-primary-btn{width:100%}
  .blacklist-alert-with-action{flex-direction:column}.blacklist-inline-edit{width:100%;min-height:44px}
  .lead-card-blacklist-quick{right:46px;top:8px;width:36px;height:36px;border-radius:11px}
  .commercial-blacklist-page .ro-page-title{align-items:stretch}.commercial-blacklist-page .ro-page-title>.blacklist-primary-btn{width:100%;min-height:46px}
  .blacklist-howto-card{font-size:13px}
  .blacklist-message-form .blacklist-primary-btn,.blacklist-message-remove .secondary-btn{width:100%;min-height:44px}
}

/* v8.7.28 · Script de Vendas no mobile */
@media(max-width:768px){
  .sales-script-shell{display:block}.sales-script-backdrop{display:none}.sales-script-drawer{width:100%;height:100dvh;border-left:0;box-shadow:none;grid-template-rows:auto auto minmax(0,1fr)}.sales-script-header{padding:calc(12px + env(safe-area-inset-top)) 14px 12px}.sales-script-header h2{font-size:20px}.sales-script-close{width:48px;height:48px;flex-basis:48px}.sales-script-toolbar{padding:9px 10px;overflow-x:auto;flex-wrap:nowrap}.sales-script-toolbar button{white-space:nowrap;min-height:44px}.sales-script-stage,.sales-script-map{padding:14px 12px calc(24px + env(safe-area-inset-bottom))}.sales-script-speech{font-size:18px;line-height:1.5;padding:17px}.sales-script-answer,.sales-script-other{min-height:50px;font-size:15px}.sales-script-map-head{display:grid}.sales-script-map-head button{justify-self:start}.sales-script-map-item{min-height:58px}.sales-script-open-btn{min-height:44px;width:100%}.sales-script-open-btn.compact{min-height:44px;width:100%;justify-self:stretch}
  .sales-script-builder-intro,.sales-script-builder-toolbar,.sales-script-builder-save,.sales-script-config-status{align-items:stretch;flex-direction:column}.sales-script-builder-intro button,.sales-script-builder-toolbar button,.sales-script-builder-save button,.sales-script-config-status a{width:100%}.sales-script-node-fields{grid-template-columns:1fr}.sales-script-node-head{align-items:flex-start}.sales-script-node-actions{flex-wrap:wrap;justify-content:flex-end}.sales-script-answer-edit-row{grid-template-columns:1fr}.sales-script-answer-edit-row>button{width:100%}.sales-script-branch-editor>header{align-items:flex-start;flex-direction:column}.sales-script-branch-editor>header button{width:100%}.sales-script-builder-save{bottom:calc(76px + env(safe-area-inset-bottom));padding:13px;border-radius:16px}
}

/* v8.7.29 · Script de Vendas mobile */
@media (max-width:768px){
  .sales-script-main-speech,.sales-script-support-text{font-size:21px;line-height:1.46;font-weight:800;padding:17px}.sales-script-capture-grid,.sales-script-summary-value-grid{grid-template-columns:1fr}.sales-script-register-btn{margin-left:0}.sales-script-toolbar{display:flex}.sales-script-toolbar .sales-script-register-btn{position:sticky;right:0}.sales-script-summary-panel{padding:14px 12px calc(24px + env(safe-area-inset-bottom))}.sales-script-summary-head{display:grid}.sales-script-summary-head button{justify-self:start}.sales-script-summary-actions{display:grid}.sales-script-summary-actions>*{width:100%;justify-content:center}.sales-script-node-fields-v2{grid-template-columns:1fr}.sales-script-node-fields-v2 .sales-script-main-field,.sales-script-node-fields-v2 .sales-script-support-field{grid-column:1}.sales-script-field-edit-main,.sales-script-field-edit-more{grid-template-columns:1fr}.sales-script-field-edit-actions{align-items:stretch;flex-direction:column}.sales-script-field-edit-actions button{width:100%}.sales-script-capture-editor>header{align-items:flex-start;flex-direction:column}.sales-script-capture-editor>header button{width:100%}
}
@media (max-width:768px){.lead-sales-script-report-list article{align-items:stretch;flex-direction:column}.lead-sales-script-report-list article a{width:100%;justify-content:center}}

/* v8.7.31 · filtro de faturamento no Comercial */
@media (max-width: 768px) {
  .commercial-kanban-page .lead-search-with-revenue { display:grid !important; grid-template-columns:minmax(0,1fr) auto !important; gap:8px !important; }
  .commercial-kanban-page .lead-search-with-revenue > input[name="q"],
  .commercial-kanban-page .lead-search-with-revenue .lead-revenue-filter { grid-column:1 / -1 !important; width:100% !important; min-width:0 !important; }
  .commercial-kanban-page .lead-search-with-revenue .lead-revenue-filter select { width:100% !important; min-height:44px !important; font-size:16px !important; }
  .lead-filter-summary { display:flex !important; gap:7px !important; overflow-x:auto; padding-bottom:2px; }
  .lead-filter-summary span { flex:0 0 auto; }
}

/* v8.7.79 · Script de Vendas vivo mobile */
@media(max-width:768px){.sales-script-prep-panel{padding:14px 12px calc(24px + env(safe-area-inset-bottom))}.sales-script-prep-grid{grid-template-columns:1fr}.sales-script-prep-wide{grid-column:auto}.sales-script-live-investment-head{align-items:stretch;flex-direction:column}.sales-script-live-investment-head button{width:100%}.sales-script-live-negotiation{grid-template-columns:1fr}.sales-script-live-negotiation>div,.sales-script-live-negotiation>small{grid-column:auto}.sales-script-live-negotiation>div{display:grid}.sales-script-live-negotiation>div button{width:100%}}
@media(max-width:768px){.sales-script-prep-actions{display:grid}.sales-script-prep-actions button{width:100%}.sales-script-summary-conversation-list summary{grid-template-columns:28px 1fr}.sales-script-summary-conversation-list summary small{grid-column:2}}
