/* :root,
.ea-light-scheme,
body {
    --color-primary: #000000 !important;
    --color-primary-dark: #333333 !important;
    --bs-primary: #000000 !important;
    --bs-primary-rgb: 0, 0, 0 !important;
}

.ea-dark-scheme {
    --color-primary: #ffffff !important;
    --color-primary-dark: #cccccc !important;
    --bs-primary: #ffffff !important;
    --bs-primary-rgb: 255, 255, 255 !important;
}

.btn-primary {
    background: var(--color-primary) !important;
    background-image: none !important;
    border-color: var(--color-primary) !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus {
    background: var(--color-primary-dark) !important;
    background-image: none !important;
    border-color: var(--color-primary-dark) !important;
    color: #ffffff !important;
}

.ea-dark-scheme .btn-primary {
    color: #000000 !important;
}

.ea-dark-scheme .btn-primary:hover,
.ea-dark-scheme .btn-primary:active,
.ea-dark-scheme .btn-primary:focus {
    color: #000000 !important;
} */

.img-logo-dashboard {
    max-width: 115px !important;
}

.ea-dark-scheme .img-logo-dashboard {
    filter: invert(1);
}

.form-fieldset.has-fieldset-error {
    border: unset !important;
    box-shadow: unset !important;
}

.field-collection-delete-button {
    transform: translateY(-3px);
}

.form-collection-item-collapse-marker {
    transform: translateY(-2px);
}

.form-group.field-collection .form-group {
    display: block !important;
}
.form-group.field-collection .form-group label {
    padding: 0 0 8px !important;
    inline-size: 100% !important;
}

/* DOCUMENT_CARD */

#documents_entry,
#documents_file,
.project-file-upload,
.existing-document-wrapper {
    border: 1px solid var(--form-input-border-color);
    background: var(--form-control-bg);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    border-radius: 0.4rem;
    border-style: dashed;
}

#documents_file,
.existing-document-wrapper {
    border: 1px solid var(--link-color);
    border-style: dashed;
}

#documents_entry,
.project-file-upload {
    padding: 2rem 1rem;
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s, background-color 0.15s;
}

#documents_entry.drag-over,
.upload-document-wrapper.drag-over,
.project-file-upload.drag-over {
    border-color: var(--link-color);
    background-color: color-mix(in srgb, var(--link-color) 8%, var(--form-control-bg));
}

#documents_file,
.existing-document-wrapper {
    padding: 1rem 1rem 2rem 1rem;
}

#documents_entry .icon,
#documents_file .icon,
.project-file-upload .icon,
.existing-document-wrapper .icon {
    width: 4rem;
    height: 4rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f3f3fd;
    font-size: 2rem;
    color: var(--link-color);
}

#documents_entry span,
#documents_file span,
.project-file-upload span,
.existing-document-wrapper span {
    margin-top: 0.25rem;
    font-weight: 400;
    color: #71717a;
    max-width: 100%;
    width: fit-content;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    padding: 0 0.5rem;
}

#documents_entry strong,
#documents_file strong,
.project-file-upload strong,
.existing-document-wrapper strong {
    display: block;
    text-align: center;
    margin-top: 1rem;
    font-size: 1rem;
}

#documents_entry small,
#documents_file small,
.project-file-upload small,
.existing-document-wrapper small {
    text-transform: uppercase;
    color: #71717a;
    border: 1px solid #71717a75;
    border-radius: 9999px;
    padding: 0.1rem 0.75rem;
    margin-top: 0.5rem;
}

#documents_file .content,
.existing-document-wrapper .content {
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#documents_file .header,
.existing-document-wrapper .header {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
}

#documents_file .metadata {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: #71717a;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

#documents_file .metadata-separator {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #a1a1aa;
}

.d-none-important {
    display: none !important;
}

/* PROJECT FILE ADD CARD */

.form-group:has(.project-files-collection) .field-collection-add-button {
    display: none !important;
}

