/* =====================================================================
   NIXX · Financeiro Onix — visual
   Escuro com laranja. Tudo via variáveis (tokens) no :root.
   ===================================================================== */
:root {
  --bg: #08080a;
  --bg-2: #0e0e11;
  --card: #131317;
  --card-2: #18181d;
  --line: #24242b;
  --line-2: #2e2e36;
  --txt: #f5f5f7;
  --txt-2: #a3a3ad;
  --txt-3: #6e6e78;
  --brand: #ff6a1a;
  --brand-2: #ff8a3d;
  --brand-soft: rgba(255, 106, 26, .13);
  --green: #2bd576;
  --green-soft: rgba(43, 213, 118, .12);
  --red: #ff4d5e;
  --red-soft: rgba(255, 77, 94, .12);
  --yellow: #ffc23d;
  --yellow-soft: rgba(255, 194, 61, .12);
  --blue: #5aa2ff;
  --r: 20px;
  --r-sm: 12px;
  --gap: 16px;
  --nav-h: 72px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--txt);
  -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.45;
  background-image: radial-gradient(900px 500px at 85% -10%, rgba(255,106,26,.10), transparent 60%),
                    radial-gradient(700px 400px at -10% 110%, rgba(255,106,26,.05), transparent 60%);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.muted { color: var(--txt-2); }
.faint { color: var(--txt-3); }
.pos { color: var(--green); } .neg { color: var(--red); } .warn { color: var(--yellow); }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 380px; padding: 32px 28px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01)), var(--card);
  border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.5);
  animation: rise .5s ease both;
}
.auth-card h1 { font-size: 22px; font-weight: 700; margin: 18px 0 4px; }
.auth-card p.sub { color: var(--txt-2); font-size: 14px; margin-bottom: 22px; }
.logo {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: #141418; border: 1px solid var(--line-2); font-weight: 800; font-size: 21px; letter-spacing: -2px;
  box-shadow: 0 0 0 6px rgba(255,106,26,.06), 0 10px 30px rgba(255,106,26,.15);
}
.logo b { color: var(--brand); }
.logo { white-space: nowrap; }
.ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.ic svg, .icon-btn svg, .bottom svg, .btn svg { display: block; }
.logo.sm { width: 36px; height: 36px; border-radius: 11px; font-size: 15px; box-shadow: none; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--txt-2); margin-bottom: 6px; font-weight: 500; }
.input, .select, textarea.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--bg-2); border: 1px solid var(--line-2); outline: none; transition: border .15s, box-shadow .15s;
}
textarea.input { height: 76px; padding: 12px 14px; resize: none; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input.big { height: 60px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }
.link { color: var(--brand-2); font-size: 13.5px; font-weight: 500; }

.btn {
  height: 44px; padding: 0 18px; border-radius: 13px; font-weight: 600; font-size: 14.5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--card-2); transition: transform .08s, background .15s, border .15s;
}
.btn:hover { border-color: #3a3a44; background: #1d1d23; }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-color: transparent; color: #1a0a00; box-shadow: 0 8px 24px rgba(255,106,26,.28); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.block { width: 100%; height: 48px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--txt-2); }
.btn.ghost:hover { color: var(--txt); background: rgba(255,255,255,.04); }
.btn.ok { background: var(--green-soft); border-color: transparent; color: var(--green); }
.btn.danger { background: var(--red-soft); border-color: transparent; color: var(--red); }
.btn[disabled] { opacity: .6; pointer-events: none; }

/* ---------- casca do app ---------- */
.shell { max-width: 1180px; margin: 0 auto; padding: 18px 20px calc(var(--nav-h) + 40px); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand .t1 { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand .t2 { font-size: 12px; color: var(--txt-3); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.month {
  display: inline-flex; align-items: center; gap: 2px; padding: 4px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
}
.month button { width: 32px; height: 32px; border-radius: 10px; color: var(--txt-2); font-size: 18px; }
.month button:hover { background: rgba(255,255,255,.05); color: var(--txt); }
.month span { min-width: 128px; text-align: center; font-weight: 600; font-size: 14px; text-transform: capitalize; }
.icon-btn { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); color: var(--txt-2); position: relative; }
.icon-btn:hover { color: var(--txt); border-color: var(--line-2); }
.dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px var(--card); }

.tabs { display: flex; gap: 6px; margin-bottom: 22px; }
.tab { padding: 9px 16px; border-radius: 12px; color: var(--txt-2); font-weight: 500; font-size: 14px; }
.tab:hover { color: var(--txt); background: rgba(255,255,255,.03); }
.tab.on { color: var(--txt); background: var(--card); border: 1px solid var(--line); }
.tab-add { margin-left: auto; }

.page { animation: fade .35s ease both; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.page-sub { color: var(--txt-2); font-size: 14px; margin-bottom: 20px; }

/* ---------- cartões ---------- */
.grid { display: grid; gap: var(--gap); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0)), var(--card);
  border: 1px solid var(--line); border-radius: var(--r); padding: 20px; position: relative; overflow: hidden;
}
.card h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card .head .link { font-size: 13px; }
.stagger > * { animation: rise .45s ease both; }
.stagger > *:nth-child(2) { animation-delay: .05s; } .stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .15s; } .stagger > *:nth-child(5) { animation-delay: .2s; }

