:root {
    /* branding.js sobrescreve estas 4 via style inline no root. */
    --brand-primary: #1e293b;
    --brand-accent: #2563eb;
    --brand-surface: #f8fafc;
    --brand-on-primary-muted: #94a3b8;

    --bg-main: var(--brand-surface);
    --bg-sidebar: var(--brand-primary);
    --bg-card: #ffffff;
    --bg-input: #ffffff;

    --text-main: #1f2937;
    --text-muted: #64748b;

    --primary: var(--brand-accent);
    --border: color-mix(in srgb, var(--brand-primary) 15%, transparent);

    --border-hover: color-mix(in srgb, var(--brand-primary) 30%, transparent);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', sans-serif;
}

[hidden] { display: none !important; }

html, body {
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-main);
    color: var(--text-main);
}

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--brand-primary);
}

.login-panel {
    background: #ffffff;
    border-radius: 12px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-header p {
    color: var(--text-muted);
    font-size: 15px;
}

.form-group {
    margin-bottom: 0px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--primary);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    width: auto;
    transition: background-color 0.2s;
    display: inline-block;
    text-align: center;
}

.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    display: inline-block;
    text-align: center;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    border-color: var(--border-hover);
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--bg-sidebar);
    padding: 32px 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-surface);
    padding: 0 32px 32px;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sidebar nav a {
    display: block;
    padding: 12px 32px;
    color: var(--brand-on-primary-muted);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    border-left: 4px solid transparent;
}

.sidebar nav a.nav-bottom {
    margin-top: auto;
}

.sidebar nav a:hover {
    color: var(--brand-surface);
    background: rgba(255, 255, 255, 0.1);
}

.sidebar nav a.active {
    background: color-mix(in srgb, var(--brand-accent) 10%, transparent);
    color: var(--brand-surface);
    border-left: 4px solid var(--brand-accent);
    font-weight: 600;
}

