/* ══════════════════════════════════════════════════════════
   CONTRATOS — Estilos específicos da página
   ══════════════════════════════════════════════════════════ */

/* ── Page Header Bar (Globals from Clientes) ── */
.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.page-header-bar .page-title-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.page-header-bar .page-icon {
    font-size: 2.2rem;
}

.title-text-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.page-header-bar h1 {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
    margin: 0;
}

.page-header-bar .page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
    margin-left: 0;
    line-height: 1.2;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    background: linear-gradient(135deg, #3d9be9, #2a7bd4);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4daaf5, #3d9be9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(61, 155, 233, 0.35);
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.search-box {
    flex: 1;
    min-width: 220px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    outline: none;
    border-color: rgba(61, 155, 233, 0.5);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(61, 155, 233, 0.1);
}

.search-box .search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    opacity: 0.5;
}

.clients-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 300;
    white-space: nowrap;
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
}

.clients-table thead {
    background: rgba(255, 255, 255, 0.03);
}

.clients-table th {
    padding: 0.9rem 1.2rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.clients-table td {
    padding: 0.9rem 1.2rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.clients-table tbody tr {
    transition: background 0.2s ease;
    cursor: pointer;
}

.clients-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.clients-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Mobile Editor Tabs ── */
.editor-mobile-toggle {
    display: none;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.2rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
}

.mobile-tab-btn {
    padding: 0.4rem 0.8rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-pill);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mobile-tab-btn.active {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
    font-weight: 600;
}

/* ── Tabs ── */
.contratos-tabs {
    display: flex;
    gap: 0.4rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.2rem;
    overflow-x: auto;
}

.ctab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: var(--text-base);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
    white-space: nowrap;
}

.ctab:hover { color: var(--text-primary); }

.ctab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.ctab-count {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    min-width: 1.5rem;
    text-align: center;
}

.ctab.active .ctab-count {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
}

.ctab-pane { display: none; }
.ctab-pane.active { display: block; }

/* ── Sub-abas da aba Templates (Contrato | Anexo) ── */
.tpl-subtabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}

.tpl-subtab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tpl-subtab:hover { color: var(--text-primary); }

.tpl-subtab.active {
    background: var(--accent-blue-glow);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.tpl-subpane { display: none; }
.tpl-subpane.active { display: block; }

/* ── Checklist de anexos (construção do contrato) ── */
.anexos-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 0 0 0.7rem 0;
    line-height: 1.4;
}

.anexos-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.anexos-check-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: all var(--transition-fast);
}

.anexos-check-item:has(input:checked) {
    border-color: rgba(61, 155, 233, 0.35);
    background: rgba(61, 155, 233, 0.05);
}

.anexos-check-item input { margin-top: 0; }

.anexos-copias-ctrl {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.anexo-copias-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-blue);
    min-width: 2rem;
    text-align: center;
}

.anexos-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: #7eb8f5;
    background: rgba(61, 155, 233, 0.1);
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    margin-left: 0.3rem;
    white-space: nowrap;
}

/* Ícone de info do anexo — tooltip nativo (title) mostra a descrição no hover/foco */
.anexos-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin: 0 0.1rem 0 0.4rem;
    border: 1px solid var(--accent-blue);
    border-radius: 50%;
    color: var(--accent-blue);
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    line-height: 1;
    cursor: help;
    flex-shrink: 0;
    vertical-align: middle;
    transition: background var(--transition-fast);
}

.anexos-info:hover,
.anexos-info:focus {
    background: var(--accent-blue-glow);
    outline: none;
}

.anexo-avulso-badge {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent-green, #0DB26B);
    background: rgba(13, 178, 107, 0.12);
    border: 1px solid rgba(13, 178, 107, 0.3);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.anexo-remover-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.anexo-remover-btn:hover {
    color: var(--accent-red, #ff3b30);
    background: rgba(255, 59, 48, 0.1);
}

.add-anexo-lista {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.add-anexo-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.7rem 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    width: 100%;
}

.add-anexo-card:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    transform: translateX(3px);
}

.add-anexo-card.is-added {
    opacity: 0.65;
    cursor: default;
    border-color: rgba(255, 255, 255, 0.05);
}

.add-anexo-card.is-added:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.05);
    background: var(--bg-tertiary);
}

.add-anexo-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
}

.add-anexo-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.add-anexo-card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Aba Contratos: linha de cliente (abre modal) + lista de contratos no modal ── */
.cliente-row {
    cursor: pointer;
    transition: background 0.12s ease;
}

.cliente-row:hover {
    background: var(--bg-hover);
}

/* Trecho onde a busca casou em campos sem coluna (título/objetos). */
.match-line {
    margin-top: 0.2rem;
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: 1.35;
}

.match-rotulo {
    font-weight: 600;
    color: var(--text-secondary);
}

mark {
    background: rgba(255, 213, 79, 0.35);
    color: var(--text-primary);
    border-radius: 3px;
    padding: 0 2px;
}

/* Lista de contratos dentro do modal do cliente. */
.contrato-lista {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 60vh;
    overflow-y: auto;
    margin: 0.5rem 0 1rem;
}

.contrato-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.contrato-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.contrato-titulo {
    font-weight: 600;
    color: var(--text-primary);
}