/* destaque do mês */
.hero {
  padding: 24px; border-radius: 24px; margin-bottom: var(--gap); position: relative; overflow: hidden;
  background: radial-gradient(600px 220px at 100% 0%, rgba(255,106,26,.22), transparent 60%),
              linear-gradient(180deg, #17171c, #111115);
  border: 1px solid #2c2c33;
}
.hero .lbl { color: var(--txt-2); font-size: 13.5px; font-weight: 500; }
.hero .big { font-size: 44px; font-weight: 800; margin: 4px 0 6px; letter-spacing: -.035em; }
.hero .cmp { font-size: 13.5px; color: var(--txt-2); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.chip.pos { background: var(--green-soft); } .chip.neg { background: var(--red-soft); } .chip.warn { background: var(--yellow-soft); }
.chip.gray { background: rgba(255,255,255,.06); color: var(--txt-2); }
.hero-row { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-end; }
.flow { flex: 1; min-width: 260px; max-width: 460px; }
.flow .bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; display: flex; margin: 8px 0; }
.flow .bar i { display: block; height: 100%; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.flow .legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--txt-2); }

.kpi .lbl { color: var(--txt-2); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi .val { font-size: 25px; font-weight: 700; margin: 8px 0 2px; }
.kpi .sub { font-size: 12.5px; color: var(--txt-3); }
.kpi .ic { width: 30px; height: 30px; }
.ic.g { background: var(--green-soft); color: var(--green); } .ic.r { background: var(--red-soft); color: var(--red); }
.ic.o { background: var(--brand-soft); color: var(--brand); } .ic.b { background: rgba(90,162,255,.12); color: var(--blue); }
.ic.y { background: var(--yellow-soft); color: var(--yellow); }

/* alertas */
.alerts { display: grid; gap: 10px; }
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.alert .ic { flex: none; }
.alert b { font-weight: 600; font-size: 14px; display: block; }
.alert small { color: var(--txt-2); font-size: 12.5px; }
.alert.grave { border-color: rgba(255,77,94,.35); background: linear-gradient(90deg, rgba(255,77,94,.08), transparent 70%), var(--bg-2); }
.alert.atencao { border-color: rgba(255,194,61,.28); }
.empty { text-align: center; padding: 26px 10px; color: var(--txt-2); font-size: 14px; }
.empty .e-ic { font-size: 26px; margin-bottom: 8px; }

/* listas */
.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .av { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 15px; flex: none; }
.row .main { flex: 1; min-width: 0; }
.row .main b { display: block; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .main small { color: var(--txt-3); font-size: 12.5px; }
.row .amt { text-align: right; font-weight: 700; font-size: 15px; white-space: nowrap; }
.row .amt small { display: block; font-weight: 500; font-size: 12px; color: var(--txt-3); }
.row.click { cursor: pointer; border-radius: 12px; }
.row.click:hover { background: rgba(255,255,255,.025); }
.day { font-size: 12px; font-weight: 600; color: var(--txt-3); text-transform: uppercase; letter-spacing: .06em; padding: 16px 4px 6px; }
.tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.tag.prev { background: var(--yellow-soft); color: var(--yellow); }
.tag.late { background: var(--red-soft); color: var(--red); }

/* barras de categoria */
.cat { margin-bottom: 14px; }
.cat:last-child { margin-bottom: 0; }
.cat .t { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; margin-bottom: 6px; }
.cat .t span:first-child { display: flex; gap: 8px; align-items: center; }
.cat .track { height: 8px; border-radius: 99px; background: rgba(255,255,255,.05); overflow: hidden; }
.cat .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); width: 0; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.cat .fill.g { background: linear-gradient(90deg, #1fb866, var(--green)); }

.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 180px; }

/* filtros */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.pill { padding: 7px 13px; border-radius: 99px; font-size: 13px; font-weight: 500; background: var(--card); border: 1px solid var(--line); color: var(--txt-2); }
.pill.on { color: var(--txt); border-color: var(--brand); background: var(--brand-soft); }
.search { flex: 1; min-width: 180px; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .2s ease both; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border: 1px solid var(--line-2); border-radius: 24px; padding: 22px; animation: rise .3s ease both; }
.modal h2 { font-size: 19px; font-weight: 700; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); margin-bottom: 16px; }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg button { height: 38px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--txt-2); }
.seg button.on { background: var(--card-2); color: var(--txt); box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.seg button.on.in { color: var(--green); } .seg button.on.out { color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips button { padding: 7px 12px; border-radius: 99px; font-size: 13px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--txt-2); }
.chips button.on { border-color: var(--brand); color: var(--txt); background: var(--brand-soft); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions .btn { flex: 1; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px); transform: translateX(-50%); background: #1f1f25; border: 1px solid var(--line-2); padding: 11px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: rise .25s ease both; }

/* menu de baixo (celular) */
.bottom { display: none; }

.skeleton { height: 18px; border-radius: 8px; background: linear-gradient(90deg, #17171c, #202027, #17171c); background-size: 200% 100%; animation: shimmer 1.2s infinite; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 960px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .shell { padding: 14px 16px calc(var(--nav-h) + 30px); }
  .tabs { display: none; }
  .brand .t2 { display: none; }
  .month span { min-width: 96px; font-size: 13px; }
  .hero { padding: 20px; }
  .hero .big { font-size: 36px; }
  .kpi .val { font-size: 21px; }
  .card { padding: 16px; }
  .bottom {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: rgba(12,12,15,.92); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); z-index: 40;
  }
  .bottom button { display: grid; justify-items: center; gap: 3px; font-size: 11px; color: var(--txt-3); }
  .bottom button.on { color: var(--brand); }
  .bottom button i { font-style: normal; font-size: 19px; display: grid; place-items: center; }
  .bottom .fab i { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; margin-top: -26px;
    background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #1a0a00; font-size: 26px; box-shadow: 0 10px 26px rgba(255,106,26,.4); }
  .overlay { place-items: end center; padding: 0; }
  .modal { border-radius: 24px 24px 0 0; max-height: 92vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

.cat .t span:last-child { white-space: nowrap; }
@media (max-width: 680px) {
  .brand > div:last-child { display: none; }
  .top-actions { gap: 6px; }
  .icon-btn { width: 38px; height: 38px; border-radius: 12px; }
  .month span { min-width: 0; padding: 0 2px; white-space: nowrap; }
  .month button { width: 28px; }
}
@media (max-width: 680px) {
  .btn.pay { width: 38px; padding: 0; }
  .btn.pay .lbl { display: none; }
  .row .amt { font-size: 14px; }
}
