/* PIX Control — sistema visual único do painel, do portal do cliente e do login. */
:root {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #161619;
  --surface-3: #1d1d21;
  --hover: #222227;
  --border: #26262b;
  --border-strong: #3a3a41;
  --text: #fafafa;
  --text-2: #d4d4d8;
  --muted: #a1a1aa;
  --faint: #71717a;
  --primary: #fafafa;
  --primary-text: #09090b;
  --primary-hover: #e4e4e7;
  --ring: #71717a;
  --ring-soft: rgba(161, 161, 170, .16);
  --green: #4ade80;
  --green-bg: rgba(34, 197, 94, .12);
  --green-text: #86efac;
  --amber: #fbbf24;
  --amber-bg: rgba(245, 158, 11, .12);
  --amber-text: #fcd34d;
  --red: #f87171;
  --red-bg: rgba(239, 68, 68, .12);
  --red-text: #fca5a5;
  --blue-bg: rgba(59, 130, 246, .14);
  --blue-text: #93c5fd;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
  --font: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; scroll-padding-top: 76px; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
body:has(dialog[open]), body.nav-open { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: 16px; line-height: 1.35; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 600; }
p { color: var(--muted); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }
::selection { background: #3f3f46; color: #fff; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
code, pre { font-family: var(--mono); }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.icon { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.truncate { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* Marca */
.brand { display: inline-flex; align-items: center; font-size: 17px; font-weight: 700; letter-spacing: -.03em; color: var(--text); white-space: nowrap; }
.brand > span:last-child { font-weight: 400; color: var(--muted); }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 13px; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; text-decoration: none; }
.btn .icon { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-2); }
.btn-secondary:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--red-bg); border-color: rgba(239, 68, 68, .3); color: var(--red-text); }
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, .2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14px; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--text-2); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 4px; }
.link:hover { color: var(--text); text-decoration-color: var(--muted); }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .icon { width: 18px; height: 18px; }

