﻿/* =========================================================
   AppGermed Clean UI
   Grids / Headers / Toolbars / Quick Filters
   ========================================================= */

/* ---------- Page / Paper ---------- */

.ag-clean-page {
    padding: 16px;
}

.ag-clean-paper {
    padding: 8px 20px 16px 20px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: none;
}

/* ---------- Header ---------- */

.ag-clean-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.ag-clean-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ag-clean-title {
    font-weight: 500;
    color: #424242;
}

.ag-clean-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------- Toolbar ---------- */

.ag-clean-toolbar {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}

.ag-clean-toolbar-search-only {
    grid-template-columns: 1fr;
    margin-top: 18px;
}

.ag-clean-search {
    width: 100%;
}

/* ---------- Quick Filters ---------- */

.ag-clean-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ag-clean-filter-btn {
    border-radius: 20px !important;
    font-size: 0.84rem !important;
    font-weight: 700 !important;
    text-transform: none !important;
}

.ag-clean-filter-default {
    background: #e0e0e0 !important;
    color: #424242 !important;
}

.ag-clean-filter-active {
    background: #5b4ce2 !important;
    color: #ffffff !important;
    border-color: #5b4ce2 !important;
}

.ag-clean-filter-germed {
    background: #e8f8fb !important;
    color: #ef3f4c !important;
    border: 2px solid #13bfd3 !important;
}

.ag-clean-filter-pardini {
    background: #fffafa !important;
    color: #d93645 !important;
    border: 2px solid #e34b5a !important;
}

.ag-clean-filter-db {
    background: #e8f8fb !important;
    color: #173d72 !important;
    border: 2px solid #13bfd3 !important;
}

.ag-clean-filter-brasil {
    background: #fffafa !important;
    color: #d93645 !important;
    border: 2px solid #e34b5a !important;
}

.ag-clean-filter-alvaro {
    background: #b01269 !important;
    color: #ffffff !important;
    border: 2px solid #b01269 !important;
}

.ag-clean-filter-matrix {
    background: #18324f !important;
    color: #ff9d00 !important;
    border: 2px solid #ff9d00 !important;
}

.ag-clean-filter-active.ag-clean-filter-germed,
.ag-clean-filter-active.ag-clean-filter-pardini,
.ag-clean-filter-active.ag-clean-filter-db,
.ag-clean-filter-active.ag-clean-filter-brasil,
.ag-clean-filter-active.ag-clean-filter-alvaro,
.ag-clean-filter-active.ag-clean-filter-matrix {
    background: #5b4ce2 !important;
    color: #ffffff !important;
    border-color: #5b4ce2 !important;
}

/* ---------- Table ---------- */

.ag-clean-table {
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
}

    .ag-clean-table .mud-table-head .mud-table-cell {
        color: #354052;
        font-weight: 800;
        font-size: 0.86rem;
        background: #ffffff;
        border-bottom: 1px solid #dddddd;
        border-right: 1px solid #e5e7eb;
    }

    .ag-clean-table .mud-table-body .mud-table-cell {
        color: #4b4b4b;
        font-size: 0.86rem;
        border-bottom: 1px solid #e0e0e0;
        border-right: 1px solid #ececec;
        vertical-align: middle;
    }

    .ag-clean-table .mud-table-row:hover {
        background-color: #f7f7fb !important;
    }

    .ag-clean-table .mud-table-cell:last-child {
        border-right: none;
    }

.ag-clean-table-inner {
    border-radius: 7px;
}

/* ---------- Table Columns ---------- */

.ag-clean-desc {
    min-width: 520px;
    width: 100%;
}

.ag-clean-code-col {
    width: 110px;
    min-width: 110px;
    max-width: 110px;
}

.ag-clean-company-col {
    width: 150px;
    min-width: 150px;
}

.ag-clean-link-col {
    width: 150px;
    min-width: 150px;
}

.ag-clean-actions-col {
    width: 170px;
    min-width: 170px;
    text-align: right !important;
}

.ag-clean-actions-cell {
    text-align: right;
    white-space: nowrap;
}

.ag-clean-actions-head {
    text-align: right !important;
}

/* ---------- Helpers ---------- */