.contrato-datas {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.contrato-tag {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
}

.contrato-acoes {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* ── Seleção em massa de contratos ── */
.contrato-sel-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.contrato-sel-count {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-right: auto;
}

.contrato-check-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

/* Checkbox compacto (seleção de clientes/contratos para exclusão) — custom para
   controlar o tamanho de forma consistente entre navegadores. */
.contrato-check,
.contrato-check-wrap input[type="checkbox"],
.cliente-check,
.col-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 15px;
    height: 15px;
    min-width: 15px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    vertical-align: middle;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    position: relative;
    transition: background .12s ease, border-color .12s ease;
}

.contrato-check:hover,
.contrato-check-wrap input[type="checkbox"]:hover,
.cliente-check:hover,
.col-check input[type="checkbox"]:hover {
    border-color: var(--accent-blue);
}

.contrato-check:checked,
.contrato-check-wrap input[type="checkbox"]:checked,
.cliente-check:checked,
.col-check input[type="checkbox"]:checked {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.contrato-check:checked::after,
.contrato-check-wrap input[type="checkbox"]:checked::after,
.cliente-check:checked::after,
.col-check input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.contrato-item.is-selected {
    border-color: var(--accent-blue);
    background: var(--accent-blue-glow);
}

/* ── Seleção em massa por cliente (tabelas) ── */
.clients-table .col-check {
    width: 1%;
    white-space: nowrap;
    text-align: center;
    padding-left: 0.6rem;
    padding-right: 0.4rem;
}

tr.cliente-row.is-selected {
    background: var(--accent-blue-glow);
}

/* ── Modal de confirmação de exclusão ── */
.confirm-del-irrev {
    color: var(--accent-red);
    font-size: var(--text-sm);
    margin: 0.5rem 0;
}

.confirm-del-shared {
    margin-top: 0.75rem;
    padding: 0.7rem 0.85rem;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-orange);
    border-radius: var(--radius-md);
}

.confirm-del-shared-hdr {
    margin: 0 0 0.5rem;
    font-size: var(--text-sm);
    color: var(--accent-orange);
}

.confirm-del-shared-list {
    margin: 0;
    padding-left: 1.1rem;
    max-height: 30vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.confirm-del-shared-list li {
    font-size: var(--text-sm);
}

.confirm-del-nomes {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ── Tag list (placeholders) ── */
.tag-list {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ── Hint box ── */
.hint {
    margin: 1rem 0;
    padding: 0.8rem 1rem;
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent-blue);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.hint code {
    background: var(--bg-tertiary);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--accent-blue);
}

/* ── Action icons ── */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: 0 2px;
    padding: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
}

.btn-icon.btn-danger:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.btn-icon.btn-copy {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 12px;
    margin: 0;
}

.actions { white-space: nowrap; }

.btn-small {
    padding: 0.45rem 0.9rem !important;
    font-size: var(--text-sm) !important;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    background: rgba(255, 80, 80, 0.12);
    color: #ff6b6b;
    border: 1px solid rgba(255, 80, 80, 0.35);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-danger:hover {
    background: rgba(255, 80, 80, 0.22);
    border-color: rgba(255, 80, 80, 0.6);
}

.btn-danger:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
}

.btn-secondary:disabled,
.btn-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    text-decoration: underline;
}

.btn-cancel {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-cancel:hover {
    background: rgba(255, 80, 80, 0.08);
    border-color: rgba(255, 80, 80, 0.3);
    color: #ff6b6b;
}

/* ════════════════════════════════════════════════════════════
   EDITOR — split fullscreen (form | preview)
   ════════════════════════════════════════════════════════════ */

/* ── Drawer Overlay ── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}
.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ── Drawer Panel ── */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(600px, 90vw);
    height: 100vh;
    height: 100dvh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-subtle);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.drawer.active {
    transform: translateX(0);
}
.drawer-wide {
    width: 100% !important;
    max-width: 100vw !important;
    border-left: none !important;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    background: var(--bg-primary);
}
.drawer-header-content {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}
.drawer-header-content > div:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}
.drawer-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    line-height: 1.2;
}
.drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}
.drawer-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}
.drawer-close:hover {
    background: rgba(255, 80, 80, 0.15);
    border-color: rgba(255, 80, 80, 0.3);
    color: #ff5050;
}
.drawer-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.editor-id {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    margin-top: 0.2rem;
    display: inline-block;
}

