/* ============================================================================
   FOCUS — COMPONENTES
============================================================================ */

/* ────────────────────────────────────────────────────────────────────────
   BOTÕES
──────────────────────────────────────────────────────────────────────── */
.btn {
  --btn-h: 40px;
  --btn-px: var(--sp-4);
  --btn-bg: var(--surface);
  --btn-color: var(--text);
  --btn-border: var(--border);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: var(--btn-h);
  padding: 0 var(--btn-px);
  border-radius: var(--radius-md);
  background: var(--btn-bg);
  color: var(--btn-color);
  border: 1px solid var(--btn-border);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-snug);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur-base) var(--ease);
  transform: translateZ(0);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  transition-duration: var(--dur-fast);
}

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

.btn--primary {
  --btn-bg: var(--accent);
  --btn-color: var(--accent-contrast);
  --btn-border: var(--accent);
}
.btn--primary:hover:not(:disabled) {
  --btn-bg: var(--accent-hover);
  --btn-border: var(--accent-hover);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
}
.btn--ghost:hover:not(:disabled) {
  --btn-bg: var(--surface-hi);
}

.btn--danger {
  --btn-bg: transparent;
  --btn-color: var(--danger);
  --btn-border: var(--danger-muted);
}
.btn--danger:hover:not(:disabled) {
  --btn-bg: var(--danger-muted);
}

.btn--sm  { --btn-h: 32px; --btn-px: var(--sp-3); font-size: var(--fs-xs); }
.btn--lg  { --btn-h: 48px; --btn-px: var(--sp-5); font-size: var(--fs-base); }

.btn--block { width: 100%; }
.btn--icon  { width: var(--btn-h); padding: 0; }

/* ────────────────────────────────────────────────────────────────────────
   INPUTS
──────────────────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1-5);
}

.field__label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.field__hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.field__error {
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: var(--sp-1);
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--text);
  transition: all var(--dur-base) var(--ease);
}

/*
 * Mobile (iOS especificamente) faz zoom automático ao focar inputs com
 * font-size < 16px. Forçamos 16px em telas pequenas pra evitar isso.
 * Aplica a todos os campos editáveis: .input, .form-input, .select, textarea.
 */
@media (max-width: 768px) {
  .input,
  .form-input,
  .select,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="date"],
  input[type="search"],
  input[type="url"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

.input::placeholder {
  color: var(--text-faint);
}

.input:hover {
  border-color: var(--border-strong);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-muted);
  outline: none;
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

textarea.input {
  height: auto;
  min-height: 96px;
  padding: var(--sp-3) var(--sp-4);
  resize: vertical;
  line-height: var(--lh-normal);
}

/* ────────────────────────────────────────────────────────────────────────
   CARD
──────────────────────────────────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  transition: all var(--dur-base) var(--ease);
}

.card--elevated {
  box-shadow: var(--shadow-md);
}

.card--hover {
  cursor: pointer;
}

.card--hover:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.card__title {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
}

.card__value {
  font-family: var(--font-mono);
  font-size: var(--fs-3xl);
  font-weight: 400;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.card__value--xl {
  font-size: var(--fs-4xl);
}

.card__footer {
  margin-top: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ────────────────────────────────────────────────────────────────────────
   BADGE / CHIP / PILL
──────────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 22px;
  padding: 0 var(--sp-2);
  font-size: var(--fs-3xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  border-radius: var(--radius-full);
  background: var(--surface-hi);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.badge--success { background: var(--success-muted); color: var(--success); border-color: transparent; }
.badge--warning { background: var(--warning-muted); color: var(--warning); border-color: transparent; }
.badge--danger  { background: var(--danger-muted);  color: var(--danger);  border-color: transparent; }
.badge--info    { background: var(--info-muted);    color: var(--info);    border-color: transparent; }
.badge--accent  { background: var(--accent-muted);  color: var(--accent);  border-color: transparent; }

/* Dot separator */
.badge__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ────────────────────────────────────────────────────────────────────────
   DIVIDER
──────────────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  width: 100%;
  margin: var(--sp-4) 0;
}

.divider--vertical {
  width: 1px;
  height: auto;
  align-self: stretch;
  margin: 0 var(--sp-4);
}

/* ────────────────────────────────────────────────────────────────────────
   TOAST
──────────────────────────────────────────────────────────────────────── */
#toast-host {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 400px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  color: var(--text);
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  animation: toast-in var(--dur-base) var(--ease-bounce);
  transform-origin: bottom right;
}

.toast--success { border-left: 3px solid var(--success); }
.toast--danger  { border-left: 3px solid var(--danger); }
.toast--warning { border-left: 3px solid var(--warning); }
.toast--info    { border-left: 3px solid var(--info); }

.toast.out {
  animation: toast-out var(--dur-base) var(--ease) forwards;
}

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

@keyframes toast-out {
  to { transform: translateX(20px) scale(0.95); opacity: 0; }
}