/* Reset EasyAdmin accordion wrappers inside the files collection */
.ea-form-collection-items:has(.project-files-collection),
.ea-form-collection-items:has(.project-files-collection) > .accordion,
.ea-form-collection-items:has(.project-files-collection) .form-widget-compound,
.ea-form-collection-items:has(.project-files-collection) [data-empty-collection] {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

/* Make cols stretch to match the tallest card in the row */
.project-files-collection > .col-12 {
    display: flex;
    flex-direction: column;
}

.project-files-collection > .col-12 > *,
.project-files-collection > .col-12 > .project-file-upload,
.project-files-collection > .col-12 > .existing-document-wrapper {
    flex: 1;
}

.project-file-add-card {
    border: 1px dashed var(--form-input-border-color);
    background: var(--form-control-bg);
    width: 100%;
    height: 100%;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 0.4rem;
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s;
    padding: 2rem 1rem;
    gap: 0.5rem;
    margin-top: 39px;
}

.project-file-add-card:hover {
    border-color: var(--link-color);
    background: var(--bs-light, #f8f9fa);
}

.project-file-add-card .icon {
    width: 4rem;
    height: 4rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f3f3fd;
    font-size: 2rem;
    color: var(--link-color);
}

.project-file-add-card span {
    margin-top: 0.25rem;
    font-weight: 400;
    color: #71717a;
}

.form-group.has-error .invalid-feedback,
.form-group.has-error ~ .invalid-feedback,
.invalid-feedback.d-block {
    display: block !important;
}

.btn-action-icon {
    border: none;
    background: #fee2e2;
    color: #ef4444;
    width: 1.75rem;
    height: 1.75rem;
    display: grid;
    place-items: center;
    border-radius: 0.25rem;
    cursor: pointer;
}

.btn-clear-file {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

/* HISTORY */

#history {
    position: relative;
    padding: 1rem;
    border: 1px solid var(--form-input-border-color);
    background: var(--form-control-bg);
    max-height: 100%;
    overflow-y: auto;
}

#history .note-item {
    position: relative;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
    padding-bottom: 2rem;
}

#history .note-date strong {
    display: block;
    font-size: 1rem;
    font-weight: 700;
}

#history .note-date span {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    color: #71717a;
}

#history .note-card-line {
    position: absolute;
    height: 100%;
    width: 1px;
    background: var(--form-input-border-color);
    left: calc(200px + 0.5rem);
    transform: translateX(-50%);
}

#history .note-card-line span {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0.5rem;
    height: 0.5rem;
    background: var(--link-color);
    border-radius: 50%;
    z-index: 2;
}

#history .note-card-content {
    padding-inline: 1rem;
    padding-bottom: 0.5rem;
}

#history .note-field-label {
    font-weight: 500;
}

/* ── Linha com exigência aberta (listagem normal de processos) ── */

tr.has-open-requirements td {
    background-color: oklch(97.3% 0.071 103.193) !important;
}

tr.has-open-requirements:hover td {
    background-color: oklch(94% 0.09 103.193) !important;
}

.ea-dark-scheme tr.has-open-requirements td {
    background-color: oklch(28% 0.07 85) !important;
}

.ea-dark-scheme tr.has-open-requirements:hover td {
    background-color: oklch(33% 0.08 85) !important;
}

/* ------------------------------------------------------------------ FILE ROWS
   Listas de arquivos em linhas (DocumentBundle/Views/file_rows.twig): Arquivos do projeto, do
   processo e da exigência, Taxas, arquivos de tarefa e as sub-abas de Documentos do projeto.
   Cores pelas variáveis do EasyAdmin, que já trocam no tema escuro. */

/* O "Adicionar" do EasyAdmin some: cada lista tem o seu (e o da sub-aba sabe a categoria). */
.form-group:has(.file-rows) .field-collection-add-button,
.form-group:has(.file-rows) .collection-empty {
    display: none !important;
}

