/* Layout da página. Componentes, cores e tipografia vêm do Carbon (@carbon/styles, tema g10). */

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
    background: var(--cds-background, #f4f4f4);
    color: var(--cds-text-primary, #161616);
}

code {
    font-family: "IBM Plex Mono", Menlo, monospace;
    font-size: 0.875rem;
}

[hidden] {
    display: none !important;
}

/* ---------------------------------------------------------------- header */

.header-session {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-right: 0.5rem;
}

.header-user {
    font-size: 0.875rem;
    color: var(--cds-text-secondary, #525252);
}

.header-logout {
    min-height: 2rem;
}

/* ---------------------------------------------------------------- página */

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(3rem + 2rem) 1rem 4rem;
}

.page-head h1 {
    margin: 0 0 0.5rem;
    font-size: 2rem;
    font-weight: 400;
    line-height: 1.25;
}

.page-head p {
    margin: 0 0 2rem;
    max-width: 640px;
    font-size: 0.875rem;
    line-height: 1.43;
    color: var(--cds-text-secondary, #525252);
}

.cds--tile h2 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    font-weight: 400;
}

.subhead {
    margin: 2rem 0 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.helper {
    margin: 0 0 1.5rem;
    font-size: 0.875rem;
    line-height: 1.43;
    color: var(--cds-text-secondary, #525252);
}

.helper.small {
    margin: 1.5rem 0 0;
    font-size: 0.75rem;
}

.helper.empty {
    margin: 1rem 0 0;
}

.session-line {
    margin: 0 0 1rem;
    font-size: 0.875rem;
}

/* ---------------------------------------------------------------- blocos */

.login-tile {
    max-width: 400px;
    padding: 2rem;
}

.section {
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-head .helper {
    margin-bottom: 0;
}

.split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 0 1rem;
}

/* ---------------------------------------------------------------- formulários */

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.btn-block {
    width: 100%;
    max-width: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem 1rem;
    align-items: start;
}

.form-grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-actions {
    grid-column: 1 / -1;
}

/* ---------------------------------------------------------------- tabelas */

.cds--data-table-container {
    overflow-x: auto;
}

.col-action {
    width: 1%;
    white-space: nowrap;
}

.action-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.action-cell .cds--select-input__wrapper {
    min-width: 200px;
}

/* ---------------------------------------------------------------- grupos */

.group-list {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    border-top: 1px solid var(--cds-border-subtle, #e0e0e0);
}

.group-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--cds-border-subtle, #e0e0e0);
    font-size: 0.875rem;
}

.group-list li span {
    display: block;
    margin-top: 0.125rem;
    font-size: 0.75rem;
    color: var(--cds-text-secondary, #525252);
}

/* ---------------------------------------------------------------- avisos */

.feedback:empty {
    display: none;
}

.feedback .cds--inline-notification {
    max-width: none;
    margin: 1rem 0;
}

@media (max-width: 672px) {
    .page {
        padding-top: calc(3rem + 1.5rem);
    }

    .header-user {
        display: none;
    }

    .action-cell {
        flex-direction: column;
        align-items: stretch;
    }

    .section-head {
        flex-direction: column;
    }
}

/* ---------------------------------------------------------------- camadas */

/* No tema g10 o campo padrão é branco, igual ao tile: dentro do tile ele usa o campo da
   segunda camada (cinza), como o Carbon faz com layer. */
.cds--tile .cds--text-input,
.cds--tile .cds--select-input {
    background-color: var(--cds-field-02, #f4f4f4);
}

.cds--tile .cds--data-table td .cds--select-input {
    background-color: var(--cds-field-02, #f4f4f4);
}

.cds--tag {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Botão compacto na linha da tabela: sem o recuo à direita reservado ao ícone. */
.action-cell .cds--btn {
    padding-right: 1rem;
    min-height: 2rem;
    flex-shrink: 0;
}

.action-cell .cds--select-input__wrapper {
    width: 220px;
    min-width: 0;
}

/* O Carbon dá min-width: 500px ao container da tabela; no celular isso alargava a página
   inteira. Aqui a tabela rola dentro do próprio tile. */
.cds--data-table-container {
    min-width: 0;
}

.section,
.split > * {
    min-width: 0;
}

@media (max-width: 672px) {
    .page {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .section {
        padding: 1rem;
    }

    .action-cell .cds--select-input__wrapper {
        width: 100%;
        min-width: 160px;
    }

    .header-session .cds--tag {
        display: none;
    }
}

.empresa-picker {
    margin-top: 1rem;
}

/* ---------------------------------------------------------------- plano do cliente */

.cliente-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: var(--cds-link-primary, #0f62fe);
    cursor: pointer;
    text-align: left;
}

.cliente-link:hover {
    text-decoration: underline;
}

.cliente-link:focus-visible {
    outline: 2px solid var(--cds-focus, #0f62fe);
    outline-offset: 2px;
}

tr.is-selected td {
    background: var(--cds-layer-selected-01, #e0e0e0);
}

.config-panel {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-left: 3px solid var(--cds-border-interactive, #0f62fe);
    background: var(--cds-layer-02, #f4f4f4);
}

.config-panel .cds--text-input {
    background-color: var(--cds-field-01, #ffffff);
}

.config-title {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
}

.solucoes {
    margin: 0;
    padding: 0;
    border: 0;
}

.solucoes-linha {
    margin-top: 0.75rem;
}

.solucoes-linha__titulo {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cds-text-secondary, #525252);
}

.solucoes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.5rem 1rem;
}

.solucao-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2rem;
    font-size: 0.875rem;
}

.solucao-item input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--cds-interactive, #0f62fe);
}


.uso-alerta {
    color: var(--cds-support-error, #da1e28);
}

@media (max-width: 672px) {
    .config-panel {
        padding: 1rem;
    }
}