/* Campos */
input, select, textarea { width: 100%; height: 40px; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; caret-color: var(--text); }
textarea { height: auto; padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: #52525b; }
input:focus, select:focus, textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring-soft); }
input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
input:-webkit-autofill { -webkit-box-shadow: inset 0 0 0 1000px var(--surface-3); -webkit-text-fill-color: var(--text); caret-color: var(--text); }
select { appearance: none; -webkit-appearance: none; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; cursor: pointer; text-overflow: ellipsis; }
option { background: var(--surface-2); color: var(--text); }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--text); flex-shrink: 0; cursor: pointer; }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
/* Datas com o mesmo chevron dos seletores; o calendário abre ao clicar no campo. */
@supports selector(::-webkit-calendar-picker-indicator) {
  input[type=date] { background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; cursor: pointer; }
  input[type=date]::-webkit-calendar-picker-indicator { display: none; }
}
input[type=date].is-empty::-webkit-datetime-edit { color: var(--faint); }
input[type=date]::-webkit-datetime-edit-fields-wrapper { padding: 0; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 500; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.field-label small { font-weight: 400; color: var(--faint); font-size: 12px; }
.hint { font-size: 12.5px; color: var(--faint); line-height: 1.55; }
.input-group { display: flex; align-items: stretch; }
.input-group > .addon { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; background: var(--surface-3); border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); font-size: 13px; font-weight: 500; }
.input-group > input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-variant-numeric: tabular-nums; }
.field-control { position: relative; display: block; min-width: 0; width: 100%; }
.field-control > input, .field-control > select, .field-control > textarea { padding-left: 38px; }
.field-control > .field-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.field-control:has(> textarea) > .field-icon { top: 12px; transform: none; }
.field-control:focus-within > .field-icon { color: var(--text); }
.field-control:has(> :disabled) > .field-icon { opacity: .55; }
.check-icon { display: inline-block; vertical-align: -3px; margin-right: 5px; color: var(--muted); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-2); line-height: 1.5; cursor: pointer; }
.check input { margin-top: 2px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-section { display: flex; flex-direction: column; gap: 16px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-section-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.form-actions .btn-primary { min-width: 140px; }
details.more { border: 1px solid var(--border); border-radius: var(--radius-sm); }
details.more > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; cursor: pointer; font-size: 13px; color: var(--text-2); font-weight: 500; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ""; width: 16px; height: 16px; background: var(--chevron) center / 16px no-repeat; transition: transform .15s; }
details.more[open] > summary::after { transform: rotate(180deg); }
details.more > .stack { padding: 4px 12px 14px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--border); padding: 18px 14px; z-index: 40; }
.sidebar-head { display: flex; align-items: center; justify-content: center; padding: 4px 8px 20px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-caption { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 16px 10px 6px; }
.nav-caption:first-child { padding-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); font-size: 13.5px; font-weight: 500; text-align: left; transition: background .15s, color .15s; }
.nav-item .icon { width: 17px; height: 17px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--amber-bg); color: var(--amber-text); font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; flex: 1; padding: 6px 0 6px 8px; min-width: 0; }
.user-chip > span { display: flex; flex: 1; min-width: 0; }
.user-chip strong { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .btn { justify-content: flex-start; flex-shrink: 0; padding: 0 6px; gap: 6px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 32px; background: rgba(9, 9, 11, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--faint); min-width: 0; }
.crumbs strong { color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .icon { width: 14px; height: 14px; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }
.content { width: 100%; max-width: 1680px; margin: 0 auto; padding: 24px clamp(16px, 2.2vw, 32px) 32px; flex: 1; }
#setup-notice { margin-bottom: 20px; }
.page { display: flex; flex-direction: column; gap: 20px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header p { margin-top: 4px; font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-backdrop { display: none; }

/* Cartões */
/* Recorta fundos de filtros, tabelas e rodapés no contorno do cartão. */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; overflow: clip; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; flex-wrap: wrap; }
.card-header p { font-size: 13px; margin-top: 2px; }
.card-header + .card-body { padding-top: 0; }
.card-body { padding: 20px; }
.card-body > p + p { margin-top: 10px; }
.card-title-row { display: flex; align-items: center; gap: 10px; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.layout-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 13px; color: var(--text-2); line-height: 1.55; }
.alert .icon { margin-top: 1px; }
.alert-warning { background: var(--amber-bg); border-color: rgba(245, 158, 11, .28); color: var(--amber-text); }
.alert-danger { background: var(--red-bg); border-color: rgba(239, 68, 68, .3); color: var(--red-text); }
.alert-success { background: var(--green-bg); border-color: rgba(34, 197, 94, .28); color: var(--green-text); }
.alert .link { color: inherit; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.overview-kpis { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); }
.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.kpi-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-label .icon { color: var(--faint); }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--faint); min-height: 30px; }
.kpi.highlight { background: linear-gradient(160deg, #1b1b1f, #121214); border-color: var(--border-strong); }
.balance-details { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; }
.balance-details > div { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.balance-details dt { color: var(--muted); }
.balance-details dd { margin: 0 0 0 auto; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); overflow-wrap: anywhere; }
.balance-card .kpi-foot { flex-wrap: wrap; margin-top: auto; }
.balance-card .kpi-foot > span { flex: 1 1 140px; min-width: 0; }
.overview-kpis > .kpi:not(.balance-card) .kpi-foot { margin-top: auto; }
button.kpi { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s; }
button.kpi:hover { border-color: var(--border-strong); }
.stat-strip { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 14px 20px; font-size: 13px; color: var(--muted); align-items: center; }
.stat-strip strong { color: var(--text-2); font-weight: 600; margin-left: 6px; font-variant-numeric: tabular-nums; }
.stat-strip .push { margin-left: auto; }
.mini-stats { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.mini-stats strong { display: block; font-size: 18px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* Margem da plataforma */
.financial-card .card-header { padding-bottom: 20px; }
.financial-summary { display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 1fr)); margin: 0 20px 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.financial-metric { display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 0; padding: 20px; }
.financial-metric + .financial-metric { border-left: 1px solid var(--border); }
.financial-result { background: var(--surface-2); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.financial-label { font-size: 12.5px; color: var(--muted); }
.financial-value { font-size: clamp(20px, 2.1vw, 28px); font-weight: 600; line-height: 1.2; letter-spacing: -.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.financial-result .financial-value { font-size: clamp(24px, 2.5vw, 34px); }
.financial-caption { font-size: 12px; color: var(--faint); }
.financial-value.positive, .financial-amount.positive { color: var(--green-text); }
.financial-value.negative, .financial-amount.negative { color: var(--red-text); }
.financial-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.financial-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 24px; padding: 14px 20px; border-top: 1px solid var(--border); }
.financial-footer > .financial-caption { flex-shrink: 0; }
.financial-explanation { max-width: 560px; font-size: 12px; color: var(--muted); }
.financial-explanation summary { cursor: pointer; }
.financial-explanation p { margin-top: 8px; line-height: 1.6; }
.financial-empty { padding: 4px 20px 20px; font-size: 13px; line-height: 1.6; }
@media (max-width: 760px) {
  .financial-summary { grid-template-columns: minmax(0, 1fr); margin-left: 16px; margin-right: 16px; }
  .financial-metric { padding: 16px; }
  .financial-metric + .financial-metric { border-left: 0; border-top: 1px solid var(--border); }
  .financial-result { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
  .financial-footer { flex-direction: column; padding-left: 16px; padding-right: 16px; }
  .financial-empty { padding-left: 16px; padding-right: 16px; }
}

/* Status */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.positive { background: var(--green-bg); color: var(--green-text); }
.badge.waiting { background: var(--amber-bg); color: var(--amber-text); }
.badge.negative { background: var(--red-bg); color: var(--red-text); }
.badge.info { background: var(--blue-bg); color: var(--blue-text); }
.badge.neutral { background: var(--surface-3); color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status-pill.ok::before { background: var(--green); box-shadow: 0 0 0 3px rgba(74, 222, 128, .15); }
.status-pill.bad::before { background: var(--red); box-shadow: 0 0 0 3px rgba(248, 113, 113, .15); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Filtros */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.card-header + .toolbar { border-top: 0; padding-top: 0; }
.toolbar input, .toolbar select { height: 36px; font-size: 13px; }
.toolbar select { width: auto; max-width: 220px; }
.toolbar > .field-select { width: auto; max-width: 250px; }
.toolbar .field-select select { width: 100%; max-width: none; }
.search { position: relative; flex: 1 1 260px; min-width: 200px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 34px; }
.control { position: relative; display: inline-flex; align-items: center; height: 36px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s; cursor: pointer; }
.control:hover { border-color: #52525b; }
.control:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px var(--ring-soft); }
.control > span { padding-left: 11px; font-size: 13px; color: var(--faint); white-space: nowrap; user-select: none; }
.control > input { border: 0; background-color: transparent; height: 34px; box-shadow: none; padding-left: 8px; width: 152px; font-size: 13px; }
.control > input:focus { box-shadow: none; }
.control > .field-icon { margin-left: 10px; color: var(--muted); pointer-events: none; }
.control:has(> .field-icon) > span { padding-left: 7px; }
.toolbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.toolbar-end:not(:has(> :not([hidden]))) { display: none; }
.result-count { font-size: 13px; color: var(--faint); white-space: nowrap; }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13.5px; }
thead th { position: sticky; top: 0; font-size: 12px; font-weight: 500; color: var(--faint); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgba(255, 255, 255, .018); }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { color: var(--text); font-weight: 500; }
th.actions, td.actions { text-align: right; width: 1%; }
.cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: 320px; }
.cell strong { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.cell small { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; }
.cell-icon { display: flex; align-items: center; gap: 12px; }
.kind-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex-shrink: 0; }
.kind-icon.in { color: var(--green-text); background: var(--green-bg); }
.kind-icon.out { color: var(--blue-text); background: var(--blue-bg); }
.row-actions { display: inline-flex; gap: 2px; justify-content: flex-end; }
.row-actions .btn-sm { padding: 0 8px; }
/* Listas de integração ocupam a largura disponível e crescem com o conteúdo. */
.adaptive-table-card { container-type: inline-size; }
.adaptive-table .table-wrap { overflow: visible; }
.adaptive-table table { table-layout: fixed; }
.adaptive-table th, .adaptive-table td { white-space: normal; overflow-wrap: anywhere; }
.adaptive-table .cell { max-width: none; }
.adaptive-table .cell strong, .adaptive-table .cell small { overflow: visible; }
.adaptive-table .cell small { margin-top: 4px; }
.adaptive-table .row-actions { flex-wrap: wrap; }
.adaptive-table .row-actions .btn { min-width: 0; height: auto; min-height: 30px; white-space: normal; overflow-wrap: anywhere; }
#integrations-list th:first-child { width: 26%; }
#integrations-list th:nth-child(2), #integrations-list th:nth-child(3) { width: 14%; }
#integrations-list th:nth-child(4) { width: 16%; }
#integrations-list th:nth-child(5) { width: 13%; }
#integrations-list th:last-child { width: 17%; }
#client-destinations th:first-child { width: 46%; }
#client-destinations th:nth-child(2) { width: 14%; }
#client-destinations th:nth-child(3), #client-destinations th.actions { width: 20%; }
@container (max-width: 860px) {
  .adaptive-table table, .adaptive-table tbody { display: block; }
  .adaptive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .adaptive-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; padding: 20px; border-top: 1px solid var(--border); }
  .adaptive-table td { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; padding: 0; border: 0; text-align: left; }
  .adaptive-table td::before { content: attr(data-label); font-size: 12px; font-weight: 400; color: var(--faint); }
  .adaptive-table td.actions { width: auto; }
  #client-destinations td:first-child, #client-destinations td.actions { grid-column: 1 / -1; }
}
@container (max-width: 480px) {
  .adaptive-table tr { grid-template-columns: minmax(0, 1fr); padding: 16px; }
}
/* A listagem de clientes se adapta à largura do próprio painel. */
#clients-card { container-type: inline-size; }
#clients-table table { table-layout: fixed; }
#clients-table th, #clients-table td { padding: 12px 10px; white-space: normal; overflow-wrap: anywhere; }
#clients-table th:nth-child(1) { width: 17%; }
#clients-table th:nth-child(2) { width: 15%; }
#clients-table th:nth-child(3) { width: 18%; }
#clients-table th:nth-child(4), #clients-table th:nth-child(5) { width: 17%; }
#clients-table th.actions { width: 16%; }
#clients-table td.num { white-space: normal; }
#clients-table .badge { white-space: nowrap; padding: 0 6px; gap: 4px; font-size: 11px; }
#clients-table .row-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; width: 100%; }
#clients-table .row-actions .btn { min-width: 0; height: auto; min-height: 30px; padding: 4px 6px; white-space: normal; overflow-wrap: anywhere; }
@container (max-width: 900px) {
  #clients-table table, #clients-table tbody { display: block; }
  #clients-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #clients-table tbody { padding: 12px; }
  #clients-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; }
  #clients-table tr:last-child { margin-bottom: 0; }
  #clients-table td { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 0; text-align: left; border-bottom: 0; }
  #clients-table td::before { content: attr(data-label); font-size: 12px; font-weight: 400; color: var(--faint); }
  #clients-table td:first-child, #clients-table td.actions { grid-column: 1 / -1; }
  #clients-table td.actions { width: auto; border-top: 1px solid var(--border); }
  #clients-table .row-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container (max-width: 300px) {
  #clients-table tr { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 480px) {
  #clients-table .row-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.status-cell small { font-size: 12px; color: var(--faint); max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.status-cell small.warn { color: var(--amber-text); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 20px; }
.empty .empty-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); margin-bottom: 6px; }
.empty strong { font-size: 14px; font-weight: 600; color: var(--text-2); }
.empty span { font-size: 13px; color: var(--faint); max-width: 360px; }
.loading-region { position: relative; }
.loading-region[aria-busy=true]:empty { min-height: 128px; }
.loading-replacement > :not(.loading-indicator) { visibility: hidden; }
.loading-indicator { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 128px; padding: 24px; color: var(--muted); font-size: 13px; background: var(--surface); }
.loading-spinner { display: inline-block; flex: 0 0 auto; width: 20px; height: 20px; border: 2px solid var(--border-strong); border-top-color: var(--text); border-radius: 50%; animation: loading-spin .75s linear infinite; }
.loading-indicator-update { inset: auto 12px 10px auto; min-height: 0; padding: 5px 9px; border: 1px solid var(--border); border-radius: 20px; font-size: 12px; pointer-events: none; }
.loading-indicator-update .loading-spinner { width: 14px; height: 14px; }
@keyframes loading-spin { to { transform: rotate(360deg); } }
.app-loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.page-loading { min-height: 280px; }
.page-loading > :not(.page-header):not(.page-loading-status) { display: none !important; }
.page-loading-status { min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: normal; }
.page-loading-update { min-height: 0; display: inline-flex; margin-left: 12px; vertical-align: middle; font-size: 12px; }
.page-loading-update .loading-spinner, .button-loading .loading-spinner { width: 14px; height: 14px; }
button.button-loading:disabled { opacity: 1; cursor: wait; }
.button-loading > .icon { display: none; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--faint); flex-wrap: wrap; }
.pagination-controls { display: flex; align-items: center; gap: 6px; }
.pagination-controls span { padding: 0 6px; color: var(--muted); white-space: nowrap; }

/* Gráfico de recebimentos */
.chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; align-items: end; height: 180px; padding: 8px 0 0; background: repeating-linear-gradient(to top, transparent 0 44px, var(--border) 44px 45px); }
.chart-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: 100%; min-width: 0; }
.chart-bar { width: 100%; max-width: 40px; min-height: 3px; border-radius: 6px 6px 2px 2px; background: #3f3f46; transition: background .15s; }
.chart-col:hover .chart-bar { background: #71717a; }
.chart-col.today .chart-bar { background: var(--text); }
.chart-col span { font-size: 11.5px; color: var(--faint); }
.chart-total { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 14px; }
.chart-total strong { font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.chart-total span { font-size: 13px; color: var(--faint); }

/* Ações rápidas e passos */
.quick-list { display: flex; flex-direction: column; }
.quick-link { display: flex; align-items: center; gap: 12px; padding: 12px 0; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; width: 100%; color: var(--text-2); }
.quick-link:first-child { border-top: 0; padding-top: 4px; }
.quick-link > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quick-link strong { font-size: 13.5px; font-weight: 500; color: var(--text); }
.quick-link small { font-size: 12.5px; color: var(--faint); }
.quick-link > .icon:last-child { margin-left: auto; color: var(--faint); transition: transform .15s; }
.quick-link:hover > .icon:last-child { transform: translateX(2px); color: var(--text); }
.quick-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); flex-shrink: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; counter-reset: step; }
.steps li { display: flex; gap: 12px; counter-increment: step; font-size: 13px; color: var(--muted); line-height: 1.55; }
.steps li::before { content: counter(step); width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.steps strong { display: block; color: var(--text); font-weight: 500; margin-bottom: 2px; }

/* Código */
pre, .code { margin: 0; font-size: 12.5px; line-height: 1.7; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; overflow: auto; color: var(--text-2); white-space: pre-wrap; word-break: break-all; }
.code-box { position: relative; }
.code-box .copy { position: absolute; top: 8px; right: 8px; }
.code-box:has(.copy) pre { padding-top: 48px; word-break: normal; overflow-wrap: anywhere; }
code { font-size: 12.5px; background: var(--surface-3); border-radius: 5px; padding: 1px 5px; color: var(--text-2); overflow-wrap: anywhere; }
pre code, .code code { background: none; padding: 0; }
.secret { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; background: var(--bg); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12.5px; color: var(--text); word-break: break-all; }
.secret > span { flex: 1; }

/* Detalhes */
.detail-list { display: flex; flex-direction: column; }
.detail-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.detail-row:last-child { border-bottom: 0; }
.detail-row > :last-child { color: var(--text); font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.detail-row .mono { font-weight: 400; color: var(--text-2); }
.amount-hero { text-align: center; padding: 6px 0 14px; }
.amount-hero strong { display: block; font-size: 32px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.amount-hero span { font-size: 13px; color: var(--faint); }
.qr { display: block; width: 216px; max-width: 100%; margin: 6px auto 14px; background: #fff; padding: 10px; border-radius: 10px; }
.available { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.available strong { font-size: 18px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Portal: formulário, orientação e histórico sem lacunas entre cartões. */
.withdrawal-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.withdrawal-heading h2, .available > span { display: inline-flex; align-items: center; gap: 9px; }
.withdrawal-heading h2 > .icon { color: var(--muted); }
.withdrawal-heading .available { padding: 9px 12px; gap: 20px; }
.withdrawal-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) minmax(0, 1.2fr); gap: 16px; }
.withdrawal-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.withdrawal-footer > .hint { display: flex; align-items: flex-start; gap: 8px; max-width: 660px; }
.withdrawal-footer > .hint .icon { margin-top: 2px; }
.withdrawal-footer .form-actions { flex-shrink: 0; }
.withdrawal-guide { padding: 16px 20px 20px; border-top: 1px solid var(--border); }
.withdrawal-guide h2 { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.withdrawal-guide .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.toolbar.toolbar-inline { padding: 0; border: 0; background: transparent; }
.toolbar-inline .toolbar-end { margin-left: 0; }
#client-withdrawals { border-top: 1px solid var(--border); }
.integration-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.integration-settings { min-width: 0; gap: 20px; }
.integration-layout .hint { overflow-wrap: anywhere; }
.integration-layout .secret > span { min-width: 0; }
.integration-layout .secret > .icon-btn { flex-shrink: 0; }
.integration-api .code-box pre { padding-top: 46px; white-space: pre-wrap; word-break: normal; overflow-wrap: anywhere; max-height: none; }
.client-view .empty { display: grid; grid-template-columns: 40px minmax(0, 460px); justify-content: center; text-align: left; column-gap: 14px; row-gap: 3px; }
.client-view .empty .empty-icon { grid-row: 1 / span 2; margin: 0; }
.client-view .empty > strong, .client-view .empty > span:last-child:not(.empty-icon) { grid-column: 2; max-width: none; }
.client-view #client-destinations .empty { display: flex; align-items: flex-start; }
.client-view #client-destinations .empty-icon { display: none; }

/* Diálogos */
dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
dialog.wide { width: min(640px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .66); backdrop-filter: blur(3px); }
dialog[open] { display: flex; flex-direction: column; animation: pop .16s ease-out; }
.dialog-header { flex: 0 0 auto; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.dialog-header > :first-child { min-width: 0; overflow-wrap: anywhere; }
.dialog-header .icon-btn { flex-shrink: 0; }
.dialog-header p { font-size: 13px; margin-top: 3px; }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.dialog-body > * { flex-shrink: 0; }
.dialog-footer { position: sticky; bottom: -20px; z-index: 1; display: flex; justify-content: flex-end; gap: 8px; padding: 14px 0 20px; margin-bottom: -20px; background: var(--surface); border-top: 1px solid var(--border); flex-wrap: wrap; }

/* Avisos flutuantes */
.toast-region { position: fixed; inset: auto max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) auto; z-index: 1000; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; pointer-events: none; color: var(--text); }
.toast-region:popover-open { display: flex; flex-direction: column; gap: 8px; }
.toast-region:not([popover]) { display: flex; flex-direction: column; gap: 8px; }
.toast-region::backdrop { background: transparent; pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); font-size: 13.5px; line-height: 1.5; color: var(--text); animation: rise .18s ease-out; pointer-events: auto; }
.toast > span { flex: 1; min-width: 0; overflow-wrap: anywhere; max-height: 30dvh; overflow-y: auto; }
.toast .toast-close { width: 28px; height: 28px; flex-shrink: 0; margin: -4px -4px -4px 0; }
.toast .toast-close .icon { color: var(--muted); margin: 0; }
.toast .icon { margin-top: 2px; color: var(--green); }
.toast.error { border-color: rgba(239, 68, 68, .4); }
.toast.error .icon { color: var(--red); }

/* Login */
.auth { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-layout { width: 100%; max-width: 432px; display: flex; flex-direction: column; align-items: center; gap: 32px; }
.auth-brand { font-size: 38px; line-height: 1.15; letter-spacing: -.055em; }
.auth-card { width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 28px; padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .035); }
.auth-card form { gap: 22px; }
.auth-card .field { gap: 9px; }
.auth-card input { height: 48px; background: var(--bg); border-color: var(--border); border-radius: 10px; }
.auth-card input:hover { border-color: var(--border-strong); }
.auth-card input:focus { border-color: var(--ring); }
.auth-card form > .btn { height: 46px; border-radius: 10px; gap: 10px; }
.segmented { position: relative; isolation: isolate; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.segmented::before { content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 12px) / 2); background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, .2); transition: transform .2s ease; }
.segmented[data-mode=client]::before { transform: translateX(calc(100% + 4px)); }
.segmented button { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; height: 40px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--faint); font-size: 12.5px; font-weight: 500; transition: color .15s; }
.segmented button .icon { width: 15px; height: 15px; }
.segmented button:hover { color: var(--text-2); }
.segmented button[aria-selected=true] { color: var(--text); }
@media (max-width: 480px) {
  .auth { padding: 32px 16px; }
  .auth-layout { gap: 26px; }
  .auth-brand { font-size: 34px; }
  .auth-card { padding: 26px 20px; gap: 26px; border-radius: 16px; }
}

/* Guia público */
.doc { max-width: 860px; margin: 0 auto; padding: 40px 24px 64px; display: flex; flex-direction: column; gap: 20px; }
.doc .card-body h2 { margin: 22px 0 8px; }
.doc .card-body h2:first-child { margin-top: 0; }
.doc .card-body p { font-size: 14px; line-height: 1.7; }
.doc .card-body pre { margin: 10px 0; }
.doc ul { color: var(--muted); font-size: 14px; line-height: 1.8; padding-left: 20px; margin: 8px 0; }
.doc a:not(.btn) { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }

@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Responsivo */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .integration-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .nav-open .sidebar { transform: none; }
  .nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .55); }
  .menu-btn { display: inline-grid; margin-left: -8px; }
  .topbar { padding: 0 20px; }
  .content { padding: 22px 20px 32px; }
  .layout-2 { grid-template-columns: minmax(0, 1fr); }
  .withdrawal-footer { align-items: flex-start; }
  .integration-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  h1 { font-size: 21px; }
  .kpis, .kpis.kpis-3, .layout-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 24px; }
  .content { padding: 18px 16px 28px; }
  .topbar { padding: 0 16px; }
  .page-header { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .card-header, .card-body { padding-left: 16px; padding-right: 16px; }
  .toolbar { padding: 12px 16px; }
  .search { flex-basis: 100%; }
  .toolbar select { flex: 1 1 100%; max-width: none; min-width: 0; }
  .toolbar > .field-select { flex: 1 1 100%; width: 100%; max-width: none; }
  .toolbar .control { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .control > span { padding-left: 10px; }
  .control > input { width: 100%; min-width: 0; padding-left: 6px; padding-right: 28px; background-position: right 8px center; }
  .toolbar-end { margin-left: 0; width: 100%; justify-content: flex-end; }
  .crumbs > span, .crumbs > .icon { display: none; }
  .hide-sm { display: none; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .pagination { padding: 10px 16px; }
  .stat-strip .push { margin-left: 0; }
  .chart { gap: 6px; }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
  .dialog-header, .dialog-body { padding-left: 16px; padding-right: 16px; }
  .form-actions .btn, .dialog-footer .btn { flex: 1; }
  .withdrawal-heading .available { width: 100%; }
  .withdrawal-fields, .withdrawal-guide .steps { grid-template-columns: minmax(0, 1fr); }
  .withdrawal-guide { padding-left: 16px; padding-right: 16px; }
  .withdrawal-guide .steps { gap: 14px; }
  .withdrawal-footer { flex-direction: column; }
  .withdrawal-footer .form-actions, .toolbar-inline { width: 100%; }
}

@media (max-width: 420px) {
  .toolbar .control { flex-basis: 100%; }
}

/* Webhooks recebidos */
:root { --series-accepted: #3987e5; --series-rejected: #d03b3b; }
.incoming-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--muted); }
.incoming-legend span { display: inline-flex; align-items: center; gap: 6px; }
.incoming-swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; }
.incoming-swatch.s-accepted { background: var(--series-accepted); }
.incoming-swatch.s-rejected { background: var(--series-rejected); }
.incoming-chart { position: relative; min-height: 200px; }
.incoming-chart svg { display: block; overflow: visible; }
.incoming-chart .grid { stroke: var(--border); stroke-width: 1; }
.incoming-chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.incoming-chart .tick { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.incoming-chart .bar.s-accepted { fill: var(--series-accepted); }
.incoming-chart .bar.s-rejected { fill: var(--series-rejected); }
.incoming-chart .band { fill: var(--hover); opacity: .6; }
.incoming-chart .hit { fill: transparent; cursor: crosshair; }
.incoming-tip { position: absolute; top: 0; transform: translateX(-50%); min-width: 170px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); box-shadow: var(--shadow-lg); font-size: 12.5px; color: var(--text-2); pointer-events: none; z-index: 2; }
.incoming-tip .tip-title { margin-bottom: 6px; font-weight: 600; color: var(--text); }
.incoming-tip .tip-row { display: flex; justify-content: space-between; gap: 16px; line-height: 1.7; }
.incoming-tip .tip-row span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.incoming-tip .tip-row strong { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.incoming-tip .tip-note { margin-top: 6px; font-size: 11.5px; color: var(--faint); }
.incoming-panels { align-items: stretch; }
dialog.incoming-dialog { width: min(760px, calc(100% - 32px)); }
.incoming-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.incoming-section { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.incoming-section h3 { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.incoming-section .code-box pre { max-height: 320px; }
.incoming-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.incoming-attempts, .incoming-timeline { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.incoming-attempts li { position: relative; display: flex; flex-direction: column; gap: 2px; margin-left: 4px; padding: 8px 0 8px 18px; border-left: 1px solid var(--border); }
.incoming-attempts li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px var(--surface); }
.incoming-attempts li.attempt-processed::before { background: var(--green); }
.incoming-attempts li.attempt-unmatched::before { background: var(--red); }
.incoming-attempts strong { font-size: 13px; font-weight: 500; color: var(--text); }
.incoming-attempts small { font-size: 12px; color: var(--faint); }
.incoming-timeline li { padding: 4px 0; }
.incoming-timeline .link:disabled { color: var(--text); text-decoration: none; cursor: default; }

.fee-rate { display:block; margin-top:6px; font-size:18px; font-variant-numeric:tabular-nums; }

/* Estrutura comum: conteúdo legível e ações acessíveis em qualquer largura. */
.page-header > div:first-child, .card-header > div, .alert > span { min-width: 0; }
.page-header p, .card-header p, .hint, .alert, .quick-link, .kpi-foot { overflow-wrap: anywhere; }
.btn { max-width: 100%; }
.field-label { flex-wrap: wrap; }
.input-group > input { min-width: 0; }
.detail-row > :first-child { flex: 0 0 38%; }
.detail-row > :last-child { min-width: 0; }
.secret > span { min-width: 0; }
.secret > button { flex-shrink: 0; }
fieldset legend { padding: 0 8px 0 0; font-size: 13px; color: var(--text-2); font-weight: 600; }
.kpi-foot { min-height: 0; flex-wrap: wrap; margin-top: auto; }
.kpi-value { font-size: clamp(22px, 2.1vw, 30px); white-space: normal; overflow-wrap: anywhere; }
.overview-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.overview-kpis .balance-card { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px 32px; }
.balance-card .kpi-label, .balance-card .kpi-value, .balance-card .kpi-foot { grid-column: 1; }
.balance-card .balance-details { grid-column: 2; grid-row: 1 / 4; margin: 0; padding: 0 0 0 24px; border-top: 0; border-left: 1px solid var(--border); justify-content: center; }
.kpis-5 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis-5 > :first-child { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 24px; }
.kpis-5 > :first-child .kpi-value { grid-column: 1; font-size: 30px; }
.kpis-5 > :first-child .kpi-foot { grid-column: 2; grid-row: 1 / 3; gap: 16px; }
.settings-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.settings-column { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.fee-tile { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 18px; }
.withdrawal-guide .steps { margin-top: 14px; }
.sidebar-head { position: relative; }
.sidebar-close { display: none; }
.nav { min-height: 0; padding-bottom: 16px; }
.nav-item { flex-shrink: 0; }
.sidebar-foot { flex-shrink: 0; }
.page-load-failed > :not(.page-header):not(.page-load-error):not(.page-loading-status) { display: none !important; }
.page-load-error { align-items: center; flex-wrap: wrap; }
.page-load-error > span { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; }
.page-load-error .btn { flex-shrink: 0; }
.list-load-error .btn { margin-top: 8px; }
#portal-error { margin-bottom: 16px; }

/* Busca e situação sempre visíveis; os filtros adicionais compartilham a mesma área. */
.toolbar { gap: 10px; }
.toolbar > .search { flex: 1 1 260px; min-width: min(200px, 100%); }
.toolbar > .field-select { flex: 0 1 210px; max-width: 250px; }
.toolbar .filter-toggle { height: 36px; flex-shrink: 0; }
.filter-toggle.has-filters { border-color: var(--muted); color: var(--text); }
.filter-extra { order: 5; display: flex; flex-wrap: wrap; gap: 10px; width: 100%; padding-top: 12px; border-top: 1px solid var(--border); }
.filter-extra > .field-control, .filter-extra > .control { flex: 1 1 190px; }
.filter-extra .field-control, .filter-extra select, .filter-extra .control { width: 100%; max-width: none; min-width: 0; }
.filter-extra .control input { width: 100%; min-width: 0; }
.filter-periods { flex: 1 1 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.filter-periods > span { color: var(--muted); font-size: 12px; margin-right: 6px; }
.filter-summary { order: 6; display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.filter-chip:hover { border-color: var(--muted); }
.filter-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-chip .icon { width: 13px; height: 13px; }
.search input { padding-right: 36px; }
.search .search-clear { position: absolute; right: 4px; top: 3px; width: 30px; height: 30px; }
.search .search-clear .icon { position: static; transform: none; width: 14px; height: 14px; }
.toolbar-inline { max-width: 100%; }
.toolbar-inline .filter-summary { justify-content: flex-end; }

/* As listas passam a fichas quando o espaço do próprio cartão fica estreito. */
.responsive-table { container-type: inline-size; min-width: 0; }
.responsive-table .table-wrap { overscroll-behavior-x: contain; }
.responsive-table .cell { max-width: 260px; white-space: normal; overflow-wrap: anywhere; }
.responsive-table .cell small { white-space: normal; }
.responsive-table .status-cell small { white-space: normal; overflow-wrap: anywhere; }
.responsive-table td.num .cell { align-items: flex-end; }
.responsive-table td.num .cell small { white-space: nowrap; }
.responsive-table .cell strong, .responsive-table .cell small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#clients-table td.num .cell small { white-space: normal; display: block; }
#clients-table .cell small { display: block; overflow: visible; }
.responsive-table .row-actions { flex-wrap: wrap; gap: 4px; }
@container (max-width: 720px) {
  .responsive-table table, .responsive-table tbody { display: block; }
  .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .responsive-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; padding: 16px; border-top: 1px solid var(--border); }
  .responsive-table tbody td { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: auto; min-width: 0; padding: 0; border: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .responsive-table td::before { content: attr(data-label); font-size: 12px; font-weight: 400; color: var(--muted); }
  .responsive-table td:first-child, .responsive-table td.actions { grid-column: 1 / -1; }
  .responsive-table td.actions { padding-top: 10px; border-top: 1px solid var(--border); }
  .responsive-table td.actions::before { display: none; }
  .responsive-table .cell, .responsive-table .truncate, .responsive-table .status-cell small { max-width: 100% !important; }
  .responsive-table .truncate { white-space: normal; overflow-wrap: anywhere; }
  .responsive-table td.num .cell { align-items: flex-start; }
  .responsive-table .row-actions { justify-content: flex-start; }
}
@container (max-width: 380px) {
  .responsive-table tbody tr { gap: 12px; }
  .responsive-table .badge { height: auto; min-height: 22px; white-space: normal; }
}
@media (max-width: 1180px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .kpis-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sidebar-close { display: inline-grid; position: absolute; right: 0; top: -3px; }
  .sidebar { width: min(288px, calc(100% - 40px)); }
  .nav-item { min-height: 42px; }
}
@media (max-width: 640px) {
  .overview-kpis { grid-template-columns: minmax(0, 1fr); }
  .overview-kpis .balance-card { display: flex; }
  .balance-card .balance-details { border-left: 0; border-top: 1px solid var(--border); padding: 12px 0 0; margin-top: 4px; }
  .kpis-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis-5 > :first-child { display: flex; }
  .kpis-5 > :first-child .kpi-foot { width: 100%; }
  .kpis-5 .kpi { padding: 16px; }
  .kpi-value { font-size: 23px; }
  .toolbar > .field-select { flex: 1 1 160px; width: auto; max-width: none; }
  .toolbar > .toolbar-end { width: auto; margin-left: auto; }
  .filter-extra > .field-control, .filter-extra > .control { flex-basis: 100%; }
  .btn { height: auto; min-height: 36px; padding-top: 7px; padding-bottom: 7px; white-space: normal; text-align: center; }
  .btn-sm { min-height: 34px; }
  .page-actions .btn { flex: 1 1 130px; }
  .dialog-footer .btn, .form-actions .btn { flex: 1 1 120px; }
  .toast { margin: 0; }
  .dialog-header { padding: 14px 16px; }
  .dialog-body { padding: 16px; }
  .dialog-footer { bottom: -16px; padding-bottom: 16px; margin-bottom: -16px; }
  .status-pill { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .incoming-chart { overflow: hidden; }
  input, select, textarea { font-size: 16px; }
  .withdrawal-fields { grid-template-columns: minmax(0, 1fr); }
}
