:root {
  --bg1: #f6f8ff;
  --accent: #6c63ff;
  --accent-2: #7dd3fc;
  --muted: #7b7f9e;
  --glass: rgba(255,255,255,0.55);
  --card-shadow: 0 6px 30px rgba(99,102,241,0.12);
  --glass-border: rgba(255,255,255,0.45);
  --success: #34d399;
  --danger: #fb7185;
  --radius-lg: 14px;
  --radius-md: 10px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: radial-gradient(1200px 600px at 10% 10%, rgba(108,99,255,0.12), transparent 8%),
              radial-gradient(900px 400px at 90% 90%, rgba(125,211,252,0.08), transparent 8%),
              var(--bg1);
  color: #111827;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 48px;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 32px;
  align-items: start;
}

.sidebar {
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.45));
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px) saturate(120%);
}

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

.brand > div:first-child {
  display: flex;
  gap: 16px;
  align-items: center;
  flex: 1;
}

.auth-section { display: flex; align-items: center; }

.user-info {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #b685ff);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.logout-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}

.logout-btn:hover { color: #111827; }

.login-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(17,24,39,0.1);
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.login-btn:hover { background: rgba(255,255,255,0.8); }

.logo {
  width: 60px;
  height: 60px;
  min-width: 60px;
  min-height: 60px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #b685ff);
  color: white;
  font-weight: 700;
  font-size: 24px;
  box-shadow: 0 6px 18px rgba(108,99,255,0.15);
  flex-shrink: 0;
}

.brand h1 { font-size: 16px; margin: 0; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }

/* Summary section */
.today-month-summary {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.7));
  border: 1px solid rgba(0,0,0,0.03);
}

.stat .meta { font-size: 12px; color: var(--muted); }
.stat .value { font-weight: 700; font-size: 18px; }

/* Form sections */
.add-expense, .history {
  margin-top: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.7));
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.03);
}

.add-expense h3, .history h3 {
  margin-top: 0;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

.add-expense .form-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field { flex: 1; min-width: 120px; }

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type=text], input[type=number], select, input[type=date] {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(17,24,39,0.06);
  background: transparent;
  outline: none;
}

.actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
}

.btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(17,24,39,0.06);
}

.btn.primary {
  background: linear-gradient(90deg, var(--accent), #b685ff);
  color: white;
}

/* Expense list */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.03);
  background: rgba(255,255,255,0.6);
  margin-bottom: 12px;
}

.list li:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(17,24,39,0.06);
}

.list li:last-child { margin-bottom: 0; }

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

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.title { font-weight: 600; }
.meta { font-size: 12px; color: var(--muted); }
.amount { font-weight: 700; text-align: right; }

.small-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(17,24,39,0.08);
  background: transparent;
  cursor: pointer;
}

.small-btn:hover { background: rgba(17,24,39,0.03); }

/* Category badges */
.badge {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(17,24,39,0.05);
  margin-right: 6px;
}

.badge .icon {
  width: 14px;
  height: 14px;
  display: inline-block;
}

.badge-food { background: rgba(255,186,107,0.15); color: #c2410c; }
.badge-travel { background: rgba(125,211,252,0.25); color: #075985; }
.badge-groceries { background: rgba(34,197,94,0.18); color: #166534; }
.badge-bills { background: rgba(245,158,11,0.18); color: #92400e; }
.badge-shopping { background: rgba(34,197,94,0.18); color: #166534; }
.badge-other { background: rgba(148,163,184,0.25); color: #334155; }

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.85));
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  max-width: 400px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal.show .modal-content { transform: scale(1); }

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

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.close-btn:hover {
  background: rgba(17,24,39,0.05);
  color: #111827;
}

/* Auth form styles */
.auth-form .field { margin-bottom: 16px; }
.auth-form .field:last-child { margin-bottom: 0; }

.auth-form input[type=text], 
.auth-form input[type=email], 
.auth-form input[type=password] {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(17,24,39,0.1);
  background: rgba(255,255,255,0.7);
  outline: none;
  font-size: 14px;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}

.error-message {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
  min-height: 16px;
}

.password-strength {
  margin-top: 4px;
  height: 4px;
  background: rgba(17,24,39,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.password-strength.weak { background: linear-gradient(90deg, #ef4444 0%, #ef4444 33%, rgba(17,24,39,0.1) 33%); }
.password-strength.medium { background: linear-gradient(90deg, #f59e0b 0%, #f59e0b 66%, rgba(17,24,39,0.1) 66%); }
.password-strength.strong { background: linear-gradient(90deg, #10b981 0%, #10b981 100%); }

.checkbox-field { margin-bottom: 20px; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

.checkbox-label input[type=checkbox] { display: none; }

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(17,24,39,0.2);
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-label input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-label input:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.form-actions .btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 720px) {
  body { padding: 24px; }
  .wrap {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}