/* ajustes.css — restyle fiel ao protótipo Claude Design (Ajustes · Visão Geral +
 * Configuração de Fees). TODO o CSS escopado sob #view-empresa. Referencia os
 * tokens --pd-* de _tokens.css. Carrega depois de settings.css → prevalece. */

#view-empresa {
    --e-pad: 20px;
    --e-gap: 16px;
    font-family: var(--pd-font);
    color: var(--pd-text);
}

/* ===== Header ===== */
#view-empresa .view-header {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 980px;
    margin-bottom: 18px;
}
#view-empresa .empresa-header-titles {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
#view-empresa .view-title {
    margin: 0;
    font: 800 23px/1.15 var(--pd-font);
    letter-spacing: -.025em;
    color: var(--pd-text);
}
#view-empresa .empresa-subtitle {
    margin: 3px 0 0;
    font: 500 13px var(--pd-font);
    color: var(--pd-muted);
}
#view-empresa .view-actions {
    margin-left: auto;
}
#view-empresa .view-actions .btn-primary {
    height: 44px;
    padding: 0 22px;
    background: var(--pd-brand);
    border: none;
    border-radius: var(--pd-r-sm);
    color: #fff;
    font: 700 13.5px var(--pd-font);
    cursor: pointer;
    box-shadow: var(--pd-shadow-brand);
    transition: filter .15s ease;
}
#view-empresa .view-actions .btn-primary:hover {
    filter: brightness(1.08);
}

/* ===== Form container ===== */
#view-empresa .empresa-form,
#view-empresa > form,
#view-empresa {
    max-width: 980px;
}
#view-empresa .empresa-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ===== Section cards (fieldset) ===== */
#view-empresa .empresa-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0 0 18px;
    padding: var(--e-pad);
    background: var(--pd-surface);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-r);
    box-shadow: var(--pd-shadow-sm);
    min-width: 0;
}
#view-empresa .empresa-form .empresa-section {
    margin: 0;
}
#view-empresa .empresa-section > legend {
    display: block;
    float: none;
    width: 100%;
    padding: 0;
    margin: 0;
    font: 800 13px var(--pd-font);
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--pd-brand);
}
/* legends que trazem estilos inline no markup (ex.: Diligência) */
#view-empresa .empresa-section > legend[style] {
    font-size: 13px !important;
    font-weight: 800 !important;
    margin: 0 !important;
}

/* ===== Rows + fields ===== */
#view-empresa .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin: 0;
}
#view-empresa .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
#view-empresa .form-group.empresa-col-2 {
    grid-column: span 2;
}
#view-empresa .form-group > label {
    font: 700 10px var(--pd-font);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pd-muted);
}

/* Inputs / selects / textareas */
#view-empresa input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
#view-empresa select,
#view-empresa textarea {
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    padding: 0 13px;
    background: var(--pd-surface-2);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-r-sm);
    font: 600 13px var(--pd-font);
    color: var(--pd-text);
    transition: border-color .15s ease, box-shadow .15s ease;
    outline: none;
}
#view-empresa textarea {
    height: auto;
    min-height: 84px;
    padding: 11px 13px;
    line-height: 1.5;
    resize: vertical;
}
#view-empresa input::placeholder,
#view-empresa textarea::placeholder {
    color: var(--pd-faint);
    font-weight: 500;
}
#view-empresa input:not([type="file"]):focus,
#view-empresa select:focus,
#view-empresa textarea:focus {
    border-color: var(--pd-brand);
    background: var(--pd-surface);
    box-shadow: 0 0 0 3px var(--pd-brand-soft);
}
#view-empresa input[id="empresa-cnpj"],
#view-empresa input[id="empresa-repr-cpf"] {
    font-family: var(--pd-mono);
}

/* ===== Buttons ===== */
/* Section save buttons — brand filled (protótipo) */
#view-empresa .btn-salvar-secao,
#view-empresa .btn-outline.btn-salvar-secao {
    align-self: flex-start;
    height: 42px;
    padding: 0 18px;
    background: var(--pd-brand);
    border: none;
    border-radius: var(--pd-r-sm);
    color: #fff;
    font: 700 13px var(--pd-font);
    cursor: pointer;
    box-shadow: var(--pd-shadow-brand);
    transition: filter .15s ease;
}
#view-empresa .btn-salvar-secao:hover {
    filter: brightness(1.08);
}

