:root {
  --navy-950: #03254c;
  --navy-900: #06356b;
  --navy-800: #0b477f;
  --green-600: #08a85b;
  --green-500: #0cbd69;
  --teal-500: #16a3a5;
  --red-500: #d84b4b;
  --ink: #10243e;
  --muted: #66758a;
  --line: #e5ebf1;
  --surface: #ffffff;
  --background: #f6f8f6;
  --warm: #fffdf7;
  --shadow: 0 22px 60px rgba(3, 37, 76, 0.12);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--background);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 16px;
  text-align: center;
  color: var(--navy-900);
}

.loading-screen p {
  margin: 0;
  font-weight: 600;
}

.loader {
  width: 42px;
  height: 42px;
  margin: auto;
  border: 4px solid #dce7e1;
  border-top-color: var(--green-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--navy-950);
  text-decoration: none;
}

.brand-mark,
.balance-symbol {
  position: relative;
  display: grid;
  place-items: center;
  color: white;
  background: var(--navy-900);
  font-weight: 800;
  line-height: 1;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 25px;
}

.brand-mark span,
.balance-symbol span {
  position: absolute;
  color: var(--green-500);
  font-weight: 900;
  transform: rotate(-7deg);
}

.brand-mark span {
  right: -2px;
  top: -4px;
  font-size: 25px;
}

.brand-name {
  display: flex;
  flex-direction: column;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.05;
}

.brand-name strong {
  color: var(--green-600);
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(440px, 0.95fr);
}

.auth-intro {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(36px, 6vw, 80px);
  color: white;
  background:
    radial-gradient(circle at 82% 18%, rgba(12, 189, 105, 0.24), transparent 30%),
    linear-gradient(145deg, var(--navy-950), var(--navy-800));
}

.auth-intro .brand {
  color: white;
}

.auth-intro .brand-mark {
  color: var(--navy-950);
  background: white;
}

.auth-intro .brand-name {
  color: white;
}

.auth-intro .brand-name strong {
  color: #57df99;
}

.intro-copy {
  max-width: 660px;
  padding: 60px 0;
}

.eyebrow {
  display: block;
  margin-bottom: 12px;
  color: var(--green-600);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-intro .eyebrow {
  color: #73e8aa;
}

.intro-copy h1 {
  max-width: 620px;
  margin: 0 0 22px;
  font-size: clamp(38px, 5.4vw, 72px);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.intro-copy p {
  max-width: 600px;
  margin: 0;
  color: #d5e3ef;
  font-size: 18px;
  line-height: 1.7;
}

.intro-points {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  color: #dce9f3;
  font-size: 14px;
  font-weight: 600;
}

.intro-points span::first-letter {
  color: #73e8aa;
}

.auth-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px;
  background: var(--warm);
}

.auth-card {
  width: min(100%, 470px);
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid rgba(6, 53, 107, 0.08);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: #edf2f0;
}

.tab {
  padding: 12px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.tab.active {
  color: var(--navy-900);
  background: white;
  box-shadow: 0 4px 14px rgba(3, 37, 76, 0.08);
}

.form-heading {
  margin: 34px 0 26px;
}

.form-heading h2 {
  margin: 0 0 8px;
  color: var(--navy-950);
  font-size: 28px;
  letter-spacing: -0.025em;
}

.form-heading p,
.privacy-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  border: 1px solid #d8e1e8;
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: #fbfcfc;
  transition: border 0.2s, box-shadow 0.2s;
}

.field input:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 4px rgba(22, 163, 165, 0.12);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 86px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  padding: 7px;
  border: 0;
  color: var(--navy-800);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  transform: translateY(-50%);
}

.primary-button {
  width: 100%;
  min-height: 52px;
  padding: 13px 20px;
  border: 0;
  border-radius: 13px;
  color: white;
  background: var(--green-600);
  box-shadow: 0 12px 24px rgba(8, 168, 91, 0.2);
  font-weight: 800;
  transition: transform 0.2s, background 0.2s;
}

.primary-button:hover:not(:disabled) {
  background: #078f4e;
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

.privacy-note {
  margin-top: 20px;
  font-size: 11px;
  text-align: center;
}

.feedback {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.feedback.error {
  color: #932f2f;
  background: #fff0f0;
}

.feedback.success {
  color: #14663f;
  background: #eaf9f1;
}

.dashboard {
  min-height: 100vh;
}

.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.brand.compact .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 22px;
}

.ghost-button {
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--navy-900);
  background: white;
  font-weight: 700;
}

