/* Meu Palcco — refinamento global de UX/UI para telas pequenas. */
@media (max-width: 720px) {
    /* Ações principais: somente ícones, com área de toque acessível. */
    .page-heading .heading-actions,
    .opportunity-heading .heading-actions {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: flex-end !important;
        align-items: center !important;
        gap: 8px !important;
        width: 100% !important;
        overflow: visible !important;
    }

    .page-heading .heading-actions > .button,
    .page-heading .heading-actions > button,
    .page-heading .heading-actions > a,
    .opportunity-heading .heading-actions > .button,
    .opportunity-heading .heading-actions > button,
    .opportunity-heading .heading-actions > a,
    .mobile-icon-only {
        flex: 0 0 46px !important;
        width: 46px !important;
        min-width: 46px !important;
        max-width: 46px !important;
        height: 46px !important;
        min-height: 46px !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        border-radius: 14px !important;
        overflow: visible !important;
        text-indent: 0 !important;
        font-size: 0 !important;
        white-space: nowrap !important;
    }

    .page-heading .heading-actions > * span,
    .opportunity-heading .heading-actions > * span,
    .mobile-icon-only > span,
    .mobile-icon-only .button-label {
        display: none !important;
    }

    .page-heading .heading-actions svg,
    .opportunity-heading .heading-actions svg,
    .mobile-icon-only > svg,
    .mobile-icon-only .button-icon svg {
        display: block !important;
        width: 21px !important;
        height: 21px !important;
        flex: 0 0 21px !important;
        margin: 0 !important;
    }

    /* Cabeçalho móvel: sino, mensagens e sair somente com ícones. */
    .topbar .topbar-actions a,
    .topbar .topbar-actions button,
    .topbar .header-actions a,
    .topbar .header-actions button {
        min-width: 46px !important;
        width: 46px !important;
        height: 46px !important;
        padding: 0 !important;
        justify-content: center !important;
        font-size: 0 !important;
        border-radius: 14px !important;
    }

    .topbar .topbar-actions a span,
    .topbar .topbar-actions button span,
    .topbar .header-actions a span,
    .topbar .header-actions button span {
        display: none !important;
    }

    .topbar .topbar-actions svg,
    .topbar .header-actions svg {
        width: 21px !important;
        height: 21px !important;
    }

    /* Cards originados de tabelas: título e ações na mesma linha. */
    .responsive-table tbody tr,
    .accounts-table tbody tr,
    .cash-flow-table tbody tr {
        padding: 14px !important;
        padding-top: 16px !important;
        overflow: visible !important;
    }

    .responsive-table tbody td.is-primary-field,
    .responsive-table tbody td:first-child:not(.bulk-select-cell):not(.actions),
    .accounts-table tbody td:first-child:not(.bulk-select-cell):not(.actions),
    .cash-flow-table tbody td:first-child:not(.bulk-select-cell):not(.actions) {
        min-height: 46px !important;
        padding: 3px 150px 12px 0 !important;
        display: block !important;
        text-align: left !important;
        border-bottom: 1px solid rgba(87, 48, 120, .10) !important;
        font-size: 17px !important;
        font-weight: 600 !important;
        line-height: 1.25 !important;
        overflow-wrap: normal !important;
    }

    .responsive-table tbody td.actions,
    .accounts-table tbody td.actions,
    .cash-flow-table tbody td.actions,
    .responsive-table tbody td[data-label="Ações"],
    .accounts-table tbody td[data-label="Ações"],
    .cash-flow-table tbody td[data-label="Ações"] {
        position: absolute !important;
        top: 11px !important;
        right: 11px !important;
        z-index: 3 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-end !important;
        width: auto !important;
        max-width: 142px !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        gap: 6px !important;
        background: transparent !important;
    }

    .responsive-table tbody td.actions::before,
    .accounts-table tbody td.actions::before,
    .cash-flow-table tbody td.actions::before,
    .responsive-table tbody td[data-label="Ações"]::before,
    .accounts-table tbody td[data-label="Ações"]::before,
    .cash-flow-table tbody td[data-label="Ações"]::before {
        display: none !important;
        content: none !important;
    }

    .responsive-table tbody td.actions .icon-action,
    .accounts-table tbody td.actions .icon-action,
    .cash-flow-table tbody td.actions .icon-action,
    .responsive-table tbody td.actions .button,
    .accounts-table tbody td.actions .button,
    .cash-flow-table tbody td.actions .button,
    .account-actions .icon-action,
    .account-actions .button {
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        border-radius: 12px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0 !important;
    }

    .responsive-table tbody td.actions svg,
    .accounts-table tbody td.actions svg,
    .cash-flow-table tbody td.actions svg,
    .account-actions svg {
        width: 19px !important;
        height: 19px !important;
    }

    /* Contas possuem até quatro ações: reserva espaço suficiente na linha do nome. */
    .accounts-table tbody td:first-child:not(.bulk-select-cell),
    .account-name-cell {
        padding-right: 188px !important;
    }

    .accounts-table tbody td.actions,
    .account-actions {
        max-width: 182px !important;
    }

    /* Checkbox de seleção fica discreto no canto superior esquerdo. */
    .responsive-table tbody td.bulk-select-cell,
    .accounts-table tbody td.bulk-select-cell,
    .cash-flow-table tbody td.bulk-select-cell {
        position: absolute !important;
        top: 17px !important;
        left: 14px !important;
        z-index: 4 !important;
        display: block !important;
        width: 22px !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .responsive-table tbody td.bulk-select-cell + td,
    .accounts-table tbody td.bulk-select-cell + td,
    .cash-flow-table tbody td.bulk-select-cell + td {
        padding-left: 32px !important;
    }

    /* Abas do modal/edição: sempre uma linha, três colunas iguais. */
    .crm-edit-tablist,
    body.app-modal-body .crm-edit-tablist {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 5px !important;
        width: 100% !important;
        padding: 5px !important;
        border-radius: 16px !important;
        overflow: visible !important;
    }

    .crm-edit-tab,
    body.app-modal-body .crm-edit-tab {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 46px !important;
        padding: 8px 5px !important;
        border-radius: 12px !important;
        font-size: clamp(.68rem, 3vw, .82rem) !important;
        line-height: 1.15 !important;
        white-space: normal !important;
        text-align: center !important;
        overflow-wrap: normal !important;
    }

    /* Modal em formato bottom-sheet, sem largura excedente. */
    .iframe-modal__dialog {
        width: 100vw !important;
        max-width: 100vw !important;
        height: min(94dvh, 900px) !important;
        max-height: 94dvh !important;
        margin-top: auto !important;
        border-radius: 24px 24px 0 0 !important;
    }

    .iframe-modal__header {
        padding: 16px 18px !important;
    }

    .iframe-modal__header h2 {
        font-size: 1.2rem !important;
        line-height: 1.25 !important;
    }

    body.app-modal-body .content {
        padding: 10px !important;
    }

    /* Kanban: barra de ações sem corte horizontal. */
    body.has-kanban-page .opportunity-heading .heading-actions {
        position: sticky;
        left: 0;
        width: max-content !important;
        min-width: 0 !important;
        padding-right: 4px;
    }
}

@media (max-width: 390px) {
    .responsive-table tbody td.is-primary-field,
    .responsive-table tbody td:first-child:not(.bulk-select-cell):not(.actions),
    .accounts-table tbody td:first-child:not(.bulk-select-cell):not(.actions),
    .cash-flow-table tbody td:first-child:not(.bulk-select-cell):not(.actions) {
        padding-right: 138px !important;
        font-size: 16px !important;
    }

    .responsive-table tbody td.actions,
    .accounts-table tbody td.actions,
    .cash-flow-table tbody td.actions {
        gap: 4px !important;
    }

    .responsive-table tbody td.actions .icon-action,
    .accounts-table tbody td.actions .icon-action,
    .cash-flow-table tbody td.actions .icon-action,
    .responsive-table tbody td.actions .button,
    .accounts-table tbody td.actions .button,
    .cash-flow-table tbody td.actions .button {
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
    }
}

/* Correção 2026-07-17: preserva os SVGs do sino e do reporte no cabeçalho mobile. */
@media (max-width: 760px) {
    .topbar .reminder-button .reminder-button-icon,
    .topbar .report-widget__button .report-widget__icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 22px !important;
        height: 22px !important;
        color: var(--ui-primary-strong, #2d1538) !important;
        font-size: initial !important;
    }

    .topbar .reminder-button .reminder-button-icon svg,
    .topbar .report-widget__button .report-widget__icon svg {
        display: block !important;
        width: 22px !important;
        height: 22px !important;
        color: inherit !important;
    }

    .topbar .reminder-button .reminder-badge {
        display: inline-flex !important;
        width: auto !important;
        height: 20px !important;
        min-width: 20px !important;
        font-size: 11px !important;
    }

    .topbar .reminder-button .reminder-badge[hidden] {
        display: none !important;
    }
}
