/* ===================================================================
   NIXX — Sistema de Gestão Financeira
   Tema escuro, responsivo (desktop + celular)
   =================================================================== */

:root {
  --bg:            #0a0a0b;
  --bg-elev:       #141416;
  --card:          #161618;
  --card-hover:    #1d1d20;
  --border:        #262629;
  --border-soft:   #1f1f22;

  --text:          #f4f4f5;
  --text-2:        #a1a1aa;
  --text-3:        #6b6b73;

  --brand:         #ff6a1a;
  --brand-soft:    rgba(255,106,26,.14);
  --green:         #22c55e;
  --green-soft:    rgba(34,197,94,.14);
  --red:           #ef4444;
  --red-soft:      rgba(239,68,68,.14);
  --blue:          #3b82f6;

  --radius:        16px;
  --radius-sm:     11px;
  --shadow:        0 8px 30px rgba(0,0,0,.35);
  --sidebar-w:     248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2a2e; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= LAYOUT ================= */
.app { display: flex; height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  z-index: 60;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 26px; }
.brand .logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(150deg, #1c1c1f, #0e0e10);
  border: 1px solid rgba(255,106,26,.35);
  box-shadow: 0 6px 16px rgba(255,106,26,.12);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 19px; letter-spacing: -1px;
}
.brand .logo span:first-child { color: #fff; }
.brand .logo .lx { color: var(--brand); margin-left: -3px; }

/* Tela de login: apenas a mini logo, um pouco maior */
.brand-solo { padding: 0 0 18px; justify-content: center; }
.brand-solo .logo { width: 56px; height: 56px; border-radius: 16px; font-size: 25px; }
.brand .name { font-size: 22px; font-weight: 800; letter-spacing: .5px; color: var(--text); }
.brand .name .ax { color: var(--brand); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: 12px;
  color: var(--text-2); font-size: 15px; font-weight: 500;
  position: relative; transition: background .15s, color .15s;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-item.active::before {
  content: ""; position: absolute; left: -16px; top: 20%; bottom: 20%;
  width: 4px; border-radius: 0 4px 4px 0; background: var(--brand);
}

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.mode-pill {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  color: var(--text); font-weight: 600; font-size: 14px; margin-bottom: 12px;
}
.mode-pill .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); display:grid; place-items:center; }
.mode-pill .dot svg { width: 15px; height: 15px; color: #fff; }
.mode-pill .chev { margin-left: auto; color: var(--text-3); }

/* ---------- Main ---------- */
.main { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }

/* Topbar */
.topbar { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.hello h1 { font-size: 27px; font-weight: 700; }
.hello p  { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.month-select {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 12px; font-weight: 500; font-size: 14px;
}
.month-select svg { width: 17px; height: 17px; color: var(--text-2); }
.month-select select {
  background: none; border: none; color: var(--text); font-weight: 500; font-size: 14px; cursor: pointer; outline: none;
}
.badge-ok {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--green); background: var(--green-soft);
  padding: 9px 14px; border-radius: 11px; font-size: 13px; font-weight: 600;
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--border); display: grid; place-items: center;
  color: var(--text-2); position: relative; background: var(--card);
}
.icon-btn:hover { color: var(--text); }
.icon-btn .dot-alert { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background:#333; }

.hamburger { display: none; }

/* ================= CARDS / GRID ================= */
.grid { display: grid; gap: 18px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card.pad-lg { padding: 24px; }

.stat-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 16px; }
.stat-icon svg { width: 22px; height: 22px; }
.i-green { background: var(--green-soft); color: var(--green); }
.i-red   { background: var(--red-soft);   color: var(--red); }
.i-brand { background: var(--brand-soft); color: var(--brand); }

.card .label { color: var(--text-2); font-size: 14px; display:flex; align-items:center; gap:8px; }
.card .value { font-size: 27px; font-weight: 700; margin: 8px 0 12px; letter-spacing: -.5px; }
.trend { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }
.card .sub { color: var(--text-3); font-size: 12.5px; margin-top: 3px; }
.eye { color: var(--text-3); cursor: pointer; display:inline-flex; }

/* Dica card */
.tip .value-tip { font-size: 14px; color: var(--text-2); line-height: 1.55; margin: 6px 0 14px; }
.tip b { color: var(--brand); }
.link-brand { color: var(--brand); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }

/* Banner positivo */
.banner {
  display: flex; align-items: center; gap: 22px;
  background: linear-gradient(90deg, rgba(34,197,94,.06), transparent 60%);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 26px; margin-bottom: 18px;
}
.banner .emoji {
  width: 66px; height: 66px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 30px;
  background: radial-gradient(circle, rgba(34,197,94,.28), rgba(34,197,94,.05));
  box-shadow: 0 0 30px rgba(34,197,94,.35);
}
.banner-text h2 { font-size: 22px; font-weight: 700; }
.banner-text h2 span { color: var(--green); }
.banner-text p { color: var(--text-2); font-size: 14px; margin-top: 5px; line-height: 1.5; }
.btn-outline {
  margin-left: auto; flex-shrink: 0;
  border: 1px solid var(--brand); color: var(--brand);
  padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-outline:hover { background: var(--brand-soft); }

/* Panel (bottom sections) */
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel-head h3 { font-size: 18px; font-weight: 600; }
.chip {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  border: 1px solid var(--border); padding: 6px 12px; border-radius: 9px;
}
.chip:hover { color: var(--brand); border-color: var(--brand); }
.chip.brand { color: var(--brand); border-color: rgba(255,106,26,.4); }

/* Lista de contas / movimentações */
.row-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.row-item:last-child { border-bottom: none; }
.row-ic { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; font-size: 15px; color:#fff; }
.row-main { flex: 1; min-width: 0; }
.row-main .t { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main .s { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.row-val { font-weight: 700; font-size: 14.5px; text-align: right; white-space: nowrap; }
.row-val .d { display:block; color: var(--text-3); font-weight: 500; font-size: 12px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.total-row { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--border); font-weight: 700; }
.total-row .lbl { color: var(--text-2); font-weight: 600; }
.total-row .v { font-size: 18px; }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { position: relative; width: 168px; height: 168px; flex-shrink: 0; }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .center small { color: var(--text-3); font-size: 12px; }
.donut .center b { display: block; font-size: 17px; margin-top: 2px; }
.legend { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 11px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.legend-item .lc { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-item .ln { color: var(--text-2); }
.legend-item .lp { margin-left: auto; font-weight: 600; }

.cta-wide {
  margin: 22px auto 0; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid var(--border); background: var(--card);
  padding: 15px 26px; border-radius: 13px; font-weight: 600; color: var(--text-2);
}
.cta-wide:hover { color: var(--brand); border-color: var(--brand); }

/* ================= BOTÕES / FORMULÁRIOS ================= */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 18px; border-radius: 11px; font-weight: 600; font-size: 14px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
}
.btn:hover { background: var(--card-hover); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #111; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); border-color: rgba(239,68,68,.4); }
.btn.danger:hover { background: var(--red-soft); }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 14px; }
.page-head h2 { font-size: 23px; font-weight: 700; }
.page-head p { color: var(--text-2); font-size: 14px; margin-top: 3px; }

/* Tabela de lançamentos */
.tx-list { display: flex; flex-direction: column; }
.tx-filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.seg button { padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.seg button.on { background: var(--brand-soft); color: var(--brand); }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--card);
  border: 1px solid var(--border); border-radius: 11px; padding: 0 14px; flex: 1; min-width: 180px;
}
.search svg { width: 16px; height: 16px; color: var(--text-3); }
.search input { flex: 1; background: none; border: none; outline: none; color: var(--text); padding: 11px 0; font-size: 14px; }

.tx-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--border-soft); }
.tx-row:hover { background: var(--card); border-radius: 10px; }
.tx-actions { display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.tx-row:hover .tx-actions { opacity: 1; }
.mini-btn { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--text-3); border: 1px solid transparent; }
.mini-btn:hover { border-color: var(--border); color: var(--text); }
.mini-btn.del:hover { color: var(--red); border-color: rgba(239,68,68,.4); }

.empty { text-align: center; color: var(--text-3); padding: 60px 20px; }
.empty svg { width: 46px; height: 46px; margin-bottom: 14px; opacity: .5; }

/* ================= MODAL ================= */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
  display: none; place-items: center; z-index: 100; padding: 20px;
}
.overlay.open { display: grid; }
.modal {
  width: 100%; max-width: 440px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 18px; padding: 24px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal h3 { font-size: 19px; font-weight: 700; margin-bottom: 20px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 7px; font-weight: 500; }
.field input, .field select {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  color: var(--text); padding: 12px 14px; border-radius: 11px; font-size: 14.5px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--brand); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.type-toggle { display: flex; gap: 10px; margin-bottom: 18px; }
.type-toggle button {
  flex: 1; padding: 12px; border-radius: 11px; border: 1px solid var(--border);
  color: var(--text-2); font-weight: 600; font-size: 14px;
}
.type-toggle button.on-income { background: var(--green-soft); color: var(--green); border-color: rgba(34,197,94,.4); }
.type-toggle button.on-expense { background: var(--red-soft); color: var(--red); border-color: rgba(239,68,68,.4); }
.modal-actions { display: flex; gap: 12px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }

/* Entrada suave dos modais */
@keyframes modalPop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.overlay.open .modal { animation: modalPop .18s ease-out; }

/* Modal de confirmação */
.modal-confirm { max-width: 384px; text-align: center; }
.modal-confirm h3 { margin-bottom: 8px; }
.confirm-icon {
  width: 54px; height: 54px; border-radius: 50%; margin: 2px auto 16px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.confirm-icon svg { width: 26px; height: 26px; }
.modal-confirm.is-danger .confirm-icon { background: var(--red-soft); color: var(--red); }
.confirm-msg { color: var(--text-2); font-size: 14px; line-height: 1.55; margin: 0 auto; max-width: 300px; }
.modal-confirm .modal-actions { justify-content: center; }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-solid:hover { background: var(--red); filter: brightness(1.08); }
.color-picker { display: flex; gap: 9px; flex-wrap: wrap; }
.color-picker .sw { width: 30px; height: 30px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.color-picker .sw.on { border-color: #fff; }

/* Reports */
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 220px; padding: 10px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; justify-content: flex-end; height: 100%; }
.bar { width: 60%; max-width: 46px; border-radius: 8px 8px 0 0; display: flex; flex-direction: column; justify-content: flex-end; min-height: 4px; }
.bar-col small { color: var(--text-3); font-size: 12px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  padding: 13px 22px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow); z-index: 200; transition: transform .3s; display:flex; align-items:center; gap:10px;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast svg { width: 18px; height: 18px; color: var(--green); }

.hide { display: none !important; }

/* ================= RESPONSIVO (CELULAR) ================= */
.scrim { display: none; }

@media (max-width: 1100px) {
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-3 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  body { overflow: auto; }
  .app { display: block; height: auto; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: var(--shadow); height: 100vh;
  }
  .sidebar.open { transform: translateX(0); }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; }
  .scrim.open { display: block; }
  .main { height: auto; padding: 16px 15px 90px; }
  .hamburger {
    display: grid; place-items: center; width: 42px; height: 42px;
    border-radius: 11px; border: 1px solid var(--border); background: var(--card); color: var(--text);
  }
  .hamburger svg { width: 22px; height: 22px; }
  .topbar { align-items: center; }
  .hello h1 { font-size: 21px; }
  .hello p { display: none; }
  .cards-4 { grid-template-columns: 1fr; }
  .month-select { padding: 9px 12px; }
  .topbar-actions .icon-btn.help { display: none; }
  .banner { flex-direction: column; text-align: center; align-items: center; }
  .btn-outline { margin-left: 0; }
  .donut-wrap { justify-content: center; }
}

@media (max-width: 420px) {
  .hello h1 { font-size: 18px; }
  .badge-ok { display: none; }
}

/* ================= TELA DE BLOQUEIO ================= */
.lock {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(255,106,26,.08), transparent), var(--bg);
  overflow-y: auto;
}
.lock-card {
  width: 100%; max-width: 384px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 20px; padding: 36px 30px 26px;
  box-shadow: var(--shadow);
}
.lock-head { text-align: center; margin-bottom: 26px; }
.lock-title { font-size: 21px; font-weight: 700; letter-spacing: .2px; margin: 0 0 7px; }
.lock-sub { color: var(--text-3); font-size: 13px; line-height: 1.5; max-width: 250px; margin: 0 auto; }
.lock-error { color: var(--red); font-size: 13px; min-height: 18px; margin: 4px 0 8px; text-align: center; }
.lock-foot {
  color: var(--text-3); font-size: 11.5px; text-align: center; line-height: 1.5;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border-soft);
}
.auth-switch { text-align: center; color: var(--text-2); font-size: 13.5px; margin-top: 18px; }
.auth-switch a { color: var(--brand); font-weight: 600; cursor: pointer; }
.auth-switch a:hover { text-decoration: underline; }

.pw-field { position: relative; }
.pw-field input { padding-right: 44px !important; }
.pw-toggle {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  color: var(--text-3); font-size: 15px; transition: color .15s;
}
.pw-toggle:hover { color: var(--text-2); }
.pw-toggle:hover { color: var(--text); }
.lock .field input[type="file"] {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  color: var(--text-2); padding: 10px 12px; border-radius: 11px; font-size: 13px;
}

/* ================= MENU DE ESPAÇOS (PESSOAL/EMPRESA) ================= */
.space-menu {
  display: none;
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px);
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); z-index: 80;
}
.space-menu.open { display: block; }
.space-menu button {
  display: block; width: 100%; text-align: left;
  padding: 12px 16px; font-size: 14px; font-weight: 500; color: var(--text-2);
}
.space-menu button:hover { background: var(--card); color: var(--text); }

/* ================= RESERVA (BARRA DE PROGRESSO) ================= */
.progress {
  height: 12px; background: var(--border-soft); border-radius: 8px; overflow: hidden;
}
.progress i {
  display: block; height: 100%; border-radius: 8px;
  background: linear-gradient(90deg, var(--green), #4FD1E8);
  transition: width .4s ease;
}
.progress-info {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 10px; font-size: 13.5px; color: var(--text-2); flex-wrap: wrap;
}

/* ================= TAGS (TRANSFERÊNCIA / NATUREZA) ================= */
.tag-transfer {
  display: inline-block; font-size: 11px; font-weight: 600;
  color: var(--blue); background: rgba(59,130,246,.14);
  padding: 2px 8px; border-radius: 6px; margin-left: 6px; vertical-align: middle;
}
.tag-nature {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px; margin-left: 6px; vertical-align: middle;
}
.tag-nature.fixo     { color: #f59e0b; background: rgba(245,158,11,.14); }
.tag-nature.variavel { color: #8b5cf6; background: rgba(139,92,246,.14); }
.tag-nature.receita  { color: var(--green); background: var(--green-soft); }

/* Botão de transferência no modal */
.type-toggle button.on-transfer {
  background: rgba(59,130,246,.14); color: var(--blue); border-color: rgba(59,130,246,.4);
}
