.brand--custom { flex-direction: column; align-items: flex-start; gap: 8px; }
.brand-logo { display: block; width: 180px; max-width: 100%; height: 64px; object-fit: contain; object-position: left center; }
.brand--custom strong { overflow-wrap: anywhere; }
.logo-editor { display: flex; gap: 24px; align-items: center; padding: 20px; border: 1px dashed #ccd8e8; border-radius: 14px; background: #f8faff; }
.logo-preview { display: grid; place-items: center; flex: 0 0 180px; height: 100px; border-radius: 10px; background: #fff; color: #64748b; border: 1px solid #e1e7f0; }
.logo-preview img { max-width: 164px; max-height: 84px; object-fit: contain; }
.logo-upload { min-width: 0; display: grid; gap: 10px; }
.logo-clear { display: flex; gap: 8px; align-items: center; }
.lookup-intro { border-radius: 12px; background: #f0f6ff; border: 1px solid #dbe8ff; padding: 18px 20px; margin-bottom: 24px; }
.lookup-intro p { margin: 6px 0 14px; color: #475569; }
.lookup-intro small { display: block; margin-top: 8px; color: #52637a; }
.lookup-overwrite { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.lookup-input { display: flex; align-items: stretch; gap: 8px; }
.lookup-input input { min-width: 0; flex: 1; }
.lookup-input button { white-space: nowrap; flex: 0 0 auto; }
.lookup-input button:disabled { opacity: .6; cursor: wait; }
.lookup-result { padding: 16px 20px; border-radius: 12px; background: #ecfdf5; border: 1px solid #bce8d6; color: #14543b; margin-bottom: 24px; overflow-wrap: anywhere; }
.lookup-result[data-state="error"] { color: #922b29; background: #fff3f2; border-color: #efc7c4; }
.lookup-result[data-state="loading"] { color: #334155; background: #f8fafc; border-color: #e2e8f0; }
.lookup-result p { margin: 6px 0; }
.lookup-result ul { margin: 8px 0; padding-left: 20px; }
.field .lookup-filled { border-color: #0b9e75; background: #f5fffa; }
.logo-editor [hidden], .lookup-result[hidden] { display: none; }
.search.filters { flex-wrap: wrap; }
.search.filters input { min-width: 0; flex: 1 1 250px; }
.form-actions, .page-heading .inline-form { flex-wrap: wrap; }
#id_clientes { max-height: 260px; overflow-y: auto; display: grid; gap: 10px; }
#id_clientes label { display: flex; align-items: center; gap: 8px; }
#id_clientes input { width: 17px; height: 17px; flex: 0 0 17px; }
@media (max-width: 700px) {
    .logo-editor { flex-direction: column; align-items: stretch; }
    .logo-preview { flex-basis: auto; }
    .lookup-input { flex-direction: column; }
    .lookup-input button { align-self: flex-start; }
}
.integration-grid { display: grid; gap: 24px; }
.integration-section { width: 100%; max-width: 1080px; min-width: 0; scroll-margin-top: 24px; }
.integration-section .field { min-width: 0; }
.integration-section input { max-width: 100%; }
.integration-section .field-check { flex-wrap: wrap; }
.integration-section .field-check small { flex-basis: 100%; }
.integration-section .form-actions { flex-wrap: wrap; margin-bottom: 20px; }
.integration-section .alert, .webhook-url { overflow-wrap: anywhere; }
.integration-nav { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.integration-nav a { background: white; padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; }
.alert-warning { background: #fffaeb; color: #93370d; }
.smtp-test-form { max-width: 480px; }
.login-brand { flex-wrap: wrap; }
.client-picker { border: 1px solid var(--line); padding: 16px; border-radius: 12px; }
.client-picker-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.client-picker-options { max-height: 300px; overflow: auto; }
.client-picker-options label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px; overflow-wrap: anywhere; }
.client-picker-options input { flex: 0 0 18px; width: 18px; height: 18px; margin: 1px 0; }
.client-picker-options [hidden] { display: none !important; }
.batch-preview { margin-top: 24px; padding: 18px; border-radius: 12px; background: #eff8ff; }
.brand--custom .brand-logo { background: #fff; border-radius: 10px; padding: 6px; }
.workflow-actions, .bulk-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 18px; }
.workflow-actions .button, .bulk-toolbar .button, .contract-workflow .button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; font-size: 14px; font-weight: 650; line-height: 1.4; }
.workflow-intro, .contract-workflow { width: 100%; max-width: 1000px; font-size: 14px; line-height: 1.5; }
.workflow-steps { display: flex; flex-wrap: wrap; gap: 12px 32px; padding: 14px 28px; color: var(--muted); }
.contract-workflow label { font-size: 14px; font-weight: 650; }
.contract-workflow input:not([type=checkbox]), .contract-workflow select, .contract-workflow textarea { font-size: 14px; min-height: 44px; }
.contract-workflow small { font-size: 12px; }

.staged-help ol { line-height: 1.8; padding-left: 22px; }
.billing-progress { display: grid; gap: 9px; margin-top: 18px; }
.progress-track { height: 12px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--line) 80%, transparent); }
.progress-track span { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--brand); transition: width .35s ease; }
.progress-track--success span { background: var(--green); }
.staged-table { margin-top: 18px; padding: 0; }
.staged-table td:last-child { min-width: 390px; }
.staged-actions { display: grid; gap: 9px; justify-items: start; }
.staged-actions form, .batch-release form { display: grid; gap: 8px; }
.test-mail-form { grid-template-columns: minmax(190px, 1fr) auto; width: 100%; }
.test-mail-form input { min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: var(--surface); color: var(--ink); }
.button.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); background: color-mix(in srgb, var(--red) 8%, var(--surface)); }
.success-text { color: var(--green); }
.batch-release { margin-top: 18px; }
.batch-release .workflow-actions { align-items: end; gap: 28px; margin-top: 18px; }
@media(max-width:760px){.test-mail-form{grid-template-columns:1fr}.staged-table td:last-child{min-width:300px}.batch-release .workflow-actions{align-items:stretch}}
.contract-workflow .form-actions { flex-wrap: wrap; align-items: center; }
.button.danger { color: #b42318; background: #fff0ee; border: 1px solid #fecdca; }
.bulk-toolbar { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.inline-form { flex-wrap: wrap; align-items: center; }
.inline-form input:not([type=hidden]) { min-width: 0; max-width: 100%; flex: 1 1 200px; }
.panel-heading { flex-wrap: wrap; gap: 12px; }
.panel-heading > div, .panel { min-width: 0; }
.panel p { overflow-wrap: anywhere; }
.content > section.panel { margin-bottom: 20px; }
.delivery-summary { border-left: 4px solid var(--brand); }
.contract-filters { align-items: end; gap: 12px; }
.contract-filters label { min-width: 180px; }
.contract-filters label:nth-of-type(2) { min-width: min(420px, 100%); }
.filter-result { color: var(--muted); font-weight: 700; padding: 12px 0; }
.contracts-table { min-width: 1180px; }
.sort-link { color: inherit; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; }
.sort-link:hover { color: var(--brand); }
.communication-preview { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.communication-preview summary { color: var(--brand); font-weight: 750; cursor: pointer; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 16px; }
.document-preview { min-width: 0; padding: 20px; background: var(--canvas); border: 1px solid var(--line); border-radius: 12px; }
.document-preview h3 { margin: 8px 0; }
.document-preview h4 { margin-bottom: 8px; }
.boleto-message { padding: 12px; background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; line-height: 1.6; }
.email-preview { margin: 12px 0; padding: 16px; max-height: 420px; overflow: auto; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.5; }
@media (max-width: 760px) { .workflow-actions .button, .bulk-toolbar .button { flex: 1 1 160px; } .workflow-steps { display: grid; gap: 8px; } }
@media (max-width: 900px) { .preview-grid { grid-template-columns: 1fr; } }
.email-editor-intro { max-width: 1000px; }
.email-customizer { grid-column: 1 / -1; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.email-editor-toolbar { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(340px, 1.25fr); gap: 18px; align-items: end; }
.email-editor-toolbar > label { display: grid; gap: 7px; font-weight: 700; }
.email-variable-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.email-token { border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: var(--brand); background: var(--surface); cursor: grab; font-weight: 700; }
.email-token:active { cursor: grabbing; }
.email-editor-status { color: var(--muted); font-size: 12px; margin: 4px 0; }
.visual-text-editor { min-height: 128px; width: 100%; padding: 14px; border: 1px solid #d0d5dd; border-radius: 9px; background: var(--surface); color: var(--ink); white-space: pre-wrap; line-height: 1.6; }
.visual-text-editor:focus { outline: 3px solid #dbeafe; border-color: #84adff; }
.email-live-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin: 22px 0 12px; }
.email-live-heading h2 { margin: 5px 0 0; }
.email-live-heading small { color: var(--muted); }
.email-live-card { max-width: 680px; margin: auto; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #f4f7fb; box-shadow: var(--shadow); }
.email-live-recipient { display: flex; justify-content: space-between; gap: 14px; padding: 10px 20px; background: var(--canvas); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.email-live-recipient strong { color: var(--ink); overflow-wrap: anywhere; }
.email-live-subject { padding: 12px 20px; display: grid; gap: 4px; background: var(--surface); border-bottom: 1px solid var(--line); }
.email-live-subject span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.email-live-brand { display: grid; padding: 22px 28px; background: #0c1830; color: white; }
.email-live-brand strong { font-size: 20px; }.email-live-brand small { color: #b8c5da; }
.email-live-body { margin: 18px; padding: 24px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); line-height: 1.55; }
.inline-email-editor { min-height: 38px; padding: 8px 10px; border: 1px dashed color-mix(in srgb, var(--brand) 55%, var(--line)); border-radius: 7px; background: color-mix(in srgb, var(--brand) 4%, var(--surface)); color: var(--ink); white-space: pre-wrap; cursor: text; }
.inline-email-editor:focus { outline: 3px solid color-mix(in srgb, var(--brand) 18%, transparent); border-style: solid; }
.email-variable-value { display: inline; padding: 2px 5px; margin: 0 2px; border-radius: 5px; background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand); font-weight: 750; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.email-live-opening { white-space: pre-line; color: var(--ink); }
.email-layout-block { position: relative; margin: 0 0 12px; padding: 12px; border: 1px solid transparent; border-radius: 9px; transition: border-color .15s, opacity .15s, transform .15s; }
.email-layout-block:hover,.email-layout-block:focus { border-color: var(--line); }
.email-layout-block.is-dragging { opacity: .45; transform: scale(.99); border: 2px dashed var(--brand); }
.email-block-toolbar { display: flex; align-items: center; gap: 8px; margin: -5px -4px 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.email-block-toolbar > span:last-child { display: flex; gap: 4px; margin-left: auto; }
.email-block-toolbar button { width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); cursor: pointer; }
.drag-handle { font-size: 19px; line-height: 1; cursor: grab; color: var(--brand); }
.email-live-meta { display: flex; justify-content: space-between; gap: 15px; margin: 22px 0; padding: 12px 0; border-block: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.email-live-meta strong { display: block; color: var(--ink); }
.email-live-item { display: flex; justify-content: space-between; gap: 16px; padding: 12px; border: 1px solid var(--line); border-bottom: 0; }
.email-live-item:last-of-type { border-bottom: 1px solid var(--line); }
.email-live-item strong { white-space: nowrap; }
.email-live-total { display: flex; justify-content: space-between; text-align: right; margin: 18px 0; }.email-live-total span:first-child { text-align: left; }
.email-live-total span:last-child strong { color: var(--brand); font-size: 21px; }
.email-live-payment { padding: 14px; background: var(--canvas); border-radius: 8px; color: var(--muted); }
.confirm-bank-change { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; }
.confirm-bank-change label { display: flex; align-items: center; gap: 8px; font-weight: 650; }
@media(max-width:800px){.email-editor-toolbar{grid-template-columns:1fr}.email-live-heading{align-items:flex-start;flex-direction:column}.email-live-body{margin:10px;padding:10px}.email-live-item,.email-live-meta{display:grid}.email-live-total{gap:16px}.email-live-recipient{display:grid}}
