/* Additional Tailwind overrides for CRM Studio EKOO */

body {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

/* Global form control normalization */
:root {
    /* UI zoom factor (1 = 100%). Applied to html font-size */
    --ui-zoom: 1;
    --crm-control-height: 2.5rem;           /* 30px */
    --crm-control-radius: 0.75rem;            /* rounded-lg */
    --crm-control-padding-x: 0.75rem;         /* px-3 */
    --crm-control-font-size: 0.875rem;        /* text-sm */

    /* Global button tokens */
    --btn-height-sm: 2.5rem; /* 30px */
    --btn-height-md: 2.5rem; /* 30px */
    --btn-height-lg: 2.5rem;  /* 36px */
    --btn-radius: 0.75rem;
    --btn-padding-x-sm: 0.75rem; /* px-3 */
    --btn-padding-x-md: 1rem;    /* px-4 */
    --btn-padding-x-lg: 1.25rem; /* px-5 */
    --btn-font-sm: 0.8125rem;    /* ~13px */
    --btn-font-md: 0.875rem;     /* 14px */
    --btn-font-lg: 1rem;         /* 16px */

    /* Brand colors (mirror header Tailwind setup) */
    --color-primary: #2B5AF4;
    --color-primary-hover: #234ae0;
    --color-danger: #e11d48;       /* rose-600 */
    --color-danger-hover: #be123c; /* rose-700 */
    --color-success: #10B981;      /* emerald-500 */
    --color-success-hover: #059669;/* emerald-600 */
    --color-text: #1f2937;         /* slate-800 */
    --color-muted: #64748b;        /* slate-500 */
    --color-border: #e2e8f0;       /* slate-200 */
    --color-border-strong: #cbd5e1;/* slate-300 */
    --color-bg: #ffffff;
}

/* Single-line inputs and selects */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="time"],
input[type="week"],
input[type="month"],
input[type="datetime-local"],
select {
    box-sizing: border-box;
    height: var(--crm-control-height);
    /* Preserve horizontal paddings (pl/pr) but normalize vertical padding
       para que a altura total fique consistente com 30px. */
    padding-top: 0.25rem;  /* 4px */
    padding-bottom: 0.25rem;
    font-size: var(--crm-control-font-size);
    border-radius: var(--crm-control-radius);
}

/* Ensure inputs never exceed container width */
input, select, textarea { max-width: 100%; }

/* Textareas keep multiline but align first-row height */
textarea {
    box-sizing: border-box;
    min-height: var(--crm-control-height);
    /* preserve existing horizontal paddings coming from classes */
    font-size: var(--crm-control-font-size);
    border-radius: var(--crm-control-radius);
}