/* Botão "Histórico" no cabeçalho do editor (substitui o antigo #id) */
.editor-hist-btn {
    margin-top: 0.25rem;
    font-size: var(--text-xs);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.editor-hist-btn:hover {
    background: var(--bg-tertiary, var(--bg-secondary));
    color: var(--text-primary);
    border-color: var(--accent-blue, var(--text-secondary));
}

/* Modal de histórico: lista de versões congeladas */
.historico-lista {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 1rem 0;
    max-height: 55vh;
    overflow-y: auto;
}
.hist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-secondary);
}
.hist-item-topo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.hist-item-meta {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: 0.15rem;
}
.hist-selo {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
}
.hist-selo-pdf { background: rgba(229, 57, 53, 0.16); color: #e53935; }
.hist-selo-docx { background: rgba(61, 155, 233, 0.16); color: #3d9be9; }
.hist-item-acoes {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}
.hist-baixar {
    font-size: var(--text-xs);
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.hist-baixar:hover {
    background: var(--bg-tertiary, var(--bg-secondary));
    border-color: var(--accent-blue, var(--text-secondary));
}
@media (max-width: 480px) {
    .hist-item { flex-direction: column; align-items: stretch; }
    .hist-item-acoes { justify-content: flex-end; }
}

.editor-body {
    flex: 1;
    display: grid;
    grid-template-columns: var(--form-col, 50%) 6px 1fr;
    overflow: hidden;
    min-height: 0;
}

/* ── Divisor arrastável entre form e preview ── */
.editor-resizer {
    cursor: col-resize;
    background: var(--border-subtle);
    position: relative;
    transition: background var(--transition-fast);
    user-select: none;
}

/* área de captura mais larga que a faixa visível */
.editor-resizer::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -4px;
    right: -4px;
}

.editor-resizer::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 30px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
    transition: background var(--transition-fast);
}

.editor-resizer:hover,
.editor-resizer.dragging {
    background: var(--accent-blue);
}

.editor-resizer:hover::after,
.editor-resizer.dragging::after {
    background: #fff;
}

/* enquanto arrasta: evita seleção de texto e mantém o cursor */
body.editor-resizing {
    cursor: col-resize;
    user-select: none;
}

body.editor-resizing iframe {
    pointer-events: none;
}

/* ── Form (esquerda) ── */
.editor-form {
    overflow-y: auto;
    border-right: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.editor-form #prepForm {
    flex: 1;
    padding: 1rem 1.2rem;
    overflow-y: auto;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Template selector highlighted as first/primary step */
.form-section-highlight {
    background: rgba(61, 155, 233, 0.03);
    border: 1px dashed rgba(61, 155, 233, 0.2);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 2rem;
}

.form-section-highlight .form-section-title {
    color: var(--accent-blue);
    border-bottom-color: rgba(61, 155, 233, 0.2);
    font-size: 0.9rem;
}

/* Grupos de campos dinâmicos introduzidos por anexos */
.campos-anexo-grupo {
    border: 1px solid rgba(61, 155, 233, 0.18);
    border-radius: 10px;
    padding: 0.9rem 1rem 0.4rem;
    margin-bottom: 1rem;
    background: rgba(61, 155, 233, 0.03);
}

.campos-anexo-titulo {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 0.7rem;
    letter-spacing: 0.02em;
}

/* ── Contratantes adicionais (accordion) ── */
.contratante-extra-card {
    border: 1px solid rgba(13, 178, 107, 0.22);
    border-radius: 10px;
    margin-bottom: 0.7rem;
    background: rgba(13, 178, 107, 0.04);
    /* sem overflow:hidden: o dropdown do combo precisa ultrapassar o card.
       Cantos arredondados são mantidos pelo border-radius do .cec-header. */
}

.contratante-extra-card.is-open {
    border-color: rgba(13, 178, 107, 0.45);
    box-shadow: 0 0 0 1px rgba(13, 178, 107, 0.15);
}

.cec-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.85rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
    border-radius: 9px 9px 0 0;  /* acompanha os cantos do card no hover */
}

/* Card fechado: o header preenche o card, então arredonda os 4 cantos */
.contratante-extra-card.is-collapsed .cec-header {
    border-radius: 9px;
}

.cec-header:hover {
    background: rgba(13, 178, 107, 0.07);
}

.cec-chevron {
    color: var(--accent-green, #0DB26B);
    font-size: 0.75rem;
    width: 0.9rem;
    text-align: center;
    flex-shrink: 0;
}

.cec-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-green, #0DB26B);
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.cec-resumo {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cec-sem-nome {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.78rem;
}

.cec-tipo-badge {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--accent-green, #0DB26B);
    background: rgba(13, 178, 107, 0.14);
    border-radius: 5px;
    padding: 0.08rem 0.4rem;
}

.cec-remove {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.cec-remove:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: var(--bg-hover);
}

/* Punho de arrastar (reordenar contratantes) */
.cec-drag {
    flex-shrink: 0;
    cursor: grab;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1;
    padding: 0 0.05rem;
    user-select: none;
}
.cec-drag:active { cursor: grabbing; }
.cec-drag:hover { color: var(--accent-green, #0DB26B); }

/* Card sendo arrastado / alvo de soltura */
.contratante-extra-card.cec-dragging { opacity: 0.5; }
.contratante-extra-card.cec-dragover {
    border-color: var(--accent-green, #0DB26B);
    box-shadow: 0 0 0 2px rgba(13, 178, 107, 0.45);
}

.cec-body {
    padding: 0.2rem 0.85rem 0.6rem;
    border-top: 1px solid rgba(13, 178, 107, 0.16);
}

.contratante-extra-card.is-collapsed .cec-body {
    display: none;
}

/* ── Bloco de representação (texto livre arrastável) ──
   Participa do mesmo accordion dos contratantes; accent âmbar para distinguir deles. */
.contratante-extra-card.rep-bloco {
    border-color: rgba(217, 152, 30, 0.35);
    background: rgba(217, 152, 30, 0.05);
}
.rep-bloco.is-open {
    border-color: rgba(217, 152, 30, 0.55);
    box-shadow: 0 0 0 1px rgba(217, 152, 30, 0.18);
}
.rep-bloco .cec-header:hover {
    background: rgba(217, 152, 30, 0.08);
}
.rep-bloco .cec-chevron,
.rep-bloco .cec-title {
    color: #C8881A;
}
.rep-bloco .cec-drag:hover {
    color: #C8881A;
}
.rep-bloco.cec-dragover {
    border-color: #C8881A;
    box-shadow: 0 0 0 2px rgba(217, 152, 30, 0.45);
}
.cec-body.rep-body {
    border-top: 1px solid rgba(217, 152, 30, 0.18);
}

.cec-end-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0.7rem 0 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Botão "Colar endereço" — secundário, discreto mas claramente um botão */
.cec-paste-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--accent-green, #0DB26B);
    background: rgba(13, 178, 107, 0.10);
    border: 1px solid rgba(13, 178, 107, 0.35);
    border-radius: 7px;
    padding: 0.32rem 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cec-paste-btn:hover {
    background: rgba(13, 178, 107, 0.18);
    border-color: var(--accent-green, #0DB26B);
}

/* Topo do card: seletores (PF/PJ, menor de idade) à esquerda e botões de
   importar à direita, dividindo as mesmas linhas — sem faixa vazia no canto
   superior esquerdo. No celular vira coluna, com os botões acima. */
.cec-topo {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
}

.cec-topo-campos {
    flex: 1;
    min-width: 0;
}

/* Botões de importação — por contratante, no topo do card. Empilhados à direita:
   "de cliente" (banco) e, logo abaixo, "com IA" (texto solto). */
.cec-import-row {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    flex: 0 0 auto;
}

.cec-import-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--accent-blue, #3d9be9);
    background: rgba(61, 155, 233, 0.10);
    border: 1px solid rgba(61, 155, 233, 0.35);
    border-radius: 7px;
    padding: 0.32rem 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cec-import-btn:hover {
    background: rgba(61, 155, 233, 0.18);
    border-color: var(--accent-blue, #3d9be9);
}

/* Variante IA: mesma silhueta, tom roxo para sinalizar serviço externo (e custo). */
.cec-import-btn-ia {
    color: var(--accent-purple, #a78bfa);
    background: rgba(167, 139, 250, 0.12);
    border-color: rgba(167, 139, 250, 0.38);
}

.cec-import-btn-ia:hover {
    background: rgba(167, 139, 250, 0.2);
    border-color: var(--accent-purple, #a78bfa);
}

/* ── Importar dados com IA ────────────────────────────────────────────────── */
.modal-box-ia {
    width: min(680px, 92vw);
    max-height: 92vh;
    overflow-y: auto;
}

.modal-box-ia textarea {
    resize: vertical;
    min-height: 180px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
}

.ia-status {
    margin: 0.6rem 0 0 !important;
    font-size: var(--text-sm);
}

.ia-status.is-erro { color: var(--accent-red, #ef4444); }

/* Painel de consumo: tokens e custo da última chamada + acumulado (localStorage). */
.ia-uso {
    margin-top: 0.9rem;
    padding: 0.6rem 0.75rem;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.ia-uso-linha { line-height: 1.6; }
.ia-uso-total { color: var(--text-muted, #888); }
.ia-uso-reset { font-size: 0.7rem; margin-top: 0.25rem; }

/* ── Combobox editável (texto da representação, com sugestões) ── */
.combo {
    position: relative;
    display: flex;
    align-items: stretch;
}

.combo .combo-input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.combo-toggle {
    flex-shrink: 0;
    width: 2rem;
    border: 1px solid var(--border-color);
    border-left: none;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.15s ease;
}

.combo-toggle:hover {
    color: var(--accent-green, #0DB26B);
    background: var(--bg-hover);
}

.combo-list {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    padding: 0.3rem;
    max-height: 40vh;
    overflow-y: auto;
}

.combo.open .combo-list {
    display: block;
}

.combo-opt {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.84rem;
}

.combo-opt:hover {
    background: var(--bg-hover);
    color: var(--accent-green, #0DB26B);
}

/* Variante para <select> nativo com a estética do combo: o box ▾ substitui a seta SVG
   padrão do .form-group select; o clique no select continua abrindo o dropdown nativo. */
.combo-native .combo-input {
    background-image: none;
    padding-right: 0.9rem;
    cursor: pointer;
}

/* Grupos do dropdown de modelo (contratos × anexos avulsos): o rótulo do <optgroup>
   herda o itálico/cor do sistema, que some no tema escuro — fixamos os dois. */
.combo-native .combo-input optgroup {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-style: normal;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}

.combo-native .combo-input option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 400;
}

/* Aviso "editando um anexo avulso" na seção Modelo. */
.modelo-aviso-anexo {
    margin: 0.55rem 0 0;
    padding: 0.5rem 0.7rem;
    border-left: 3px solid var(--accent-green, #0DB26B);
    border-radius: 0 6px 6px 0;
    background: var(--bg-tertiary);
    color: var(--text-secondary, var(--text-muted));
}

/* Modal "colar endereço de…": lista de contratantes-fonte */
.colar-end-lista {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.6rem 0 1rem;
    max-height: 52vh;
    overflow-y: auto;
}

.colar-end-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.colar-end-item:hover {
    border-color: var(--accent-green, #0DB26B);
    background: var(--bg-hover);
}

.cei-top {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cei-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.cei-nome {
    font-size: 0.85rem;
    color: var(--accent-green, #0DB26B);
}

.cei-nome.cei-sem {
    color: var(--text-muted);
    font-style: italic;
}

.cei-end {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Modal de campo personalizado: tela cheia, conteúdo centralizado em coluna estreita */
.modal-box-fullscreen.campo-modal {
    display: block;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.campo-modal-inner {
    width: min(560px, 92vw);
    margin: 0 auto;
}

.campo-modal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.campo-modal-header h3 { margin: 0; }

.campo-info-icon {
    cursor: pointer;
    color: var(--accent-blue);
    font-size: 1.1rem;
    line-height: 1;
    user-select: none;
}

.campo-info-icon:hover { opacity: 0.8; }

.campo-info-pop {
    background: rgba(61, 155, 233, 0.06);
    border: 1px solid rgba(61, 155, 233, 0.2);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

.campo-info-pop p { margin: 0 0 0.6rem; }
.campo-info-pop p:last-child { margin-bottom: 0; }

/* Download buttons inside gerar modal */
.gerar-resultado-links {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Opções de geração (DOCX / PDF / PDF Separado) */
.gerar-opcoes {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.btn-opcao-gerar {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    text-align: left;
    padding: 0.85rem 1rem;
    background: var(--bg-elevated, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-opcao-gerar:hover:not(:disabled) {
    border-color: var(--accent-blue, #3d9be9);
    background: rgba(61, 155, 233, 0.08);
    transform: translateY(-1px);
}

.btn-opcao-gerar:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-opcao-gerar .opc-ic {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.btn-opcao-gerar .opc-txt {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.btn-opcao-gerar .opc-txt strong {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 600;
}

.btn-opcao-gerar .opc-txt small {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Botão "Voltar" das opções de PDF — pill discreto, alinhado à esquerda */
.btn-voltar-gerar {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.2rem;
    padding: 0.45rem 0.95rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-voltar-gerar:hover {
    background: rgba(61, 155, 233, 0.08);
    border-color: var(--accent-blue, #3d9be9);
    color: var(--text-primary);
}

.btn-voltar-gerar .seta {
    display: inline-block;
    transition: transform var(--transition-fast);
}

.btn-voltar-gerar:hover .seta {
    transform: translateX(-2px);
}

.form-row {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.form-row.single { flex-direction: column; }

.form-group { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; gap: 0.35rem; }

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group label .required {
    color: #ff5050;
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    padding: 0.65rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-variant-numeric: lining-nums tabular-nums;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(61, 155, 233, 0.5);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(61, 155, 233, 0.1);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.2rem;
    cursor: pointer;
}

.form-group select option {
    background: #1a1a2e;
    color: var(--text-primary);
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.02);
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.radio-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.radio-pill:has(input:checked) {
    background: var(--accent-blue-glow);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

.radio-pill input { accent-color: var(--accent-blue); }

/* Texto "x clientes • x contratos" reposicionado abaixo da tabela. */
.table-footer-info {
    margin-top: 0.75rem;
    text-align: right;
}

/* ── Marcação discreta de menoridade (PF) ── */
.menor-row { margin-bottom: 0.6rem; }
.menor-ctrl {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
/* Ícone de ajuda reusa .anexos-info; aqui só o gap do flex separa (sem margem própria). */
.menor-ctrl .anexos-info { margin: 0; }
/* Pill discreto, da mesma família dos .radio-pill logo acima (Pessoa Física/
   Jurídica) — fica coeso em vez de "solto", mas mantém-se apagado até marcado. */
.menor-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.04);
    font-size: var(--text-sm);
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
}
.menor-toggle:hover {
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.16);
}
/* Checkbox oculto: o próprio pill é o controle. Fica fora do fluxo (não é item
   flex), então a label continua disparando o toggle e o :has(:checked) colore. */
.menor-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}
.menor-toggle:has(input:checked) {
    background: var(--accent-blue-glow);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* Select alinhado aos demais da app (.form-group select): fundo escuro,
   borda sutil, chevron SVG próprio e foco azul — apenas mais compacto. */
.menor-sel {
    appearance: none;
    -webkit-appearance: none;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--text-primary);
    padding: 0.4rem 1.9rem 0.4rem 0.7rem;
    max-width: 100%;
    background-color: rgba(255, 255, 255, 0.04);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.menor-sel:hover { border-color: rgba(255, 255, 255, 0.16); }
.menor-sel:focus {
    outline: none;
    border-color: rgba(61, 155, 233, 0.5);
    background-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}
.menor-sel option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.editor-form-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem;
    border-top: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    flex-wrap: wrap;
}

.editor-form-footer button {
    flex: 1;
    min-width: 100px;
    white-space: normal;
    text-align: center;
    justify-content: center;
    word-break: break-word;
}

/* Rodapé: dois grupos de botões — só um visível por modo (padrão = completo). */
.footer-modo-cadastro,
.footer-modo-completo { display: none; flex: 1; gap: 0.5rem; }
.footer-modo-completo { display: flex; }
#editorDrawer.modo-cadastro .footer-modo-completo { display: none; }
#editorDrawer.modo-cadastro .footer-modo-cadastro { display: flex; }

/* ── Editor em "modo cadastro" (form simples: só Contratantes + Observações) ── */
#editorDrawer.modo-cadastro .editor-preview,
#editorDrawer.modo-cadastro .editor-resizer,
#editorDrawer.modo-cadastro .editor-mobile-toggle,
#editorDrawer.modo-cadastro .editor-so-completo {
    display: none !important;
}
/* Form ocupa toda a largura (grid passa a uma coluna). */
#editorDrawer.modo-cadastro .editor-body {
    grid-template-columns: 1fr;
}

/* ── Seções colapsáveis do formulário ──
   Clica no título para recolher. Esconde todos os filhos diretos exceto o título —
   não exige wrapper de corpo, funciona com a estrutura atual das .form-section. */
.form-section.collapsible > .form-section-title {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.form-section.collapsible > .form-section-title:hover {
    color: var(--text-primary);
}
.fs-chevron {
    font-size: 0.7rem;
    line-height: 1;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}
.form-section.is-collapsed > .form-section-title {
    margin-bottom: 0;
    border-bottom-color: transparent;
}
.form-section.is-collapsed .fs-chevron {
    transform: rotate(-90deg);
}
.form-section.is-collapsed > :not(.form-section-title) {
    display: none !important;
}

/* Setinha discreta no fim de cada seção colapsável — recolhe sem voltar ao topo.
   Some junto com o corpo quando a seção já está recolhida (regra acima). */
.fs-collapse-foot,
.cec-collapse-foot {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0.4rem;
    padding: 0.1rem;
    font-size: 0.7rem;
    line-height: 1;
    color: var(--text-muted);
    opacity: 0.3;
    cursor: pointer;
    user-select: none;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    transition: opacity 0.15s ease, color 0.15s ease;
}
.fs-collapse-foot:hover,
.cec-collapse-foot:hover {
    opacity: 0.9;
    color: var(--text-primary);
}
.cec-collapse-foot {
    border-top-color: rgba(13, 178, 107, 0.16);
    color: var(--accent-green, #0DB26B);
    margin-top: 0.6rem;
}

/* ── Preview (direita) ── */
.editor-preview {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
    min-height: 0;
    min-width: 0;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
}

.preview-mode-toggle { display: flex; gap: 0.4rem; }

.pm-btn {
    padding: 0.45rem 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.pm-btn:hover { color: var(--text-primary); }

.pm-btn.active {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.preview-status {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.preview-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
}

#previewFrame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.quill-host {
    flex: 1;
    width: 100%;
    overflow: hidden; /* Quill container shouldn't scroll, .ql-editor should */
    background: white;
    color: #111;
    border: none !important;
    display: flex;
    flex-direction: column;
}

.ql-toolbar.ql-snow {
    flex-shrink: 0;
    background: #f5f5f5;
    border: none !important;
    border-bottom: 1px solid #ddd !important;
}

.ql-container.ql-snow {
    flex: 1;
    border: none !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.quill-host .ql-editor {
    flex: 1;
    overflow-y: auto;
    font-family: "Times New Roman", Times, serif;
    font-size: 11pt;
    padding: 20px;
}

.preview-edit-warning {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 149, 0, 0.1);
    border-top: 1px solid var(--accent-orange);
    color: var(--accent-orange);
    font-size: var(--text-sm);
}

/* ════════════════════════════════════════════════════════════
   MODALS (gerar, upload, import)
   ════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 20, 0.7);
    backdrop-filter: blur(4px);
    z-index: calc(var(--z-modal) + 10);
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: min(500px, 90vw);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    backdrop-filter: blur(20px);
}

.modal-box-wide {
    width: min(960px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box-cliente {
    width: min(680px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box-fullscreen {
    width: 98vw;
    height: 96vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.tpl-split-layout {
    display: flex;
    flex: 1;
    min-height: 0;
}

.tpl-sidebar {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1.5rem;
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
}

.tpl-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.tpl-sidebar-header h3 { margin: 0; }

.tpl-sidebar-header span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tpl-sidebar-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 1rem;
}

.tpl-sidebar-actions button { width: 100%; justify-content: center; }

.tpl-editor-pane {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.tpl-editor-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

/* Quill dentro do modal de edição de template */
.quill-tpl-host {
    flex: 1;
    min-height: 0;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.code-editor-textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.65;
    background: #0d1117;
    color: #c9d1d9;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 1rem;
    resize: vertical;
    overflow: auto;
    caret-color: var(--accent-blue);
}
.code-editor-textarea:focus {
    outline: none;
    border-color: rgba(61, 155, 233, 0.4);
    box-shadow: 0 0 0 2px rgba(61, 155, 233, 0.1);
}

.modal-box h3 {
    margin: 0 0 0.6rem 0;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: var(--text-md);
}

.modal-box p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin: 0 0 1rem 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1rem;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
}

.check-row input { accent-color: var(--accent-blue); }

/* ════════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════════ */
.toast-holder {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: calc(var(--z-modal) + 100);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
    box-shadow: var(--glass-shadow);
    max-width: 360px;
    animation: toast-in 0.3s ease;
}

.toast-info { border-left-color: var(--accent-blue); }
.toast-ok { border-left-color: var(--accent-green); }
.toast-erro { border-left-color: var(--accent-red); }
.toast-out { opacity: 0; transform: translateX(20px); transition: all 0.7s ease; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ════════════════════════════════════════════════════════════
   REFERÊNCIA DE PLACEHOLDERS (aba Templates)
   ════════════════════════════════════════════════════════════ */

.tpl-ref-card {
    margin-top: 1.5rem;
    border: 1px solid rgba(61, 155, 233, 0.15);
    border-radius: 14px;
    background: rgba(61, 155, 233, 0.03);
    overflow: hidden;
}

.tpl-ref-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.85rem 1.2rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    gap: 0.5rem;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.tpl-ref-toggle:hover,
.tpl-ref-toggle.open {
    color: var(--accent-blue);
    background: rgba(61, 155, 233, 0.04);
}

.tpl-ref-chevron {
    font-size: 1rem;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.tpl-ref-toggle.open .tpl-ref-chevron {
    transform: rotate(180deg);
}

.tpl-ref-body {
    border-top: 1px solid rgba(61, 155, 233, 0.1);
    padding: 1.2rem 1.4rem 1.4rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.6rem;
}

.tpl-ref-col-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.8rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tpl-ref-table {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tpl-ref-row {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    font-size: 0.78rem;
    line-height: 1.4;
}

.tpl-ref-row code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #7eb8f5;
    background: rgba(61, 155, 233, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.tpl-ref-row span {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.tpl-ref-row span strong { color: var(--text-primary); }
.tpl-ref-row span em { color: var(--text-primary); }
.tpl-ref-row span u  { color: var(--text-primary); }

.tpl-ref-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 0.4rem 0;
}

.tpl-ref-filter-group {
    margin-top: 1rem;
}

.tpl-ref-filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.tpl-ref-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 0.7rem 0;
    line-height: 1.5;
}

.tpl-ref-note code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #7eb8f5;
    background: rgba(61, 155, 233, 0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

.tpl-ref-code-block {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #c9d1d9;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    line-height: 1.8;
}

.tpl-ref-tips {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tpl-ref-tips li {
    font-size: 0.77rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.tpl-ref-tips li code {
    font-family: var(--font-mono);
    font-size: 0.73rem;
    color: #7eb8f5;
    background: rgba(61, 155, 233, 0.1);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}

/* ════════════════════════════════════════════════════════════
   Responsivo
   ════════════════════════════════════════════════════════════ */

/* ── Tabelas viram cartões no celular/tablet estreito ──
   Mesmo princípio da área de Clientes: em telas estreitas a tabela
   não cabe, então cada <tr> vira um cartão empilhado e cada <td>
   mostra seu rótulo (via data-label) à esquerda do valor. */
@media (max-width: 900px) {
    .table-container {
        background: transparent;
        border: none;
        border-radius: 0;
        overflow: visible;
        backdrop-filter: none;
    }

    .clients-table,
    .clients-table tbody,
    .clients-table tr,
    .clients-table td {
        display: block;
        width: 100%;
    }

    .clients-table thead { display: none; }

    .clients-table tr {
        position: relative;
        background: var(--bg-card);
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        padding: 0.85rem 1rem;
        margin-bottom: 0.85rem;
    }

    .clients-table tr.is-selected {
        border-color: var(--accent-blue);
        box-shadow: 0 0 0 1px var(--accent-blue);
    }

    /* Linhas de "vazio"/erro (colspan) continuam centralizadas e sem cara de card. */
    .clients-table td[colspan] {
        background: var(--bg-card);
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
    }

    .clients-table td {
        padding: 0.3rem 0;
        border-bottom: none;
        font-size: 0.9rem;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
    }

    /* Rótulo da coluna à esquerda de cada valor. */
    .clients-table td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
        padding-top: 0.1rem;
    }

    .clients-table td[data-label] { text-align: right; }
    .clients-table td[data-label] > * { text-align: right; }

    /* Título do cartão (nome/rótulo do item) ocupa a linha inteira, sem rótulo. */
    .clients-table td.cell-title {
        display: block;
        font-size: 1rem;
        padding-right: 2.2rem; /* espaço p/ checkbox flutuante */
        margin-bottom: 0.35rem;
    }
    .clients-table td.cell-title strong { font-size: 1rem; }

    /* Checkbox de seleção vai para o canto superior direito do cartão. */
    .clients-table td.col-check {
        position: absolute;
        top: 0.7rem;
        right: 0.8rem;
        width: auto;
        padding: 0;
    }

    /* Barra de ações alinhada à direita, com divisória. */
    .clients-table td.actions {
        justify-content: flex-end;
        gap: 0.5rem;
        margin-top: 0.5rem;
        padding-top: 0.6rem;
        border-top: 1px solid var(--border-subtle);
    }
    .clients-table td.actions .btn-icon {
        width: 40px;
        height: 40px;
    }

    .table-footer-info { text-align: left; }

    /* Modais de duas colunas (editar template / autopreenchimento / qualificação):
       a barra lateral e o painel empilham em vez de o painel vazar pela direita. */
    .modal-box-fullscreen { width: 100vw; height: 100vh; border-radius: 0; }

    .tpl-split-layout { flex-direction: column; overflow-y: auto; }

    .tpl-sidebar {
        width: 100%;
        flex-shrink: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    /* Ações não colam mais no rodapé (o layout agora rola); ficam logo abaixo. */
    .tpl-sidebar-actions { margin-top: 0.4rem; }

    .tpl-editor-pane { min-height: 60vh; }
}

@media (max-width: 1024px) {
    .tpl-ref-body { grid-template-columns: 1fr 1fr; }
    .editor-mobile-toggle { display: flex; }
    
    .editor-body {
        display: flex;
        flex-direction: column;
    }

    .editor-resizer { display: none; }

    .editor-form {
        flex: 1;
        border-right: none;
        border-bottom: none;
        display: flex;
    }
    
    .editor-preview {
        flex: 1;
        display: none;
    }
    
    /* When preview is active via mobile tab */
    .editor-body[data-mobile-view="preview"] .editor-form {
        display: none;
    }
    
    .editor-body[data-mobile-view="preview"] .editor-preview {
        display: flex;
    }
}

@media (max-width: 600px) {
    .tpl-ref-body { grid-template-columns: 1fr; }
    .form-row:not(.single) { flex-direction: column; }
    /* Sem espaço lateral para os botões: eles voltam para cima dos seletores. */
    .cec-topo { flex-direction: column; gap: 0; }
    .cec-topo .cec-import-row { order: -1; }
    .editor-overlay { padding: 0; }
    .editor-shell { border-radius: 0; }

    /* Header: título e botão "Novo Contrato" empilhados, botão full-width. */
    .page-header-bar { flex-direction: column; align-items: stretch; gap: 0.9rem; }
    .page-header-bar > div { width: 100%; }
    .page-header-bar .btn-primary { width: 100%; justify-content: center; }

    /* Toolbar de busca + botões empilha. */
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .search-box { min-width: 0; width: 100%; }
    .toolbar .btn-primary,
    .toolbar .btn-secondary,
    .toolbar .btn-small,
    .toolbar .btn-danger { width: 100%; justify-content: center; }
    .toolbar .clients-count { text-align: left; }

    /* Sub-abas de Templates roláveis lado a lado em vez de embolar. */
    .tpl-subtabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tpl-subtab { white-space: nowrap; flex: 0 0 auto; }
}

/* ── Autopreenchimento — painel de campos ── */
.ap-fields-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem 2rem;
}

/* Tabela marcada como "de assinatura" (botão ⊞✍) — destaque só no editor de
   modelos. No PDF a marca some; ela só impede a quebra entre páginas. */
.ql-editor .sig-keep {
    outline: 2px dashed #c9a227;
    outline-offset: 3px;
    background: rgba(201, 162, 39, 0.06);
}

/* Quebra de página dentro dos editores Quill (embed qp-break preservado pelo
   blot registrado; vira quebra real no PDF). Mesmo visual do preview. */
.ql-editor .qp-break {
    border: none;
    border-top: 2px dashed #bbb;
    margin: 24px 0;
    position: relative;
}
.ql-editor .qp-break.anexo-inicio { border-top-color: #c9a227; }
.ql-editor .qp-break.anexo-inicio::after {
    content: "📎  INÍCIO DE ANEXO";
    color: #c9a227;
}
.ql-editor .qp-break::after {
    content: "✂  QUEBRA DE PÁGINA";
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 0 12px;
    color: #aaa;
    font-size: 10px;
    font-family: sans-serif;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* ── Janela Flutuante de Observações ── */
.btn-obs-floating-toggle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary, #9ca3af);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-obs-floating-toggle:hover {
    background: var(--bg-hover, #252d3d);
    color: var(--accent-blue, #3d9be9);
    border-color: var(--accent-blue, #3d9be9);
}

.obs-floating-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    height: 220px;
    min-width: 240px;
    min-height: 120px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    resize: both;
    overflow: hidden;
    background: var(--bg-secondary, #151922);
    border: 1px solid var(--border-color, #2a3341);
    border-radius: var(--radius-sm, 8px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75);
    z-index: 2500;
    display: flex;
    flex-direction: column;
}

.obs-floating-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.55rem;
    background: var(--bg-tertiary, #1f2430);
    border-bottom: 1px solid var(--border-color, #2a3341);
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.obs-floating-header-title {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-primary, #e6e8eb);
}

.obs-drag-handle {
    color: var(--text-muted, #6b7280);
    font-size: 0.8rem;
    cursor: grab;
}

.obs-floating-actions {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.obs-fbtn {
    background: transparent;
    border: none;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    font-size: 0.82rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.obs-fbtn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.obs-floating-content {
    padding: 0.35rem;
    display: flex;
    flex: 1;
    min-height: 0;
    background: var(--bg-secondary, #151922);
}

.obs-floating-content textarea {
    width: 100%;
    height: 100%;
    resize: none;
    background: var(--bg-primary, #0c0f14);
    border: 1px solid var(--border-color, #2a3341);
    border-radius: 4px;
    color: var(--text-primary, #e6e8eb);
    padding: 0.4rem 0.5rem;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.82rem;
    line-height: 1.4;
    box-sizing: border-box;
}

.obs-floating-content textarea:focus {
    outline: none;
    border-color: var(--accent-blue, #3d9be9);
}