.ag-clean-bold,
.ag-clean-bold *,
.ag-clean-bold input,
.ag-clean-bold textarea,
.ag-clean-bold .mud-input-slot,
.ag-clean-bold .mud-typography {
    font-weight: 800 !important;
}

.ag-input-bold,
.ag-input-bold input,
.ag-input-bold textarea,
.ag-input-bold .mud-input-slot,
.ag-input-bold .mud-select-input,
.ag-input-bold .mud-input,
.ag-input-bold .mud-typography {
    font-weight: 800 !important;
}

.ag-clean-chip {
    height: 24px !important;
    font-size: 0.70rem !important;
    font-weight: 700 !important;
}

.ag-clean-avatar-text {
    font-weight: 800;
    box-shadow: none !important;
}

/* ---------- Child / Inline Panels ---------- */

.ag-clean-child-wrap {
    padding: 14px 16px 10px 20px;
}

.ag-clean-grandchild-wrap {
    padding: 12px 16px 10px 20px;
}

.ag-clean-child-paper {
    padding: 16px;
    margin-bottom: 12px;
    background: #fbfcfe;
    border: 1px solid rgba(6, 75, 122, .08) !important;
    box-shadow: 0 4px 10px rgba(6, 75, 122, .04);
    border-radius: 12px;
}

.ag-clean-child-paper-info {
    padding: 12px;
    background: #fbfcfe;
}

.ag-clean-child-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* =========================================================
   Status Procedimento
   ========================================================= */

/* ---------- Base ---------- */

.ag-status-chip {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
}

