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

:root {
  --bg: #f4f5fb;
  --card-radius: 18px;
  --shadow: 0 8px 24px rgba(99, 102, 241, 0.08);
  --shadow-hover: 0 12px 32px rgba(99, 102, 241, 0.14);
}

body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: #1f2333;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ===================== Login Screen ===================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #ec4899 50%, #f59e0b 100%);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 48px 40px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.login-logo {
  font-size: 48px;
  margin-bottom: 8px;
}

.login-card h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 6px;
}

.login-card h1 span {
  background: linear-gradient(135deg, #6366f1, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-sub {
  color: #6b7280;
  margin-bottom: 32px;
  font-size: 14px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  border-radius: 12px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-google:hover {
  border-color: #6366f1;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}

.login-footnote {
  margin-top: 24px;
  font-size: 12px;
  color: #9ca3af;
}

/* ===================== Top Bar ===================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 20px;
  font-weight: 800;
}

.brand span {
  color: #fde68a;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-photo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #ddd;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
}

.btn-signout {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.2s ease;
}

.btn-signout:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* ===================== Layout ===================== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 800px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ===================== Summary Cards ===================== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

@media (max-width: 800px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.summary-card {
  position: relative;
  border-radius: var(--card-radius);
  padding: 22px;
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.card-pink {
  background: linear-gradient(135deg, #f472b6, #ec4899);
}
.card-blue {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
}
.card-purple {
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}
.card-orange {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.summary-label {
  font-size: 13px;
  opacity: 0.9;
  font-weight: 500;
  margin-bottom: 8px;
}

.summary-value {
  font-size: 24px;
  font-weight: 800;
}

.summary-icon {
  position: absolute;
  right: 14px;
  top: 14px;
  font-size: 26px;
  opacity: 0.5;
}

/* ===================== Panels ===================== */
.panel {
  background: #fff;
  border-radius: var(--card-radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ===================== Form ===================== */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 6px;
}

.field input,
.field select,
#filter-category {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid #e5e7eb;
  font-family: inherit;
  font-size: 14px;
  background: #fafafa;
  transition: border-color 0.2s ease;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #6366f1;
  background: #fff;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn-primary {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 12px 18px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* ===================== Chart panel ===================== */
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-header h2 {
  margin-bottom: 0;
}

.view-toggle {
  display: flex;
  gap: 4px;
  background: #f1f1f7;
  border-radius: 10px;
  padding: 4px;
}

.toggle-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: #fff;
  color: #6366f1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chart-wrap {
  position: relative;
  height: 260px;
}

.chart-wrap-small {
  height: 240px;
}

/* ===================== Expense list ===================== */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.list-header h2 {
  margin-bottom: 0;
  white-space: nowrap;
}

#filter-category {
  width: auto;
  max-width: 160px;
}

.expense-list {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.expense-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #fafafa;
  transition: background 0.15s ease;
}

.expense-item:hover {
  background: #f1f1f7;
}

.expense-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

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

.expense-desc {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-meta {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
}

.expense-amount {
  font-weight: 700;
  font-size: 14px;
  color: #1f2333;
  white-space: nowrap;
}

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

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: #e5e7eb;
}

.empty-state {
  text-align: center;
  color: #9ca3af;
  padding: 40px 0;
  font-size: 14px;
}

/* ===================== Toast ===================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2333;
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

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