/* ============================================================
   AFEX PAY — Design System (dark-native)
   ============================================================ */

:root {
  /* Brand */
  --afex-orange: #FF5A00;
  --afex-orange-2: #FF7A33;
  --green: #22C55E;
  --red: #EF4444;
  --amber: #F59E0B;
  --blue: #3B82F6;
  --violet: #8B5CF6;

  /* Surfaces (dark) */
  --bg: #050505;
  --bg-2: #0A0A0A;
  --surface: #111111;
  --surface-2: #1A1A1A;
  --surface-3: #232323;

  /* Lines */
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.18);

  /* Text */
  --ink: #FAFAFA;
  --ink-soft: rgba(255, 255, 255, 0.64);
  --ink-faint: rgba(255, 255, 255, 0.42);
  --ink-ghost: rgba(255, 255, 255, 0.26);

  /* Accent washes */
  --accent: var(--afex-orange);
  --accent-wash: rgba(255, 90, 0, 0.13);
  --accent-line: rgba(255, 90, 0, 0.38);
  --green-wash: rgba(34, 197, 94, 0.13);
  --red-wash: rgba(239, 68, 68, 0.13);
  --amber-wash: rgba(245, 158, 11, 0.14);
  --blue-wash: rgba(59, 130, 246, 0.14);
  --violet-wash: rgba(139, 92, 246, 0.14);

  /* Radii */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 8px 30px rgba(0,0,0,0.45);
  --shadow-lg: 0 24px 70px rgba(0,0,0,0.6);

  /* Typography */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;

  /* Layout */
  --sidebar-w: 252px;
  --topbar-h: 64px;

  /* Density (overridden by tweaks) */
  --density: 1;
}

/* Light theme (tweak toggle) */
[data-theme="light"] {
  --bg: #F6F6F4;
  --bg-2: #EFEFEC;
  --surface: #FFFFFF;
  --surface-2: #F4F4F2;
  --surface-3: #ECECE9;
  --line: rgba(5, 5, 5, 0.08);
  --line-2: rgba(5, 5, 5, 0.13);
  --line-strong: rgba(5, 5, 5, 0.2);
  --ink: #0A0A0A;
  --ink-soft: rgba(10, 10, 10, 0.66);
  --ink-faint: rgba(10, 10, 10, 0.46);
  --ink-ghost: rgba(10, 10, 10, 0.3);
  --shadow: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-lg: 0 24px 70px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
}

#root { height: 100%; }

::selection { background: var(--accent-wash); color: var(--ink); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: content-box; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; margin: 0; }

.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ===== Utility ===== */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center { align-items: center; justify-content: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.gap-20 { gap: 20px; } .gap-24 { gap: 24px; } .gap-32 { gap: 32px; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.tnum { font-variant-numeric: tabular-nums; }

/* ===== Card ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: calc(22px * var(--density)); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.01em;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--afex-orange-2); box-shadow: 0 6px 20px rgba(255,90,0,0.3); }
.btn-ghost { background: var(--surface-2); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn-subtle { background: transparent; color: var(--ink-soft); }
.btn-subtle:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--red-wash); color: var(--red); border-color: rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Badge ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { color: var(--green); background: var(--green-wash); }
.badge-red { color: var(--red); background: var(--red-wash); }
.badge-amber { color: var(--amber); background: var(--amber-wash); }
.badge-blue { color: var(--blue); background: var(--blue-wash); }
.badge-violet { color: var(--violet); background: var(--violet-wash); }
.badge-orange { color: var(--accent); background: var(--accent-wash); }
.badge-gray { color: var(--ink-soft); background: var(--surface-2); border-color: var(--line); }

/* ===== Inputs ===== */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-soft); letter-spacing: -0.01em; }
.input {
  height: 44px; padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--ink); font-size: 14.5px;
  transition: all .15s ease; width: 100%;
}
.input::placeholder { color: var(--ink-ghost); }
.input:focus { outline: none; border-color: var(--accent-line); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-wash); }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; min-height: 90px; }
.input-affix { position: relative; }
.input-affix .affix { position: absolute; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 14px; }
.input-affix .affix-l { left: 14px; } .input-affix .affix-r { right: 14px; }
.input-affix .input { padding-left: 34px; }

/* ===== Table ===== */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding: 0 16px 12px; white-space: nowrap;
}
.tbl td { padding: 14px 16px; border-top: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.tbl tbody tr { transition: background .12s ease; cursor: default; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.clickable { cursor: pointer; }

/* ===== Misc ===== */
.kpi-label { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.kpi-value { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; }
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }

.divider { height: 1px; background: var(--line); width: 100%; }
.vdivider { width: 1px; background: var(--line); align-self: stretch; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 500; color: var(--ink-soft);
  transition: all .14s ease;
}
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip.active { background: var(--accent-wash); color: var(--accent); border-color: var(--accent-line); }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid transparent; color: var(--ink-soft);
  transition: all .14s ease;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-family: var(--font-display); font-weight: 600;
  color: #fff; flex-shrink: 0;
}

.tag-method {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 500;
}

.section-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.03em; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }

/* progress */
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* fade/scale entrance — neutralized: this render context can freeze CSS
   animations at frame 0, so content wrappers must rest in their final state.
   Hover/focus transitions (which use `transition`, not `animation`) are unaffected. */
.fade-up { opacity: 1; }
.fade-in { opacity: 1; }

/* skeleton shimmer for QR etc not needed */

/* Focus ring for a11y */
.btn:focus-visible, .iconbtn:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* responsive helpers */
.hide-mobile { }
.show-mobile, .show-mobile-fixed { }
/* theme-aware wordmark swap */
.wm-for-light { display: none !important; }
[data-theme="light"] .wm-for-dark { display: none !important; }
[data-theme="light"] .wm-for-light { display: block !important; }
@keyframes slideIn { from { transform: translateX(40px); } to { transform: none; } }

@media (max-width: 900px) {
  :root { --sidebar-w: 248px; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: inline-flex !important; }
  .sidebar { position: fixed !important; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .mobile-nav-open .sidebar { transform: translateX(0); }
  main { padding: 20px 16px 50px !important; }
  .kpi-grid, .bal-grid, .chart-grid { grid-template-columns: 1fr !important; }
  .auth-grid { grid-template-columns: 1fr !important; }
  .onb-grid { grid-template-columns: 1fr !important; }
  .onb-body { padding: 28px 20px !important; }
}
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
/* Phones: stack any multi-field form row so inputs go full-width (onboarding,
   modals, config). Without this, 3–4 fields side by side get cramped (UF/CEP). */
@media (max-width: 600px) {
  .row:has(> .field) { flex-direction: column; align-items: stretch; gap: 14px; }
  .row:has(> .field) > .field { flex: 1 1 auto !important; width: 100%; }
}