.dashboard-content {
  width: min(100% - 40px, 1180px);
  margin: auto;
  padding: 52px 0 80px;
}

.welcome-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.welcome-row h1 {
  margin: 0 0 8px;
  color: var(--navy-950);
  font-size: clamp(30px, 4vw, 44px);
  letter-spacing: -0.04em;
}

.welcome-row p {
  margin: 0;
  color: var(--muted);
}

.period-pill {
  flex: none;
  padding: 10px 15px;
  border: 1px solid #d9e8e0;
  border-radius: 999px;
  color: var(--green-600);
  background: #effaf4;
  font-size: 13px;
  font-weight: 700;
}

.balance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 220px;
  padding: clamp(30px, 6vw, 56px);
  border-radius: 28px;
  color: white;
  background:
    radial-gradient(circle at 82% 20%, rgba(12, 189, 105, 0.25), transparent 30%),
    var(--navy-900);
  box-shadow: 0 24px 46px rgba(3, 37, 76, 0.2);
}

.balance-card > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.balance-card span {
  color: #a8e6c7;
  font-weight: 600;
}

.balance-card strong {
  font-size: clamp(42px, 8vw, 72px);
  letter-spacing: -0.055em;
}

.balance-card small {
  color: #c6d8e7;
}

.balance-symbol {
  width: 94px;
  height: 94px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 48px;
}

.balance-symbol span {
  right: 2px;
  top: -8px;
  font-size: 44px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 22px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  box-shadow: 0 12px 30px rgba(3, 37, 76, 0.06);
}

.summary-icon {
  width: 48px;
  height: 48px;
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 800;
}

.summary-card p {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.summary-card strong {
  font-size: clamp(18px, 2.5vw, 24px);
}

.income .summary-icon,
.income strong {
  color: var(--green-600);
}

.income .summary-icon {
  background: #e8f8f0;
}

.expense .summary-icon,
.expense strong {
  color: var(--red-500);
}

.expense .summary-icon {
  background: #fff0f0;
}

.withdrawal .summary-icon,
.withdrawal strong {
  color: var(--teal-500);
}

.withdrawal .summary-icon {
  background: #e7f7f7;
}

.empty-card {
  margin-top: 22px;
  padding: 48px 24px;
  border: 1px dashed #cbd9d2;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.66);
  text-align: center;
}

.empty-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 18px;
  color: white;
  background: var(--green-600);
  font-size: 34px;
}

.empty-card h2 {
  margin: 0 0 10px;
  color: var(--navy-950);
}

.empty-card p {
  max-width: 560px;
  margin: 0 auto 24px;
  color: var(--muted);
  line-height: 1.6;
}

.empty-card .primary-button {
  max-width: 360px;
}

.history-card {
  margin-top: 22px;
  padding: clamp(24px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: white;
  box-shadow: 0 12px 30px rgba(3, 37, 76, 0.06);
}

.history-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.history-header h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: 27px;
  letter-spacing: -0.03em;
}

.history-count {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  background: #f0f3f5;
  font-size: 12px;
  font-weight: 700;
}

.history-list {
  display: grid;
}

.history-empty {
  margin: 0;
  padding: 34px 10px 12px;
  color: var(--muted);
  text-align: center;
}

.history-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
}

.history-item:last-child {
  border-bottom: 0;
  padding-bottom: 4px;
}

.history-item-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 800;
}

.history-item.recebimento .history-item-icon {
  color: var(--green-600);
  background: #e8f8f0;
}

.history-item.despesa_trabalho .history-item-icon {
  color: var(--red-500);
  background: #fff0f0;
}

.history-item.retirada_pessoal .history-item-icon {
  color: var(--teal-500);
  background: #e7f7f7;
}

.history-item-main {
  min-width: 0;
}

.history-item-main strong,
.history-item-main span {
  display: block;
}

.history-item-main strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-main span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.history-item-value {
  text-align: right;
}

.history-item-value strong,
.history-item-value small {
  display: block;
}

.history-item-value strong {
  font-size: 15px;
}

.history-item.recebimento .history-item-value strong {
  color: var(--green-600);
}

.history-item.despesa_trabalho .history-item-value strong {
  color: var(--red-500);
}

.history-item.retirada_pessoal .history-item-value strong {
  color: var(--teal-500);
}