.content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 40px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--brand-primary);
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-card h3 {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card p {
    font-size: 32px;
    font-weight: 700;
    color: var(--brand-primary);
}

.table-container {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

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

th, td {
    padding: 8px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f8fafc;
    color: var(--brand-primary);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    font-size: 14px;
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

.hover-row:hover {
    background-color: color-mix(in srgb, var(--brand-accent) 5%, transparent);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 48px !important;
}

.tabs {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.tab-btn {
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 0;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.tab-btn:hover {
    color: var(--brand-primary);
}
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

.badge {
	display: inline-block;
	padding: 4px 8px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	background: #f1f5f9;
	color: #475569;
}

.badge-ativo, .badge-paga, .badge-aceita, .badge-adimplente, .badge-aprovada, .badge-concluida {
	background: #dcfce7;
	color: #166534;
}

.badge-inativo, .badge-atrasada, .badge-estornada, .badge-cancelada, .badge-rejeitada, .badge-inadimplente, .badge-removida_pelo_usuario_recebedor {
	background: #fee2e2;
	color: #991b1b;
}

.badge-criada, .badge-enviada, .badge-recebida, .badge-aberta, .badge-ativa {
	background: #dbeafe;
	color: #1e40af;
}

.badge-expirada {
	background: #fef9c3;
	color: #854d0e;
}

td[data-col="txid"],
td[data-col="contrato"],
td[data-col="locid"] {
	font-family: monospace;
	font-size: 12px;
	color: var(--text-muted);
}

td[data-col="nome"],
td[data-col="valor"] {
	font-weight: 600;
}

td[data-col="url"] {
	font-family: monospace;
	font-size: 12px;
	color: var(--text-muted);
	max-width: 400px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.user-sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    background: rgba(0, 0, 0, 0.15);
}

.user-info-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-accent);
    color: #ffffff;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    color: var(--brand-surface);
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.user-role {
    color: var(--brand-on-primary-muted);
    font-size: 11px;
    font-weight: 600;
    opacity: 0.85;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-menu-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--brand-surface);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.user-menu-btn:hover, .user-menu-btn.active {
    background: var(--brand-accent);
    border-color: var(--brand-accent);
    color: #ffffff;
}

.triangle-icon {
    font-size: 9px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.user-menu-btn.active .triangle-icon {
    transform: rotate(180deg);
}

.user-submenu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 16px;
    left: 16px;
    background: #ffffff;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    z-index: 100;
}

.submenu-header {
    padding: 6px 10px 8px;
    font-size: 11px;
    color: var(--text-muted);
    word-break: break-all;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 4px;
    font-weight: 600;
}

.submenu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.logout-item {
    color: #dc2626;
}

.submenu-item:hover {
    background: #fef2f2;
}

.link-discreto {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.link-discreto:hover {
    color: var(--primary);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-md {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-copy {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.btn-danger-soft {
    background-color: #fef2f2;
    color: #ef4444;
    border: 1px solid #f87171;
}

.btn-info {
    background-color: #3b82f6;
}

.back-button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
}

.login-panel .form-group {
    margin-bottom: 16px;
}

.form-message {
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 600;
}

.form-message-error {
    color: #ef4444;
}

.form-message-success {
    color: #10b981;
}

.field-readonly {
    background-color: #f8fafc;
}

.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.checkbox {
    width: 18px;
    height: 18px;
}

label.check-label {
    margin: 0;
}

.currency-field {
    display: flex;
    gap: 8px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    height: 42px;
}

.currency-field .form-input {
    border: none;
    background: transparent;
    padding: 0;
    height: 100%;
    box-shadow: none;
}

.currency-field span {
    color: var(--text-muted);
    font-weight: 600;
}

.preview-line {
    margin-top: 6px;
    font-family: monospace;
    font-size: 13px;
    word-break: break-all;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.grid-compact {
    gap: 12px;
}

.span-2 {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

h3.section-title {
    font-size: 16px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

h3.block-title {
    font-size: 16px;
    color: var(--text-main);
}

h3.heading-sm {
    font-size: 16px;
}

h3.heading-bold {
    font-weight: 700;
}

.page-header {
    margin-bottom: 32px;
}

.page-header-compact {
    gap: 16px;
}

.page-header-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.title-with-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-subtitle {
    color: var(--text-muted);
    font-family: monospace;
}

.page-subtitle-block {
    font-size: 13px;
}

.page-subtitle-inline {
    margin-top: 4px;
}

.list-title {
    font-size: 24px;
    font-weight: 800;
}

.filter-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-search {
    display: flex;
    flex: 1;
    min-width: 280px;
    gap: 6px;
}

.column-menu-wrap {
    position: relative;
}

.column-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    width: 180px;
}

.column-menu label {
    display: block;
    margin-bottom: 6px;
}

.column-menu label:last-child {
    margin-bottom: 0;
}

.clickable-row {
    cursor: pointer;
}

.sortable-header {
    cursor: pointer;
    user-select: none;
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.subtable td,
.subtable th {
    padding: 10px 16px;
}

.subtable-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.subtable-card table {
    font-size: 13px;
}

.subtable-card thead tr {
    background: #f1f5f9;
}

.subtable-card tr {
    border-bottom: 1px solid #e2e8f0;
}

.subtable-card th {
    font-weight: 600;
    color: var(--text-main);
}

.subtable-bordered {
    overflow-x: auto;
}

.subtable-bordered tr {
    border-bottom: 1px solid var(--border);
}

.empty-note {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
}

.empty-state-error {
    color: #991b1b;
    background: #fee2e2;
    border-radius: 8px;
}

.api-response,
.api-details pre {
    padding: 12px;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.api-response {
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 24px;
}

.api-details {
    margin: 24px 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
}

.api-details summary {
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    user-select: none;
}

.api-details pre {
    background: #ffffff;
    border-radius: 6px;
    margin-top: 12px;
    margin-bottom: 0;
}

.sandbox-box {
    margin-top: 24px;
    padding: 16px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
}

.badge-env {
    background: #ea580c;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    margin-left: 10px;
    display: inline-block;
    vertical-align: middle;
}

.app-alert {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    padding: 14px 18px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.w-full { width: 100%; }
.w-140 { width: 140px; }
.w-150 { width: 150px; }
.w-160 { width: 160px; }
.w-170 { width: 170px; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-12 { font-size: 12px; }
.semibold { font-weight: 600; }
.mono { font-family: monospace; }

.flex-row { display: flex; gap: 8px; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
