:root {
  --bg-1: #fff8ef;
  --bg-2: #eefcff;
  --bg-3: #f6f0ff;
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(255, 255, 255, 0.45);
  --ink: #18324b;
  --ink-soft: #58718a;
  --teal: #14b8a6;
  --blue: #3b82f6;
  --pink: #ec4899;
  --violet: #8b5cf6;
  --orange: #fb923c;
  --yellow: #facc15;
  --green: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 22px 45px rgba(40, 60, 120, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 212, 128, 0.42), transparent 28%),
    radial-gradient(circle at 90% 15%, rgba(96, 165, 250, 0.25), transparent 24%),
    radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.18), transparent 22%),
    linear-gradient(140deg, var(--bg-1), var(--bg-2) 48%, var(--bg-3));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(18px);
  z-index: -1;
  opacity: 0.55;
}

body::before {
  width: 240px;
  height: 240px;
  background: rgba(20, 184, 166, 0.18);
  top: 8%;
  left: -50px;
}

body::after {
  width: 300px;
  height: 300px;
  background: rgba(139, 92, 246, 0.16);
  right: -80px;
  bottom: 8%;
}

.container {
  padding: 72px 16px 36px;
  max-width: 980px;
  margin: auto;
}

h2,
h3 {
  color: #17324d;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  padding: 16px;
  border-radius: 22px;
  margin-top: 12px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), transparent 38%);
  pointer-events: none;
}

.card-balance {
  border-top: 4px solid var(--green);
}

.card-card {
  border-top: 4px solid var(--violet);
}

.card-chart {
  border-top: 4px solid var(--blue);
}

.card-projection {
  border-top: 4px solid var(--orange);
}

.card-history {
  border-top: 4px solid var(--teal);
}

.card-forecast-form {
  border-top: 4px solid var(--pink);
}

.card-forecast-list {
  border-top: 4px solid var(--yellow);
}

.card-forecast-history {
  border-top: 4px solid var(--teal);
}

.card-sms-import {
  border-top: 4px solid var(--blue);
  padding: 14px;
}

.card-card-history {
  border-top: 4px solid var(--violet);
}

.card-config {
  border-top: 4px solid var(--blue);
}

.page {
  display: none;
}

.active {
  display: block;
}

#menu {
  position: fixed;
  left: -280px;
  top: 0;
  width: 264px;
  height: 100%;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid rgba(255, 255, 255, 0.48);
  transition: .3s;
  padding: 24px 20px;
  z-index: 40;
  box-shadow: 12px 0 24px rgba(15, 23, 42, 0.14);
}

#menu h3 {
  margin-top: 0;
  color: var(--ink-soft);
}

#menu a {
  display: block;
  margin: 10px 0;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 16px;
  transition: .2s ease;
}

#menu a:hover {
  background: rgba(59, 130, 246, 0.10);
  transform: translateX(4px);
}

#menu a.active-link {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(20, 184, 166, 0.18));
  color: #12304a;
  font-weight: 700;
}

#menuBtn,
#userBtn {
  position: fixed;
  top: 12px;
  font-size: 24px;
  cursor: pointer;
  z-index: 50;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: var(--ink);
  width: auto;
  box-shadow: 0 12px 22px rgba(23, 50, 77, 0.14);
}

#menuBtn {
  left: 10px;
}

#userBtn {
  right: 10px;
}

input,
textarea,
select,
button {
  width: 100%;
  padding: 12px 14px;
  margin-top: 8px;
  border-radius: 14px;
  border: 1px solid rgba(186, 207, 228, 0.72);
  font-size: 15px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

input::placeholder {
  color: #7b8da1;
}

textarea::placeholder {
  color: #7b8da1;
}

input:focus,
textarea:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(59, 130, 246, 0.28);
  outline-offset: 1px;
}

label {
  margin-top: 10px;
  display: block;
  font-size: 14px;
  color: var(--ink-soft);
}

button {
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
}

.inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-row-space {
  justify-content: space-between;
}

