/* ─────────────────────────────────────────────────────────────
   KamiWallet — Auth & App pages (login, register, dashboard)
   Reusa tokens do styles.css. Dark-only.
   ───────────────────────────────────────────────────────────── */

/* ──────────────────────────────────────────────────────────
   AUTH PAGES (login / register)
   ────────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(env(safe-area-inset-top), 24px) 24px max(env(safe-area-inset-bottom), 24px);
  position: relative;
  z-index: 1;
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(17,17,20,0.97) 0%, rgba(12,12,16,0.97) 100%);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: clamp(28px, 5vw, 44px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.025) inset,
    0 32px 80px -20px rgba(0,0,0,0.7),
    0 0 140px -40px rgba(94, 106, 210, 0.4);
  overflow: hidden;
  animation: card-in 0.55s cubic-bezier(0.22,1,0.36,1) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 0%, rgba(94, 106, 210, 0.18), transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,0.035) 0%, transparent 30%);
  pointer-events: none;
}

.auth-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(94, 106, 210, 0.5) 50%, transparent 100%);
}

.auth-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.auth-brand-logo {
  height: 26px; width: auto;
  filter: invert(1);
}
.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-soft);
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
}
.auth-brand-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.auth-heading { display: flex; flex-direction: column; gap: 8px; }
.auth-heading h1 {
  font-size: clamp(22px, 4vw, 28px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--white);
}
.auth-heading p { font-size: 14px; color: var(--gray-2); line-height: 1.6; }

.auth-divider { height: 1px; background: var(--border); }

/* Form */
.form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-row { display: flex; align-items: center; justify-content: space-between; }
.field label {
  color: var(--gray-2);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.field input {
  width: 100%;
  padding: 13px 14px;
  background: rgba(var(--on-surface-rgb), 0.02);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--white);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--gray-3); }
.field input:focus {
  border-color: var(--accent-line);
  background: rgba(var(--on-surface-rgb), 0.04);
  box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.18);
}
.field input:invalid:not(:placeholder-shown) {
  border-color: rgba(248,113,113,0.4);
}

.input-with-action { position: relative; }
.input-with-action input { padding-right: 44px; }
.input-action {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 8px;
  color: var(--gray-2);
  cursor: pointer;
}
.input-action:hover { color: var(--white); background: rgba(var(--on-surface-rgb), 0.04); }

.checkbox {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--gray-2);
  cursor: pointer; user-select: none;
}
.checkbox input { accent-color: var(--accent); width: 16px; height: 16px; }

.link-muted { color: var(--gray-2); font-size: 13px; }
.link-muted:hover { color: var(--white); }

.btn-discord {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: var(--discord, #5865f2);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  box-shadow: 0 14px 28px -12px rgba(88,101,242,0.6);
  font-family: inherit;
}
.btn-discord:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-discord:active { transform: none; filter: brightness(0.96); }
.btn-discord svg { width: 18px; height: 14px; flex-shrink: 0; }

/* Override do .btn-primary do styles.css pra ser largura total nas páginas auth */
.auth-card .btn-primary {
  width: 100%;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  font-size: 14.5px;
  border-radius: var(--r-md);
}
.auth-card .btn-primary::after { display: none; }

.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  display: none;
  animation: btn-spin 0.8s linear infinite;
}
.btn-primary.is-loading .btn-label { opacity: 0; }
.btn-primary.is-loading .btn-spinner { display: inline-block; position: absolute; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

.form-error {
  margin: 4px 0 0 0;
  padding: 10px 12px;
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--r-sm);
  color: var(--ban);
  font-size: 13px;
}

.divider-or {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0;
  color: var(--gray-3);
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.divider-or::before, .divider-or::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.auth-foot {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--gray-2);
}
.auth-foot a { color: var(--accent-soft); }
.auth-foot a:hover { color: var(--white); }

.auth-note {
  font-size: 11.5px;
  color: var(--gray-4);
  line-height: 1.6;
  text-align: center;
}
.auth-note a {
  color: var(--gray-3);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-note a:hover { color: var(--white); }

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 13px;
  color: var(--gray-3);
  transition: color 150ms;
}
.auth-back:hover { color: var(--white); }
.auth-back svg { transition: transform 150ms; }
.auth-back:hover svg { transform: translateX(-2px); }


/* ──────────────────────────────────────────────────────────
   APP (dashboard) — layout mobile-first
   ────────────────────────────────────────────────────────── */

.app-page {
  display: flex; flex-direction: column;
  min-height: 100dvh;
  padding-bottom: max(env(safe-area-inset-bottom), 32px);
}

.topbar {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 12px;
  padding: max(env(safe-area-inset-top), 14px) 18px 12px;
  background: rgba(8, 9, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  display: inline-flex; align-items: center; gap: 9px;
  justify-self: center;
  font-weight: 600; letter-spacing: -0.01em;
  font-size: 15px;
}
.topbar-logo { height: 22px; width: auto; filter: invert(1); }

.iconbtn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: var(--r-md);
  color: var(--white);
  cursor: pointer;
  transition: background 150ms;
}
.iconbtn:hover { background: rgba(var(--on-surface-rgb), 0.04); }