.ag-status-pill {
    min-height: 22px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    font-size: 0.70rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

/* ---------- Warning / Pendente / Sem Resultado ---------- */

.ag-status-warning {
    background: #fff8db !important;
    color: #b77900 !important;
    border: 1px solid #f4c542 !important;
}

/* ---------- Orange / Entrega ---------- */

.ag-status-orange {
    background: #fff1e7 !important;
    color: #d66a00 !important;
    border: 1px solid #ff9f43 !important;
}

/* ---------- Error / Resultado / Rejeição ---------- */

.ag-status-error {
    background: #ffe5e5 !important;
    color: #d63031 !important;
    border: 1px solid #ff7675 !important;
}

/* ---------- Info / Coleta / Trânsito ---------- */

.ag-status-info {
    background: #eaf4ff !important;
    color: #0984e3 !important;
    border: 1px solid #74b9ff !important;
}

/* ---------- Success / Laudo Impresso ---------- */

.ag-status-success {
    background: #e9fff3 !important;
    color: #00a65a !important;
    border: 1px solid #55efc4 !important;
}

/* ---------- Secondary / Assinado ---------- */

.ag-status-secondary {
    background: #f3eaff !important;
    color: #8e44ad !important;
    border: 1px solid #c39bd3 !important;
}

/* ---------- Default / Apoio ---------- */

.ag-status-default {
    background: #f1f2f6 !important;
    color: #636e72 !important;
    border: 1px solid #dfe6e9 !important;
}

/* ---------- Apoio Externo ---------- */

.ag-status-apoio {
    background: #eef2f7 !important;
    color: #495057 !important;
    border: 1px solid #ced4da !important;
}

/* ---------- Interno ---------- */

.ag-status-interno {
    background: #f8f9fa !important;
    color: #6c757d !important;
    border: 1px dashed #ced4da !important;
}

/* ---------- Responsive ----------
   Passo 77.2 - Responsividade global das páginas Clean

   Mantém a densidade atual em telas grandes e adapta somente
   largura, espaçamento, cabeçalhos, ações e área das tabelas.
   Não altera escala global de fonte, zoom ou tamanho dos controles.
   ------------------------------------------------------------ */

/*
   Desktop/notebook largo:
   recupera área útil sem desmontar cabeçalhos e toolbars.
*/
@media (max-width: 1600px) {
    .ag-clean-page {
        padding: 12px;
    }

    .ag-clean-paper {
        padding: 8px 16px 14px 16px;
    }

    .ag-clean-header {
        gap: 12px;
    }

    .ag-clean-toolbar {
        gap: 14px;
        margin-bottom: 14px;
    }

    .ag-clean-child-wrap,
    .ag-clean-grandchild-wrap {
        padding-left: 14px;
        padding-right: 12px;
    }
}

/*
   Faixa em que o Shell já trabalha com a área operacional inteira.
   Cabeçalhos continuam horizontais quando houver espaço, mas podem
   quebrar de forma controlada antes de o conteúdo ser comprimido.
*/
@media (max-width: 1366px) {
    .ag-clean-page {
        padding: 10px;
    }

    .ag-clean-paper {
        padding: 8px 14px 12px 14px;
    }

    .ag-clean-header {
        flex-wrap: wrap;
    }

    .ag-clean-header-left {
        min-width: 0;
        flex: 1 1 320px;
    }

    .ag-clean-actions {
        flex: 0 1 auto;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .ag-clean-toolbar {
        grid-template-columns: minmax(0, auto) minmax(240px, 1fr);
        gap: 12px;
    }

    /*
       Tabelas podem ser naturalmente largas. Em vez de comprimir
       colunas operacionais ou esconder conteúdo, a rolagem fica
       restrita à própria área da tabela.
    */
    .ag-clean-table {
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .ag-clean-desc {
        min-width: 360px;
    }

    .ag-clean-child-wrap,
    .ag-clean-grandchild-wrap {
        padding-left: 10px;
        padding-right: 8px;
    }

    .ag-clean-child-paper {
        padding: 14px;
    }
}

/*
   Tablet/notebook com viewport CSS reduzido.
*/
@media (max-width: 960px) {
    .ag-clean-page {
        padding: 8px;
    }

    .ag-clean-paper {
        padding: 8px 10px 12px 10px;
    }

    .ag-clean-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .ag-clean-header-left {
        width: 100%;
        flex-basis: auto;
    }

    .ag-clean-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .ag-clean-toolbar {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 12px;
    }

    .ag-clean-filters {
        gap: 7px;
    }

    .ag-clean-desc {
        min-width: 280px;
    }

    .ag-clean-child-wrap,
    .ag-clean-grandchild-wrap {
        padding: 8px 4px;
    }

    .ag-clean-child-paper {
        padding: 10px;
    }
}

/*
   Tela estreita.
   Ações podem ocupar várias linhas sem forçar largura mínima da página.
*/
@media (max-width: 600px) {
    .ag-clean-page {
        padding: 4px;
    }

    .ag-clean-paper {
        padding: 6px 8px 10px 8px;
        border-radius: 9px;
    }

    .ag-clean-header-left {
        gap: 8px;
    }

    .ag-clean-actions {
        gap: 4px;
        justify-content: flex-start;
    }

    .ag-clean-toolbar {
        gap: 8px;
    }

    .ag-clean-filters {
        gap: 5px;
    }

    .ag-clean-desc {
        min-width: 220px;
    }

    .ag-clean-child-wrap,
    .ag-clean-grandchild-wrap {
        padding: 6px 2px;
    }

    .ag-clean-child-paper {
        padding: 8px;
        border-radius: 9px;
    }

    .ag-clean-child-header {
        gap: 8px;
    }
}


/* =========================================================
   Recipiente
   Etiquetas / Tabs Verticais
   ========================================================= */

.ag-recipiente-tabs {
    width: 100%;
    min-height: 78vh;
}

    /* Painel da direita */
    .ag-recipiente-tabs .mud-tabs-panels {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: none !important;
        padding-left: 14px;
    }

    .ag-recipiente-tabs .mud-tab-panel {
        width: 100% !important;
        max-width: none !important;
    }

/* Textarea das etiquetas */
.ag-recipiente-textarea {
    width: 100% !important;
    max-width: none !important;
}

    .ag-recipiente-textarea .mud-input-control,
    .ag-recipiente-textarea .mud-input,
    .ag-recipiente-textarea textarea {
        width: 100% !important;
        max-width: none !important;
    }

    .ag-recipiente-textarea textarea {
        height: 40vh !important;
        min-height: 40vh !important;
        max-height: 40vh !important;
        font-family: Consolas, monospace !important;
        font-size: 15px !important;
        line-height: 1.25rem !important;
    }

/* Destaque da TAB vertical selecionada */
.ag-tabs-vertical .mud-tab.mud-tab-active {
    background: #e8f1ff !important;
    color: #1d4ed8 !important;
    font-weight: 700 !important;
}

    /* Ícone da TAB selecionada */
    .ag-tabs-vertical .mud-tab.mud-tab-active .mud-icon-root {
        color: #2563eb !important;
    }

/* Indicador lateral padrão do MudBlazor */
.ag-tabs-vertical .mud-tab-slider {
    width: 3px !important;
    border-radius: 999px !important;
}


/* =========================================================
   Financeiro / Plano de Contas TreeView
   ========================================================= */

.ag-fin-tree {
    width: 100%;
}

.ag-fin-tree-row {
    width: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 6px;
    border-radius: 8px;
}

    .ag-fin-tree-row:hover {
        background: #f7f7fb;
    }

.ag-fin-tree-main {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.ag-fin-tree-code {
    font-weight: 800;
    color: #354052;
    white-space: nowrap;
}

.ag-fin-tree-desc {
    color: #4b4b4b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ag-fin-tree-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: .45;
    transition: opacity .15s ease-in-out;
}

.ag-fin-tree-row:hover .ag-fin-tree-actions {
    opacity: 1;
}

@media (max-width: 960px) {
    .ag-fin-tree-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .ag-fin-tree-actions {
        opacity: 1;
    }
}

/* =========================================================
   global-processing
   ========================================================= */

.ag-global-processing {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    z-index: 9999;
    background: transparent;
}

.ag-global-processing-bar {
    height: 3px !important;
}

.ag-global-processing-text {
    position: absolute;
    right: 18px;
    top: 6px;
    font-size: .78rem;
    font-weight: 800;
    color: #1d4ed8;
    background: rgba(255,255,255,.92);
    border: 1px solid #dbeafe;
    border-radius: 999px;
    padding: 4px 12px;
    box-shadow: 0 4px 12px rgba(33, 80, 140, .10);
}

/* ============================================================
   13) ATENDIMENTO - PAINEL INLINE OPERACIONAL
   ------------------------------------------------------------
   Utilizado na AtendimentoPacPage para consulta rápida de:
   - dados do atendimento;
   - guias / médicos;
   - procedimentos / exames;
   - seleção para protocolo e laudo.
   ============================================================ */

.ag-at-inline-shell {
    padding: 18px 14px 22px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.ag-at-inline-panel {
    overflow: hidden;
    border-radius: 14px !important;
    border-color: rgba(91, 75, 223, .18) !important;
    box-shadow: 0 8px 26px rgba(15, 23, 42, .07);
}

.ag-at-inline-header {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, rgba(91, 75, 223, .06), #ffffff 56%);
    border-bottom: 1px solid rgba(15, 23, 42, .10);
}

.ag-at-inline-header__avatar {
    flex: 0 0 auto;
    align-self: center;
}

.ag-at-inline-header__context {
    min-width: 0;
    display: grid;
    gap: 10px;
}

.ag-at-inline-header__identity {
    display: grid;
    grid-template-columns: 132px 1px minmax(260px, 1fr) 1px 112px 82px 138px 112px;
    gap: 12px;
    align-items: center;
    min-height: 64px;
    padding: 8px 14px;
    border: 1px solid rgba(91, 75, 223, .16);
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
}

.ag-at-inline-header__identity-item {
    min-width: 0;
}

.ag-at-inline-header__identity-item--number,
.ag-at-inline-header__identity-item--compact {
    text-align: center;
}

.ag-at-inline-header__identity-item--compact {
    display: flex;
    min-height: 46px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

    .ag-at-inline-header__identity-item--compact strong {
        display: block;
        margin-top: 3px;
        color: #374151;
        font-size: .78rem;
        font-weight: 850;
        line-height: 1.1;
        white-space: nowrap;
    }

.ag-at-inline-label {
    color: #ff3d71 !important;
    font-weight: 800 !important;
    letter-spacing: .35px;
}

.ag-at-inline-number,
.ag-at-inline-patient {
    color: #374151 !important;
    font-weight: 850 !important;
    line-height: 1.15 !important;
}

.ag-at-inline-patient {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ag-at-inline-header__actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(145px, 1fr));
    gap: 8px;
    align-items: stretch;
}

    .ag-at-inline-header__actions .mud-button-root {
        min-height: 40px;
        white-space: nowrap;
    }

.ag-at-inline-content {
    display: grid;
    grid-template-columns: minmax(360px, .86fr) minmax(680px, 1.55fr);
    gap: 14px;
    padding: 14px;
}

.ag-at-inline-section {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #dce2ea;
    border-radius: 12px;
    background: #ffffff;
}

.ag-at-inline-section__header {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border-bottom: 1px solid #e5e7eb;
}

.ag-at-inline-section__title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

    .ag-at-inline-section__title .mud-typography-h6 {
        color: #263238;
        font-weight: 750;
    }

    .ag-at-inline-section__title .mud-typography-caption {
        color: #6b7280;
    }

.ag-at-inline-selection {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
}

.ag-at-inline-table {
    width: 100%;
}

    .ag-at-inline-table .mud-table-head .mud-table-cell {
        height: 38px;
        padding: 7px 9px !important;
        background: #f8fafc;
        color: #334155;
        font-size: .73rem;
        font-weight: 850;
        white-space: nowrap;
    }

    .ag-at-inline-table .mud-table-body .mud-table-cell {
        min-height: 42px;
        padding: 7px 9px !important;
        color: #263238;
        vertical-align: middle;
    }

    .ag-at-inline-table .mud-table-row:hover {
        background: #f7f9ff !important;
    }

.ag-at-inline-two-lines {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

    .ag-at-inline-two-lines strong {
        font-weight: 750;
    }

    .ag-at-inline-two-lines span {
        margin-top: 3px;
        color: #64748b;
        font-size: .76rem;
    }

.ag-at-inline-sequence {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #5B4BDF;
    border-radius: 999px;
    color: #4938db;
    font-size: .76rem;
    font-weight: 800;
}

.ag-at-inline-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

    .ag-at-inline-status strong {
        color: #374151;
        font-size: .68rem;
        font-weight: 850;
    }

.ag-at-inline-empty {
    padding: 22px;
    color: #64748b;
    text-align: center;
}


@media (max-width: 1320px) {
    .ag-at-inline-header__identity {
        grid-template-columns: 118px 1px minmax(220px, 1fr) 1px repeat(4, minmax(92px, auto));
        gap: 9px;
        padding-inline: 10px;
    }

    .ag-at-inline-header__actions {
        grid-template-columns: repeat(4, minmax(130px, 1fr));
    }

    .ag-at-inline-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1050px) {
    .ag-at-inline-header__identity {
        grid-template-columns: 112px 1px minmax(210px, 1fr);
    }

        .ag-at-inline-header__identity > .mud-divider:nth-of-type(2) {
            display: none;
        }

    .ag-at-inline-header__identity-item--compact {
        min-height: 52px;
        padding: 6px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        background: #f8fafc;
    }

    .ag-at-inline-header__actions {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }
}

@media (max-width: 760px) {
    .ag-at-inline-shell {
        padding: 10px 4px 16px;
    }

    .ag-at-inline-header {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .ag-at-inline-header__avatar {
        justify-self: center;
    }

    .ag-at-inline-header__identity {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        text-align: center;
    }

        .ag-at-inline-header__identity > .mud-divider {
            display: none;
        }

    .ag-at-inline-header__identity-item:not(.ag-at-inline-header__identity-item--compact) {
        grid-column: span 1;
        min-height: 58px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 7px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        background: #ffffff;
    }

    .ag-at-inline-header__actions {
        grid-template-columns: 1fr 1fr;
    }

    .ag-at-inline-content {
        padding: 8px;
    }
}

@media (max-width: 520px) {
    .ag-at-inline-header__identity,
    .ag-at-inline-header__actions {
        grid-template-columns: 1fr;
    }

    .ag-at-inline-header__identity-item:not(.ag-at-inline-header__identity-item--compact) {
        grid-column: auto;
    }
}


/* ---------- Atendimento: filtros da pesquisa ---------- */

.ag-at-search-toolbar {
    grid-template-columns: minmax(320px, 1fr) 230px !important;
    gap: 12px !important;
    align-items: end !important;
    margin-top: 18px;
}

.ag-at-search-delivery-filter {
    width: 100%;
}

@media (max-width: 760px) {
    .ag-at-search-toolbar {
        grid-template-columns: 1fr !important;
    }
}
