/* FlashDePix Web — design system. Grafite/carvão com acento "ember"
   (laranja-vermelho), tipografia monoespaçada tabular para números. */

@font-face {
  font-family: "Mono Ledger";
  src: url("/static/fonts/DejaVuSansMono.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --ink: #14100f;
  --char: #241f1d;
  --char-2: #2c2624;
  --paper: #f6f1ec;
  --ember: #ff5a2b;
  --ember-soft: #ffb27a;
  --rise: #2fbf71;
  --fall: #ef4565;
  --amber: #f0a83c;

  --bg: var(--ink);
  --bg-elevated: var(--char);
  --bg-elevated-2: var(--char-2);
  --border: #3a332f;
  --text: #f3ece5;
  --text-muted: #a99d94;
  --text-faint: #766a63;
  --accent: var(--ember);
  --accent-soft: var(--ember-soft);
  --danger-bg: #3a1720;
  --danger-text: #ff8ba0;
  --success-bg: #16351f;
  --success-text: #7be495;
  --warning-bg: #3a2f14;
  --warning-text: #ffcf6a;
  --info-bg: #142a3a;
  --info-text: #7fc4ff;
  --shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: var(--paper);
    --bg-elevated: #fffdfb;
    --bg-elevated-2: #efe7e0;
    --border: #e2d8cf;
    --text: #201a17;
    --text-muted: #6f645c;
    --text-faint: #a4988f;
    --shadow: 0 16px 32px -18px rgba(60, 40, 20, 0.25);
  }
}
:root[data-theme="dark"] {
  --bg: var(--ink);
  --bg-elevated: var(--char);
  --bg-elevated-2: var(--char-2);
  --border: #3a332f;
  --text: #f3ece5;
  --text-muted: #a99d94;
  --text-faint: #766a63;
  --shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.6);
}
:root[data-theme="light"] {
  --bg: var(--paper);
  --bg-elevated: #fffdfb;
  --bg-elevated-2: #efe7e0;
  --border: #e2d8cf;
  --text: #201a17;
  --text-muted: #6f645c;
  --text-faint: #a4988f;
  --shadow: 0 16px 32px -18px rgba(60, 40, 20, 0.25);
}

* { box-sizing: border-box; }
html {
  height: 100%;
  background: var(--bg);
  overscroll-behavior-y: none;
}
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}
body {
  min-height: 100%;
  overscroll-behavior-y: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { text-wrap: balance; margin: 0; }
.num {
  font-family: "Mono Ledger", ui-monospace, "SF Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------- app shell ---------- */
.app-frame {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

header.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem 0.9rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; flex-direction: column; line-height: 1.05; text-decoration: none; color: inherit; }
.brand .wordmark {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.brand .wordmark .flash { color: var(--accent); }
.brand .tagline {
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 0.15rem;
}
.header-icons { display: flex; gap: 0.5rem; }
.icon-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  text-decoration: none;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

main.app-main {
  flex: 1;
  padding: 1.15rem 1.25rem 6.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ---------- flash messages ---------- */
.flash { padding: 0.6rem 0.8rem; border-radius: 10px; font-size: 0.9rem; }
.flash.success { background: var(--success-bg); color: var(--success-text); }
.flash.danger { background: var(--danger-bg); color: var(--danger-text); }
.flash.warning { background: var(--warning-bg); color: var(--warning-text); }
.flash.info { background: var(--info-bg); color: var(--info-text); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  border-radius: 22px;
  padding: 1.5rem 1.4rem 1.4rem;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--ember) 32%, transparent), transparent 60%),
    linear-gradient(155deg, var(--bg-elevated) 0%, var(--bg-elevated-2) 100%);
  border: 1px solid var(--border);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 220px; height: 220px;
  background: radial-gradient(circle, color-mix(in srgb, var(--ember-soft) 55%, transparent) 0%, transparent 70%);
  filter: blur(2px);
  pointer-events: none;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.hero-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); }
.hero-period {
  font-size: 0.7rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 40%, transparent);
}
.hero-figure { margin-top: 0.7rem; display: flex; align-items: baseline; gap: 0.4rem; position: relative; z-index: 1; }
.hero-figure .currency { font-size: 1.2rem; color: var(--text-muted); font-weight: 600; }
.hero-figure .amount { font-size: 2.3rem; font-weight: 500; letter-spacing: -0.01em; }
.hero-sub { margin-top: 0.35rem; font-size: 0.82rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; position: relative; z-index: 1; }
.hero-sub .up { color: var(--rise); font-weight: 700; }
.hero-sub .down { color: var(--fall); font-weight: 700; }
.hero-note {
  margin-top: 1rem;
  font-size: 0.72rem;
  color: var(--text-faint);
  position: relative;
  z-index: 1;
  border-top: 1px dashed var(--border);
  padding-top: 0.7rem;
}