.ea-form-collection-items:has(.file-rows),
.ea-form-collection-items:has(.file-rows) > .accordion,
.ea-form-collection-items:has(.file-rows) .form-widget-compound,
.ea-form-collection-items:has(.file-rows) [data-empty-collection] {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

/* Sub-abas de categoria: o mesmo desenho das abas de Relatórios (reports.css, .rp-tab). Os
   valores são os do dashboard.css (--db-*), repetidos aqui porque aquele CSS só carrega no
   painel e nos relatórios. */
.file-rows-categorized {
    --fr-tab-bg:        #ffffff;
    --fr-tab-bg-hover:  #f8faff;
    --fr-tab-border:    rgba(0, 0, 0, 0.07);
    --fr-tab-text:      #6b7280;
    --fr-tab-text-hover: #1a1d23;
    --fr-tab-accent:    #2563eb;
}

[data-bs-theme="dark"] .file-rows-categorized,
.ea-dark .file-rows-categorized {
    --fr-tab-bg:        #1a1d26;
    --fr-tab-bg-hover:  #1f2330;
    --fr-tab-border:    rgba(255, 255, 255, 0.07);
    --fr-tab-text:      #a0aabf;
    --fr-tab-text-hover: #f0f2f8;
    --fr-tab-accent:    #3b82f6;
}

.file-rows-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 14px;
    scrollbar-width: thin;
}

