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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.22), transparent 32%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.13), transparent 30%),
    #0f172a;
  color: white;
  min-height: 100vh;
}

.app {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

/* MAIN */

.main-screen {
  min-height: 100vh;
  padding: 20px;
  transition: filter 0.3s ease;
}

.blurred {
  filter: blur(8px);
  pointer-events: none;
}

/* LOGIN */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(16px);
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 28px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(24px);
  text-align: center;
}

.login-card h1 {
  font-size: 30px;
  margin-bottom: 8px;
}

.login-card p {
  color: #cbd5e1;
  margin-bottom: 24px;
}

.auth-switch {
  margin-top: 16px;
  margin-bottom: 0 !important;
  font-size: 14px;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.2s ease;
}

.auth-switch:hover {
  color: white;
}

/* FORMS */

input,
select,
button {
  width: 100%;
  border: none;
  border-radius: 16px;
  font-size: 16px;
}

input,
select {
  padding: 15px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  outline: none;
}

input:focus,
select:focus {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

select option {
  color: black;
}

input::placeholder {
  color: #94a3b8;
}

button {
  padding: 15px;
  background: white;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  opacity: 0.85;
}

/* TOP BAR */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 10px 0;
  backdrop-filter: blur(16px);
}

.top-bar h2 {
  font-size: 22px;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-label {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 13px;
}

.top-account {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 160px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 14px;
}

.account-icon {
  font-size: 16px;
}

#accountLogin {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.settings-btn,
.modal-close {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 0;
  font-size: 20px;
}

/* SUMMARY */

.summary {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0.07)
  );
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.summary-card span {
  display: block;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.summary-card strong {
  font-size: 34px;
}

.summary-card small {
  display: block;
  margin-top: 8px;
  color: #94a3b8;
  font-size: 13px;
}

.limit-card.good {
  border: 1px solid rgba(34, 197, 94, 0.7);
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.18);
}

.limit-card.warning {
  border: 1px solid rgba(245, 158, 11, 0.85);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.18);
}

.limit-card.bad {
  border: 1px solid rgba(239, 68, 68, 0.8);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.18);
}

.limit-over-label {
  color: #fecaca !important;
}

/* DASHBOARD */

.dashboard-grid {
  display: grid;
  gap: 18px;
  align-items: start;
}

.dashboard-card,
.expense-form,
.expenses-panel {
  padding: 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.1);
}

.form-header {
  margin-bottom: 16px;
}

.form-header h3 {
  margin-bottom: 4px;
}

.form-header p,
.expenses-panel-header p,
.analytics-header p {
  color: #94a3b8;
  font-size: 14px;
  margin-top: 4px;
}

.expenses-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.expense-filters {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.expense-filters input,
.expense-filters select {
  margin-bottom: 0;
}

.reset-filter-btn,
.quick-amount-btn,
.confirm-cancel-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.reset-filter-btn {
  padding: 12px;
  font-size: 14px;
  border-radius: 14px;
}

.quick-amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.quick-amount-btn {
  padding: 11px;
  border-radius: 14px;
  font-size: 14px;
}

/* EXPENSES LIST */

.expenses-list {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.expenses-list::-webkit-scrollbar {
  width: 6px;
}

.expenses-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.expense-empty {
  color: #94a3b8;
  font-size: 14px;
}

.expense-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.expense-item:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.expense-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 20px;
}

.expense-info {
  flex: 1;
  min-width: 0;
}

.expense-title-row,
.expense-meta-row,
.category-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.expense-title-row strong {
  font-size: 15px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.expense-amount {
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 15px;
  color: white;
}

.expense-meta-row {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 13px;
}

.expense-meta-row span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.expense-actions {
  display: none;
}

/* ANALYTICS */

.analytics-panel {
  min-height: 260px;
}

.analytics-stats {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.analytics-stat {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.analytics-stat span {
  display: block;
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 6px;
}

.analytics-stat strong {
  display: block;
  color: white;
  font-size: 18px;
}

.category-analytics {
  margin-top: 18px;
}

.category-analytics h4 {
  margin-bottom: 12px;
  font-size: 15px;
  color: #e2e8f0;
}

.category-stats-list {
  display: grid;
  gap: 12px;
}

.category-stat-item {
  display: grid;
  gap: 8px;
}

.category-stat-top {
  color: #cbd5e1;
  font-size: 14px;
}

.category-stat-top strong {
  color: white;
  font-size: 14px;
}

.category-stat-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.category-stat-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.45);
}

.analytics-empty {
  color: #94a3b8;
  font-size: 14px;
}

/* MODALS */

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.45);
}

.overlay.show {
  display: block;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 16;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border-radius: 28px;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h3 {
  font-size: 22px;
}

.modal-close {
  font-size: 24px;
  line-height: 1;
}

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

.settings-section h4 {
  margin-bottom: 12px;
  color: #e2e8f0;
  font-size: 15px;
}

.settings-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.settings-user strong {
  font-size: 16px;
}

.settings-actions {
  margin-top: 8px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-size: 14px;
}

.logout-btn,
.confirm-danger-btn {
  margin-top: 12px;
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.logout-btn:hover,
.confirm-danger-btn:hover {
  background: rgba(239, 68, 68, 0.24);
}

.confirm-message {
  color: #cbd5e1;
  font-size: 15px;
  line-height: 1.5;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.confirm-actions button,
.confirm-danger-btn {
  margin-top: 0;
}

.confirm-main-btn {
  background: white;
  color: #0f172a;
}

/* TOAST */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  transform: translateX(-50%) translateY(20px);
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.96);
  color: white;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  color: #dcfce7;
  border-color: rgba(34, 197, 94, 0.45);
}

.toast.error {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.45);
}

.toast.warning {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.45);
}

/* RESPONSIVE */

@media (min-width: 700px) {
  .main-screen {
    max-width: 760px;
    margin: 0 auto;
  }

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

  .expense-filters {
    grid-template-columns: 1fr 1fr;
  }

  .expense-filters input,
  .reset-filter-btn {
    grid-column: span 2;
  }
}

@media (min-width: 1000px) {
  .main-screen {
    max-width: 1180px;
  }

  .dashboard-grid {
    grid-template-columns: 1.15fr 1fr 1.1fr;
  }

  .expenses-panel {
    order: 1;
  }

  .expense-form {
    order: 2;
    position: sticky;
    top: 110px;
  }

  .analytics-panel {
    order: 3;
  }

  .expenses-list {
    max-height: 460px;
  }
}

@media (max-width: 999px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .expense-form {
    order: 1;
  }

  .expenses-panel {
    order: 2;
  }

  .analytics-panel {
    order: 3;
  }
}

@media (max-width: 420px) {
  .main-screen {
    padding: 16px;
  }

  .top-bar h2 {
    font-size: 19px;
  }

  .account-pill {
    max-width: 120px;
    padding: 9px 11px;
  }

  .summary-card strong {
    font-size: 28px;
  }

  .login-card {
    padding: 24px;
  }

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