:root {
  --bg: #f6f4fb;
  --surface: #ffffff;
  --surface-soft: #f0edfa;
  --text: #252237;
  --muted: #6f6a85;
  --primary: #6c5ce7;
  --primary-soft: #e9e5ff;
  --success: #20c997;
  --warning: #f6ad3c;
  --danger: #f06a6a;
  --blue: #4d96ff;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 14px 34px rgba(52, 39, 94, 0.10);
  --shadow-sm: 0 8px 20px rgba(52, 39, 94, 0.08);
  --nav-height: 78px;
  --topbar-height: 82px;
  --max-width: 940px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

img,
svg,
canvas {
  max-width: 100%;
}

body {
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(108, 92, 231, 0.32);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.loading-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 18% 12%, rgba(108, 92, 231, 0.18), transparent 34%),
    radial-gradient(circle at 88% 0%, rgba(255, 146, 43, 0.18), transparent 30%),
    linear-gradient(160deg, #fbfaff 0%, #f3efff 100%);
}

.loading-brand {
  text-align: center;
  animation: fadeSlide 0.3s ease both;
}

.loading-brand h1 {
  margin: 14px 0 6px;
  font-size: 30px;
  letter-spacing: -1px;
}

.loading-brand p {
  margin: 0;
  color: var(--muted);
}

.app-shell {
  min-height: 100vh;
}

.auth-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 28px 18px 50px;
  background:
    radial-gradient(circle at 18% 12%, rgba(108, 92, 231, 0.18), transparent 34%),
    radial-gradient(circle at 88% 0%, rgba(255, 146, 43, 0.18), transparent 30%),
    linear-gradient(160deg, #fbfaff 0%, #f3efff 100%);
}

.auth-brand {
  text-align: center;
  max-width: 330px;
}

.brand-badge {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  font-size: 36px;
  background: var(--surface);
  border-radius: 26px;
  box-shadow: var(--shadow);
  animation: float 4s ease-in-out infinite;
}

.auth-brand h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 42px);
  letter-spacing: -1.2px;
}

.auth-brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.auth-card {
  width: min(100%, 460px);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  background: var(--surface-soft);
  border-radius: 16px;
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 8px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: none;
  gap: 14px;
}

.auth-form.active {
  display: flex;
  flex-direction: column;
  animation: fadeSlide 0.28s ease both;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #4a4560;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid #e7e2f5;
  background: #fff;
  border-radius: 13px;
  padding: 12px 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
}

textarea {
  resize: vertical;
  min-height: 78px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
}

.payday-label {
  display: block;
  color: #4a4560;
  font-size: 13px;
  font-weight: 700;
}

.payday-static {
  border: 1.5px solid #e7e2f5;
  background: #fff;
  border-radius: 13px;
  padding: 12px 13px;
  color: var(--muted);
  font-size: 14px;
}

.payday-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.auth-switch {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auth-switch button {
  border: 0;
  background: none;
  color: var(--primary);
  font-weight: 800;
  padding: 0;
}

.btn {
  border: 0;
  border-radius: 15px;
  padding: 12px 18px;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8a7bff);
  color: #fff;
  box-shadow: 0 10px 22px rgba(108, 92, 231, 0.26);
}

.btn-primary:hover {
  box-shadow: 0 14px 28px rgba(108, 92, 231, 0.34);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-soft);
  color: var(--text);
}

.btn-danger {
  background: #ffe7e7;
  color: #c93b3b;
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
}

.btn-block {
  width: 100%;
}

.btn-small {
  padding: 8px 11px;
  border-radius: 11px;
  font-size: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding: 14px 18px 10px;
  background: rgba(246, 244, 251, 0.84);
  backdrop-filter: blur(16px);
  max-width: var(--max-width);
  margin: 0 auto;
}

.topbar-greeting {
  font-size: 20px;
}

.topbar-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.icon-btn {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 20px;
  position: relative;
}

.dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid #fff;
}

.main-content {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4px 16px 28px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: screenIn 0.3s ease both;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 14px;
  width: 100%;
}