.iconbtn-sm {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: var(--gray-2);
  cursor: pointer;
}
.iconbtn-sm:hover { color: var(--white); background: rgba(var(--on-surface-rgb), 0.04); }

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 13px; font-weight: 700;
  border: 1px solid var(--accent-line);
  letter-spacing: -0.01em;
  cursor: pointer;
}

.app-shell {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 28px;
  padding: 20px var(--pad) 36px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

/* Saldo */
.balance { display: flex; flex-direction: column; gap: 14px; }
.balance-row { display: flex; align-items: center; gap: 8px; }
.balance-label { color: var(--gray-2); font-size: 14px; font-weight: 500; }
.chip {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  color: var(--accent-soft);
  font-size: 12.5px; font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
}
.chip:hover { background: rgba(94, 106, 210, 0.18); }
.balance-amount {
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--white);
}
.balance-delta {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-soft);
  font-size: 13px;
  font-weight: 500;
}

/* Card Conta */
.account-card {
  position: relative;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(94, 106, 210, 0.10), transparent 55%),
    linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex; flex-direction: column;
  gap: 18px;
  overflow: hidden;
}
.account-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(94, 106, 210, 0.4) 50%, transparent 100%);
}
.account-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.account-title {
  margin: 0;
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--white);
}
.account-sub {
  margin: 4px 0 0; color: var(--gray-2); font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.account-sub .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.badge-mono {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: rgba(var(--on-surface-rgb), 0.03);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  color: var(--gray-2);
  font-size: 11.5px; font-weight: 500;
  font-family: var(--mono);
  cursor: pointer;
}
.badge-mono:hover { color: var(--white); border-color: var(--border-3); }

.account-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.account-grid .text-right { text-align: right; }
.kpi-label {
  display: block;
  color: var(--gray-2);
  font-size: 11.5px;
  margin-bottom: 5px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.kpi-value {
  display: block;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.kpi-value.pos { color: var(--ok-2); }
.kpi-value.neg { color: var(--ban); }
.kpi-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px;
  margin-top: 5px;
  color: var(--gray-2);
}
.kpi-delta.pos { color: var(--ok-2); }
.kpi-delta.neg { color: var(--ban); }
.kpi-delta::before {
  content: ""; width: 11px; height: 11px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: inline-block;
}

.account-icon {
  display: flex; justify-content: center; align-items: center;
}
.account-icon img { width: 44px; height: 44px; object-fit: contain; }

.account-limit { display: flex; flex-direction: column; gap: 8px; }
.limit-row { display: flex; justify-content: space-between; align-items: baseline; }
.limit-row > .kpi-label { margin-bottom: 0; }
.limit-value { color: var(--white); font-size: 13px; }
.limit-value b { color: var(--accent-soft); font-weight: 600; }
.limit-bar {
  height: 4px;
  background: rgba(var(--on-surface-rgb), 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.limit-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width .4s ease;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Quick actions */
.quickactions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.qa {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 8px;
  background: rgba(var(--on-surface-rgb), 0.02);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--white);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 150ms, background 150ms;
}
.qa:hover {
  border-color: var(--border-3);
  background: rgba(var(--on-surface-rgb), 0.04);
}
.qa-icon {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-dim);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  color: var(--accent-soft);
}

/* Atividade */
.section-head {
  display: flex; justify-content: space-between; align-items: center;
}
.section-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--white);
}
.link-accent {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent-soft);
  font-size: 13px; font-weight: 500;
}
.link-accent:hover { color: var(--white); }

.activity-list {
  list-style: none;
  margin: 14px 0 0; padding: 0;
  display: flex; flex-direction: column;
}
.activity-empty {
  padding: 24px; text-align: center;
  color: var(--gray-2);
  font-size: 13.5px;
  background: rgba(var(--on-surface-rgb), 0.02);
  border: 1px dashed var(--border-2);
  border-radius: var(--r-md);
}

.activity-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.activity-item:last-child { border-bottom: 0; }

.activity-icon {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(var(--on-surface-rgb), 0.03);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--accent-soft);
}
.activity-icon.pos { color: var(--ok-2); border-color: rgba(16,185,129,0.18); background: rgba(16,185,129,0.06); }
.activity-icon.neg { color: var(--ban); border-color: rgba(248,113,113,0.18); background: rgba(248,113,113,0.06); }
.activity-title { font-weight: 500; font-size: 14px; color: var(--white); letter-spacing: -0.005em; }
.activity-sub { color: var(--gray-2); font-size: 12px; margin-top: 2px; }
.activity-amount { font-weight: 600; font-size: 14px; text-align: right; letter-spacing: -0.01em; }
.activity-amount.pos { color: var(--ok-2); }
.activity-amount.neg { color: var(--ban); }
.activity-date { color: var(--gray-3); font-size: 11.5px; margin-top: 2px; text-align: right; font-family: var(--mono); }

@media (min-width: 720px) {
  .balance-amount { font-size: 56px; }
}