/* Generic primary buttons inside sections */
#view-empresa .empresa-section .btn-primary {
    height: 42px;
    padding: 0 18px;
    background: var(--pd-brand);
    border: none;
    border-radius: var(--pd-r-sm);
    color: #fff;
    font: 700 13px var(--pd-font);
    cursor: pointer;
    box-shadow: var(--pd-shadow-brand);
    transition: filter .15s ease;
}
#view-empresa .empresa-section .btn-primary:hover {
    filter: brightness(1.08);
}
#view-empresa .empresa-section .btn-primary.btn-sm {
    height: 40px;
}

/* Outline (Selecionar imagem, secondary) */
#view-empresa .btn-outline:not(.btn-salvar-secao) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 14px;
    background: var(--pd-surface-2);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-r-sm);
    color: var(--pd-text-2);
    font: 700 12px var(--pd-font);
    cursor: pointer;
    transition: border-color .15s ease;
}
#view-empresa .btn-outline:not(.btn-salvar-secao):hover {
    border-color: var(--pd-faint);
}

/* Ghost (Remover) */
#view-empresa .btn-ghost {
    background: none;
    border: none;
    padding: 7px 6px;
    color: var(--pd-accent);
    font: 700 12px var(--pd-font);
    cursor: pointer;
}

/* ===== Logo card ===== */
#view-empresa .empresa-logo-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
#view-empresa .empresa-logo-preview {
    width: 84px;
    height: 84px;
    flex: none;
    border-radius: 14px;
    background: var(--pd-surface-2);
    border: 1px solid var(--pd-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#view-empresa .empresa-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#view-empresa .empresa-logo-placeholder {
    font: 600 11px var(--pd-font);
    color: var(--pd-faint);
    text-align: center;
}
#view-empresa .empresa-logo-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
#view-empresa .empresa-logo-actions .btn-outline {
    height: 32px;
    padding: 0 14px;
}
#view-empresa .empresa-logo-hint {
    flex-basis: 100%;
    margin: 2px 0 0;
    font: 500 12px var(--pd-font);
    color: var(--pd-muted);
}

/* ===== Hints ===== */
#view-empresa .form-hint,
#view-empresa .form-field-hint {
    margin: 0;
    font: 500 12px var(--pd-font);
    color: var(--pd-muted);
    line-height: 1.5;
}
#view-empresa .form-field-hint code {
    font-family: var(--pd-mono);
    font-size: 11px;
    color: var(--pd-text-2);
}

/* ===== Fee tiers table ===== */
#view-empresa #fee-tiers-section .clientes-table-wrap {
    overflow-x: auto;
}
#view-empresa #fee-tiers-section .clientes-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}
#view-empresa #fee-tiers-section thead th {
    padding: 9px 8px;
    text-align: left;
    border-bottom: 1px solid var(--pd-border);
    font: 700 9.5px var(--pd-font);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pd-muted);
    white-space: nowrap;
}
#view-empresa #fee-tiers-section tbody td {
    padding: 11px 8px;
    border-bottom: 1px solid var(--pd-border);
    vertical-align: middle;
    font: 700 12.5px var(--pd-font);
    color: var(--pd-text);
}
/* Tier cell — bold with brand accent */
#view-empresa #fee-tiers-section tbody td:first-child {
    font: 800 12.5px var(--pd-font);
    color: var(--pd-text);
}
/* Ordem cell */
#view-empresa #fee-tiers-section tbody td:nth-child(5) {
    text-align: center;
    color: var(--pd-muted-2);
}
/* Inline inputs inside the fee table */
#view-empresa #fee-tiers-section tbody td input {
    height: 38px;
    padding: 0 12px;
    background: var(--pd-surface-2);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-r-sm);
    font: 600 12.5px var(--pd-font);
    color: var(--pd-text);
}
#view-empresa #fee-tiers-section tbody td input[type="number"] {
    font-family: var(--pd-mono);
    font-weight: 600;
}
#view-empresa #fee-tiers-section tbody td input[data-field="cashback"] {
    color: var(--pd-green);
}
#view-empresa #fee-tiers-section tbody td:last-child {
    white-space: nowrap;
}
#view-empresa #fee-tiers-section tbody td:last-child button {
    height: 34px;
    padding: 0 13px;
    border-radius: var(--pd-r-sm);
    font: 700 12px var(--pd-font);
    cursor: pointer;
}

/* Add-tier form row */
#view-empresa .fee-tier-add-form {
    margin-top: 4px;
}
#view-empresa .fee-tier-add-form .form-row {
    align-items: end;
}

/* ===== Status / connected pill (YouTube etc.) ===== */
#view-empresa .empresa-section a.btn-primary {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