.card-title {
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.card-subtitle {
  margin: -8px 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #6c5ce7 0%, #8a6ff5 56%, #a36ef1 100%);
  color: #fff;
  border-radius: 26px;
  box-shadow: 0 18px 38px rgba(108, 92, 231, 0.32);
  padding: 20px;
  margin-bottom: 14px;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -46px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
}

.hero-label {
  font-size: 13px;
  opacity: 0.85;
}

.hero-amount {
  font-size: clamp(34px, 10vw, 48px);
  font-weight: 900;
  letter-spacing: -2px;
  margin: 7px 0 12px;
}

.hero-period {
  font-size: 13px;
  opacity: 0.9;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.quick-action {
  min-width: 0;
  border: 0;
  background: var(--surface);
  border-radius: 18px;
  padding: 12px 4px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 12px;
  color: var(--text);
  transition: transform 0.18s ease;
}

.quick-action:active {
  transform: scale(0.96);
}

.quick-action span {
  font-size: 24px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-card {
  min-width: 0;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 14px 12px;
  text-align: center;
}

.stat-icon {
  font-size: 20px;
}

.stat-value {
  margin: 7px 0 3px;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -0.5px;
  overflow-wrap: anywhere;
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #f0edf7;
}

.list-item:last-child {
  border-bottom: 0;
}

.item-emoji {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-soft);
  font-size: 20px;
}

.item-main {
  min-width: 0;
  flex: 1;
}

.item-title {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta.wrap {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.4;
}

.item-amount {
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.amount-positive {
  color: var(--success);
}

.amount-negative {
  color: var(--danger);
}

.amount-neutral {
  color: var(--blue);
}

.empty-state {
  text-align: center;
  padding: 26px 12px;
  color: var(--muted);
}

.empty-state .empty-icon {
  font-size: 42px;
  display: block;
  margin-bottom: 10px;
}

.empty-state h3 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 16px;
}

.empty-state p {
  margin: 0 0 15px;
  font-size: 13px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(226, 221, 242, 0.85);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 30;
  overflow: hidden;
}

.nav-item {
  min-width: 0;
  flex: 1 1 0;
  border: 0;
  background: transparent;
  color: #8b86a0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 800;
  transition: color 0.2s ease, transform 0.2s ease;
}

.nav-item span {
  font-size: 21px;
  line-height: 1;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item:active {
  transform: scale(0.94);
}

.nav-add {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  margin-top: -22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8a7bff);
  color: #fff;
  box-shadow: 0 12px 24px rgba(108, 92, 231, 0.35);
  justify-content: center;
}

.nav-add span {
  font-size: 30px;
  line-height: 0;
}

.segment {
  display: flex;
  gap: 6px;
  background: var(--surface-soft);
  border-radius: 15px;
  padding: 5px;
  flex-wrap: wrap;
  overflow: hidden;
  scrollbar-width: none;
}

.segment::-webkit-scrollbar {
  display: none;
}

.segment button {
  flex: 1 1 110px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 11px;
  font-weight: 800;
  font-size: 12px;
}

.segment button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-row input,
.filter-row select {
  width: auto;
  min-width: 110px;
  flex: 1;
}

.progress {
  height: 9px;
  background: #eeeaf8;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), #8a7bff);
  transition: width 0.45s ease;
}

.progress-bar.warning {
  background: linear-gradient(90deg, #f6ad3c, #ffd166);
}

.progress-bar.danger {
  background: linear-gradient(90deg, #f06a6a, #ff9a9a);
}

.debt-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 13px;
}

.debt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.debt-title {
  font-size: 17px;
  font-weight: 900;
  margin: 0;
}

.debt-creditor {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.debt-amounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.debt-amounts-three {
  grid-template-columns: repeat(3, 1fr);
}

.summary-grid,
.financial-grid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-heading .card-title {
  margin-bottom: 4px;
}

.commitment-tabs {
  margin-top: 12px;
}

.status-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 9px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
}

.status-chip.completed {
  background: #ddf8ef;
  color: #13795b;
}

.status-chip.overdue {
  background: #ffe7e7;
  color: #b93838;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid #eeeaf8;
  border-radius: 15px;
  background: #eeeaf8;
}

.detail-grid > div {
  min-width: 0;
  padding: 11px 12px;
  background: #fff;
}

.detail-grid small,
.schedule-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.detail-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}

.schedule-details {
  margin-top: 12px;
  border: 1px solid #e8e3f4;
  border-radius: 14px;
  overflow: hidden;
}

.schedule-details summary {
  padding: 11px 12px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.schedule-list {
  max-height: 310px;
  overflow-y: auto;
  border-top: 1px solid #eeeaf8;
}

.schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #f2eff8;
  font-size: 12px;
}

.schedule-row:last-child {
  border-bottom: 0;
}

.schedule-row.atrasado {
  background: #fff6f6;
}

.schedule-row.hoy {
  background: #fff9ed;
}

.commitment-note,
.history-subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.history-subtitle {
  margin: 0 0 14px;
}

.payment-origin-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.payment-origin-summary span {
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pending-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.pending-group-title h3 {
  margin: 0;
  font-size: 15px;
}

.pending-group-title span {
  min-width: 26px;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-soft);
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.pending-group.atrasado {
  border: 1px solid #ffd4d4;
}

.pending-payment-action {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
}

.calculation-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  align-items: center;
  min-height: 58px;
  padding: 11px 13px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--muted);
  font-size: 12px;
}

.calculation-preview strong {
  color: var(--primary);
  font-size: 17px;
}

.calculation-preview small {
  grid-column: 1 / -1;
}

.quick-actions-modal {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 8px;
}

.inline-actions {
  display: flex;
  gap: 4px;
}

.icon-btn.compact {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  font-size: 15px;
}

.reminder-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0edf7;
}

.reminder-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.debt-amount {
  background: var(--surface-soft);
  border-radius: 14px;
  padding: 11px;
}

.debt-amount small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.debt-amount strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.debt-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 13px;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
}