/* ────────────────────────────────────────────────────────────────────────
   LOADING (spinner + skeleton)
──────────────────────────────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--text-faint);
  border-top-color: var(--accent);
  animation: spin 600ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-hi);
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border) 50%,
    transparent
  );
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ────────────────────────────────────────────────────────────────────────
   MODAL
──────────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  animation: fade-in var(--dur-base) var(--ease);
  /* Se o modal + padding exceder a viewport, o backdrop também rola */
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modal-in var(--dur-slow) var(--ease);
  transition: all var(--dur-base) var(--ease);
  /* Limita altura — conteúdo rola internamente */
  max-height: calc(100vh - var(--sp-8));
  max-height: calc(100dvh - var(--sp-8));
  display: flex;
  flex-direction: column;
}

.modal--sm { max-width: 400px; }
.modal--md { max-width: 540px; }
.modal--lg { max-width: 720px; }

.modal__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 500;
  letter-spacing: var(--tracking-snug);
}

.modal__header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal__body {
  padding: var(--sp-6);
  overflow-y: auto;
  overflow-x: hidden;
  /* Scroll interno — cresce até o teto, depois scrolla */
  flex: 1 1 auto;
  min-height: 0;
}

.modal__footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  background: var(--surface-low);
  flex-shrink: 0;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ────────────────────────────────────────────────────────────────────────
   TABLE
──────────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-low);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  font-size: var(--fs-3xs);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
}

.table tbody tr:hover {
  background: var(--surface-hi);
}

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

/* ────────────────────────────────────────────────────────────────────────
   EMPTY STATE
──────────────────────────────────────────────────────────────────────── */
.empty {
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  color: var(--text-muted);
}

.empty__title {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  color: var(--text);
  margin-bottom: var(--sp-2);
  letter-spacing: var(--tracking-snug);
}

.empty__desc {
  font-size: var(--fs-sm);
  max-width: 40ch;
  margin: 0 auto;
}

/* ────────────────────────────────────────────────────────────────────────
   UTILITIES COMUNS
──────────────────────────────────────────────────────────────────────── */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap, var(--sp-4));
}

.row {
  display: flex;
  align-items: center;
  gap: var(--gap, var(--sp-3));
}

.row--between { justify-content: space-between; }
.row--end     { justify-content: flex-end; }

.grid { display: grid; gap: var(--gap, var(--sp-4)); }

.text-dim   { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }

.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

.fs-xs { font-size: var(--fs-xs); }
.fs-sm { font-size: var(--fs-sm); }
.fs-lg { font-size: var(--fs-lg); }

/* ────────────────────────────────────────────────────────────────────────
   SEGMENTED CONTROL (tabs/filters)
──────────────────────────────────────────────────────────────────────── */
.segment {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-hi);
  border-radius: var(--radius-md);
  gap: 2px;
  border: 1px solid var(--border);
}

.segment__btn {
  padding: 6px var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-dim);
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition: all var(--dur-base) var(--ease);
  background: transparent;
  border: none;
  white-space: nowrap;
}

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

.segment__btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ────────────────────────────────────────────────────────────────────────
   PROGRESS BAR
──────────────────────────────────────────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--surface-low);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width var(--dur-slower) var(--ease);
  transform-origin: left;
}

.progress__fill--success { background: var(--success); }
.progress__fill--warning { background: var(--warning); }
.progress__fill--danger  { background: var(--danger); }

/* ────────────────────────────────────────────────────────────────────────
   CHECKBOX / SWITCH
──────────────────────────────────────────────────────────────────────── */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-sm);
}

.checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  position: relative;
  cursor: pointer;
  transition: all var(--dur-base) var(--ease);
}

.checkbox input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid var(--accent-contrast);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  transition: background var(--dur-base) var(--ease);
  cursor: pointer;
}

.switch__slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: var(--surface);
  border-radius: 50%;
  transition: transform var(--dur-base) var(--ease);
  box-shadow: var(--shadow-xs);
}

.switch input:checked + .switch__slider {
  background: var(--accent);
}

.switch input:checked + .switch__slider::before {
  transform: translateX(16px);
}

/* ────────────────────────────────────────────────────────────────────────
   SELECT custom
──────────────────────────────────────────────────────────────────────── */
.select {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%236b6964' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M3 5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--sp-4) center;
  padding-right: var(--sp-8);
  transition: all var(--dur-base) var(--ease);
}

.select:hover { border-color: var(--border-strong); }

.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-muted);
}

/* ────────────────────────────────────────────────────────────────────────
   FORM ROW (2 colunas lado a lado)
──────────────────────────────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

@media (max-width: 520px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ────────────────────────────────────────────────────────────────────────
   PAGE TOOLBAR (filtros + ações)
──────────────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.toolbar__search {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.toolbar__search .input {
  padding-left: var(--sp-10);
  height: 40px;
}

.toolbar__search::before {
  content: "";
  position: absolute;
  left: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6964' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='M21 21l-4.35-4.35'/></svg>");
  background-repeat: no-repeat;
  pointer-events: none;
}

.toolbar__spacer { flex: 1; min-width: 8px; }

/* ────────────────────────────────────────────────────────────────────────
   ATTACHMENTS (anexos de comprovantes)
──────────────────────────────────────────────────────────────────────── */
.attach-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  transition: background var(--dur-base) var(--ease);
}
.attach-item + .attach-item { margin-top: 2px; }
.attach-item:hover { background: var(--surface-hi); }

