:root {
  --bg: #0b1220;
  --panel: #0f1a30;
  --card: #101f3a;
  --line: #1c2b4a;
  --text: #e8eefc;
  --muted: #a9b7d8;
  --primary: #5b8cff;
  --danger: #ff5b6b;
  --ok: #34d399;
  --warn: #fbbf24;
  --shadow: 0 14px 40px rgba(0, 0, 0, .35);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(91, 140, 255, .25), transparent 55%),
    radial-gradient(800px 500px at 90% 0%, rgba(52, 211, 153, .14), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(11, 18, 32, .65);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 12px;
  /* Suaviza o fundo branco da imagem */
  transition: transform 0.3s ease;
}

.logo-img--large {
  width: 180px;
  height: 180px;
  border-radius: 40px;
  /* Arredonda para parecer um ícone de app */
  filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.4));
  margin-bottom: 20px;
}

.login-logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
}

.brand-group:hover .logo-img {
  transform: scale(1.1) rotate(-5deg);
}

.brand {
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #fff 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 19px;
}

.subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px
}

.topbar__left {
  display: flex;
  flex-direction: column
}

.topbar__select {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  cursor: pointer;
  outline: none;
  padding: 0;
  font-family: inherit;
}

.topbar__select:hover {
  color: var(--text);
}

.topbar__select option {
  background-color: var(--bg);
  color: var(--text);
}

.topbar__right {
  display: flex;
  gap: 10px
}

.view {
  padding-top: 10px
}

.card {
  background: rgba(16, 31, 58, .92);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.authCard {
  max-width: 420px;
  margin: 50px auto;
  padding: 20px
}

.h1 {
  margin: 0 0 6px 0;
  font-size: 24px
}

.muted {
  margin: 0 0 16px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.label {
  font-size: 12px;
  color: var(--muted)
}

.input {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .10);
  color: var(--text);
  outline: none;
}

.input:focus {
  border-color: rgba(91, 140, 255, .55);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, .12);
}

/* Correção para dropdowns (select/option) */
select.input option {
  background-color: var(--card);
  color: var(--text);
}

.btn {
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.btn:hover {
  border-color: rgba(255, 255, 255, .22)
}

.btn--primary {
  background: rgba(91, 140, 255, .22);
  border-color: rgba(91, 140, 255, .55)
}

.btn--danger {
  background: rgba(255, 91, 107, .16);
  border-color: rgba(255, 91, 107, .55)
}

.btn--ghost {
  background: transparent
}

.iconBtn {
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 18px
}

.hint {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
  margin-top: 4px
}

.contextBar {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(16, 31, 58, .55);
  backdrop-filter: blur(10px);
}

.row {
  display: flex;
  gap: 14px;
  align-items: end
}

.row--gap {
  gap: 10px;
  align-items: center
}

.col {
  flex: 1
}

.col--right {
  display: flex;
  justify-content: flex-end
}

.segmented {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .10);
  padding: 6px;
  border-radius: 14px;
}

.segmented__btn {
  padding: 8px 10px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented__btn--active {
  background: rgba(91, 140, 255, .22);
  color: var(--text);
}

.balances {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.balanceCard {
  padding: 14px
}

.balanceCard__label {
  color: var(--muted);
  font-size: 12px
}

.balanceCard__value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 6px
}

.balanceCard__meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px
}

.balanceCard--highlight {
  border-color: rgba(91, 140, 255, .45);
  background: rgba(91, 140, 255, .15);
}

.panel {
  margin-top: 14px
}

.calendar {
  padding: 14px;
}

.calendarHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.calendarHeader__title {
  font-weight: 800
}

.calendarGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.dow {
  color: var(--muted);
  font-size: 12px;
  text-align: center
}

.dayCell {
  min-height: 86px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .03);
  cursor: pointer;
}

.dayCell:hover {
  border-color: rgba(255, 255, 255, .18)
}

.dayCell--weekend {
  background: rgba(91, 140, 255, .05);
  border-color: rgba(91, 140, 255, .12);
}