/* Buttons only inside forms to avoid affecting icon/utility buttons elsewhere */
form button,
form input[type="submit"],
form .btn,
form .crm-btn {
    box-sizing: border-box;
    height: var(--btn-height-md);
    padding-left: var(--btn-padding-x-md);
    padding-right: var(--btn-padding-x-md);
    font-size: var(--btn-font-md);
    border-radius: var(--btn-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Center button text globally */
button,
input[type="submit"],
input[type="button"],
input[type="reset"],
.btn,
.crm-btn,
a[role="button"] {
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Ensure anchor-based buttons are centered too */
a.inline-flex {
    text-align: center;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Histórico de Propostas (Cliente): botões lado a lado 50% cada */
#client-proposals-history .shrink-0.flex.items-center.gap-2 {
    /* Regra base neutra: deixa o desktop livre; mobile ajusta abaixo */
    gap: 0.5rem;
}

/* Global button component */
.crm-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem; /* icon + label spacing */
    height: var(--btn-height-md);
    padding-left: var(--btn-padding-x-md);
    padding-right: var(--btn-padding-x-md);
    font-size: var(--btn-font-md);
    font-weight: 600;
    border-radius: var(--btn-radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
    background-color: var(--color-bg);
    color: var(--color-text);
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.crm-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(43, 90, 244, 0.25);
}

.crm-btn:disabled,
.crm-btn[disabled],
.crm-btn.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Sizes */
.crm-btn--sm { height: var(--btn-height-sm); padding-left: var(--btn-padding-x-sm); padding-right: var(--btn-padding-x-sm); font-size: var(--btn-font-sm); }
.crm-btn--lg { height: var(--btn-height-lg); padding-left: var(--btn-padding-x-lg); padding-right: var(--btn-padding-x-lg); font-size: var(--btn-font-lg); }

/* Variants */
.crm-btn--primary { background-color: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.crm-btn--primary:hover { background-color: var(--color-primary-hover); border-color: var(--color-primary-hover); }

.crm-btn--secondary { background-color: #fff; color: #334155; border-color: var(--color-border-strong); }
.crm-btn--secondary:hover { border-color: var(--color-primary); color: var(--color-primary); }

.crm-btn--ghost { background-color: transparent; color: #334155; border-color: transparent; }
.crm-btn--ghost:hover { background-color: #f1f5f9; }

.crm-btn--danger { background-color: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.crm-btn--danger:hover { background-color: var(--color-danger-hover); border-color: var(--color-danger-hover); }

.crm-btn--success { background-color: var(--color-success); color: #fff; border-color: var(--color-success); }
.crm-btn--success:hover { background-color: var(--color-success-hover); border-color: var(--color-success-hover); }

.crm-btn--success-outline { background-color: #fff; color: var(--color-success); border-color: var(--color-success); }
.crm-btn--success-outline:hover { background-color: #ecfdf5; }

.crm-btn--link { background: transparent; border-color: transparent; color: var(--color-primary); padding-left: 0; padding-right: 0; height: auto; font-weight: 600; }
.crm-btn--link:hover { text-decoration: underline; }

@media (max-width: 1024px) {
    main {
        padding-top: 6rem;
    }

    /* Padronização mobile: botões 100% em contextos de ações */
    /* 1) Listas em tabela: já tratadas pelos seletores existentes abaixo (crm-stack-table). */

    /* 2) Grupos genéricos de ações (fora de tabela) que usam flex + gap-2 */
    main .flex.items-center.gap-2[data-mobile-actions],
    main .flex.gap-2[data-mobile-actions] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }
    main .flex.items-center.gap-2[data-mobile-actions] > a.crm-btn,
    main .flex.items-center.gap-2[data-mobile-actions] > button.crm-btn,
    main .flex.items-center.gap-2[data-mobile-actions] > form,
    main .flex.items-center.gap-2[data-mobile-actions] > form .crm-btn,
    main .flex.gap-2[data-mobile-actions] > a.crm-btn,
    main .flex.gap-2[data-mobile-actions] > button.crm-btn,
    main .flex.gap-2[data-mobile-actions] > form,
    main .flex.gap-2[data-mobile-actions] > form .crm-btn {
        width: 100% !important;
    }
}

.icon-bubble img,
.icon-rounded img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

.icon-bubble,
.icon-rounded {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-preview img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 0.75rem;
}

[data-deal-id] {
    cursor: grab;
}

[data-deal-id]:active {
    cursor: grabbing;
}

.sortable-fallback {
    opacity: 0.75;
    transform: scale(1.02);
}

body.select-none {
    user-select: none;
}

.crm-ui-select {
    position: relative;
    width: 100%;
}

.crm-ui-select__native {
    display: none !important;
}

.crm-ui-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    height: var(--crm-control-height);
    padding: 0 1rem;
    font-size: 0.875rem;
    color: #1e293b;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.crm-ui-select__trigger:hover {
    border-color: #3b82f6;
}

.crm-ui-select__trigger:focus-visible {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.crm-ui-select__trigger-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.crm-ui-select__trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.75rem;
}

.crm-ui-select__menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 60;
    max-height: 16rem;
    overflow-y: auto;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.5rem;
    box-shadow: 0 10px 35px rgba(15, 23, 42, 0.15);
    display: none;
}

.crm-ui-select__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: none;
    background: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #1f2933;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    text-align: left;
}

.crm-ui-select__option:hover {
    background-color: #e2e8f0;
}

.crm-ui-select__option.is-active {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.crm-ui-select__option--disabled {
    cursor: not-allowed;
    color: #94a3b8;
    padding: 0.5rem 0.75rem;
}

.crm-ui-select__option--disabled:hover {
    background: none;
}

.crm-ui-select__option--check {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
}

.crm-ui-select__option--check:hover {
    background-color: #e2e8f0;
}

.crm-ui-select__checkbox {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin-right: 0.75rem;
    accent-color: #2563eb;
}

.crm-ui-select__option-label {
    flex: 1;
    color: #1f2937;
}

.crm-ui-select--open .crm-ui-select__menu {
    display: block;
}

.crm-ui-select--disabled .crm-ui-select__trigger {
    cursor: not-allowed;
    background-color: #f1f5f9;
    color: #94a3b8;
}

.crm-ui-select--disabled .crm-ui-select__trigger:hover {
    border-color: #e2e8f0;
}

.crm-ui-select--single.crm-ui-select--has-value .crm-ui-select__trigger-label,
.crm-ui-select--multiple.crm-ui-select--has-value .crm-ui-select__trigger-label {
    color: #1f2937;
}

.crm-ui-select--multiple.crm-ui-select--has-value .crm-ui-select__trigger-label {
    font-weight: 500;
}

input[type="date"] {
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    height: var(--crm-control-height);
    padding: 0 1rem;
    font-size: 0.875rem;
    color: #1f2937;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Ensure currency prefix overlays (e.g., R$) sit above inputs */
.relative > span.pointer-events-none { z-index: 10; }

input[type="date"]:focus-visible {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* Global zoom via root font-size so rem-based Tailwind scales together */
html {
    font-size: calc(16px * var(--ui-zoom, 1));
}

/* Page title normalization – match Deals list header */
/* Convert oversized h1/h2 to the standard h2 text-lg slate-700 look */
main h1.text-2xl.font-semibold.text-slate-800,
h1.text-2xl.font-semibold.text-slate-800,
main h1.text-3xl.font-semibold.text-slate-800,
h1.text-3xl.font-semibold.text-slate-800,
main h2.text-2xl.font-semibold.text-slate-700,
h2.text-2xl.font-semibold.text-slate-700 {
    font-size: 1.125rem;    /* Tailwind text-lg */
    line-height: 1.75rem;   /* Tailwind leading-7 */
    color: #334155;         /* slate-700 */
}

/* --- Mobile refinements (no desktop changes) --- */
@media (max-width: 640px) {
    /* Avoid any accidental horizontal overflow on the whole page */
    html, body { overflow-x: hidden; }
    main { overflow-x: hidden; }
    header, main, footer { max-width: 100vw; }
    body > .flex { max-width: 100vw; overflow-x: hidden; }
    /* Headers internos (não só os com mb-6) também devem quebrar */
    main .flex.items-center.justify-between {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    main .flex.items-center.justify-between > * {
        flex: 1 1 100%;
    }
    main .flex.items-center.justify-between a.crm-btn,
    main .flex.items-center.justify-between button.crm-btn,
    main .flex.items-center.justify-between a.inline-flex {
        width: 100%;
    }
    /* Grupo genérico de ações marcado via JS: aplica empilhamento e 100% */
    main [data-mobile-actions] {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }
    main [data-mobile-actions] > a,
    main [data-mobile-actions] > button,
    main [data-mobile-actions] > form,
    main [data-mobile-actions] > form > .crm-btn,
    main [data-mobile-actions] > form > button,
    main [data-mobile-actions] > a.inline-flex,
    main [data-mobile-actions] > button.inline-flex {
        width: 100% !important;
    }

    /* Conteúdos em coluna (space-y-*) com botões isolados: 100% no mobile */
    main .space-y-1 > .crm-btn,
    main .space-y-2 > .crm-btn,
    main .space-y-3 > .crm-btn,
    main .space-y-4 > .crm-btn,
    main .space-y-5 > .crm-btn {
        width: 100% !important;
    }
    /* Barras de ação alinhadas à direita: empilhar e preencher 100% */
    main .flex.justify-end,
    main .flex.items-center.justify-end,
    main .flex.justify-center,
    main .flex.items-center.justify-center {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }
    main .flex.justify-end > a.crm-btn,
    main .flex.justify-end > button.crm-btn,
    main .flex.justify-end > a.inline-flex,
    main .flex.justify-end > button,
    main .flex.justify-end > form,
    main .flex.justify-end > form .crm-btn,
    main .flex.justify-end > form button,
    main .flex.items-center.justify-end > a.crm-btn,
    main .flex.items-center.justify-end > button.crm-btn,
    main .flex.items-center.justify-end > a.inline-flex,
    main .flex.items-center.justify-end > button,
    main .flex.items-center.justify-end > form,
    main .flex.items-center.justify-end > form .crm-btn,
    main .flex.items-center.justify-end > form button,
    main .flex.justify-center > a.crm-btn,
    main .flex.justify-center > button.crm-btn,
    main .flex.justify-center > a.inline-flex,
    main .flex.justify-center > button,
    main .flex.justify-center > form,
    main .flex.justify-center > form .crm-btn,
    main .flex.justify-center > form button,
    main .flex.items-center.justify-center > a.crm-btn,
    main .flex.items-center.justify-center > button.crm-btn,
    main .flex.items-center.justify-center > a.inline-flex,
    main .flex.items-center.justify-center > button,
    main .flex.items-center.justify-center > form,
    main .flex.items-center.justify-center > form .crm-btn,
    main .flex.items-center.justify-center > form button {
        width: 100% !important;
    }
    /* Stack page headers (title + ação) quando não cabe lado a lado */
    main .mb-6.flex.items-center.justify-between {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    main .mb-6.flex.items-center.justify-between > * {
        flex: 1 1 100%;
    }
    /* Botões de ação no cabeçalho em largura total para toque confortável */
    main .mb-6.flex.items-center.justify-between a.crm-btn,
    main .mb-6.flex.items-center.justify-between button.crm-btn,
    main .mb-6.flex.items-center.justify-between a.inline-flex {
        width: 100%;
    }

    /* Formulários verticais: botões ocupam 100% da largura no mobile */
    main form .crm-btn,
    main form button.crm-btn,
    main form > button,
    main form > .crm-btn {
        width: 100%;
    }

    /* Exceção: cabeçalhos de cards que não devem quebrar/esticar */
    main .rounded-2xl .flex.items-center.justify-between form .crm-btn,
    main .rounded-xl .flex.items-center.justify-between form .crm-btn,
    main .rounded-2xl .flex.items-center.justify-between form > button,
    main .rounded-xl .flex.items-center.justify-between form > button {
        width: auto;
    }

    /* Evitar que grupos internos dentro de cartões quebrem indevidamente */
    main .rounded-2xl .flex.items-center.justify-between,
    main .rounded-xl .flex.items-center.justify-between {
        flex-wrap: nowrap;
        gap: 0.5rem;
    }
    main .rounded-2xl .flex.items-center.justify-between > *,
    main .rounded-xl .flex.items-center.justify-between > * {
        flex: initial;
    }
    main .rounded-2xl .flex.items-center.justify-between a.crm-btn,
    main .rounded-xl .flex.items-center.justify-between a.crm-btn,
    main .rounded-2xl .flex.items-center.justify-between button.crm-btn,
    main .rounded-xl .flex.items-center.justify-between button.crm-btn,
    main .rounded-2xl .flex.items-center.justify-between a.inline-flex,
    main .rounded-xl .flex.items-center.justify-between a.inline-flex {
        width: auto;
    }

    /* Tabelas se adaptam SEM rolagem horizontal */
    main table.min-w-full {
        table-layout: fixed;
        width: 100%;
    }
    main table.min-w-full > thead > tr > th,
    main table.min-w-full > tbody > tr > td {
        white-space: normal;
        word-break: break-word;
    }
    /* Compactar células para caber melhor */
    main table.min-w-full > thead > tr > th,
    main table.min-w-full > tbody > tr > td {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        font-size: 0.8125rem; /* ~13px */
    }
    /* Coluna de ações: empilhar botões e preencher largura */
    main table.min-w-full td .flex {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    main table.min-w-full td .flex > * {
        width: 100%;
    }

    /* Evitar estouro de layout por textos longos */
    main .text-slate-700,
    main .text-slate-600,
    main .text-slate-500 {
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    /* Tablists (e.g., E-mail Marketing, Configurações) empilham no mobile */
    main [role="tablist"].flex {
        flex-direction: column;
        row-gap: 0.5rem;
        gap: 0.5rem;
        align-items: stretch;
    }
    main [role="tablist"].flex > * { width: 100%; display: block; }
    /* Grupos com gap em formulários devem quebrar linha quando necessário */
    form .flex.gap-2,
    form .flex.gap-3,
    form .flex.gap-4,
    form .flex[class*="gap-"] {
        flex-wrap: wrap;
    }
    form .flex.gap-2 > *,
    form .flex.gap-3 > *,
    form .flex.gap-4 > *,
    form .flex[class*="gap-"] > * {
        flex: 1 1 100%;
    }

    /* Tabelas empilhadas (vertical) no mobile: classe aplicada via JS */
    .crm-stack-table thead { display: none; }
    .crm-stack-table tbody tr { display: block; border-top: 1px solid #e2e8f0; padding: 0.5rem 0; }
    .crm-stack-table tbody tr:first-child { border-top: none; }
    .crm-stack-table tbody tr td { display: block; padding: 0.5rem 1rem !important; white-space: normal; word-break: break-word; }
    .crm-stack-table tbody tr td::before { content: attr(data-label); display: block; font-size: 0.75rem; color: #64748b; text-transform: uppercase; letter-spacing: .02em; margin-bottom: 0.125rem; }
    /* Ações em tabelas empilhadas: botões ocupam largura total, quebrando de forma natural */
    .crm-stack-table tbody tr td .crm-btn,
    .crm-stack-table tbody tr td a.inline-flex,
    .crm-stack-table tbody tr td button.crm-btn { width: 100%; height: 2rem; font-size: 0.75rem; }

    /* Ações empilhadas quando a célula é um container flex (ex.: Tarefas) */
    .crm-stack-table tbody tr td:last-child { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
    .crm-stack-table tbody tr td.flex { flex-direction: column !important; align-items: stretch !important; gap: 0 !important; }
    .crm-stack-table tbody tr td.flex { width: 100% !important; }
    .crm-stack-table tbody tr td.flex > * { width: 100% !important; }
    .crm-stack-table tbody tr td .flex,
    .crm-stack-table tbody tr td .inline-flex { flex-direction: column; align-items: stretch; gap: 0 !important; }
    .crm-stack-table tbody tr td .inline-flex { display: flex !important; width: 100% !important; }
    .crm-stack-table tbody tr td .flex > *,
    .crm-stack-table tbody tr td .inline-flex > * { width: 100% !important; }
    .crm-stack-table tbody tr td form,
    .crm-stack-table tbody tr td form .crm-btn,
    .crm-stack-table tbody tr td form button { width: 100% !important; }
    /* Espaçamento idêntico ao padrão de Negócios: 0.5rem entre botões */
    .crm-stack-table tbody tr td:last-child > * + * { margin-top: 0.5rem !important; }
    .crm-stack-table tbody tr td:last-child .flex > * + * { margin-top: 0.5rem !important; }

    /* Cards de Propostas Arquivadas: padronizar grupo de ações */
    [data-archive-card] .flex.flex-wrap {
        width: 100%;
        justify-content: flex-start;
        gap: 0.5rem;
    }
    [data-archive-card] .crm-btn {
        width: 100%;
        height: 2rem;
        font-size: 0.75rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        min-width: 0;
    }

    /* Histórico de Propostas dentro do Cliente: alinhar ações */
    #client-proposals-history .shrink-0.flex.items-center.gap-2 {
        width: 100%;
        flex-wrap: nowrap; /* 50/50 em uma linha */
        justify-content: flex-start;
        gap: 0.5rem;
    }
    #client-proposals-history .shrink-0.flex.items-center.gap-2 > * { flex: 1 1 0; }
    #client-proposals-history .shrink-0.flex.items-center.gap-2 > a.crm-btn { width: 100%; }
    #client-proposals-history .shrink-0.flex.items-center.gap-2 > form { width: 100%; }
    #client-proposals-history .shrink-0.flex.items-center.gap-2 > form .crm-btn { width: 100%; }
    #client-proposals-history .crm-btn {
        height: 2rem;
        font-size: 0.75rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        min-width: 0;
    }
    /* Força o grupo de ações para a 2ª linha no mobile */
    #client-proposals-history .flex.items-center.justify-between { flex-wrap: wrap !important; }
    #client-proposals-history .flex.items-center.justify-between > * { flex: 1 1 100%; }

    /* Tabela de Itens (Proposta Arquivada) -> formato vertical no mobile */
    .crm-archived-items-table thead { display: none; }
    .crm-archived-items-table tbody tr {
        display: block;
        border-top: 1px solid #e2e8f0;
        padding: 0.5rem 0;
    }
    .crm-archived-items-table tbody tr:first-child { border-top: none; }
    .crm-archived-items-table tbody tr td {
        display: block;
        padding: 0.5rem 0 !important;
        white-space: normal;
        word-break: break-word;
    }
    .crm-archived-items-table tbody tr td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.75rem;
        color: #64748b; /* slate-500 */
        text-transform: uppercase;
        letter-spacing: .02em;
        margin-bottom: 0.125rem;
    }

    /* Footer com fonte reduzida no mobile */
    footer { font-size: 0.75rem !important; }
}

/* Ajuste sutil de padding horizontal em telas muito pequenas */
@media (max-width: 420px) {
    main.flex-1 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (min-width: 641px) {
    /* Desktop: restaurar comportamento natural no histórico de propostas */
    #client-proposals-history .shrink-0.flex.items-center.gap-2 { width: auto; flex-wrap: nowrap; gap: 0.5rem; }
    #client-proposals-history .shrink-0.flex.items-center.gap-2 > * { flex: 0 0 auto; }
    #client-proposals-history .shrink-0.flex.items-center.gap-2 > a.crm-btn { width: auto; }
    #client-proposals-history .shrink-0.flex.items-center.gap-2 > form { width: auto; }
    #client-proposals-history .shrink-0.flex.items-center.gap-2 > form .crm-btn { width: auto; }
}