.inline-label {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  white-space: nowrap;
}

.no-margin {
  margin: 0;
}

.grow {
  flex: 1;
}

.mt-8 {
  margin-top: 8px;
}

.mt-12 {
  margin-top: 12px;
}

.mb-8 {
  margin-bottom: 8px;
}

.soft-text {
  color: var(--ink-soft);
  line-height: 1.6;
}

.helper-text {
  margin-top: 8px;
  color: #36597a;
  font-size: 13px;
  line-height: 1.6;
}

.history-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.filter-col label {
  margin-top: 0;
}

.input-with-btn {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-btn input {
  flex: 1;
}

textarea {
  resize: vertical;
  min-height: 118px;
  line-height: 1.55;
}

.sms-import-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.sms-import-toggle:hover {
  transform: none;
  filter: none;
}

.sms-import-toggle-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sms-import-toggle-icon {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #60a5fa, #14b8a6);
  color: white;
  font-size: 18px;
  box-shadow: 0 12px 20px rgba(59, 130, 246, 0.18);
}

.sms-import-toggle-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sms-import-toggle-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.sms-import-toggle-subtitle {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.sms-import-toggle-indicator {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
}

.sms-import-body {
  padding-top: 12px;
}

.sms-textarea-wrap {
  position: relative;
  margin-top: 8px;
}

.sms-textarea-wrap textarea {
  margin-top: 0;
  padding-right: 56px;
}

.sms-paste-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  margin-top: 0;
  padding: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 10px 18px rgba(24, 50, 75, 0.12);
  z-index: 2;
}

.input-with-btn .calcBtn {
  width: 50px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #dbeafe, #c7d2fe);
  color: #1e3a8a;
  border: 1px solid rgba(191, 219, 254, 0.9);
  flex-shrink: 0;
}

.btnPix {
  background: linear-gradient(135deg, #7dd3fc, #2dd4bf);
  color: #093c44;
  border: none;
  border-radius: 14px;
  font-weight: 700;
}

.btnCartao {
  background: linear-gradient(135deg, #c084fc, #f472b6);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
}

.btnPay {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
}

.btnEdit {
  background: linear-gradient(135deg, #fcd34d, #fb923c);
  color: #422006;
  border: none;
  border-radius: 12px;
  font-weight: 700;
}

.btnDel {
  background: linear-gradient(135deg, #fb7185, #ef4444);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 700;
}

.btnGhost {
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

.btnInfo {
  background: linear-gradient(135deg, #60a5fa, #14b8a6);
  color: white;
  border: none;
  font-weight: 700;
}

.btnSmall {
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  width: auto;
}

.danger-btn {
  background: linear-gradient(135deg, #fb7185, #ef4444);
  color: white;
  border: none;
  font-weight: 700;
}

.pay-button-wide {
  min-width: 148px;
  width: auto;
}

.barra-bg {
  background: rgba(203, 213, 225, 0.42);
  border-radius: 999px;
  padding: 5px;
  margin-top: 10px;
}

#barraCartao {
  height: 18px;
  background: linear-gradient(90deg, #22c55e, #06b6d4, #8b5cf6);
  width: 0%;
  border-radius: 999px;
  transition: width .5s ease;
}

.btnPlus {
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  margin-top: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fb923c, #f43f5e);
  color: white;
  font-size: 22px;
  line-height: 1;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 12px 22px rgba(244, 63, 94, 0.22);
}

.month-select {
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
}

.chart-wrap {
  height: 220px;
  margin-top: 12px;
  position: relative;
}

.chart-empty {
  position: absolute;
  left: 12px;
  top: 12px;
  color: var(--ink-soft);
  white-space: pre-line;
  line-height: 1.5;
  max-width: calc(100% - 24px);
}

.previsao-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.54));
  border: 1px solid rgba(255, 255, 255, 0.55);
  margin-top: 8px;
}

.previsao-main {
  min-width: 0;
  flex: 1;
}

.previsao-meta {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.previsao-status {
  font-size: 13px;
  color: #315b80;
  margin-top: 4px;
}

.previsao-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.previsao-actions button {
  margin-left: 0;
}

.projection-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.projection-list li {
  margin: 6px 0;
  color: var(--ink);
}

.forecast-group {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  overflow: hidden;
}

.forecast-summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--ink);
  font-weight: 800;
  list-style: none;
  user-select: none;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.14), rgba(20, 184, 166, 0.14));
}

.forecast-summary::-webkit-details-marker {
  display: none;
}

.forecast-list {
  padding: 8px 10px 12px;
}

.projection-group {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.66), rgba(255, 247, 237, 0.72));
  border-color: rgba(251, 146, 60, 0.18);
}