.file-rows-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid var(--fr-tab-border);
    background: var(--fr-tab-bg);
    color: var(--fr-tab-text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-rows-tab:hover {
    color: var(--fr-tab-text-hover);
    background: var(--fr-tab-bg-hover);
}

.file-rows-tab.active {
    background: var(--fr-tab-accent);
    border-color: var(--fr-tab-accent);
    color: #fff;
}

/* Contagem: o .rp-count do relatório; na aba ativa, translúcida sobre o azul. */
.file-rows-count {
    display: inline-block;
    min-width: 26px;
    padding: 2px 9px;
    border-radius: 8px;
    border: 1px solid var(--fr-tab-border);
    background: var(--fr-tab-bg-hover);
    color: var(--fr-tab-text);
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.file-rows-tab.active .file-rows-count {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Sub-abas entre campos (Processo: Documentos Principais / Pagamentos). */
.field-subtab.is-hidden-subtab,
.file-rows.is-hidden-subtab {
    display: none !important;
}

/* O campo cuja lista está escondida só mostra a barra de abas: sem a margem de baixo. */
.field-subtab:has(.file-rows.is-hidden-subtab) {
    margin-bottom: 0;
}

.file-rows-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--form-input-border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.file-rows-list:not(:has([data-file-row])) {
    display: none;
}

.file-rows-empty {
    display: none;
    margin: 0;
    padding: 1rem;
    border: 1px dashed var(--form-input-border-color);
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

.file-rows-list:not(:has([data-file-row])) + .file-rows-empty {
    display: block;
}

.file-rows .file-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-height: 3.5rem;
    padding: 0.625rem 0.875rem;
    background: var(--form-control-bg);
}

.file-rows .file-row + .file-row {
    border-top: 1px solid var(--form-input-border-color);
}

.file-rows .file-row.is-new {
    background: rgba(127, 127, 127, 0.05);
}

.file-rows .file-row-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--link-color);
    font-size: 1.05rem;
}

.file-rows .file-row.is-new .file-row-icon {
    background: rgba(127, 127, 127, 0.12);
    color: var(--text-muted);
}

.file-rows .file-row-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.file-rows .file-row-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

/* Nome editável no lugar. Com arquivo: parece texto até passar o mouse. Item novo: campo leve. */
.file-rows .file-row-name.form-control {
    flex: 1;
    max-width: 32rem;
    min-width: 0;
    height: 1.875rem;
    padding: 0.125rem 0.5rem;
    margin-left: -0.5rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    background: transparent;
    box-shadow: none;
    font-size: 0.9375rem;
    font-weight: 600;
}

/* Com arquivo, o campo tem o tamanho do nome, para o selo "vigente" ficar colado nele. Navegador
   sem field-sizing (Firefox) cai na largura máxima — só o selo fica mais longe. */
.file-rows .file-row.has-file .file-row-name.form-control {
    flex: 0 1 auto;
    width: auto; /* o .form-control do EasyAdmin força 100%, que anula o field-sizing */
    field-sizing: content;
    min-width: 8rem;
}

.file-rows .file-row.is-new .file-row-name.form-control {
    margin-left: 0;
    border-color: var(--form-input-border-color);
    background: var(--form-control-bg);
    font-weight: 500;
}

.file-rows .file-row-name.form-control:hover {
    border-color: var(--form-input-border-color);
}

.file-rows .file-row-name.form-control:focus {
    border-color: var(--link-color);
    background: var(--form-control-bg);
    box-shadow: 0 0 0 0.15rem rgba(99, 102, 241, 0.15);
}

.file-rows .file-row-badge {
    flex-shrink: 0;
    padding: 0.0625rem 0.5rem;
    border-radius: 999px;
    background: rgba(25, 135, 84, 0.14);
    color: #198754;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.file-rows .file-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.3;
}

.file-rows .file-row-filename {
    max-width: 22rem;
    overflow: hidden;
    color: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-rows .file-row-filename:hover {
    color: var(--link-color);
}

.file-rows .file-row-pending.is-chosen {
    color: var(--link-color);
    font-weight: 600;
}

/* Interruptor "Enviar ao cliente": anula o .form-check e o <label> de campo do EasyAdmin. */
.file-rows .file-row-send {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.5rem;
    min-height: 0;
    margin: 0;
    padding: 0;
}

.file-rows .file-row-send .form-check {
    display: flex;
    align-items: center;
    min-height: 0;
    margin: 0;
    padding: 0;
}

.file-rows .file-row-send .form-check-input {
    float: none;
    width: 2rem;
    height: 1.125rem;
    margin: 0;
    cursor: pointer;
}

.file-rows .file-row-send .file-row-send-label {
    margin: 0;
    padding: 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.file-rows .file-row-send:has(:checked) .file-row-send-label {
    color: var(--link-color);
}

/* Largura fixa: "Escolher arquivo" e "Baixar" têm tamanhos diferentes, e sem isto o interruptor
   do item novo saía desalinhado dos outros. */
.file-rows .file-row-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 0.375rem;
    min-width: 11.25rem;
}

/* Botões da linha: mesma altura, mesmo desenho; "Remover" é só o ícone. */
/* `.rel-btn`: o mesmo botão fora das listas de arquivo — o "Editar" das listagens relacionadas
   (propostas, projetos, reuniões, tarefas, processos, exigências, endereços, empresas). */
.file-rows .file-row-btn,
.rel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 2rem;
    padding: 0 0.75rem;
    border: 1px solid var(--form-input-border-color);
    border-radius: 0.375rem;
    background: var(--form-control-bg);
    color: var(--link-color);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.file-rows .file-row-btn:hover,
.rel-btn:hover {
    border-color: var(--link-color);
    background: rgba(99, 102, 241, 0.06);
}

.file-rows .file-row-btn.is-primary {
    border-color: var(--link-color);
    background: var(--link-color);
    color: #fff;
}

.file-rows .file-row-btn.is-primary:hover {
    filter: brightness(1.08);
}

.file-rows .file-row-btn.is-icon {
    width: 2rem;
    padding: 0;
}

.file-rows .file-row-btn.is-danger {
    color: var(--text-muted);
}

.file-rows .file-row-btn.is-danger:hover {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.08);
    color: #dc3545;
}

@media (max-width: 767px) {
    .file-rows .file-row {
        flex-wrap: wrap;
    }

    .file-rows .file-row-main {
        flex-basis: calc(100% - 3.25rem);
    }

    .file-rows .file-row-send {
        margin-left: 3.125rem;
    }

    .file-rows .file-row-actions {
        min-width: 0;
        margin-left: auto;
    }

    .file-rows .file-row-btn span {
        display: none;
    }

    .file-rows .file-row-btn {
        width: 2rem;
        padding: 0;
    }
}

/* Documentos de campo fixo (file_card.twig) e campos de arquivo das tarefas (file_upload_card.twig):
   a mesma linha das listas, com o tipo do documento como nome. */
.file-rows-slots .file-slot-item + .file-slot-item {
    border-top: 1px solid var(--form-input-border-color);
}

.file-rows .file-slot-label {
    overflow: hidden;
    font-size: 0.9375rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-rows .file-slot .file-row-actions {
    min-width: 0;
}

.file-rows .file-slot.is-removed .file-slot-label {
    color: var(--text-muted);
    text-decoration: line-through;
}

.file-rows .file-slot-removed {
    color: #dc3545;
    font-weight: 600;
}

.file-rows .file-slot-undo {
    padding: 0;
    border: 0;
    background: none;
    color: var(--link-color);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.file-rows .file-slot.is-drag-over {
    outline: 2px dashed var(--link-color);
    outline-offset: -4px;
    background: rgba(99, 102, 241, 0.06);
}

/* Linha isolada (campo de tarefa, Configurações > Documentos): ela mesma é o "cartão". */
.file-rows-single {
    container-type: inline-size;
}

.file-rows-single .file-row {
    border: 1px solid var(--form-input-border-color);
    border-radius: 0.5rem;
}

/* Vários campos de arquivo seguidos (as telas de tarefa: Relatório, Pré-briefing, Proposta…) viram
   UMA lista, um abaixo do outro, sem espaço e separados por uma linha — o mesmo desenho dos
   documentos de campo fixo dos módulos. Cada campo é um form-group próprio do EasyAdmin, então a
   lista é montada aqui: um campo "tem anterior/próximo" quando o vizinho (pulando a quebra de linha
   `.field-form_row` do addRow()) também é um campo de arquivo. Atenção: :has() não pode ter outro
   :has() dentro — o navegador descarta a regra inteira —, por isso o "próximo" olha direto para
   dentro do irmão (`:has(+ * > .form-group …)`). */
.row > :has(> .form-group .file-rows-single):has(+ * > .form-group .file-rows-single) > .form-group,
.row > :has(> .form-group .file-rows-single):has(+ .field-form_row + * > .form-group .file-rows-single) > .form-group {
    /* O espaço entre campos do EasyAdmin é o padding de baixo do .form-group (24px). */
    padding-bottom: 0;
    margin-bottom: 0;
}

.row > :has(> .form-group .file-rows-single) + :has(> .form-group .file-rows-single),
.row > :has(> .form-group .file-rows-single) + .field-form_row + :has(> .form-group .file-rows-single) {
    margin-top: 0;
}

/* Com próximo: sem os cantos de baixo. */
.row > :has(> .form-group .file-rows-single):has(+ * > .form-group .file-rows-single) .file-rows-single .file-row,
.row > :has(> .form-group .file-rows-single):has(+ .field-form_row + * > .form-group .file-rows-single) .file-rows-single .file-row {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Com anterior: sem a borda de cima (a de baixo do anterior é a linha que separa) e sem os cantos de cima. */
.row > :has(> .form-group .file-rows-single) + :has(> .form-group .file-rows-single) .file-rows-single .file-row,
.row > :has(> .form-group .file-rows-single) + .field-form_row + :has(> .form-group .file-rows-single) .file-rows-single .file-row {
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Coluna estreita (as tarefas usam setColumns(3)): só os ícones nos botões, e o ícone menor. */
@container (max-width: 380px) {
    .file-rows .file-row {
        gap: 0.625rem;
        padding: 0.5rem 0.625rem;
    }

    .file-rows .file-row-icon {
        width: 1.875rem;
        height: 1.875rem;
        font-size: 0.95rem;
    }

    .file-rows .file-row-btn span {
        display: none;
    }

    .file-rows .file-row-btn {
        width: 2rem;
        padding: 0;
    }
}

.file-rows-add {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding: 0.4rem 0.9rem;
    border: 1px dashed var(--form-input-border-color);
    border-radius: 0.4rem;
    background: transparent;
    color: var(--link-color);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.file-rows-add:hover {
    border-color: var(--link-color);
}


/* Item das listagens relacionadas (propostas, projetos, reuniões, tarefas, processos, exigências,
   endereços, empresas): o mesmo cartão dos projetos do cliente, com o botão .rel-btn. */
.rel-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.625rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--form-input-border-color);
    border-radius: 0.5rem;
    background: var(--form-control-bg);
}

/* Pilha de cartões (Informações Complementares da tarefa): o espaço é o margin do próprio cartão. */
.rel-items > .rel-item:last-child {
    margin-bottom: 0;
}

.rel-item.is-overdue {
    border-color: #dc3545;
}

.rel-item-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.rel-item-info small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Cliente > Projetos (projects_list.twig): cada projeto é um cartão, e os documentos abrem dentro
   dele — uma lista enxuta, sem caixa por categoria. */
.customer-project {
    margin-bottom: 0.625rem;
    border: 1px solid var(--form-input-border-color);
    border-radius: 0.5rem;
    background: var(--form-control-bg);
    overflow: hidden;
}

.customer-project-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0.875rem;
}

.customer-project-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.customer-project-info small {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.customer-project-actions {
    display: flex;
    flex-shrink: 0;
    gap: 0.375rem;
}

.file-rows .customer-project-toggle .file-rows-count {
    min-width: 1.5rem;
    padding: 0 0.4rem;
    font-size: 0.6875rem;
}

.customer-project-chevron {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.customer-project-toggle:not(.collapsed) .customer-project-chevron {
    transform: rotate(180deg);
}

.customer-project-toggle:not(.collapsed) {
    border-color: var(--link-color);
}

.customer-project-docs {
    padding: 0.25rem 0.875rem 0.75rem;
    border-top: 1px solid var(--form-input-border-color);
    background: rgba(127, 127, 127, 0.035);
}

.cpd-group-title {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0.75rem 0 0.25rem;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.cpd-group-title span {
    padding: 0 0.375rem;
    border-radius: 999px;
    background: rgba(127, 127, 127, 0.15);
    font-size: 0.625rem;
}

.cpd-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cpd-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 2.5rem;
    padding: 0.25rem 0;
}

.cpd-item + .cpd-item {
    border-top: 1px dashed var(--form-input-border-color);
}

.cpd-icon {
    flex-shrink: 0;
    width: 1.25rem;
    color: var(--link-color);
    text-align: center;
}

.cpd-name {
    flex-shrink: 0;
    max-width: 40%;
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cpd-meta {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cpd-client {
    flex-shrink: 0;
    padding: 0.0625rem 0.5rem;
    border-radius: 999px;
    background: rgba(37, 211, 102, 0.12);
    color: #128c7e;
    font-size: 0.75rem;
    font-weight: 600;
}

.file-rows .cpd-item .file-row-btn.is-icon {
    flex-shrink: 0;
    width: 1.875rem;
    height: 1.875rem;
    margin-left: auto; /* sempre na ponta direita, mesmo quando o texto do meio some (celular) */
}

@media (max-width: 575px) {
    .customer-project-head {
        flex-wrap: wrap;
    }

    /* A regra de celular das listas esconde todo texto dos botões; a contagem fica. */
    .file-rows .customer-project-toggle {
        width: auto;
        padding: 0 0.5rem;
    }

    .file-rows .customer-project-toggle .file-rows-count {
        display: inline-block;
    }

    .cpd-meta {
        display: none;
    }
}

/* O .rel-btn não mora num .file-rows: garante que nada do link padrão vaze (sublinhado, cor). */
.rel-btn,
.rel-btn:hover,
.rel-btn:focus {
    flex-shrink: 0;
    text-decoration: none;
}

.rel-btn:hover {
    color: var(--link-color);
}