.attach-item__icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--accent-muted);
  color: var(--accent);
}

.attach-item__main { min-width: 0; }

.attach-item__name {
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attach-item__meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.attach-item__actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

/* ────────────────────────────────────────────────────────────────────────
   SPLIT ROWS (múltiplas formas de pagamento)
──────────────────────────────────────────────────────────────────────── */
.split-row {
  display: grid;
  grid-template-columns: 140px 1fr 140px 32px;
  gap: var(--sp-2);
  align-items: center;
}

.split-row .input,
.split-row .select {
  height: 40px;
  font-size: var(--fs-sm);
}

@media (max-width: 640px) {
  .split-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "amount  remove"
      "wallet  wallet"
      "date    date";
    gap: var(--sp-2);
    padding: var(--sp-3);
    background: var(--surface-low);
    border-radius: var(--radius-md);
  }
  .split-row [data-split-amount] { grid-area: amount; }
  .split-row [data-split-wallet] { grid-area: wallet; }
  .split-row [data-split-date]   { grid-area: date; }
  .split-row [data-split-remove] { grid-area: remove; justify-self: end; }
}

/* ────────────────────────────────────────────────────────────────────────
   TX FORM (grid do modal de lançamento)
   Normal: 1 coluna.
   Com .is-recurring: 2 colunas (main esquerda, recurring direita,
   footer full-width).
──────────────────────────────────────────────────────────────────────── */
.tx-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.tx-form__main {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.tx-form__recurring {
  /* oculta/mostra via JS */
}

.tx-form__recurring-inner {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--surface-low);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  height: 100%;
}

.tx-form__recurring-title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 500;
  letter-spacing: var(--tracking-snug);
  color: var(--text);
  margin-bottom: var(--sp-1);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.tx-form__footer {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ── Modo 2 colunas ── */
.tx-form.is-recurring {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "main    recurring"
    "footer  footer";
  gap: var(--sp-5);
  align-items: stretch;
}

.tx-form.is-recurring .tx-form__main      { grid-area: main; }
.tx-form.is-recurring .tx-form__recurring { grid-area: recurring; }
.tx-form.is-recurring .tx-form__footer    { grid-area: footer; }

/* ── Mobile: sempre 1 coluna ── */
@media (max-width: 720px) {
  .tx-form.is-recurring {
    display: flex;
    flex-direction: column;
  }
}

/* ────────────────────────────────────────────────────────────────────────
   MOBILE — ajustes do modal e forms em tela pequena
──────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Modal ocupa quase a tela toda com padding menor */
  .modal-backdrop {
    padding: var(--sp-2);
  }

  .modal {
    max-height: calc(100vh - var(--sp-4));
    max-height: calc(100dvh - var(--sp-4));
    border-radius: var(--radius-lg);
  }

  .modal__header {
    padding: var(--sp-4) var(--sp-5);
  }

  .modal__body {
    padding: var(--sp-4) var(--sp-5);
  }

  .modal__footer {
    padding: var(--sp-3) var(--sp-5);
  }

  /* Form-row sempre 1 coluna em mobile (antes era 520px, sobe pra 640) */
  .form-row {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
  }

  /* Toolbar empilha */
  .toolbar {
    padding: var(--sp-3);
  }

  /* Segmented control em telas estreitas: overflow horizontal em vez de quebrar */
  .segment {
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
  }
  .segment::-webkit-scrollbar { display: none; }
}

/* ────────────────────────────────────────────────────────────────────────
   TX MODE SELECTOR — 3 cards: Único / Parcelado / Fixo
──────────────────────────────────────────────────────────────────────── */
.tx-wizard {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.tx-mode {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-2);
}

.tx-mode__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--dur-base) var(--ease);
  text-align: center;
  position: relative;
}

.tx-mode__card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hi);
}

.tx-mode__card.active {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--accent-contrast, var(--text));
}

.tx-mode__card.active::before {
  content: "";
  position: absolute;
  top: var(--sp-2);
  right: var(--sp-2);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.tx-mode__icon {
  color: var(--text-dim);
  transition: color var(--dur-base) var(--ease);
}

.tx-mode__card.active .tx-mode__icon {
  color: var(--accent);
}

.tx-mode__label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-md);
  letter-spacing: var(--tracking-snug);
}

.tx-mode__desc {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.3;
}

.tx-block {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

@media (max-width: 640px) {
  .tx-mode {
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }
  .tx-mode__card {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    padding: var(--sp-3);
  }
  .tx-mode__icon { flex-shrink: 0; }
  .tx-mode__label { font-size: var(--fs-sm); }
  .tx-mode__desc { font-size: 11px; }
}

/* Input small — usado em filtros de data inline */
.input--sm {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-sm);
  height: 32px;
}