.history-item-value small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 25, 50, 0.66);
  backdrop-filter: blur(5px);
}

.modal-card {
  position: relative;
  width: min(100%, 670px);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: clamp(24px, 4vw, 38px);
  border-radius: 26px;
  background: white;
  box-shadow: 0 30px 90px rgba(3, 25, 50, 0.28);
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.modal-header h2 {
  margin: 0;
  color: var(--navy-950);
  font-size: clamp(23px, 4vw, 31px);
  letter-spacing: -0.035em;
}

.modal-close {
  width: 42px;
  height: 42px;
  display: grid;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: white;
  font-size: 26px;
}

.type-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}

.type-selector legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.type-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 94px;
  padding: 13px;
  border: 2px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: border 0.2s, background 0.2s, transform 0.2s;
}

.type-option:hover {
  transform: translateY(-1px);
}

.type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-option:has(input:checked) {
  border-color: var(--green-500);
  background: #effaf4;
}

.expense-option:has(input:checked) {
  border-color: var(--red-500);
  background: #fff4f4;
}

.withdrawal-option:has(input:checked) {
  border-color: var(--teal-500);
  background: #effafa;
}

.type-option-icon {
  width: 36px;
  height: 36px;
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 50%;
  color: var(--green-600);
  background: #ddf6e9;
  font-weight: 800;
}

.expense-option .type-option-icon {
  color: var(--red-500);
  background: #ffe5e5;
}

.withdrawal-option .type-option-icon {
  color: var(--teal-500);
  background: #dff5f5;
}

.type-option strong,
.type-option small {
  display: block;
}

.type-option strong {
  color: var(--ink);
  font-size: 13px;
}

.type-option small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.transaction-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.money-input {
  position: relative;
}

.money-input > span {
  position: absolute;
  top: 50%;
  left: 15px;
  color: var(--navy-900);
  font-weight: 800;
  transform: translateY(-50%);
}

.money-input input {
  padding-left: 48px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 12px;
  margin-top: 8px;
}

.secondary-button {
  min-height: 52px;
  padding: 13px 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--navy-900);
  background: white;
  font-weight: 800;
}

.toast {
  position: fixed;
  z-index: 120;
  right: 22px;
  bottom: 22px;
  padding: 15px 20px;
  border-radius: 13px;
  color: white;
  background: var(--green-600);
  box-shadow: 0 18px 40px rgba(3, 37, 76, 0.22);
  font-weight: 700;
}

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-intro {
    min-height: auto;
    padding: 36px 28px 44px;
  }

  .intro-copy {
    padding: 64px 0 48px;
  }

  .intro-copy h1 {
    font-size: clamp(38px, 10vw, 58px);
  }

  .auth-panel {
    min-height: auto;
    padding: 30px 18px 56px;
  }

  .auth-card {
    margin-top: -24px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .auth-intro {
    padding: 26px 20px 42px;
  }

  .intro-copy {
    padding: 50px 0 40px;
  }

  .intro-copy p {
    font-size: 16px;
  }

  .intro-points {
    display: grid;
    gap: 12px;
  }

  .auth-panel {
    padding-inline: 12px;
  }

  .auth-card {
    padding: 25px 20px;
    border-radius: 22px;
  }

  .topbar {
    height: 70px;
    padding: 0 18px;
  }

  .topbar .brand-name {
    display: none;
  }

  .dashboard-content {
    width: min(100% - 24px, 1180px);
    padding-top: 32px;
  }

  .welcome-row {
    align-items: start;
    flex-direction: column;
  }

  .balance-card {
    min-height: 200px;
    padding: 28px 24px;
  }

  .balance-symbol {
    display: none;
  }

  .balance-card strong {
    font-size: 45px;
  }

  .summary-card {
    padding: 20px;
  }

  .history-card {
    padding: 22px 18px;
  }

  .history-item {
    gap: 11px;
  }

  .history-item-icon {
    width: 40px;
    height: 40px;
  }

  .history-item-main strong {
    max-width: 150px;
  }

  .modal {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 94vh;
    padding: 24px 18px 28px;
    border-radius: 24px 24px 0 0;
  }

  .type-selector {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .type-option {
    min-height: 70px;
  }

  .transaction-fields,
  .modal-actions {
    grid-template-columns: 1fr;
  }

  .secondary-button {
    order: 2;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    text-align: center;
  }
}