.chip button {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 14px;
}

.insight {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #f0edf7;
  font-size: 13px;
  line-height: 1.45;
}

.insight:last-child {
  border-bottom: 0;
}

.insight span {
  flex: 0 0 24px;
}

.chart-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 150px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 82px;
  align-items: center;
  gap: 9px;
}

.bar-label {
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  background: #eeeaf8;
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.45s ease;
}

.bar-value {
  font-size: 12px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.settings-group {
  margin-bottom: 18px;
}

.settings-group h2 {
  font-size: 16px;
  margin: 0 0 10px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 48px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: #d9d3ea;
  transition: background 0.2s ease;
}

.switch-track::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.switch input:checked + .switch-track {
  background: var(--primary);
}

.switch input:checked + .switch-track::before {
  transform: translateX(20px);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(28, 21, 48, 0.48);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  animation: fadeIn 0.2s ease both;
}

.modal {
  width: min(100%, 560px);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 26px;
  box-shadow: 0 24px 55px rgba(28, 21, 48, 0.28);
  padding: 20px;
  animation: sheetUp 0.28s ease both;
  overscroll-behavior: contain;
}

.modal * {
  min-width: 0;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-soft);
  font-size: 18px;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + 14px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(calc(100% - 28px), 420px);
  pointer-events: none;
}

.toast {
  background: #2a253f;
  color: #fff;
  border-radius: 15px;
  padding: 12px 15px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
  animation: toastIn 0.25s ease both;
}

.toast.error {
  background: #b93838;
}

.toast.success {
  background: #198f70;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  background: rgba(28, 21, 48, 0.5);
  padding: 18px;
  animation: fadeIn 0.2s ease both;
}

.confirm-box {
  width: min(100%, 400px);
  background: var(--surface);
  border-radius: 24px;
  padding: 22px;
  text-align: center;
  animation: popIn 0.22s ease both;
}

.confirm-icon {
  font-size: 40px;
}

.confirm-box h2 {
  margin: 10px 0 7px;
  font-size: 19px;
}

.confirm-box p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 18px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.payday-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff4e3;
  color: #9a5b08;
  border-radius: 16px;
  padding: 12px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 12px;
  animation: pulseSoft 1.6s ease-in-out infinite;
}

.payday-banner button {
  margin-left: auto;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheetUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes pulseSoft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(246, 173, 60, 0.25); }
  50% { box-shadow: 0 0 0 7px rgba(246, 173, 60, 0); }
}

@media (min-width: 700px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }

  .auth-view {
    padding-top: 46px;
  }

  .bottom-nav {
    border-radius: 24px 24px 0 0;
  }
}

@media (max-width: 380px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .stat-card {
    padding: 11px 6px;
  }

  .stat-value {
    font-size: 14px;
  }

  .bar-row {
    grid-template-columns: 82px 1fr 72px;
    gap: 6px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    padding-left: 5px;
    padding-right: 5px;
  }

  .nav-item {
    font-size: 9px;
  }

  .nav-item span {
    font-size: 19px;
  }

  .nav-add {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
  }

  .debt-amounts-three,
  .summary-grid,
  .financial-grid {
    grid-template-columns: 1fr 1fr;
  }

  .quick-actions-modal {
    grid-template-columns: 1fr 1fr;
  }

  .payment-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .payment-item .item-main {
    min-width: calc(100% - 58px);
  }

  .pending-payment-action {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-left: 54px;
  }

  .reminder-row {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .reminder-row .btn {
    grid-column: 2;
    justify-self: start;
  }

  .btn {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