/* ---------- metrics grid ---------- */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.metric { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 14px; padding: 0.85rem 0.9rem; }
.metric .m-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-faint); display: flex; align-items: center; gap: 0.35rem; }
.metric .m-label .swatch { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.metric .m-value { margin-top: 0.4rem; font-size: 1.1rem; font-weight: 500; }
.metric .m-count { font-size: 0.72rem; color: var(--text-faint); margin-top: 0.15rem; }

/* ---------- panel / chart ---------- */
.panel { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 16px; padding: 1.1rem 1.1rem 0.9rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.65rem; }
.panel-title { font-size: 0.92rem; font-weight: 600; }
.panel-head .legend { display: flex; gap: 0.7rem; font-size: 0.68rem; color: var(--text-faint); }
.legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.legend i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-days { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 0.35rem; }
.chart-days span { font-size: 0.65rem; color: var(--text-faint); text-align: center; }

/* ---------- transactions ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head h2 { font-size: 0.95rem; font-weight: 600; }
.section-head a { font-size: 0.76rem; color: var(--accent); text-decoration: none; font-weight: 600; }

.tx-list { display: flex; flex-direction: column; gap: 0.55rem; }
.tx-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  text-decoration: none;
  color: inherit;
}
.tx-icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tx-icon.in { background: color-mix(in srgb, var(--rise) 18%, transparent); color: var(--rise); }
.tx-icon.out { background: color-mix(in srgb, var(--fall) 16%, transparent); color: var(--fall); }
.tx-icon svg { width: 17px; height: 17px; }
.tx-mid { min-width: 0; }
.tx-title { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { margin-top: 0.15rem; font-size: 0.72rem; color: var(--text-faint); display: flex; align-items: center; gap: 0.4rem; }
.badge { font-size: 0.63rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.12rem 0.45rem; border-radius: 999px; font-weight: 700; }
.badge.paid { background: color-mix(in srgb, var(--rise) 20%, transparent); color: var(--rise); }
.badge.pending { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.badge.error { background: color-mix(in srgb, var(--fall) 20%, transparent); color: var(--fall); }
.tx-amount { text-align: right; }
.tx-amount .val { font-size: 0.92rem; font-weight: 600; white-space: nowrap; }
.tx-amount .val.in { color: var(--rise); }
.tx-amount .val.out { color: var(--fall); }
.tx-amount .unit { display: block; font-size: 0.65rem; color: var(--text-faint); text-align: right; margin-top: 0.1rem; }
.empty-note { font-size: 0.85rem; color: var(--text-faint); padding: 1rem 0; }

/* ---------- bottom nav ---------- */
nav.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr 64px 1fr 1fr;
  align-items: end;
  padding: 0.6rem 0.6rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
@media (min-width: 481px) {
  nav.bottom-nav { max-width: 480px; margin: 0 auto; right: auto; left: 50%; transform: translateX(-50%); }
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-faint);
  font-size: 0.62rem;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 0.3rem 0 0.1rem;
  text-decoration: none;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active { color: var(--accent); }
.fab-slot { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.fab-label { font-size: 0.62rem; color: var(--accent); font-weight: 600; }
.fab {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(155deg, var(--ember-soft), var(--ember) 65%);
  box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--ember) 65%, transparent);
  border: 3px solid var(--bg);
  transform: translateY(-16px);
  color: #1a0d05;
  cursor: pointer;
  text-decoration: none;
}
.fab svg { width: 24px; height: 24px; }

@media (prefers-reduced-motion: no-preference) {
  .fab { transition: transform 0.15s ease; }
  .fab:active { transform: translateY(-16px) scale(0.94); }
  .icon-btn, .nav-item { transition: color 0.15s ease, background 0.15s ease; }
}
.icon-btn:focus-visible, .nav-item:focus-visible, .fab:focus-visible, .section-head a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- cards / forms (telas que ainda nao usam o app-shell) ---------- */
.card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem; }
label { display: block; margin: 0.9rem 0 0.3rem; font-size: 0.9rem; color: var(--text-muted); }
input[type=email], input[type=password], input[type=text], input[type=number], input[type=tel], select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
  font-size: 1rem;
}
button, .btn {
  margin-top: 1.2rem;
  width: 100%;
  padding: 0.7rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #1a0d05;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--accent-soft); }
.errors { color: var(--danger-text); font-size: 0.8rem; margin-top: 0.2rem; }
.field-hint, .pix-hint { font-size: 0.78rem; color: var(--text-faint); margin: 0.2rem 0 0; }
.footer-link { margin-top: 1rem; font-size: 0.9rem; text-align: center; }
.tx-id {
  font-family: "Mono Ledger", ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
  margin: 0.2rem 0 1.1rem;
}
.status-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; }
.status-pendente { background: var(--warning-bg); color: var(--warning-text); }
.status-aprovado { background: var(--success-bg); color: var(--success-text); }
.status-rejeitado, .status-bloqueado { background: var(--danger-bg); color: var(--danger-text); }