.dayCell--prediction {
  border-style: dashed;
  border-color: rgba(91, 140, 255, .35);
  background: rgba(91, 140, 255, .02);
}

.dow--weekend {
  color: var(--primary);
  font-weight: 700;
}

.dayNum {
  font-size: 12px;
  color: var(--muted)
}

.daySum {
  margin-top: 8px;
  font-weight: 800
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted)
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%
}

.dot--neg {
  background: var(--danger)
}

.dot--pos {
  background: var(--ok)
}

.dot--prediction {
  background: var(--primary);
  box-shadow: 0 0 5px var(--primary);
}

.dot--neu {
  background: rgba(255, 255, 255, .35)
}

.ledger {
  padding: 14px;
}

.ledgerHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  padding: 10px 8px;
  text-align: left;
  font-size: 13px;
}

.table th {
  color: var(--muted);
  font-weight: 600
}

.trClickable {
  cursor: pointer
}

.amountPos {
  color: var(--ok);
  font-weight: 700
}

.amountNeg {
  color: var(--danger);
  font-weight: 700
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
}

.modal__content {
  position: relative;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow: auto;
  background: rgba(16, 31, 58, .98);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.modal__content--wide {
  width: min(900px, 94vw)
}

.modal__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px
}

.modal__title {
  font-weight: 800;
  flex: 1
}

#btnModalBack {
  font-size: 20px;
  padding: 4px 8px;
  margin-left: -8px
}

#btnModalBack:hover {
  background: rgba(255, 255, 255, .08);
  border-radius: 8px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0 12px 0;
  flex-wrap: wrap
}

.tabs__btn {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  cursor: pointer;
}

.tabs__btn--active {
  color: var(--text);
  border-color: rgba(91, 140, 255, .55);
  background: rgba(91, 140, 255, .16)
}

.tabPanel {
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .03)
}

.kv {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 10px;
  align-items: center
}

.hr {
  height: 1px;
  background: rgba(255, 255, 255, .08);
  margin: 12px 0
}

@media (max-width: 900px) {
  .balances {
    grid-template-columns: 1fr
  }

  .row {
    flex-direction: column;
    align-items: stretch
  }

  .kv {
    grid-template-columns: 1fr
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 10px 14px;
  }

  .brand {
    font-size: 14px;
  }

  .topbar__select {
    font-size: 11px;
    max-width: 140px;
  }

  .container {
    padding: 12px;
  }

  .balances {
    grid-template-columns: 1fr 1fr;
  }

  .contextBar .row {
    flex-direction: column;
    gap: 15px;
  }

  .segmented {
    width: 100%;
  }

  .segmented__btn {
    flex: 1;
    text-align: center;
  }

  .table thead {
    display: none;
  }

  .table tr {
    display: block;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
  }

  .table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    padding: 6px 0;
    text-align: right;
  }

  .table td::before {
    content: attr(data-label);
    font-weight: bold;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    margin-right: 15px;
  }
}

@media (max-width: 480px) {
  .balances {
    grid-template-columns: 1fr;
  }

  .topbar__right {
    gap: 5px;
  }

  .btn--ghost {
    padding: 6px 8px;
    font-size: 12px;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  /* Ajuste para o calendário em telas muito pequenas */
  .calendar__day {
    min-height: 60px;
    font-size: 12px;
  }
}

/* Toast System */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
  animation: toastIn 0.3s ease forwards;
  backdrop-filter: blur(10px);
}

.toast--hide {
  animation: toastOut 0.3s ease forwards;
}

.toast__icon {
  width: 24px;
  height: 24px;
  background: #4ade80;
  color: #064e3b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(50px);
  }
}

.dayEventsList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.dayEventItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
}

.dayEventItem__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dayEventItem__title {
  font-weight: 700;
  font-size: 14px;
}

.dayEventItem__meta {
  font-size: 12px;
  color: var(--muted);
}

.dayEventItem__amount {
  font-weight: 800;
  font-size: 15px;
}