.projection-summary {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.16), rgba(244, 63, 94, 0.12));
}

.projection-list-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.projection-month-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}

.paid-group {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.68), rgba(236, 253, 245, 0.74));
  border-color: rgba(20, 184, 166, 0.16);
}

.paid-summary {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.16), rgba(59, 130, 246, 0.10));
}

.sms-status {
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
}

.sms-status.success {
  color: #155e52;
  background: rgba(45, 212, 191, 0.16);
  border-color: rgba(20, 184, 166, 0.22);
}

.sms-status.warning {
  color: #8a4b0f;
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(245, 158, 11, 0.24);
}

.sms-status.error {
  color: #991b1b;
  background: rgba(251, 113, 133, 0.16);
  border-color: rgba(239, 68, 68, 0.22);
}

.sms-preview {
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.46), rgba(236, 253, 245, 0.56));
  border: 1px solid rgba(96, 165, 250, 0.18);
}

.sms-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.sms-preview-item {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
}

.sms-preview-label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.sms-preview-value {
  font-size: 14px;
  color: var(--ink);
  word-break: break-word;
}

.sms-preview-note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.categoria-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(199, 210, 254, 0.32);
}

.categoria-row:last-child {
  border-bottom: none;
}

.movement-card strong {
  display: block;
}

.movement-meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.6;
}

.empty-state {
  color: var(--ink-soft);
  line-height: 1.6;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(28, 35, 56, 0.34);
  z-index: 100;
}

.modal[aria-hidden="false"] {
  display: flex;
}

.modal-content {
  width: 90%;
  max-width: 720px;
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: 0 28px 60px rgba(30, 41, 59, 0.18);
  color: var(--ink);
}

.modal-field {
  padding: 8px 0;
  color: var(--ink);
  line-height: 1.5;
}

.modal-month-list {
  max-height: 320px;
  overflow: auto;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: linear-gradient(135deg, rgba(24, 50, 75, 0.94), rgba(59, 130, 246, 0.88));
  color: #fff;
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 14px 26px rgba(30, 41, 59, 0.24);
  z-index: 200;
  display: none;
  font-size: 14px;
}

.toast.show {
  display: block;
  animation: toastIn .18s ease;
}

@keyframes toastIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#modalPay,
#modalEdit {
  z-index: 110 !important;
}

@media (max-width: 900px) {
  body::before,
  body::after {
    display: none;
  }

  .container {
    padding: 82px 12px 24px;
  }

  .card,
  #menu,
  #menuBtn,
  #userBtn,
  .modal-content {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .card {
    box-shadow: 0 14px 28px rgba(40, 60, 120, 0.10);
  }

  .chart-wrap {
    height: 170px;
  }

  .inline-row,
  .inline-row-space {
    flex-direction: column;
    align-items: stretch;
  }

  .history-filters {
    grid-template-columns: 1fr;
  }

  .pay-button-wide,
  .btnSmall {
    width: 100%;
  }

  .btnPlus {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    align-self: flex-start;
  }

  .previsao-item {
    flex-direction: column;
  }

  .previsao-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .sms-preview-grid {
    grid-template-columns: 1fr;
  }

  .sms-import-toggle-subtitle {
    font-size: 12px;
  }

  .month-select {
    min-width: 100%;
  }

  .projection-month-actions {
    justify-content: stretch;
  }
}
